Skip to content

Commit a997847

Browse files
tighten up tests
1 parent 09ece31 commit a997847

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

inst/tests/tests.Rraw

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21217,11 +21217,10 @@ setDT(get0("dt_get0"))
2121721217
test(2319.2, !is.null(attr(dt_get0, ".internal.selfref")))
2121821218

2121921219
# Create a data.table when one vector is transposed doesn't respect the name defined by user #4124
21220-
test(2320.1, data.table(a=1:2, b=matrix(1:2)), data.table(a=1:2, b=1:2))
21221-
test(2320.2, names(data.table(a=1:2, b=matrix(1:2))), names(data.frame(a=1:2, b=matrix(1:2))))
21222-
test(2320.3, data.table(a=1L[0L], b=matrix(1L)[0L]), data.table(a=1L[0L], b=1L[0L])) # length 0
21223-
test(2320.4, names(data.table(a=1L[0L], b=matrix(1L)[0L])), names(data.frame(a=1L[0L], b=matrix(1L)[0L])))
21220+
test(2320.1, DT <- data.table(a=1:2, b=matrix(1:2)), data.table(a=1:2, b=1:2))
21221+
test(2320.2, names(DT), names(data.frame(a=1:2, b=matrix(1:2))))
21222+
test(2320.3, DT <- data.table(a=integer(), b=matrix(1L, nrow=0L, ncol=1L)), data.table(a=integer(), b=integer()))
21223+
test(2320.4, names(DT), names(data.frame(a=integer(), b=matrix(1L, nrow=0L, ncol=1L))))
2122421224
# data.table(vector, matrix) can return duplicate column names #3193
21225-
is.unq = function(x) length(unique(x)) == length(x)
21226-
test(2320.5, is.unq(names(data.table(1:5, matrix(6:15, nrow = 5L)))))
21227-
test(2320.6, is.unq(names(data.table(1L[0L], matrix(6:15, nrow=5L)[0L]))))
21225+
test(2320.5, anyDuplicated(names(data.table(1:5, matrix(6:15, nrow = 5L)))), 0L)
21226+
test(2320.6, anyDuplicated(names(data.table(integer(), matrix(1L, nrow=0L, ncol=2L)))), 0L)

0 commit comments

Comments
 (0)