def test_sendMessage_length2(self): bbMock = BbMock() nrf = nerf.Nerf([1, 2, 3, 4, 5], CLK_PIN, MISO_PIN, MOSI_PIN, ENABLE_PIN, bbMock) nrf.sendMessage([5, 4, 3, 2, 1], [0x55, 0x69]) self.assertEqual([0x02, 5, 4, 3, 2, 1, 0x01, 2, 0x55, 0x69, 0], bbMock.bytesFromMaster)
def test_receiveMessage_length1(self): bbMock = BbMock() nrf = nerf.Nerf([1, 2, 3, 4, 5], CLK_PIN, MISO_PIN, MOSI_PIN, ENABLE_PIN, bbMock) bbMock.bytesToMaster = [0x01, 1, 0x99] received = nrf.receiveMessage() self.assertEquals(([1, 2, 3, 4, 5], [0x99]), received.toComparable()) self.assertEquals([0x04, 0x03, 0], bbMock.bytesFromMaster)
def test_receiveMessage_noneWaiting(self): bbMock = BbMock() nrf = nerf.Nerf([1, 2, 3, 4, 5], CLK_PIN, MISO_PIN, MOSI_PIN, ENABLE_PIN, bbMock) bbMock.bytesToMaster = [0x00] received = nrf.receiveMessage() self.assertEquals(None, received) self.assertEquals([0x04, 0], bbMock.bytesFromMaster)