|
18 | 18 | .runThisTest <- Sys.getenv("RunAllRcppTests") == "yes" |
19 | 19 |
|
20 | 20 | if (.runThisTest) { |
21 | | - |
| 21 | + |
22 | 22 | .setUp <- Rcpp:::unitTestSetup("ListOf.cpp") |
23 | | - |
| 23 | + |
24 | 24 | x <- list( c(1, 5), c(2, 6), c(3, 7) ) |
25 | | - |
26 | | - test.identity <- function() { |
| 25 | + |
| 26 | + test.ListOf.identity <- function() { |
27 | 27 | checkIdentical( |
28 | 28 | test_identity(setNames(x, c('a', 'b', 'c'))), |
29 | 29 | setNames(x, c('a', 'b', 'c')) |
30 | 30 | ) |
31 | 31 | } |
32 | | - |
33 | | - test.lapply.sum <- function() { |
| 32 | + |
| 33 | + test.ListOf.lapply.sum <- function() { |
34 | 34 | x <- list( c(1, 5), c(2, 6), c(3, 7) ) |
35 | 35 | checkIdentical( test_lapply_sum(x), lapply(x, sum) ) |
36 | 36 | } |
37 | | - |
38 | | - test.sapply.sum <- function() { |
| 37 | + |
| 38 | + test.ListOf.sapply.sum <- function() { |
39 | 39 | x <- list( c(1, 5), c(2, 6), c(3, 7) ) |
40 | 40 | checkIdentical( test_sapply_sum(x), sapply(x, sum) ) |
41 | 41 | } |
42 | | - |
43 | | - test.assign <- function() { |
| 42 | + |
| 43 | + test.ListOf.assign <- function() { |
44 | 44 | test_assign(x, 100, "apple") |
45 | 45 | checkIdentical( x[[2]], 100 ) |
46 | 46 | } |
47 | | - |
48 | | - test.assign.names <- function() { |
| 47 | + |
| 48 | + test.ListOf.assign.names <- function() { |
49 | 49 | x <- setNames(list(1, 2, 3), c('a', 'b', 'c')) |
50 | 50 | test_assign_names(x) |
51 | 51 | checkIdentical( x[["a"]], x[["b"]] ) |
52 | 52 | } |
53 | | - |
54 | | - test.arith <- function() { |
| 53 | + |
| 54 | + test.ListOf.arith <- function() { |
55 | 55 | checkIdentical(test_add(list(1, 2, 3)), 6) |
56 | 56 | checkIdentical(test_add_subtract(list(1, 2, 3)), 0) |
57 | 57 | checkIdentical(test_mult( list(1, 2, 3) ), 6) |
58 | 58 | checkIdentical(test_char( list("banana") ), list("apple")) |
59 | 59 | } |
60 | | - |
61 | | - test.assign.names <- function() { |
| 60 | + |
| 61 | + test.ListOf.assign.names <- function() { |
62 | 62 | checkException(test_assign_names(list(alpha=1, beta=2, gamma=3))) |
63 | 63 | } |
64 | | - |
| 64 | + |
| 65 | + test.ListOf.sub.calls <- function() { |
| 66 | + checkEquals(test_sub_calls( list(1, 2, 3) ), 3) |
| 67 | + } |
| 68 | + |
65 | 69 | } |
0 commit comments