[Rprotobuf-commits] r515 - in pkg: . inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 28 00:33:39 CEST 2013


Author: murray
Date: 2013-08-28 00:33:38 +0200 (Wed, 28 Aug 2013)
New Revision: 515

Modified:
   pkg/ChangeLog
   pkg/inst/unitTests/runit.int64.R
Log:
Add unit tests for the new int64 as character string support.



Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2013-08-27 22:02:04 UTC (rev 514)
+++ pkg/ChangeLog	2013-08-27 22:33:38 UTC (rev 515)
@@ -6,8 +6,8 @@
 	  to get around the lack of 64-bit integer support in R when working
 	  interactively with RProtoBufs where a large precision number or
 	  identifier needs to be stored.
+	* inst/unitTests/runit.int64.R: Add tests for the above.
 
-
 2013-08-21  Murray Stokely  <murray at FreeBSD.org>
 
 	* inst/unitTests/runit.addressbook.R (test.ascii): Add more tests.

Modified: pkg/inst/unitTests/runit.int64.R
===================================================================
--- pkg/inst/unitTests/runit.int64.R	2013-08-27 22:02:04 UTC (rev 514)
+++ pkg/inst/unitTests/runit.int64.R	2013-08-27 22:33:38 UTC (rev 515)
@@ -23,10 +23,22 @@
         readProtoFiles(file=unittest.proto.file)
     }
 
+    a <- new(protobuf_unittest.TestAllTypes)
+    a$repeated_int64 <- 1
+    # 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 set any garbage string to an int64.
+    checkException(a$repeated_int64 <-c("invalid", "invalid"))
+
     a <- protobuf_unittest.TestAllTypes$readASCII(
            file(system.file("unitTests", "data", "int64.ascii",
                             package="RProtoBuf")))
+    # And can read them in OK from an ASCII file.
+    checkEquals(length(a$repeated_int64), 2)
 
+    # TODO(mstokely): But the accessors still silently cast to double
+    # which removes uniqueness.  Fix this.
     # Uncomment when RProtoBuf / Rcpp are unbroken with respect to 64-bit ints.
     # checkEquals(length(unique(a$repeated_int64)), 2)
 }



More information about the Rprotobuf-commits mailing list