File: test_bool_datetime.R

package info (click to toggle)
r-cran-rcpptoml 0.2.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 280 kB
  • sloc: cpp: 204; sh: 14; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 717 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

library(RcppTOML)

isSolaris <- Sys.info()[["sysname"]] == "SunOS"

toml <- parseToml("bool_datetime.toml")

expect_equal(names(toml), c("boolean", "date", "datetime", "time"))

expect_true(toml$boolean$True)
expect_false(toml$boolean$False)

ref1 <- as.POSIXct("1979-05-27 07:32:00", tz="UTC", usetz=TRUE)
ref2 <- as.POSIXct("1979-05-27 07:32:00.999999", tz="UTC", usetz=TRUE)

if (!isSolaris) expect_equal(toml$datetime$key1, ref1)
if (!isSolaris) expect_equal(toml$datetime$key2, ref1)
if (!isSolaris) expect_equal(toml$datetime$key3, ref2)

d1 <- as.Date("1979-05-27")
expect_equal(toml$date$dat1, d1)

t1 <- "07:32:00"
t2 <- "00:32:00.999999"
expect_equal(toml$time$time1, t1)
expect_equal(toml$time$time2, t2)