basic future tests
[scpubgit/TenDotTcl.git] / ten / test.tcl
index c577494..3159c6e 100644 (file)
@@ -14,10 +14,26 @@ namespace eval ::ten::test:: {
     puts stdout "not ok $test_count $reason"
   }
 
+  proc ok {cond reason} {
+    if $cond {
+      pass $reason
+    } else {
+      fail "$reason: $cond false"
+    }
+  }
+
+  proc cmp_ok {op left right reason} {
+    if [expr $left $op $right] {
+      pass $reason
+    } else {
+      fail "$reason: $left $op $right false"
+    }
+  }
+
   proc is {left right reason} {
     switch $left \
       $right { pass $reason } \
-      default { fail "$reason: expected $left, got $right" }
+      default { fail "$reason: expected $right, got $left" }
   }
 
   proc done_testing {} {
@@ -25,7 +41,7 @@ namespace eval ::ten::test:: {
     puts stdout "1..$test_count"
   }
 
-  namespace export pass fail is done_testing
+  namespace export pass fail is ok cmp_ok done_testing
 }
 
 package provide ten::test 0.0.1