Browse code

general cleanup and fixes, doc updates

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@111183 bc3139a8-67e5-0310-9ffc-ced21a209358

Michael Lawrence authored on 03/12/2015 21:11:09
Showing 1 changed files
... ...
@@ -1,48 +1 @@
1
-.test <- function(dir, pattern = "^test_.*\\.R$")
2
-{
3
-    .failure_details <- function(result) {
4
-        res <- result[[1L]]
5
-        if (res$nFail > 0 || res$nErr > 0) {
6
-            Filter(function(x) length(x) > 0,
7
-                   lapply(res$sourceFileResults,
8
-                          function(fileRes) {
9
-                              names(Filter(function(x) x$kind != "success",
10
-                                           fileRes))
11
-                          }))
12
-        } else list()
13
-    }
14
-
15
-    if (missing(dir)) {
16
-        dir <- system.file("unitTests", package="gmapR")
17
-        if (!length(dir)) {
18
-            dir <- system.file("UnitTests", package="gmapR")
19
-            if (!length(dir))
20
-                stop("unable to find unit tests, no 'unitTests' dir")
21
-        }
22
-    }
23
-    require("RUnit", quietly=TRUE) || stop("RUnit package not found")
24
-    RUnit_opts <- getOption("RUnit", list())
25
-    RUnit_opts$verbose <- 0L
26
-    RUnit_opts$silent <- TRUE
27
-    RUnit_opts$verbose_fail_msg <- TRUE
28
-    options(RUnit = RUnit_opts)
29
-    suite <- defineTestSuite(name="gmapR RUnit Tests", dirs=dir,
30
-                             testFileRegexp=pattern,
31
-                             rngKind="default",
32
-                             rngNormalKind="default")
33
-    result <- runTestSuite(suite)
34
-    cat("\n\n")
35
-    printTextProtocol(result, showDetails=FALSE)
36
-    if (length(details <- .failure_details(result)) >0) {
37
-        cat("\nTest files with failing tests\n")
38
-        for (i in seq_along(details)) {
39
-            cat("\n  ", basename(names(details)[[i]]), "\n")
40
-            for (j in seq_along(details[[i]])) {
41
-                cat("    ", details[[i]][[j]], "\n")
42
-            }
43
-        }
44
-        cat("\n\n")
45
-        stop("unit tests failed for package gmapR")
46
-    }
47
-    result
48
-}
1
+.test <- function() BiocGenerics:::testPackage("gmapR")
Browse code

*added test harness for gmapR

*added exonsToGmapSpliceSites and associated unit test


git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/gmapR@57572 bc3139a8-67e5-0310-9ffc-ced21a209358

Cory Barr authored on 20/08/2011 03:36:15
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,48 @@
1
+.test <- function(dir, pattern = "^test_.*\\.R$")
2
+{
3
+    .failure_details <- function(result) {
4
+        res <- result[[1L]]
5
+        if (res$nFail > 0 || res$nErr > 0) {
6
+            Filter(function(x) length(x) > 0,
7
+                   lapply(res$sourceFileResults,
8
+                          function(fileRes) {
9
+                              names(Filter(function(x) x$kind != "success",
10
+                                           fileRes))
11
+                          }))
12
+        } else list()
13
+    }
14
+
15
+    if (missing(dir)) {
16
+        dir <- system.file("unitTests", package="gmapR")
17
+        if (!length(dir)) {
18
+            dir <- system.file("UnitTests", package="gmapR")
19
+            if (!length(dir))
20
+                stop("unable to find unit tests, no 'unitTests' dir")
21
+        }
22
+    }
23
+    require("RUnit", quietly=TRUE) || stop("RUnit package not found")
24
+    RUnit_opts <- getOption("RUnit", list())
25
+    RUnit_opts$verbose <- 0L
26
+    RUnit_opts$silent <- TRUE
27
+    RUnit_opts$verbose_fail_msg <- TRUE
28
+    options(RUnit = RUnit_opts)
29
+    suite <- defineTestSuite(name="gmapR RUnit Tests", dirs=dir,
30
+                             testFileRegexp=pattern,
31
+                             rngKind="default",
32
+                             rngNormalKind="default")
33
+    result <- runTestSuite(suite)
34
+    cat("\n\n")
35
+    printTextProtocol(result, showDetails=FALSE)
36
+    if (length(details <- .failure_details(result)) >0) {
37
+        cat("\nTest files with failing tests\n")
38
+        for (i in seq_along(details)) {
39
+            cat("\n  ", basename(names(details)[[i]]), "\n")
40
+            for (j in seq_along(details[[i]])) {
41
+                cat("    ", details[[i]][[j]], "\n")
42
+            }
43
+        }
44
+        cat("\n\n")
45
+        stop("unit tests failed for package gmapR")
46
+    }
47
+    result
48
+}