Skip to content

Commit 1421db8

Browse files
committed
add more tests
1 parent 9461ef3 commit 1421db8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

inst/tests/tests.Rraw

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21568,4 +21568,13 @@ test(2335.5, isoyear("2019-12-30"), 2020L)
2156821568
test(2335.6, isoyear(as.Date("2019-12-30")), 2020L)
2156921569

2157021570
# 2864 force decimal points for whole numbers in numeric columns
21571-
test(2336.1, capture.output(fwrite(data.table(x=c(1, 2, 3)), forceDecimal=TRUE)), c("x", "1.", "2.", "3."))
21571+
dd = data.table(x=c(1, 2, 3))
21572+
di = data.table(x=c(1L, 2L, 3L))
21573+
test(2336.1, capture.output(fwrite(dd, forceDecimal=TRUE)), c("x", "1.", "2.", "3."))
21574+
test(2336.2, capture.output(fwrite(dd, forceDecimal=FALSE)), c("x", "1", "2", "3"))
21575+
test(2336.3, capture.output(fwrite(di, forceDecimal=TRUE)), c("x", "1", "2", "3"))
21576+
test(2336.4, capture.output(fwrite(data.table(x=c(0.)), forceDecimal=TRUE)), c("x", "0."))
21577+
test(2336.5, capture.output(fwrite(data.table(x=c(-0.)), forceDecimal=TRUE)), c("x", "0."))
21578+
# round trip
21579+
test(2336.6, fread(text=paste0(capture.output(fwrite(dd, forceDecimal=TRUE)), collapse = "\n")), dd)
21580+
test(2336.7, fread(text=paste0(capture.output(fwrite(dd, forceDecimal=FALSE)), collapse = "\n")), di)

0 commit comments

Comments
 (0)