directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wesmck...@apache.org
Subject svn commit: rev 6345 - incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test
Date Wed, 28 Jan 2004 23:13:06 GMT
Author: wesmckean
Date: Wed Jan 28 15:13:05 2004
New Revision: 6345

Modified:
   incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java
Log:
Changed to use BitSet

Modified: incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java
==============================================================================
--- incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java
(original)
+++ incubator/directory/snickers/trunk/ber/src/java/org/apache/snickers/test/TestBitString.java
Wed Jan 28 15:13:05 2004
@@ -50,6 +50,7 @@
 
 package org.apache.snickers.test;
 
+import java.util.BitSet;
 import junit.framework.TestCase;
 import org.apache.commons.codec.binary.Binary;
 import org.apache.snickers.asn.BitString;
@@ -62,13 +63,13 @@
 public class TestBitString extends TestCase {
 
     String binary[] = {
-        "00000001",
-        "00000010",
-        "00000100",
-        "00001000",
-        "00010000",
-        "00100000",
-        "01000000",
+        "1",
+        "10",
+        "100",
+        "1000",
+        "10000",
+        "100000",
+        "1000000",
         "10000000"
     };
     
@@ -100,7 +101,9 @@
             int[] tmp = new int[1];
             tmp[0] = vals[i];
             BitString bs = new BitString( tmp,8 );
-            
+            BitSet bset = bs;
+            // System.out.println( "\n" + bs.toString());
+            // System.out.println( bset.toString() );
             assertTrue( "testSimpleBinary:" + binary[i], bs.toString().equals(binary[i]));
         }
     }
@@ -118,7 +121,9 @@
         tmp[0] = (( Binary.BIT_7 | Binary.BIT_3 ) << 8 ) | (Binary.BIT_1 | Binary.BIT_2
| Binary.BIT_3 );
         
         BitString bs = new BitString( tmp, 16 ); 
+        BitSet bset = bs;
         //System.out.println( "\n" + bs.toString() );
+        //System.out.println( bset.toString() );
         assertTrue( "testComplicated:1", bs.toString().equals("1000100000001110") );
         
         // Lets do a 24 bit bit string. 
@@ -126,6 +131,8 @@
                     (Binary.BIT_6 | Binary.BIT_0);
         bs = new BitString( tmp, 24 ); 
         //System.out.println( "\n" + bs.toString() );
+        bset = bs;
+        //System.out.println( bset.toString() );
         assertTrue( "testComplicated:2", bs.toString().equals("100010000000111001000001")
);
         
         // Lets do a 32 bit string
@@ -133,6 +140,8 @@
                     ((Binary.BIT_6 | Binary.BIT_0) << 8 ) | (Binary.BIT_5 | Binary.BIT_0
| Binary.BIT_1 | Binary.BIT_3 );
         bs = new BitString( tmp, 32 );
         //System.out.println( "\n" + bs.toString() );
+        bset = bs; 
+        //System.out.println( bset );
         assertTrue( "testComplicated:3", bs.toString().equals("10001000000011100100000100101011")
);
         
         // Now for the real test.  2 ints (64 bit strings)
@@ -224,7 +233,7 @@
         //     ----------------
         //     0000100000101000        
         
-        assertTrue( "testXor", delta.toString().equals("0000100000101000"));
+        assertTrue( "testXor", delta.toString().equals("100000101000"));
     }
     
 	public static void main(String[] args) {

Mime
View raw message