[rkward-cvs] SF.net SVN: rkward-code:[4585] trunk/rkward/tests

tfry at users.sf.net tfry at users.sf.net
Tue Mar 12 12:28:56 UTC 2013


Revision: 4585
          http://sourceforge.net/p/rkward/code/4585
Author:   tfry
Date:     2013-03-12 12:28:56 +0000 (Tue, 12 Mar 2013)
Log Message:
-----------
Add test for sort_data plugin

Modified Paths:
--------------
    trunk/rkward/tests/all_tests.R

Added Paths:
-----------
    trunk/rkward/tests/data_plugin_tests/
    trunk/rkward/tests/data_plugin_tests/sort_data.rkcommands.R
    trunk/rkward/tests/data_plugin_tests.R

Modified: trunk/rkward/tests/all_tests.R
===================================================================
--- trunk/rkward/tests/all_tests.R	2013-03-12 11:47:38 UTC (rev 4584)
+++ trunk/rkward/tests/all_tests.R	2013-03-12 12:28:56 UTC (rev 4585)
@@ -7,6 +7,7 @@
 	"item_response_theory.R",
 	"analysis_plugins.R",
 	"distributions.R",
-	"plots.R")
+	"plots.R",
+	"data_plugin_tests.R")
 
 rktest.makeplugintests (testsuites=testsuites, outfile="make_plugintests.txt")

Added: trunk/rkward/tests/data_plugin_tests/sort_data.rkcommands.R
===================================================================
--- trunk/rkward/tests/data_plugin_tests/sort_data.rkcommands.R	                        (rev 0)
+++ trunk/rkward/tests/data_plugin_tests/sort_data.rkcommands.R	2013-03-12 12:28:56 UTC (rev 4585)
@@ -0,0 +1,4 @@
+local({
+## Compute
+.GlobalEnv$women.backup <- women.backup[order (-xtfrm (women.backup[["height"]])),]
+})

Added: trunk/rkward/tests/data_plugin_tests.R
===================================================================
--- trunk/rkward/tests/data_plugin_tests.R	                        (rev 0)
+++ trunk/rkward/tests/data_plugin_tests.R	2013-03-12 12:28:56 UTC (rev 4585)
@@ -0,0 +1,25 @@
+## definition of the test suite
+suite <- new ("RKTestSuite", id="data_plugin_tests",
+	# place here libraries that are required for *all* tests in this suite, or highly likely to be installed
+	libraries = c ("datasets"),
+	# initCalls are run *before* any tests. Use this to set up the environment
+	initCalls = list (
+		function () {
+			# prepare some different files for loading
+			library ("datasets")
+			data (women)
+		}
+	## the tests
+	), tests = list (
+		new ("RKTest", id="sort_data", call=function () {
+			assign("women.backup", datasets::women, pos=globalenv())
+			rk.sync.global()
+
+			rk.call.plugin ("rkward::sort_data", conversion.string="as is", multi_sortby.serialized="keys=women.backup[[\\\"height\\\"]]\n_row=conversion.string=as is\treverse.state=1", object.available="women.backup", order.string="", saveto_select.string="same", sortby.available="women.backup[[\"height\"]]", submit.mode="submit")
+
+			stopifnot (all.equal (women.backup, women[order (-women$height),]))
+		})
+	), postCalls = list (
+			function(){rm("women", pos=globalenv())}
+			)	# like initCalls: run after all tests to clean up. Empty in this case.
+)





More information about the rkward-tracker mailing list