Commit | Line | Data |
---|---|---|
1 | # Functions to assert that conditions are true or false in R unit tests | |
2 | ||
3 | RunitTestsMethods = ' | |
4 | # Functions to assert that a condition is true or false [to be extended] | |
5 | assertTrue = function(condition, message, context="") { | |
6 | if (!condition) { | |
7 | cat("Failure: ", message, sep=\'\') | |
8 | if (context != "") cat(" [",context,"]") | |
9 | cat("\\n") | |
10 | } | |
11 | } | |
12 | ||
13 | assertFalse = function(condition, message, context="") { | |
14 | assertTrue(!condition, message, context) | |
15 | } | |
16 | ' |