Skip to content

Commit 1d324d6

Browse files
committed
add tests
1 parent c47ec27 commit 1d324d6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

R/data.table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3346,7 +3346,7 @@ is_constantish = function(q, check_singleton=FALSE) {
33463346

33473347
.gforce_ok = function(q, x, envir=parent.frame(2L)) {
33483348
if (is.N(q)) return(TRUE) # For #334
3349-
if (!is.call(q)) return(FALSE) # plain columns are not gforce-able since they might not aggregate (see test 104.1)
3349+
if (!is.call(q)) return(is.numeric(q)) # plain columns are not gforce-able since they might not aggregate (see test 104.1)
33503350
if (q %iscall% "(") return(.gforce_ok(q[[2L]], x, envir))
33513351

33523352
q1 = .get_gcall(q)

inst/tests/tests.Rraw

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21236,3 +21236,7 @@ test(2345.23, levels=0:2, names(dt[, lapply(list(b, c), sum), by=a]))
2123621236
dt = data.table(a=1:4, b=1:2)
2123721237
test(2345.31, levels=0:2, dt[, .(max(a)-min(a)), by=b, verbose=TRUE], output=out)
2123821238
test(2345.32, levels=0:2, dt[, .((max(a) - min(a)) / (max(a) + min(a))), by=b, verbose=TRUE], data.table(b=1:2, V1=c(0.5, 1/3)), output=out)
21239+
test(2345.33, levels=0:2, dt[, sum(a) / .N, b, verbose=TRUE], output=out)
21240+
test(2345.34, levels=0:2, dt[, mean(a) * 2L + sum(a), b, verbose=TRUE], output=out)
21241+
test(2345.35, levels=0:2, dt[, list(range=max(a)-min(a), avg=mean(a)), by=b, verbose=TRUE], output=out)
21242+
test(2345.36, levels=0:2, dt[, .(max(a)-sqrt(min(a))), by=b, verbose=TRUE], output="GForce FALSE")

0 commit comments

Comments
 (0)