[Swift-commit] r4083 - in SwiftApps/SwiftR/Swift: . R

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Feb 10 15:10:53 CST 2011


Author: tga
Date: 2011-02-10 15:10:50 -0600 (Thu, 10 Feb 2011)
New Revision: 4083

Modified:
   SwiftApps/SwiftR/Swift/NAMESPACE
   SwiftApps/SwiftR/Swift/R/TestFramework.R
Log:
Added function to collate results from performance tests into vectors.


Modified: SwiftApps/SwiftR/Swift/NAMESPACE
===================================================================
--- SwiftApps/SwiftR/Swift/NAMESPACE	2011-02-10 19:15:41 UTC (rev 4082)
+++ SwiftApps/SwiftR/Swift/NAMESPACE	2011-02-10 21:10:50 UTC (rev 4083)
@@ -25,3 +25,4 @@
 
 export(mkPerfTest)
 export(doPerfTest)
+export(analysePerf)

Modified: SwiftApps/SwiftR/Swift/R/TestFramework.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/TestFramework.R	2011-02-10 19:15:41 UTC (rev 4082)
+++ SwiftApps/SwiftR/Swift/R/TestFramework.R	2011-02-10 21:10:50 UTC (rev 4083)
@@ -45,7 +45,30 @@
     return (makeTestGroup(name, tests, setup, teardown))
 }
 
+analysePerf <- function (testGroupResults, nargs) {
+    # Build a list of vectors of performance results for easier analysis
+    # [[1]] -> first arg
+    # [[2]] -> second arg
+    # ...   ... .......
+    # [[n]] -> nth arg
+    # $name 
+    # $passed 
+    # $time
+    collated <- list()
+    for (i in 1:nargs) {
+        collated[[i]] <- unlist(lapply(testGroupResults$tests, 
+                        function(test) {test$args[[i]]}))
+    }
+    collated$name <- unlist(lapply(testGroupResults$tests, 
+                        function(test) {test$name }))
+    collated$passed <-unlist(lapply(testGroupResults$tests, 
+                        function(test) {test$passed }))
+    collated$time <- unlist(lapply(testGroupResults$tests, 
+                        function(test) {test$time }))
+    return (collated)
+}
 
+
 runTestGroup <- function (group) {
     cat("\n*** Starting test group ", group$name, "***\n")
     if (!is.null(group$setup))




More information about the Swift-commit mailing list