[Rprotobuf-commits] r548 - in pkg: . inst tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 15 16:48:10 CET 2013


Author: edd
Date: 2013-12-15 16:48:10 +0100 (Sun, 15 Dec 2013)
New Revision: 548

Added:
   pkg/tests/runUnitTests.R
Removed:
   pkg/tests/doRUnit.R
Modified:
   pkg/ChangeLog
   pkg/inst/NEWS.Rd
Log:
Minor rewrite (as runUnitTests.R) and cleanup (from doRUnit.R) with a tip of the hat to Murray's version in his HistogramTools package


Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog	2013-12-15 05:19:37 UTC (rev 547)
+++ pkg/ChangeLog	2013-12-15 15:48:10 UTC (rev 548)
@@ -1,3 +1,8 @@
+2013-12-15  Dirk Eddelbuettel  <edd at debian.org>
+
+	* tests/runUnitTests.R: Minor rewrite and cleanup from doRUnit.R with
+	a tip of the hat to Murray's version in his HistogramTools package
+
 2013-12-14  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/lookup.cpp (rprotobuf): Descrictor pools attached directly

Modified: pkg/inst/NEWS.Rd
===================================================================
--- pkg/inst/NEWS.Rd	2013-12-15 05:19:37 UTC (rev 547)
+++ pkg/inst/NEWS.Rd	2013-12-15 15:48:10 UTC (rev 548)
@@ -15,6 +15,7 @@
     \item Add missing enum_type method and improve show method for
     EnumValueDescriptors.
     \item Improve documentation and tests for all of the above.
+    \item Rewrote \code{tests/} script calling \cpkg{RUnit} tests
   }
 }
 

Deleted: pkg/tests/doRUnit.R
===================================================================
--- pkg/tests/doRUnit.R	2013-12-15 05:19:37 UTC (rev 547)
+++ pkg/tests/doRUnit.R	2013-12-15 15:48:10 UTC (rev 548)
@@ -1,27 +0,0 @@
-#### doRUnit.R --- Run RUnit tests
-####------------------------------------------------------------------------
-
-### borrowed from package fUtilities in RMetrics
-### http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/fUtilities/tests/doRUnit.R?rev=1958&root=rmetrics&view=markup
-
-### Originally follows Gregor Gojanc's example in CRAN package  'gdata'
-### and the corresponding section in the R Wiki:
-###  http://wiki.r-project.org/rwiki/doku.php?id=developers:runit
-
-### MM: Vastly changed:  This should also be "runnable" for *installed*
-##              package which has no ./tests/
-## ----> put the bulk of the code e.g. in  ../inst/unitTests/runTests.R :
-
-if(require("RUnit", quietly = TRUE)) {
-
-  ## --- Setup ---
-  pkg <- "RProtoBuf"
-
-  require( pkg, character.only=TRUE)
-
-  path <- system.file("unitTests", package = pkg)
-
-  stopifnot(file.exists(path), file.info(path.expand(path))$isdir)
-
-  source(file.path(path, "runTests.R"), echo = TRUE)
-}

Copied: pkg/tests/runUnitTests.R (from rev 547, pkg/tests/doRUnit.R)
===================================================================
--- pkg/tests/runUnitTests.R	                        (rev 0)
+++ pkg/tests/runUnitTests.R	2013-12-15 15:48:10 UTC (rev 548)
@@ -0,0 +1,36 @@
+
+## doRUnit.R --- Run RUnit tests
+##
+## with credits to package fUtilities in RMetrics
+## which credits Gregor Gojanc's example in CRAN package  'gdata'
+## as per the R Wiki http://wiki.r-project.org/rwiki/doku.php?id=developers:runit
+## and changed further by Martin Maechler
+## and more changes by Murray Stokely in HistogramTools
+##
+## Dirk Eddelbuettel, Dec 2013
+
+stopifnot(require("RUnit", quietly=TRUE))
+stopifnot(require("RProtoBuf", quietly=TRUE))
+
+#  path <- system.file("unitTests", package = pkg)
+#  stopifnot(file.exists(path), file.info(path.expand(path))$isdir)
+#  source(file.path(path, "runTests.R"), echo = TRUE)
+
+## Set a seed to make the test deterministic
+set.seed(42)
+
+## Define tests
+testSuite <- defineTestSuite(name="RProtoBuf Unit Tests",
+                             dirs=system.file("unitTests", package = "RProtoBuf"),
+                             testFuncRegexp = "^[Tt]est.+")
+
+## Run tests
+tests <- runTestSuite(testSuite)
+
+## Print results
+printTextProtocol(tests)
+
+## Return success or failure to R CMD CHECK
+if (getErrors(tests)$nFail > 0) {
+    stop("TEST FAILED!")
+}



More information about the Rprotobuf-commits mailing list