Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Dec 20, 2023
1 parent 407c257 commit 38471f1
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -2948,10 +2948,7 @@ test(995, DT[CJ(c(5,3), c(5,1), sorted=FALSE)], OUT)
xx <- factor(letters[1:2], ordered=TRUE)
yy <- sample(2L)
yy_sort = base::sort.int(yy)
old = options(datatable.CJ.names=FALSE)
test(996.01, CJ(xx, yy), setkey(data.table(rep(xx, each=2L), rep(yy_sort, 2L))))
test(996.02, CJ(a = xx, yy), setkey(data.table(a = rep(xx, each=2L), V2 = rep(yy_sort, 2L))))
options(datatable.CJ.names=TRUE)
# 996.01, 996.02 tested the now-ineffectual datatable.CJ.names option
test(996.03, CJ(xx, yy), setkey(data.table(xx = rep(xx, each=2L), yy = rep(yy_sort, 2L))))
options(old)

Expand Down Expand Up @@ -7303,10 +7300,7 @@ test(1524, ans1, ans2)
x = c(1, 2, 1)
y = c(5, 8, 8, 4)
w = c(10, 12, 12, 13) # already sorted but has dups; more efficient case to cover
options(datatable.CJ.names=FALSE)
test(1525.1, CJ(x, y, unique=TRUE), CJ(V1=c(1,2), V2=c(4,5,8)))
test(1525.2, CJ(x, z=y, unique=TRUE), ans<-data.table(V1=rep(c(1,2), each=3), z=c(4,5,8), key="V1,z")) # naming of one but not both, too
options(datatable.CJ.names=TRUE)
# tests 1525.1, 1525.2 tested the now-ineffectual datatable.CJ.names option.
test(1525.3, CJ(x, y, unique=TRUE), CJ( x=c(1,2), y=c(4,5,8)))
test(1525.4, CJ(x, z=y, unique=TRUE), setnames(ans,c("x","z")))
test(1525.5, CJ(x, w, unique=TRUE), data.table(x=(rep(c(1,2), each=3)), w=c(10,12,13), key="x,w"))
Expand Down Expand Up @@ -10777,7 +10771,8 @@ test(1736.05, capture.output(fwrite(DT, sep='|', sep2=c("c(",",",")"), logical01
"2|c(15,16,17,18)|c(1.2,2.3,3.4,3.14159265358979,-9)", "3|c(7)|c(foo,bar)", "4|c(9,10)|c(TRUE,TRUE,FALSE)"))
test(1736.06, capture.output(fwrite(DT, sep='|', sep2=c("{",",","}"), logicalAsInt=TRUE)),
c("A|B|C", "1|{1,2,3,4,5,6,7,8,9,10}|{s,t,u,v,w}",
"2|{15,16,17,18}|{1.2,2.3,3.4,3.14159265358979,-9}", "3|{7}|{foo,bar}", "4|{9,10}|{1,1,0}"))
"2|{15,16,17,18}|{1.2,2.3,3.4,3.14159265358979,-9}", "3|{7}|{foo,bar}", "4|{9,10}|{1,1,0}"),
warning="logicalAsInt has been renamed logical01")
DT = data.table(A=c("foo","ba|r","baz"))
test(1736.07, capture.output(fwrite(DT,na="")), c("A","foo","ba|r","baz")) # no list column so no need to quote
test(1736.08, capture.output(fwrite(DT)), c("A","foo","ba|r","baz"))
Expand Down

0 comments on commit 38471f1

Please sign in to comment.