From d75e9410c3c59a8cf02e60523bc907da8e820074 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Fri, 6 Jun 2008 19:07:04 +0000 Subject: [PATCH] adding tests for ntz git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@664083 13f79535-47bb-0310-9956-ffa450edef68 --- src/test/org/apache/solr/util/TestUtils.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/org/apache/solr/util/TestUtils.java b/src/test/org/apache/solr/util/TestUtils.java index 79e66e623df..2d75527a5ae 100755 --- a/src/test/org/apache/solr/util/TestUtils.java +++ b/src/test/org/apache/solr/util/TestUtils.java @@ -122,4 +122,23 @@ public class TestUtils extends TestCase { assertEquals( num, NumberUtils.SortableStr2long(sortable, 0, sortable.length() ) ); 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) ); + } }