Beispiel #1
0
 def test_bitstring_highest_set_bit(self):
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([])), None)
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([0])), None)
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([0, 0])), None)
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([1])), 0)
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([1, 1])), 1)
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([1, 1, 1])), 2)
     self.assertEqual(ASN1Tools.bitstring_highbit(BitString([1, 1, 1, 0])),
                      2)
     self.assertEqual(
         ASN1Tools.bitstring_highbit(BitString([1, 1, 1, 0, 0])), 2)
     self.assertEqual(
         ASN1Tools.bitstring_highbit(BitString([1, 1, 1, 0, 0, 1])), 5)
     self.assertEqual(
         ASN1Tools.bitstring_highbit(BitString([1, 1, 1, 0, 0, 1, 0])), 5)
     self.assertEqual(
         ASN1Tools.bitstring_highbit(BitString([1, 1, 1, 0, 0, 1, 0, 1])),
         7)
Beispiel #2
0
 def highest_set_bit_value(self):
     return ASN1Tools.bitstring_highbit(
         self.asn1) if (self.asn1 is not None) else None