Skip to content

Commit

Permalink
Retire tests for solaris (#130)
Browse files Browse the repository at this point in the history
* Retire test for Solaris platform

* Roll micro version and date
  • Loading branch information
eddelbuettel authored Jun 22, 2024
1 parent dc37796 commit 02beeae
Show file tree
Hide file tree
Showing 6 changed files with 387 additions and 418 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2024-06-22 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Roll minor version and date

* inst/tinytest/test_nanotime.R: Retire test for Solaris
* inst/tinytest/test_nanoperiod.R: Idem
* inst/tinytest/test_nanoival.R: Idem
* inst/tinytest/test_zoo.R: Idem

2024-06-21 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Release 0.3.9
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: nanotime
Type: Package
Title: Nanosecond-Resolution Time Support for R
Version: 0.3.9
Date: 2024-06-21
Version: 0.3.9.1
Date: 2024-06-22
Author: Dirk Eddelbuettel and Leonardo Silvestri
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Description: Full 64-bit resolution date and time functionality with
Expand Down
59 changes: 27 additions & 32 deletions inst/tinytest/test_nanoival.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
library(nanotime)
suppressMessages(library(bit64))

isSolaris <- Sys.info()[["sysname"]] == "SunOS"
extended_tests <- Sys.getenv("CI", "") != ""

savedFormat <- NULL
Expand Down Expand Up @@ -37,27 +36,25 @@ expect_identical(nanoival.start(ni), c(a=nanotime("2013-01-01 00:00:00"),
expect_identical(nanoival.sopen(ni), c(a=FALSE, b=FALSE, c=TRUE, d=TRUE)) &
expect_identical(nanoival.eopen(ni), c(a=TRUE, b=FALSE, c=TRUE, d=FALSE))

if (!isSolaris) {
expect_identical(length(as.nanoival(vector("character", 0))), 0L)
expect_identical(as.nanoival("-2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_York+"),
nanoival(nanotime("2013-01-01 00:00:00 America/New_York"),
nanotime("2014-01-01 00:00:00 America/New_York"), TRUE, FALSE))

## test warning when we double specify the timezone:
expect_error(as.nanoival("-2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00+00:00+", tz="Europe/London"),
"timezone is specified twice: in the string and as an argument")

##test_as.nanoival_vector_fail <- function() {
expect_error(as.nanoival("-2013-01-01 00:00:00 -> 2014-01-01 00:00:00"), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("2013-01-01 00:00:00 -> 2014-01-01 00:00:00-"), "`nanoival` must start with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 $$ 2014-01-01 00:00:00-"), "Parse error on 2013-01-01 00:00:00 \\$\\$ 2014-01-01 00:00:00")
expect_error(as.nanoival("+2013-01-01 00:00:00 -> 2014-01-01 00:00:00- "), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 -> 2014-01-01 00:00:00a"), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_York %%"), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_York + "), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("-2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_YYork+"),
"Cannot retrieve timezone")
}
expect_identical(length(as.nanoival(vector("character", 0))), 0L)
expect_identical(as.nanoival("-2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_York+"),
nanoival(nanotime("2013-01-01 00:00:00 America/New_York"),
nanotime("2014-01-01 00:00:00 America/New_York"), TRUE, FALSE))

## test warning when we double specify the timezone:
expect_error(as.nanoival("-2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00+00:00+", tz="Europe/London"),
"timezone is specified twice: in the string and as an argument")

##test_as.nanoival_vector_fail <- function() {
expect_error(as.nanoival("-2013-01-01 00:00:00 -> 2014-01-01 00:00:00"), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("2013-01-01 00:00:00 -> 2014-01-01 00:00:00-"), "`nanoival` must start with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 $$ 2014-01-01 00:00:00-"), "Parse error on 2013-01-01 00:00:00 \\$\\$ 2014-01-01 00:00:00")
expect_error(as.nanoival("+2013-01-01 00:00:00 -> 2014-01-01 00:00:00- "), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 -> 2014-01-01 00:00:00a"), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_York %%"), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("+2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_York + "), "`nanoival` must end with '\\+' or '-'")
expect_error(as.nanoival("-2013-01-01 00:00:00 America/New_York -> 2014-01-01 00:00:00 America/New_YYork+"),
"Cannot retrieve timezone")

expect_error(as.nanoival(aa, tz=list(1)), "argument 'tz' must be of type 'character'")

Expand Down Expand Up @@ -1353,10 +1350,9 @@ n1 <- nanotime(1)
n2 <- nanotime(2)
ni <- nanoival(n1, n2)
prd <- as.nanoperiod("200y")
if (!isSolaris) {
expect_warning(plus (ni, prd, "America/New_York"), "NAs produced by time overflow \\(remember that interval times are coded with 63 bits\\)")
expect_warning(minus(ni, prd, "America/New_York"), "NAs produced by time overflow \\(remember that interval times are coded with 63 bits\\)")
}
expect_warning(plus (ni, prd, "America/New_York"), "NAs produced by time overflow \\(remember that interval times are coded with 63 bits\\)")
expect_warning(minus(ni, prd, "America/New_York"), "NAs produced by time overflow \\(remember that interval times are coded with 63 bits\\)")

dur <- as.nanoduration(200*365*24*3600*1e9)
expect_warning(ni + dur, "NAs produced by time overflow \\(remember that interval times are coded with 63 bits\\)")
expect_warning(ni + dur, "NAs produced by time overflow \\(remember that interval times are coded with 63 bits\\)")
Expand Down Expand Up @@ -1389,12 +1385,11 @@ expect_identical(as.nanoival(aa), as(aa, "nanoival"))
## test seq:

x <- as.nanoival("+2013-01-01 15:00:00 -> 2013-01-01 17:00:00-")
if (!isSolaris) {
expect_identical(seq(x, by=as.nanoperiod("1m"), length.out=4, tz="America/New_York"),
nanoival(seq(nanoival.start(x), by=as.nanoperiod("1m"), length.out=4, tz="America/New_York"),
seq(nanoival.end(x), by=as.nanoperiod("1m"), length.out=4, tz="America/New_York"),
FALSE, TRUE))
}
expect_identical(seq(x, by=as.nanoperiod("1m"), length.out=4, tz="America/New_York"),
nanoival(seq(nanoival.start(x), by=as.nanoperiod("1m"), length.out=4, tz="America/New_York"),
seq(nanoival.end(x), by=as.nanoperiod("1m"), length.out=4, tz="America/New_York"),
FALSE, TRUE))

y <- as.nanoival("+2013-01-04 15:00:00 -> 2013-01-04 17:00:00-")
expect_identical(seq(x, y, by=as.nanoduration("24:00:00")),
nanoival(seq(nanoival.start(x), by=as.nanoperiod("1d"), length.out=4, tz="UTC"),
Expand Down
Loading

0 comments on commit 02beeae

Please sign in to comment.