more r tests

This commit is contained in:
AndLLA 2022-11-16 22:17:25 +01:00
commit a88995a11d
4 changed files with 187 additions and 0 deletions

View file

@ -0,0 +1,57 @@
clargs <- commandArgs(trailing=TRUE)
source(file.path(clargs[1], "unittest.R"))
#source("unittest.R")
dyn.load(paste("template_classes", .Platform$dynlib.ext, sep=""))
source("template_classes.R")
cacheMetaData(1)
# This test is just testing incorrect number of arguments/parameters checking
point = PointInt()
rectangle = RectangleInt()
p = RectangleInt_getPoint(rectangle)
unittest(PointInt_getX(p), 0)
RectangleInt_setPoint(rectangle, point)
unittest(RectangleInt_static_noargs(), 0)
unittest(RectangleInt_static_onearg(12), 12)
argCheckFailed = F
try({
RectangleInt_setPoint(rectangle)
argCheckFailed = T
}, silent=T)
unittest(argCheckFailed, F)
argCheckFailed = F
try({
RectangleInt_getPoint(rectangle, 0, .copy = F)
argCheckFailed = T
}, silent=T)
unittest(argCheckFailed, F)
argCheckFailed = F
try({
RectangleInt_static_noargs(123, .copy = F)
argCheckFailed = T
}, silent=T)
unittest(argCheckFailed, F)
argCheckFailed = F
try({
RectangleInt_static_onearg()
argCheckFailed = T
}, silent=T)
unittest(argCheckFailed, F)