summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sources/scala/UnitTest.scala42
1 files changed, 42 insertions, 0 deletions
diff --git a/sources/scala/UnitTest.scala b/sources/scala/UnitTest.scala
new file mode 100644
index 0000000000..e5cefb94df
--- /dev/null
+++ b/sources/scala/UnitTest.scala
@@ -0,0 +1,42 @@
+package scala ;
+
+object UnitTest {
+
+ def test[b,a]( doit:b => a,
+ input: b,
+ expectedResult:a ):Unit = {
+
+ if( doit(input) == expectedResult )
+ {
+ System.out.println("passed ok")
+ }
+ else
+ {
+ System.out.print("failed! we got");
+ System.out.print( "\""+doit(input).toString()+"\"" );
+ System.out.println(" but expected "+expectedResult)
+ }
+
+ } // testAlg
+
+ def test2[c,b,a]( doit:(c,b) => a,
+ in1: c,
+ in2: b,
+ expectedResult:a ):Unit = {
+
+ if( doit(in1,in2) == expectedResult )
+ {
+ System.out.println("passed ok")
+ }
+ else
+ {
+ System.out.print("failed! we got");
+ System.out.print( "\""+doit(in1,in2).toString()+"\"" );
+ System.out.println(" but expected "+expectedResult)
+ }
+
+ } // testAlg
+
+} // unitTest
+
+