@@ -2031,17 +2031,19 @@ options(datatable.optimize = 2L)
20312031test(658.1, DT[ , mean(x), by=grp1, verbose=TRUE], output="GForce optimized j to.*gmean")
20322032test(658.2, DT[ , list(mean(x)), by=grp1, verbose=TRUE], output="GForce optimized j to.*gmean")
20332033test(658.3, DT[ , list(mean(x), mean(y)), by=grp1, verbose=TRUE], output="GForce optimized j to.*gmean")
2034- tt = capture.output(DT[,list(mean(x),mean(y)),by=list(grp1,grp2),verbose=TRUE])
2035- test(659, !length(grep("Wrote less rows", tt))) # first group is one row with this seed. Ensure we treat this as aggregate case rather than allocate too many rows.
2034+ # first group is one row with this seed. Ensure we treat this as aggregate case rather than allocate too many rows.
2035+ test(659, DT[,list(mean(x),mean(y)),by=list(grp1,grp2),verbose=TRUE], notOutput = "Wrote less rows")
20362036
20372037# Test .N for logical i subset
20382038DT = data.table(a=1:10, b=rnorm(10))
20392039test(660, DT[a==8L, .N], 1L)
20402040
20412041# Test that growing is sensible in worst case
20422042DT = data.table(a=rep(1:10,1:10),b=rnorm(55))
2043- tt = capture.output(DT[,sum(b)*b,by=a,verbose=TRUE])
2044- test(661, length(grep("growing from",tt))<3) # was 6 when we simply grew enough for latest result
2043+ test(661, DT[,sum(b)*b,by=a,verbose=TRUE],
2044+ notOutput = paste(rep("growing from", 3), collapse = ".*"))
2045+ # Need to test that "growing from" is printed less than three times.
2046+ # The number was previously 6 when we simply grew enough for latest result
20452047
20462048# Test that adding a new logical column is supported, #2094
20472049DT=data.table(a=1:3)
@@ -10246,33 +10248,33 @@ options("datatable.use.index"=TRUE, "datatable.auto.index"=TRUE)
1024610248test(1666.01, d[k==1L, verbose=TRUE], d[3L], output="Creating new index 'k'")
1024710249d = data.table(k=3:1)
1024810250options("datatable.use.index"=TRUE, "datatable.auto.index"=FALSE)
10249- test(1666.02, grep("Creating new index", capture.output( d[k==1L, verbose=TRUE])), integer(0) ) # do not create index
10251+ test(1666.02, d[k==1L, verbose=TRUE], notOutput="Creating new index" ) # do not create index
1025010252d = data.table(k=3:1)
1025110253options("datatable.use.index"=FALSE, "datatable.auto.index"=FALSE)
10252- test(1666.03, grep("Creating new index", capture.output( d[k==1L, verbose=TRUE])), integer(0) )
10254+ test(1666.03, d[k==1L, verbose=TRUE], notOutput="Creating new index" )
1025310255d = data.table(k=3:1)
1025410256options("datatable.use.index"=FALSE, "datatable.auto.index"=TRUE)
10255- test(1666.04, grep("Creating new index", capture.output( d[k==1L, verbose=TRUE])), integer(0) )
10257+ test(1666.04, d[k==1L, verbose=TRUE], notOutput="Creating new index" )
1025610258d = data.table(k=3:1) # subset - index
1025710259setindex(d, k)
1025810260options("datatable.use.index"=TRUE, "datatable.auto.index"=TRUE)
1025910261test(1666.05, d[k==1L, verbose=TRUE], d[3L], output="Optimized subsetting with index 'k'")
1026010262options("datatable.use.index"=TRUE, "datatable.auto.index"=FALSE)
1026110263test(1666.06, d[k==1L, verbose=TRUE], d[3L], output="Optimized subsetting with index 'k'")
1026210264options("datatable.use.index"=FALSE, "datatable.auto.index"=FALSE)
10263- test(1666.07, grep("Using existing index", capture.output( d[k==1L, verbose=TRUE])), integer(0) ) # not using existing index
10265+ test(1666.07, d[k==1L, verbose=TRUE], notOutput="Using existing index" ) # not using existing index
1026410266options("datatable.use.index"=FALSE, "datatable.auto.index"=TRUE)
10265- test(1666.08, grep("Using existing index", capture.output( d[k==1L, verbose=TRUE])), integer(0) )
10267+ test(1666.08, d[k==1L, verbose=TRUE], notOutput="Using existing index" )
1026610268d1 = data.table(k=3:1) # join - no index
1026710269d2 = data.table(k=2:4)
1026810270options("datatable.use.index"=TRUE, "datatable.auto.index"=TRUE)
1026910271test(1666.09, d1[d2, on="k", verbose=TRUE], d1[d2, on="k"], output="ad hoc")
1027010272options("datatable.use.index"=TRUE, "datatable.auto.index"=FALSE)
1027110273test(1666.10, d1[d2, on="k", verbose=TRUE], d1[d2, on="k"], output="ad hoc")
1027210274options("datatable.use.index"=FALSE, "datatable.auto.index"=FALSE)
10273- test(1666.11, grep("Looking for existing (secondary) index", capture.output( d1[d2, on="k", verbose=TRUE])), integer(0) ) # not looking for index
10275+ test(1666.11, d1[d2, on="k", verbose=TRUE], notOutput="Looking for existing (secondary) index" ) # not looking for index
1027410276options("datatable.use.index"=FALSE, "datatable.auto.index"=TRUE)
10275- test(1666.12, grep("Looking for existing (secondary) index", capture.output( d1[d2, on="k", verbose=TRUE])), integer(0) )
10277+ test(1666.12, d1[d2, on="k", verbose=TRUE], notOutput="Looking for existing (secondary) index" )
1027610278d1 = data.table(k=3:1,v1=10:12) # join - index
1027710279d2 = data.table(k=2:4,v2=20:22)
1027810280setindex(d1, k)
@@ -16319,7 +16321,7 @@ test(2094.02, X$TAG, rep(names(x), each = 2))
1631916321
1632016322# use arbitrary column without message when fun.aggregate=length, #2980
1632116323DT = data.table(a=c(3L, 3L, 2L, 9L, 5L, 10L, 3L, 2L, 9L, 8L), b=rep(1:5, 2))
16322- test(2095, any(grepl('override', capture.output( dcast(DT, a~b, fun.aggregate=length)), fixed=TRUE)), FALSE )
16324+ test(2095, dcast(DT, a~b, fun.aggregate=length), notOutput='override' )
1632316325
1632416326# gmean intermediate can overflow integers without warning, #986
1632516327test(2096, data.table(a=c(1L,1L), v=c(2e9L, 2e9L))[, mean(v), a], data.table(a=1L, V1=2e9))
0 commit comments