[Rprotobuf-commits] r457 - in pkg/inst/unitTests: . data
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 9 03:11:18 CEST 2012
Author: edd
Date: 2012-08-09 03:11:18 +0200 (Thu, 09 Aug 2012)
New Revision: 457
Added:
pkg/inst/unitTests/data/nested.proto
pkg/inst/unitTests/runit.nested.R
Log:
new proto file and new unit test from Murray's mutators.cpp patch
Added: pkg/inst/unitTests/data/nested.proto
===================================================================
--- pkg/inst/unitTests/data/nested.proto (rev 0)
+++ pkg/inst/unitTests/data/nested.proto 2012-08-09 01:11:18 UTC (rev 457)
@@ -0,0 +1,6 @@
+message NestedInner {
+ required int32 x = 1;
+}
+message NestedOuter {
+ required NestedInner b = 1;
+}
Added: pkg/inst/unitTests/runit.nested.R
===================================================================
--- pkg/inst/unitTests/runit.nested.R (rev 0)
+++ pkg/inst/unitTests/runit.nested.R 2012-08-09 01:11:18 UTC (rev 457)
@@ -0,0 +1,16 @@
+.setUp <- function(){
+ if( ! exists( "NestedOuter", "RProtoBuf:DescriptorPool" ) ) {
+ ## None of the messages in unittest.proto is exactly right to tickle this bug.
+ unitest.proto.file <- system.file( "unitTests", "data", "nested.proto", package = "RProtoBuf" )
+ readProtoFiles(file = unitest.proto.file)
+ }
+}
+
+# RProtoBuf before v0.2.5 had a bug whereby uninitialized memory was read and used
+# to determine whether or not to update a nested message field in new() / update().
+test.nested <- function() {
+ for (i in 1:1000) {
+ q <- new(NestedOuter, b=new(NestedInner, x=1))
+ checkTrue(q$isInitialized())
+ }
+}
More information about the Rprotobuf-commits
mailing list