def test_LNavMessage_updateParity0(): ''' GPS LNav: parity of empty message ''' msg = LNavMessage(1, tow0=0, n_msg=0, n_prefixBits=0) bits = msg.getBits(0b00000000000000000000000000000000, 32) msg.updateParity(bits, False) assert (bits == 0).all()
def test_LNavMessage_updateParity_D22D23p2(): ''' GPS LNav: parity of message with D22/D23 patch ''' msg = LNavMessage(1, tow0=0, n_msg=0, n_prefixBits=0) bits = msg.getBits(0b10101010101010101010101110101010, 32) bits2 = msg.getBits(0b10101010101010101010101101101000, 32) msg.updateParity(bits, True) assert (bits == bits2).all()
def test_LNavMessage_updateParity2(): ''' GPS LNav: D29' contribution ''' msg = LNavMessage(1, tow0=0, n_msg=0, n_prefixBits=0) bits = msg.getBits(0b10000000000000000000000000000000, 32) bits2 = msg.getBits(0b10000000000000000000000000101001, 32) msg.updateParity(bits, False) assert (bits == bits2).all()
def test_LNavMessage_updateParity1(): ''' GPS LNav: inversion of parity ''' msg = LNavMessage(1, tow0=0, n_msg=0, n_prefixBits=0) bits = msg.getBits(0b01000000000000000000000000000000, 32) bits2 = msg.getBits(0b01111111111111111111111111010101, 32) msg.updateParity(bits, False) assert (bits == bits2).all()
def test_LNavMessage_updateParity_d8(): ''' GPS LNav: parity of D8 bit ''' msg = LNavMessage(1, tow0=0, n_msg=0, n_prefixBits=0) bits = msg.getBits(0b0000000000000000000000100000000, 32) bits2 = msg.getBits(0b0000000000000000000000100000011, 32) msg.updateParity(bits, False) assert (bits == bits2).all()
def test_LNavMessage_getDataBits0(): ''' GPS LNav message: fetch data bits ''' dataAll_idx = numpy.linspace(0, 299, 300, dtype=numpy.long) msg = LNavMessage(1, tow0=1, n_msg=1, n_prefixBits=30) bits = msg.getDataBits(dataAll_idx) assert isinstance(bits, numpy.ndarray) assert bits.shape == (300, ) assert (bits == msg.messageBits[:300]).all()
def test_LNavMessage_getDataBits0(): ''' GPS LNav message: fetch data bits ''' dataAll_idx = numpy.linspace(0, 299, 300, dtype=numpy.long) msg = LNavMessage(1, tow0=1, n_msg=1, n_prefixBits=30) bits = msg.getDataBits(dataAll_idx) assert isinstance(bits, numpy.ndarray) assert bits.shape == (300,) assert (bits == msg.messageBits[:300]).all()