[Rprotobuf-commits] r769 - in pkg: . inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 13 22:30:55 CET 2014
Author: murray
Date: 2014-01-13 22:30:55 +0100 (Mon, 13 Jan 2014)
New Revision: 769
Modified:
pkg/ChangeLog
pkg/inst/unitTests/runit.int64.R
Log:
Check for sizeof(long long) right at the beginning of this test and
exit immediately if we're not on a 64-bit platform. The previous
behavior here I think would still have been broken on a 32-bit
machine.
Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog 2014-01-13 21:26:03 UTC (rev 768)
+++ pkg/ChangeLog 2014-01-13 21:30:55 UTC (rev 769)
@@ -1,3 +1,12 @@
+2014-01-13 Murray Stokely <mstokely at google.com>
+
+ * inst/unitTests/runit.int64.R (test.int64): Skip this test with a
+ warning if running on a machine with sizeof(long long) < 8.
+ * vignettes/RProtoBuf-intro.Rnw (subsection{64-bit integer
+ issues}): Hide 64-bit field accesses with if conditional to
+ avoid running code that won't work on platforms without 64-bit
+ long longs.
+
2014-01-09 Murray Stokely <mstokely at google.com>
* R/read.R: Add a logical argument 'partial' to readASCII that
Modified: pkg/inst/unitTests/runit.int64.R
===================================================================
--- pkg/inst/unitTests/runit.int64.R 2014-01-13 21:26:03 UTC (rev 768)
+++ pkg/inst/unitTests/runit.int64.R 2014-01-13 21:30:55 UTC (rev 769)
@@ -23,19 +23,20 @@
readProtoFiles(file=unittest.proto.file)
}
+ if (.Machine$sizeof.longlong < 8) {
+ warning("Can't test 64-bit int type on platform with sizeof(long long) < 8")
+ return
+ }
+
a <- new(protobuf_unittest.TestAllTypes)
a$repeated_int64 <- 1
# Now just test that we can use add to set int64 fields.
a$add("repeated_int64", 2:10)
checkEquals(length(a$repeated_int64), 10)
- if (.Machine$sizeof.longlong >= 8) {
- # Verify we can set character strings of large 64-bit ints
- a$repeated_int64 <- c("9007199254740992", "9007199254740993")
- checkEquals(length(a$repeated_int64), 2)
- } else {
- warning("Can't test 64-bit int type on platform with sizeof(long long) < 8")
- }
+ # Verify we can set character strings of large 64-bit ints
+ a$repeated_int64 <- c("9007199254740992", "9007199254740993")
+ checkEquals(length(a$repeated_int64), 2)
# Verify we can't set any garbage string to a repeated int64.
checkException(a$repeated_int64 <-c("invalid", "invalid"))
@@ -57,7 +58,5 @@
options("RProtoBuf.int64AsString" = TRUE)
# But we can see they are different if we treat them as strings.
- if (.Machine$sizeof.longlong >= 8) {
- checkEquals(length(unique(a$repeated_int64)), 2)
- }
+ checkEquals(length(unique(a$repeated_int64)), 2)
}
More information about the Rprotobuf-commits
mailing list