[Rprotobuf-commits] r767 - pkg/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 13 20:59:07 CET 2014


Author: murray
Date: 2014-01-13 20:59:07 +0100 (Mon, 13 Jan 2014)
New Revision: 767

Modified:
   pkg/inst/unitTests/runit.int64.R
Log:
Check .Machine$sizeof.longlong >= 8 before some of the int64 tests.



Modified: pkg/inst/unitTests/runit.int64.R
===================================================================
--- pkg/inst/unitTests/runit.int64.R	2014-01-13 06:36:03 UTC (rev 766)
+++ pkg/inst/unitTests/runit.int64.R	2014-01-13 19:59:07 UTC (rev 767)
@@ -28,10 +28,15 @@
     # Now just test that we can use add to set int64 fields.
     a$add("repeated_int64", 2:10)
     checkEquals(length(a$repeated_int64), 10)
-    
-    # Verify we can set character strings of large 64-bit ints
-    a$repeated_int64 <- c("9007199254740992", "9007199254740993")
-    checkEquals(length(a$repeated_int64), 2)
+
+    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't set any garbage string to a repeated int64.
     checkException(a$repeated_int64 <-c("invalid", "invalid"))
 
@@ -52,6 +57,7 @@
 
     options("RProtoBuf.int64AsString" = TRUE)
     # But we can see they are different if we treat them as strings.
-    checkEquals(length(unique(a$repeated_int64)), 2)
-
+    if (.Machine$sizeof.longlong >= 8) {
+      checkEquals(length(unique(a$repeated_int64)), 2)
+    }
 }



More information about the Rprotobuf-commits mailing list