Browse Source

add aeq to unit tests

Simon Krajewski 10 years ago
parent
commit
7ef4e4d4d1
1 changed files with 14 additions and 0 deletions
  1. 14 0
      tests/unit/src/unit/Test.hx

+ 14 - 0
tests/unit/src/unit/Test.hx

@@ -35,6 +35,20 @@ class Test #if swf_mark implements mt.Protect #end {
 		}
 		}
 	}
 	}
 
 
+	function aeq<T>(expected:Array<T>, actual:Array<T>, ?pos:haxe.PosInfos) {
+		if (expected.length != actual.length) {
+			report('Array length differs (${actual.length} should be ${expected.length})', pos);
+			success = false;
+		} else {
+			for (i in 0...expected.length) {
+				if (expected[i] != actual[i]) {
+					report('[${i}] ${actual[i]} should be ${expected[i]}', pos);
+					success = false;
+				}
+			}
+		}
+	}
+
 	function t( v, ?pos ) {
 	function t( v, ?pos ) {
 		eq(v,true,pos);
 		eq(v,true,pos);
 	}
 	}