As BytesRef has now native order use them in numeric tests. The contents are raw byte[] and no strings, it should compare native

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@966633 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-07-22 13:02:20 +00:00
parent 06a753ff72
commit 55b373f5ed
1 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class TestNumericUtils extends LuceneTestCase {
NumericUtils.longToPrefixCoded(l, 0, act); NumericUtils.longToPrefixCoded(l, 0, act);
if (last!=null) { if (last!=null) {
// test if smaller // test if smaller
assertTrue("actual bigger than last (BytesRef)", BytesRef.getUTF8SortedAsUnicodeComparator().compare(last, act) < 0 ); assertTrue("actual bigger than last (BytesRef)", last.compareTo(act) < 0 );
assertTrue("actual bigger than last (as String)", last.utf8ToString().compareTo(act.utf8ToString()) < 0 ); assertTrue("actual bigger than last (as String)", last.utf8ToString().compareTo(act.utf8ToString()) < 0 );
} }
// test is back and forward conversion works // test is back and forward conversion works
@ -49,7 +49,7 @@ public class TestNumericUtils extends LuceneTestCase {
NumericUtils.intToPrefixCoded(i, 0, act); NumericUtils.intToPrefixCoded(i, 0, act);
if (last!=null) { if (last!=null) {
// test if smaller // test if smaller
assertTrue("actual bigger than last (BytesRef)", BytesRef.getUTF8SortedAsUnicodeComparator().compare(last, act) < 0 ); assertTrue("actual bigger than last (BytesRef)", last.compareTo(act) < 0 );
assertTrue("actual bigger than last (as String)", last.utf8ToString().compareTo(act.utf8ToString()) < 0 ); assertTrue("actual bigger than last (as String)", last.utf8ToString().compareTo(act.utf8ToString()) < 0 );
} }
// test is back and forward conversion works // test is back and forward conversion works
@ -85,7 +85,7 @@ public class TestNumericUtils extends LuceneTestCase {
// check sort order (prefixVals should be ascending) // check sort order (prefixVals should be ascending)
for (int i=1; i<prefixVals.length; i++) { for (int i=1; i<prefixVals.length; i++) {
assertTrue( "check sort order", BytesRef.getUTF8SortedAsUnicodeComparator().compare(prefixVals[i-1], prefixVals[i] ) < 0 ); assertTrue( "check sort order", prefixVals[i-1].compareTo(prefixVals[i]) < 0 );
} }
// check the prefix encoding, lower precision should have the difference to original value equal to the lower removed bits // check the prefix encoding, lower precision should have the difference to original value equal to the lower removed bits
@ -125,7 +125,7 @@ public class TestNumericUtils extends LuceneTestCase {
// check sort order (prefixVals should be ascending) // check sort order (prefixVals should be ascending)
for (int i=1; i<prefixVals.length; i++) { for (int i=1; i<prefixVals.length; i++) {
assertTrue( "check sort order", BytesRef.getUTF8SortedAsUnicodeComparator().compare(prefixVals[i-1], prefixVals[i] ) < 0 ); assertTrue( "check sort order", prefixVals[i-1].compareTo(prefixVals[i]) < 0 );
} }
// check the prefix encoding, lower precision should have the difference to original value equal to the lower removed bits // check the prefix encoding, lower precision should have the difference to original value equal to the lower removed bits