/trunk/Examples/test-suite/r/unittest.R

# · R · 17 lines · 16 code · 1 blank · 0 comment · 4 complexity · 6ef588ea07bd9118136d3fbabe80d4fd MD5 · raw file

  1. unittest <- function (x,y) {
  2. if (x==y) {
  3. print("PASS")
  4. } else {
  5. print("FAIL")
  6. stop("Test failed")
  7. }
  8. }
  9. unittesttol <- function(x,y,z) {
  10. if (abs(x-y) < z) {
  11. print("PASS")
  12. } else {
  13. print("FAIL")
  14. stop("Test failed")
  15. }
  16. }