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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 5 00:44:11 CEST 2010


Author: edd
Date: 2010-08-05 00:44:10 +0200 (Thu, 05 Aug 2010)
New Revision: 371

Added:
   pkg/inst/unitTests/runit.addressbook.R
Log:
very humble beginnings...


Added: pkg/inst/unitTests/runit.addressbook.R
===================================================================
--- pkg/inst/unitTests/runit.addressbook.R	                        (rev 0)
+++ pkg/inst/unitTests/runit.addressbook.R	2010-08-04 22:44:10 UTC (rev 371)
@@ -0,0 +1,23 @@
+
+## created as
+##   demo(addressbook)  ## creates 'book'
+##   con <- file("/tmp/addressbook.pb", open="wb")
+##   serialize(book, con)
+##   close(con)
+
+# this is executed before each test function
+.setUp <- function() {
+    file <- system.file( "examples", "AddressBookFile", package = "RProtoBuf" )
+    book <- read( tutorial.AddressBook, file )
+}
+
+test.size <- function() {
+	checkTrue(book$size("person"), 4, msg="Number of persons")
+}
+
+test.personOne <- function() {
+	checkTrue(book$person[[1]]$name, "Humpty Dumpty", msg="First person name")
+	checkTrue(length(book$person[[1]]$phone), 2,      msg="First person phones")
+	checkTrue(book$person[[1]]$phone[[1]]$number, "123.456.789", msg="First person phone number")
+	checkTrue(book$person[[1]]$phone[[1]]$number, "0",           msg="First person phone type")
+}


Property changes on: pkg/inst/unitTests/runit.addressbook.R
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:eol-style
   + native



More information about the Rprotobuf-commits mailing list