Browse Source

Add some modulo tests

Hugh Sanderson 13 years ago
parent
commit
6056166ec3
1 changed files with 10 additions and 0 deletions
  1. 10 0
      tests/unit/TestOps.hx

+ 10 - 0
tests/unit/TestOps.hx

@@ -52,6 +52,16 @@ class TestOps extends Test {
 		eq( 10 % 3 * 5, 5);
 		eq( (10 % 3) * 5, 5);
 		eq( 10 % (3 * 5), 10);
+		eq( 100 % 100, 0);
+		eq( -100 % 100, 0);
+		eq( 101.5 % 100, 1.5);
+		eq( -101.5 % 100, -1.5);
+		var x = 101.5;
+		x %= 100;
+		eq( x, 1.5);
+		var x:Dynamic = [-101.5];
+		x[0] %= 100;
+		eq( x[0], -1.5);
 
 		eq( true ? 1 : 6 * 5, 1);
 		eq( false ? 1 : 6 * 5, 30);