inst/tinytest/test_nested.R

library(RProtoBuf)

#.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( "tinytest", "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))
    expect_true(q$isInitialized())
}
#}

Try the RProtoBuf package in your browser

Any scripts or data that you put into this service are public.

RProtoBuf documentation built on Nov. 3, 2022, 9:06 a.m.