Merge pull request #636 from richardbeare/RExtraStdVectorNumericTypes
R extra std vector numeric types
This commit is contained in:
commit
6212800fe3
3 changed files with 462 additions and 32 deletions
15
Examples/test-suite/r/li_std_vector_runme.R
Normal file
15
Examples/test-suite/r/li_std_vector_runme.R
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
clargs <- commandArgs(trailing=TRUE)
|
||||
source(file.path(clargs[1], "unittest.R"))
|
||||
|
||||
dyn.load(paste("li_std_vector", .Platform$dynlib.ext, sep=""))
|
||||
source("li_std_vector.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
testvec <- c(1, 2, 3)
|
||||
|
||||
unittest(half(testvec), testvec/2)
|
||||
unittest(average(testvec), mean(testvec))
|
||||
q(save="no")
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
unittest <- function (x,y) {
|
||||
if (x==y) {
|
||||
if (all(x==y)) {
|
||||
print("PASS")
|
||||
} else {
|
||||
print("FAIL")
|
||||
|
|
@ -8,7 +8,7 @@ unittest <- function (x,y) {
|
|||
}
|
||||
|
||||
unittesttol <- function(x,y,z) {
|
||||
if (abs(x-y) < z) {
|
||||
if (all(abs(x-y) < z)) {
|
||||
print("PASS")
|
||||
} else {
|
||||
print("FAIL")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue