PageRenderTime 203ms CodeModel.GetById 80ms app.highlight 2ms RepoModel.GetById 119ms app.codeStats 0ms

/rcdk/inst/unitTests/runit.props.R

http://github.com/rajarshi/cdkr
R | 25 lines | 15 code | 2 blank | 8 comment | 1 complexity | dc6a130b7131b6ac1aadfeb047bae785 MD5 | raw file
 1test.set.props <- function() {
 2  m <- parse.smiles("CCCC")[[1]]
 3  set.property(m, "foo", "bar")
 4  checkEquals(get.property(m,"foo"), "bar")
 5}
 6
 7test.get.properties <- function() {
 8  m <- parse.smiles("CCCC")[[1]]
 9  set.property(m, "foo", "bar")
10  set.property(m, "baz", 1.23)  
11  props <- get.properties(m)
12  checkEquals(length(props), 3)
13  checkTrue(all(sort(names(props)) == c('baz','cdk:Title','foo')))
14  checkEquals(props$foo,'bar')
15  checkEquals(props$baz,1.23)  
16}
17
18## test.props.from.file <- function() {
19##   print(getwd())
20##   kegg_file <- system.file("molfiles/kegg.sdf", packge="rcdk")
21##   f <- load.molecules(kegg_file)
22##   checkEquals(length(f), 10)
23##   proplens <- unlist(lapply(lapply(f, get.properties), length))
24##   checkEquals(proplens, c(5,5,5,5,5,5,5,3,5,5))
25## }