Browse Source

weaken Reflect.compare specification to admit negative/positive values instead of -1/1 so Caue has less stuff to fix

Simon Krajewski 12 years ago
parent
commit
daf2556ac9
2 changed files with 7 additions and 7 deletions
  1. 3 3
      std/Reflect.hx
  2. 4 4
      tests/unit/unitstd/Reflect.unit.hx

+ 3 - 3
std/Reflect.hx

@@ -105,8 +105,8 @@ extern class Reflect {
 	/**
 		Compares [a] and [b].
 		
-		If [a] is less than [b], the result is -1. If [b] is less than [a], the
-		result is 1. If [a] and [b] are equal, the result is 0.
+		If [a] is less than [b], the result is negative. If [b] is less than
+		[a], the result is positive. If [a] and [b] are equal, the result is 0.
 		
 		This function is only defined if [a] and [b] are of the same type.
 		
@@ -114,7 +114,7 @@ extern class Reflect {
 		[Type.compareMethods()] should be used instead.
 		
 		For all other types, the result is 0 if [a] and [b] are equal. If they
-		are not equal, the result depends on the type and is -1 if:
+		are not equal, the result depends on the type and is negative if:
 			Numeric types: a is less than b
 			String: a is lexicographically less than b
 			Other: unspecified

+ 4 - 4
tests/unit/unitstd/Reflect.unit.hx

@@ -82,12 +82,12 @@ Reflect.field(y, "b") == null;
 Reflect.field(y, "c") == null;
 
 //compare
-Reflect.compare(1,2) == -1;
-Reflect.compare(2,1) == 1;
+Reflect.compare(1,2) < 0;
+Reflect.compare(2,1) > 1;
 Reflect.compare(1,1) == 0;
-Reflect.compare("abcd","e") == -1;
+Reflect.compare("abcd","e") < -1;
 Reflect.compare("abcd","abcd") == 0;
-Reflect.compare("e","abcd") == 1;
+Reflect.compare("e","abcd") > 1;
 Reflect.compare(null,null) == 0;
 Reflect.compare("abcd",null) != 0;
 Reflect.compare(null, "abcd") != 0;