Merge pull request #636 from richardbeare/RExtraStdVectorNumericTypes

R extra std vector numeric types
This commit is contained in:
joequant 2016-03-16 18:55:58 +08:00
commit 6212800fe3
3 changed files with 462 additions and 32 deletions

View 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")

View file

@ -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")