Esempio n. 1
0
    def test_003_normal_passa(self):

        self.dut = pdu_utils.pdu_range_filter(pmt.intern("start_time"), 1, 5,
                                              False)
        self.connectUp()

        in_data = [0, 0, 0, 0, 0, 0]
        i_meta = pmt.dict_add(pmt.make_dict(), pmt.intern("start_time"),
                              pmt.from_double(1.0))
        in_pdu = pmt.cons(i_meta, pmt.init_u8vector(len(in_data), in_data))
        expected_data = [0, 0, 0, 0, 0, 0]
        e_meta = pmt.dict_add(pmt.make_dict(), pmt.intern("start_time"),
                              pmt.from_double(1.0))
        expected_pdu = pmt.cons(
            e_meta, pmt.init_u8vector(len(expected_data), expected_data))

        self.tb.start()
        time.sleep(.001)
        self.emitter.emit(in_pdu)
        time.sleep(.01)
        self.tb.stop()
        self.tb.wait()

        self.assertEqual(1, self.debug.num_messages())
        self.assertTrue(pmt.equal(self.debug.get_message(0), expected_pdu))
Esempio n. 2
0
    def test_001_no_meta(self):

        self.dut = pdu_utils.pdu_range_filter(pmt.intern("start_time"), 1, 5,
                                              False)
        self.connectUp()

        in_data = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
        in_pdu = pmt.cons(pmt.make_dict(),
                          pmt.init_u8vector(len(in_data), in_data))

        self.tb.start()
        time.sleep(.001)
        self.emitter.emit(in_pdu)
        time.sleep(.01)
        self.tb.stop()
        self.tb.wait()

        self.assertEqual(0, self.debug.num_messages())