[Rprotobuf-commits] r499 - in pkg: R inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 11 02:47:29 CEST 2013


Author: murray
Date: 2013-07-11 02:47:27 +0200 (Thu, 11 Jul 2013)
New Revision: 499

Modified:
   pkg/R/00classes.R
   pkg/inst/unitTests/runit.enums.R
Log:
Add tests and fix a nit noticed by Karl in code review.



Modified: pkg/R/00classes.R
===================================================================
--- pkg/R/00classes.R	2013-07-10 17:55:22 UTC (rev 498)
+++ pkg/R/00classes.R	2013-07-11 00:47:27 UTC (rev 499)
@@ -224,8 +224,8 @@
 		"containing_type" = function() containing_type(x),
 		"length" = function() length(x),
 		"value_count" = function() value_count(x),
-		"value" = function(...) value(x, ...) ,
-                "has" = function(name) .Call( "has_enum_name", x at pointer, name, package = "RProtoBuf"),
+		"value" = function(...) value(x, ...),
+                "has" = function(name, ...) has(x, name, ...),
 		# default
 		.Call( "get_value_of_enum", x at pointer, name, PACKAGE = "RProtoBuf" )
 		)

Modified: pkg/inst/unitTests/runit.enums.R
===================================================================
--- pkg/inst/unitTests/runit.enums.R	2013-07-10 17:55:22 UTC (rev 498)
+++ pkg/inst/unitTests/runit.enums.R	2013-07-11 00:47:27 UTC (rev 499)
@@ -20,6 +20,10 @@
   checkEquals(name(value(ProtoFormat$PhoneType, index=1)), "MOBILE")
   checkEquals(name(value(ProtoFormat$PhoneType, index=2)), "HOME")
 
+  checkEquals(length(ProtoFormat$PhoneType), 3)
+  checkTrue(has(ProtoFormat$PhoneType, "WORK"))
+  checkTrue(!has(ProtoFormat$PhoneType, "NONEXISTANT"))
+
   # Verify that invalid indices are returned as NULL.
   checkTrue(is.null(value(ProtoFormat$PhoneType, index=900)))
 }



More information about the Rprotobuf-commits mailing list