[go: up one dir, main page]

File: Rcpp-unitTests.Rnw

package info (click to toggle)
rcpp 0.11.3-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,948 kB
  • ctags: 16,427
  • sloc: ansic: 42,692; cpp: 34,078; makefile: 32; sh: 21
file content (76 lines) | stat: -rw-r--r-- 2,490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
\documentclass[10pt]{article}
%\VignetteIndexEntry{Rcpp-unitTests}
%\VignetteKeywords{R,Rcpp,unit tests}
%\VignetteDepends{Rcpp}

\usepackage{vmargin}
\setmargrb{0.75in}{0.75in}{0.75in}{0.75in}

\usepackage{microtype}                     %% cf http://www.khirevich.com/latex/microtype/
\usepackage[T1]{fontenc}		   %% cf http://www.khirevich.com/latex/font/
\usepackage[bitstream-charter]{mathdesign} %% cf http://www.khirevich.com/latex/font/

<<echo=FALSE,print=FALSE>>=
require(Rcpp)
prettyVersion <- packageDescription("Rcpp")$Version
prettyDate <- format(Sys.Date(), "%B %e, %Y")
library(RUnit)
@

\usepackage[colorlinks]{hyperref}
\author{Dirk Eddelbuettel \and Romain Fran\c{c}ois}
\title{\textbf{Rcpp}: Unit testing results}
\date{Rcpp version \Sexpr{prettyVersion} as of \Sexpr{prettyDate}}

\begin{document}
\maketitle

\section*{Test Execution}

<<unitTesting,echo=FALSE,print=FALSE>>=
pkg <- "Rcpp"

if( Sys.getenv( "TRAVIS" ) == "true" ){
  writeLines( "not running any tests as part of checking the vignette when doing continuous integration with travis" )
} else {  
  
  ## Check the environemnt variable to see if all tests should be run
  if (Sys.getenv("RunAllRcppTests") != "yes") {
      writeLines("The environment variable 'RunAllRcppTests' was not set to 'yes', so skipping some tests.")
  }
  
  if (file.exists("unitTests-results")) unlink("unitTests-results", recursive = TRUE)
  dir.create("unitTests-results")
  path <- system.file("unitTests", package=pkg)
  testSuite <- defineTestSuite(name=paste(pkg, "unit testing"), dirs=path)
  tests <- runTestSuite(testSuite)
  err <- getErrors(tests)
  if (err$nFail > 0) stop(sprintf("unit test problems: %d failures", err$nFail))
  if (err$nErr > 0) stop( sprintf("unit test problems: %d errors", err$nErr))
  printHTMLProtocol(tests, fileName=sprintf("unitTests-results/%s-unitTests.html", pkg))
  printTextProtocol(tests, fileName=sprintf("unitTests-results/%s-unitTests.txt" , pkg))
  
  #if (file.exists("/tmp")) {
  #    invisible(sapply(c("txt", "html"), function(ext) {
  #        fname <- sprintf("unitTests-results/%s-unitTests.%s", pkg, ext)
  #        file.copy(fname, "/tmp", overwrite=TRUE)
  #    }))
  #}
}
@

\section*{Test Results}

\begin{verbatim}
<<importResults,echo=FALSE,results=tex>>=
results <- "unitTests-results/Rcpp-unitTests.txt"
if (file.exists(results)) {
    writeLines(readLines(results))
} else{
    writeLines("Unit test results not available")
}
@

\end{verbatim}

\end{document}