|
2 | 2 | # |
3 | 3 | # @Author -- Jingtang Zhang |
4 | 4 | # @Date -- 2018.7.31, Hangzhou |
5 | | -# @Update -- 2018.8.15, Hangzhou |
| 5 | +# @Update -- 2018.8.19, Ningbo |
6 | 6 | # |
7 | 7 | # |
8 | 8 |
|
9 | 9 | library("RDolphinDB") |
10 | 10 | conn <- dbConnect(DolphinDB(), "192.168.137.132", 8888) |
11 | 11 | if (conn@connected == TRUE) { |
12 | 12 |
|
13 | | - ptm <- proc.time() |
| 13 | + source("Assert.R") |
| 14 | + record <- c(0L, 0L) |
| 15 | + |
14 | 16 | mtx <- matrix(c(NA, NA, NA, NA, NA, NA), nrow=3, byrow=F) |
15 | 17 | rownames(mtx) <- c("a", "b", "c") |
16 | 18 | colnames(mtx) <- c(2.5, 3.6) |
17 | 19 | testList <- list(mtx) |
18 | 20 | result <- dbRpc(conn, "sum", testList) |
19 | | - print(result) |
20 | | - print(class(result)) |
21 | | - print(proc.time() - ptm) |
| 21 | + vec <- as.numeric(c(NA, NA, NA)) |
| 22 | + record <- assert(record, "test empty matrix rpc", result, vec) |
22 | 23 |
|
23 | | - ptm <- proc.time() |
24 | 24 | mtx <- matrix(c(1.5, 2.5, 3.5, NA, 5.5, 6.5), nrow=3, byrow=F) |
25 | 25 | rownames(mtx) <- c("a", "b", "c") |
26 | 26 | colnames(mtx) <- c(2.5, 3.6) |
27 | 27 | testList <- list(mtx) |
28 | 28 | result <- dbRpc(conn, "sum", testList) |
29 | | - print(result) |
30 | | - print(class(result)) |
31 | | - print(proc.time() - ptm) |
| 29 | + vec <- c(1.5, 8.0, 10.0) |
| 30 | + record <- assert(record, "test numeric matrix rpc", result, vec) |
32 | 31 |
|
33 | | - ptm <- proc.time() |
34 | 32 | mtx <- matrix(c(1L, 2L, 3L, NA, 5L, 6L), nrow=3, byrow=F) |
35 | 33 | rownames(mtx) <- c("a", "b", "c") |
36 | 34 | colnames(mtx) <- c(2.5, 3.6) |
37 | 35 | testList <- list(mtx) |
38 | 36 | result <- dbRpc(conn, "sum", testList) |
39 | | - print(result) |
40 | | - print(class(result)) |
41 | | - print(proc.time() - ptm) |
| 37 | + vec <- c(1L, 7L, 9L) |
| 38 | + record <- assert(record, "test integer matrix rpc", result, vec) |
42 | 39 |
|
43 | | - ptm <- proc.time() |
44 | 40 | mtx <- matrix(c(TRUE, TRUE, FALSE, FALSE, FALSE, NA), nrow=3, byrow=F) |
45 | 41 | rownames(mtx) <- c("a", "b", "c") |
46 | 42 | colnames(mtx) <- c(2.5, 3.6) |
47 | 43 | testList <- list(mtx) |
48 | 44 | result <- dbRpc(conn, "sum", testList) |
49 | | - print(result) |
50 | | - print(class(result)) |
51 | | - print(proc.time() - ptm) |
| 45 | + vec <- c(1L, 1L, 0L) |
| 46 | + record <- assert(record, "test logical matrix rpc", result, vec) |
52 | 47 |
|
53 | | - ptm <- proc.time() |
54 | 48 | result <- dbRun(conn, "matrix(true true NULL, false false false)") |
55 | | - print(result) |
56 | | - print(class(result)) |
57 | | - print(proc.time() - ptm) |
| 49 | + mtx <- matrix(c(TRUE, TRUE, NA, FALSE, FALSE, FALSE), nrow=3, byrow=F) |
| 50 | + record <- assert(record, "test logical matrix with NULL", result, mtx) |
58 | 51 |
|
59 | | - ptm <- proc.time() |
60 | 52 | result <- dbRun(conn, "a = matrix(1 2 3, 4 5 6);a.rename!(`a`b`c, NULL 1.5);a") |
61 | | - print(result) |
62 | | - print(class(result)) |
63 | | - print(proc.time() - ptm) |
| 53 | + mtx <- matrix(c(1L, 2L, 3L, 4L, 5L, 6L), nrow=3, byrow=F) |
| 54 | + rownames(mtx) <- c("a", "b", "c") |
| 55 | + colnames(mtx) <- c(NA, 1.5) |
| 56 | + record <- assert(record, "test integer matrix with lable", result, mtx) |
64 | 57 |
|
65 | | - ptm <- proc.time() |
66 | 58 | result <- dbRun(conn, "matrix(1 NULL 3, 4 5 6)") |
67 | | - print(result) |
68 | | - print(class(result)) |
69 | | - print(proc.time() - ptm) |
| 59 | + mtx <- matrix(c(1L, NA, 3L, 4L, 5L, 6L), nrow=3, byrow=F) |
| 60 | + record <- assert(record, "test integer matrix with NULL", result, mtx) |
70 | 61 |
|
71 | | - ptm <- proc.time() |
72 | 62 | result <- dbRun(conn, "matrix(1.5 2.5 3.5, 4 5 6)") |
73 | | - print(result) |
74 | | - print(class(result)) |
75 | | - print(proc.time() - ptm) |
| 63 | + mtx <- matrix(c(1.5, 2.5, 3.5, 4, 5, 6), nrow=3, byrow=F) |
| 64 | + record <- assert(record, "test numeric matrix", result, mtx) |
76 | 65 |
|
77 | | - ptm <- proc.time() |
78 | 66 | result <- dbRun(conn, "matrix(1.5 2.5 3.5, 4 NULL 6)") |
79 | | - print(result) |
80 | | - print(class(result)) |
81 | | - print(proc.time() - ptm) |
| 67 | + mtx <- matrix(c(1.5, 2.5, 3.5, 4, NA, 6), nrow=3, byrow=F) |
| 68 | + record <- assert(record, "test numeric matrix with NULL", result, mtx) |
82 | 69 |
|
| 70 | + printer(record) |
83 | 71 | } |
84 | 72 | dbClose(conn) |
0 commit comments