Esempio n. 1
0
 def test_bit_count(self):
   self.assertEqual(builtins.integer_bit_count(0), 0)
   self.assertEqual(builtins.integer_bit_count(1), 1)
   self.assertEqual(builtins.integer_bit_count(255), 8)
   self.assertEqual(builtins.integer_bit_count(2), 1)
   self.assertEqual(builtins.integer_bit_count(3), 2)
   self.assertEqual(builtins.integer_bit_count(5), 2)
   self.assertEqual(builtins.integer_bit_count(1 << 128), 1)
   self.assertEqual(builtins.integer_bit_count((1 << 129) - 1), 129)
   self.assertEqual(builtins.integer_bit_count(1 << 1024), 1)
   self.assertEqual(builtins.integer_bit_count((1 << 1024) - 1), 1024)
Esempio n. 2
0
 def test_bit_count(self):
   self.assertEqual(integer_bit_count(0), 0)
   self.assertEqual(integer_bit_count(1), 1)
   self.assertEqual(integer_bit_count(255), 8)
   self.assertEqual(integer_bit_count(2), 1)
   self.assertEqual(integer_bit_count(3), 2)
   self.assertEqual(integer_bit_count(5), 2)
   self.assertEqual(integer_bit_count(1 << 128), 1)
   self.assertEqual(integer_bit_count((1 << 129) - 1), 129)
   self.assertEqual(integer_bit_count(1 << 1024), 1)
   self.assertEqual(integer_bit_count((1 << 1024) - 1), 1024)
Esempio n. 3
0
 def test_negative_checks_against_abs(self):
   self.assertEqual(builtins.integer_bit_count(-1), 1)
   self.assertEqual(builtins.integer_bit_count(-255), 8)
Esempio n. 4
0
 def test_negative_checks_against_abs(self):
   self.assertEqual(integer_bit_count(-1), 1)
   self.assertEqual(integer_bit_count(-255), 8)