Displaying 4 results from an estimated 4 matches for "checkequals".
2009 Dec 31
1
what don't I get about numeric/double comparisons in R way?
...cal(range_sd, foo)
[1] FALSE
> identical(range_sd, 34.40783)
[1] FALSE
> identical(range_sd, 34.40783, num.eq=FALSE)
[1] FALSE
> identical(range_sd, 34.40783, num.eq=TRUE)
[1] FALSE
> library(RUnit)
Warning message:
package 'RUnit' was built under R version 2.10.1
> checkEquals(range_sd, 34.40783)
Error in checkEquals(range_sd, 34.40783) :
Mean relative difference: 5.79431e-08
> checkEquals(range_sd, foo)
Error in checkEquals(range_sd, foo) :
Mean relative difference: 5.79431e-08
> if( range_sd == 34.40783 ) { print("foo")}
> if( range_sd ==...
2010 Jul 09
2
Compress string memCompress/Decompress
Hello,
I would like to compress a long string (character vector), store the compressed string in the text field of a SQLite database (using RSQLite), and then load the text back into memory and decompress it back into the the original string. My character vector can be compressed considerably using standard gzip/bzip2 compression. In theory it should be much faster for me to compress/decompress
2006 Feb 04
1
RUnit - need advice on a good directory structure or tips...
...rint(".tearDown")
}
##################################################
##
## Start of test functions.
##
## Add your own test functions with names starting with "test"
##
##################################################
test.c2f <- function() {
# print(currentPath)
checkEquals(c2f(0), 32)
checkEquals(c2f(10), 50)
checkException(c2f("xx"))
}
test.f2c <- function() {
checkEquals(f2c(32), 0)
checkEquals(f2c(50), 10)
checkTrue(identical(f2c(50),10))
checkException(f2c("xx"))
}
test.errordemo <- function() {
DEACTIVATED("Fanta lo...
2010 Dec 17
0
How to use the RUnit tracker in unit tests?
...using 'inspect' in the unit
test functions. Moreover, doing so, I tried something like
library(RUnit)
myFunction <- function(x) {
return(x)
}
track <- tracker()
track$init()
test.someTestFunction <- function() {
y <- 10
res <- inspect(myFunction(y), track = track)
checkEquals(res, 10)
}
which works fine, when calling test.someTestFunction() from
the command line, but embedded in a test suite, I get
Error in eval(expr, envir, enclos) : object 'y' not found
Another question/suggestion: The 'inspect' function inserts
track points in the code, and this cou...