more tests for R
This commit is contained in:
parent
86b3e60617
commit
db9df1b3be
4 changed files with 171 additions and 0 deletions
50
Examples/test-suite/r/extend_template_method_runme.R
Normal file
50
Examples/test-suite/r/extend_template_method_runme.R
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
clargs <- commandArgs(trailing=TRUE)
|
||||
source(file.path(clargs[1], "unittest.R"))
|
||||
#source("unittest.R")
|
||||
|
||||
dyn.load(paste("extend_template_method", .Platform$dynlib.ext, sep=""))
|
||||
source("extend_template_method.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
|
||||
em = ExtendMe()
|
||||
|
||||
ret_double = em$do_stuff_double(1, 1.1)
|
||||
unittest(ret_double, 1.1)
|
||||
|
||||
ret_string = em$do_stuff_string(1, "hello there")
|
||||
unittest(ret_string, "hello there")
|
||||
|
||||
ret_double = em$do_overloaded_stuff(1.1)
|
||||
unittest(ret_double, 1.1)
|
||||
|
||||
ret_string = em$do_overloaded_stuff("hello there")
|
||||
unittest(ret_string, "hello there")
|
||||
|
||||
|
||||
unittest(ExtendMe_static_method(123), 123)
|
||||
|
||||
em2 = ExtendMe(123)
|
||||
|
||||
em = TemplateExtend()
|
||||
|
||||
ret_double = em$do_template_stuff_double(1, 1.1)
|
||||
unittest(ret_double, 1.1)
|
||||
|
||||
ret_string = em$do_template_stuff_string(1, "hello there")
|
||||
unittest(ret_string, "hello there")
|
||||
|
||||
|
||||
ret_double = em$do_template_overloaded_stuff(1.1)
|
||||
unittest(ret_double, 1.1)
|
||||
|
||||
ret_string = em$do_template_overloaded_stuff("hello there")
|
||||
unittest(ret_string, "hello there")
|
||||
|
||||
unittest(TemplateExtend_static_template_method(123), 123)
|
||||
|
||||
|
||||
em2 = TemplateExtend(123)
|
||||
|
||||
|
||||
q(save="no")
|
||||
68
Examples/test-suite/r/li_attribute_template_runme.R
Normal file
68
Examples/test-suite/r/li_attribute_template_runme.R
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
clargs <- commandArgs(trailing=TRUE)
|
||||
source(file.path(clargs[1], "unittest.R"))
|
||||
#source("unittest.R")
|
||||
|
||||
dyn.load(paste("li_attribute_template", .Platform$dynlib.ext, sep=""))
|
||||
source("li_attribute_template.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
|
||||
# Check usage of template attributes
|
||||
chell = Cintint(1, 2, 3)
|
||||
|
||||
# Testing primitive by value attribute
|
||||
unittest(chell$a, 1)
|
||||
|
||||
chell$a = 3
|
||||
unittest(chell$a, 3)
|
||||
|
||||
# Testing primitive by ref attribute
|
||||
unittest(chell$b, 2)
|
||||
|
||||
chell$b = 5
|
||||
unittest(chell$b, 5)
|
||||
|
||||
# Testing string
|
||||
chell$str = "abc"
|
||||
unittest(chell$str, "abc")
|
||||
|
||||
# Testing class by value
|
||||
unittest(chell$d$value, 1)
|
||||
|
||||
chell$d = Foo(2)
|
||||
unittest(chell$d$value, 2)
|
||||
|
||||
# Testing class by reference
|
||||
unittest(chell$e$value, 2)
|
||||
|
||||
chell$e = Foo(3)
|
||||
unittest(chell$e$value, 3)
|
||||
|
||||
chell$e$value = 4
|
||||
unittest(chell$e$value, 4)
|
||||
|
||||
|
||||
# Testing moderately complex template by value
|
||||
unittest(chell$f$first, 1)
|
||||
unittest(chell$f$second, 2)
|
||||
|
||||
pair = pair_intint(3, 4)
|
||||
chell$f = pair
|
||||
unittest(chell$f$first, 3)
|
||||
unittest(chell$f$second, 4)
|
||||
|
||||
# Testing moderately complex template by ref
|
||||
unittest(chell$g$first, 2)
|
||||
unittest(chell$g$second, 3)
|
||||
|
||||
pair = pair_intint(4, 5)
|
||||
chell$g = pair
|
||||
unittest(chell$g$first, 4)
|
||||
unittest(chell$g$second, 5)
|
||||
|
||||
chell$g$first = 6
|
||||
chell$g$second = 7
|
||||
unittest(chell$g$first, 6)
|
||||
unittest(chell$g$second, 7)
|
||||
|
||||
q(save="no")
|
||||
37
Examples/test-suite/r/li_boost_shared_ptr_template_runme.R
Normal file
37
Examples/test-suite/r/li_boost_shared_ptr_template_runme.R
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
clargs <- commandArgs(trailing=TRUE)
|
||||
source(file.path(clargs[1], "unittest.R"))
|
||||
#source("unittest.R")
|
||||
|
||||
dyn.load(paste("li_boost_shared_ptr_template", .Platform$dynlib.ext, sep=""))
|
||||
source("li_boost_shared_ptr_template.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
b = BaseINTEGER()
|
||||
d = DerivedINTEGER()
|
||||
|
||||
unittest(BaseINTEGER_bar(b), 1)
|
||||
unittest(b$bar(), 1)
|
||||
|
||||
unittest(DerivedINTEGER_bar(d), 2)
|
||||
unittest(d$bar(), 2)
|
||||
|
||||
unittest(bar_getter(b), 1)
|
||||
unittest(bar_getter(d), 2)
|
||||
|
||||
|
||||
b = BaseDefaultInt()
|
||||
d = DerivedDefaultInt()
|
||||
d2 = DerivedDefaultInt2()
|
||||
|
||||
unittest(BaseDefaultInt_bar2(b), 3)
|
||||
unittest(b$bar2(), 3)
|
||||
|
||||
unittest(DerivedDefaultInt_bar2(d), 4)
|
||||
unittest(d$bar2(), 4)
|
||||
|
||||
unittest(bar2_getter(b), 3)
|
||||
unittest(bar2_getter(d), 4)
|
||||
unittest(bar2_getter(d2), 4)
|
||||
|
||||
|
||||
q(save="no")
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
clargs <- commandArgs(trailing=TRUE)
|
||||
source(file.path(clargs[1], "unittest.R"))
|
||||
#source("unittest.R")
|
||||
|
||||
dyn.load(paste("smart_pointer_templatevariables", .Platform$dynlib.ext, sep=""))
|
||||
source("smart_pointer_templatevariables.R")
|
||||
cacheMetaData(1)
|
||||
|
||||
|
||||
d = DiffImContainerPtr_D(create(1234, 5678))
|
||||
unittest(d$id, 1234)
|
||||
|
||||
d$id = 4321
|
||||
unittest(d$id, 4321)
|
||||
|
||||
q(save="no")
|
||||
Loading…
Add table
Add a link
Reference in a new issue