File: li_attribute_template_runme.R

package info (click to toggle)
swig 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 46,232 kB
  • sloc: cpp: 54,631; ansic: 29,122; java: 17,530; python: 12,505; cs: 10,369; ruby: 7,232; yacc: 6,477; makefile: 5,965; javascript: 5,520; sh: 5,415; perl: 4,187; php: 3,693; ml: 2,187; lisp: 2,056; tcl: 1,991; xml: 115
file content (68 lines) | stat: -rw-r--r-- 1,290 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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")