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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 22 05:30:26 CEST 2013


Author: murray
Date: 2013-08-22 05:30:26 +0200 (Thu, 22 Aug 2013)
New Revision: 510

Added:
   pkg/inst/unitTests/data/int64.ascii
   pkg/inst/unitTests/runit.int64.R
Modified:
   pkg/ChangeLog
Log:
Add unit test (commented out) illustrating how RProtoBuf and Rcpp are
broken with respect to 64-bit integers.



Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2013-08-22 03:10:49 UTC (rev 509)
+++ pkg/ChangeLog	2013-08-22 03:30:26 UTC (rev 510)
@@ -1,5 +1,8 @@
 2013-08-21  Murray Stokely  <murray at FreeBSD.org>
 
+	* inst/unitTests/runit.int64.R (test.int64): Add a test
+	  illustrating how RProtoBuf is broken in handling 64-bit integers
+	  (commented out for now).
 	* man/P.Rd: Document behavior for extensions.
 	* inst/unitTests/runit.extensions.R (test.extension): Add another test.
 	* src/wrapper_Message.cpp (rprotobuf): Add function for returning

Added: pkg/inst/unitTests/data/int64.ascii
===================================================================
--- pkg/inst/unitTests/data/int64.ascii	                        (rev 0)
+++ pkg/inst/unitTests/data/int64.ascii	2013-08-22 03:30:26 UTC (rev 510)
@@ -0,0 +1,2 @@
+repeated_int64: 9007199254740992
+repeated_int64: 9007199254740993

Added: pkg/inst/unitTests/runit.int64.R
===================================================================
--- pkg/inst/unitTests/runit.int64.R	                        (rev 0)
+++ pkg/inst/unitTests/runit.int64.R	2013-08-22 03:30:26 UTC (rev 510)
@@ -0,0 +1,31 @@
+# Copyright 2013 Google Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+test.int64 <- function() {
+    if (!exists("protobuf_unittest.TestAllTypes",
+                "RProtoBuf:DescriptorPool")) {
+        unittest.proto.file <- system.file("unitTests", "data",
+                                           "unittest.proto",
+                                           package="RProtoBuf")
+        readProtoFiles(file=unittest.proto.file)
+    }
+
+    a <- protobuf_unittest.TestAllTypes$readASCII(
+           system.file("unitTests", "data", "int64.ascii", package="RProtoBuf"))
+
+    # 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