@@ -81,48 +81,6 @@ public void byteArrayToInt_tests() {
8181 assertEquals (0x7f7f7f7f , OptOutUtils .toInt (new byte []{0x7f , 0x7f , 0x7f , 0x7f }, 0 ));
8282 }
8383
84- @ Test
85- public void compareBytes_tests () {
86- for (int i = 0 ; i < 1000 ; ++i ) {
87- long a = OptOutUtils .rand .nextLong ();
88- long b = OptOutUtils .rand .nextLong ();
89- int cmp1 = Long .compareUnsigned (a , b );
90- // System.out.format("a vs b: %x vs %x (cmp %d)\n", a, b, cmp1);
91- byte [] x = OptOutUtils .toByteArray (a );
92- byte [] y = OptOutUtils .toByteArray (b );
93- int cmp2 = OptOutUtils .compareBytes (x , y );
94- if (cmp1 == 0 ) {
95- assertTrue (cmp2 == 0 );
96- } else if (cmp1 > 0 ) {
97- // little endian doesn't guarantee byte array comparison yields the same consistent result
98- // assertTrue(cmp2 > 0);
99- } else /* cmp1 < 0 */ {
100- // little endian doesn't guarantee byte array comparison yields the same consistent result
101- // assertTrue(cmp2 < 0);
102- }
103- }
104- }
105-
106- @ Test
107- public void compareBytesBE_tests () {
108- for (int i = 0 ; i < 1000 ; ++i ) {
109- long a = OptOutUtils .rand .nextLong ();
110- long b = OptOutUtils .rand .nextLong ();
111- int cmp1 = Long .compareUnsigned (a , b );
112- // System.out.format("a vs b: %x vs %x (cmp %d)\n", a, b, cmp1);
113- byte [] x = OptOutUtils .toByteArrayBE (a );
114- byte [] y = OptOutUtils .toByteArrayBE (b );
115- int cmp2 = OptOutUtils .compareBytes (x , y );
116- if (cmp1 == 0 ) {
117- assertTrue (cmp2 == 0 );
118- } else if (cmp1 > 0 ) {
119- assertTrue (cmp2 > 0 );
120- } else /* cmp1 < 0 */ {
121- assertTrue (cmp2 < 0 );
122- }
123- }
124- }
125-
12684 @ Test
12785 public void nullHash_tests () {
12886 assertTrue (OptOutUtils .isValidSha256Hex (OptOutUtils .nullHash ));
0 commit comments