adding tests for ntz

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@664083 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2008-06-06 19:07:04 +00:00
parent 16c6d850c5
commit d75e9410c3
1 changed files with 19 additions and 0 deletions

View File

@ -122,4 +122,23 @@ public class TestUtils extends TestCase {
assertEquals( num, NumberUtils.SortableStr2long(sortable, 0, sortable.length() ) ); assertEquals( num, NumberUtils.SortableStr2long(sortable, 0, sortable.length() ) );
assertEquals( Long.toString(num), NumberUtils.SortableStr2long(sortable) ); assertEquals( Long.toString(num), NumberUtils.SortableStr2long(sortable) );
} }
public void testBitUtils()
{
long num = 100000;
assertEquals( 5, BitUtil.ntz(num) );
assertEquals( 5, BitUtil.ntz2(num) );
assertEquals( 5, BitUtil.ntz3(num) );
num = 10;
assertEquals( 1, BitUtil.ntz(num) );
assertEquals( 1, BitUtil.ntz2(num) );
assertEquals( 1, BitUtil.ntz3(num) );
num = 234;
//????? why 1?
// assertEquals( 0, BitUtil.ntz(num) );
// assertEquals( 0, BitUtil.ntz2(num) );
// assertEquals( 0, BitUtil.ntz3(num) );
}
} }