def test_getMSBCodeSet(self):
     testWord = bitstring.BitArray("0x000000FF0000000000")
     result = BitSlice.getMSBInternalIndications(testWord)
     assert result.uint == bitstring.BitArray("0xFF").uint ,  "slice is pulling the wrong bits ({}, {})".format(result.uint, bitstring.Bits("0xF").uint)  
 def test_AHsliceFinalFlag(self):
     testWord = bitstring.BitArray("0x4000000000000080")
     result = BitSlice.getFinalFlag(testWord)
     assert result.uint == bitstring.BitArray("0x1").uint,  "slice is pulling the wrong bits ({}, {})".format(result.uint, bitstring.BitArray("0x1").uint)   
 def test_AHgetFunctionCode(self):
     testWord = bitstring.BitArray("0x00FF000000000000")
     result = BitSlice.getFuncCode(testWord)
     assert result.uint == bitstring.BitArray("0xFF").uint ,  "slice is pulling the wrong bits ({}, {})".format(result.uint, bitstring.BitArray("0xFA").uint)   
 def test_AHsliceSequenceNum(self):
     testWord = bitstring.BitArray("0x0F0000000000000")
     result = BitSlice.getSequence(testWord)
     assert result.uint == bitstring.BitArray("0xF").uint ,  "slice is pulling the wrong bits ({}, {})".format(result.uint, bitstring.BitArray("0xF").uint)   
 def test_AHsliceConfirmationlag(self):
     testWord = bitstring.BitArray("0x20000000000000000")
     result = BitSlice.getConfirmationFlag(testWord)
     accepted = bitstring.BitArray("0x1")
     assert result.uint == accepted.uint,  "slice is pulling the wrong bits ({}, {})".format(result.uint, accepted.uint)   
 def test_sliceTestFail(self):
     testWord = bitstring.BitArray("0x00000000000F0000")
     testWord.reverse()
     result = BitSlice.slice(testWord, 0, 2)
     assert result.uint == bitstring.BitArray("0x0").uint , "slice somehow returned the correct result ({})".format(result)
Ejemplo n.º 7
0
 def test_sliceFirstFlag(self):
     testWord = bitstring.Bits("0x0000000000000040")
     result = BitSlice.getFirstFlag(testWord)
     assert result.int == bitstring.Bits("0x01").int ,  "slice is pulling the wrong bits ({}, {})".format(result.int, bitstring.Bits("0x01").int)   
Ejemplo n.º 8
0
 def test_sliceConsequtiveFlag(self):
     testWord = bitstring.Bits("0x0000000000000020")
     result = BitSlice.getConsequtiveFlag(testWord, )
     assert result.int == bitstring.Bits("0x01").int,  "slice is pulling the wrong bits ({}, {})".format(result.int, bitstring.Bits("0x01").int)   
Ejemplo n.º 9
0
 def test_sliceSequenceNum(self):
     testWord = bitstring.Bits("0x000000000000000E")
     result = BitSlice.getSequence(testWord)
     assert result.int == bitstring.Bits("0x07").int ,  "slice is pulling the wrong bits ({}, {})".format(result.int, bitstring.Bits("0x07").int)   
Ejemplo n.º 10
0
 def test_sliceTestPass(self):
     testWord = bitstring.Bits("0x0000000000FF0000")
     result = BitSlice.slice(testWord, 8, 16)
     assert result.int == bitstring.Bits("0x0FF").int , "slice is pulling the wrong bits ({}, {})".format(result.int, bitstring.Bits("0x0FF").int)