Exemplo n.º 1
0
 def test_sign_convert_array_value(self):
   t = ArrayType(BitsType(signed=True, size=8), 3)
   self.assertEqual(
       sample_runner.sign_convert_value(
           t,
           Value.make_array((Value.make_ubits(8,
                                              0x42), Value.make_ubits(8, 0x43),
                             Value.make_ubits(8, 0x44)))),
       Value.make_array((Value.make_sbits(8, 0x42), Value.make_sbits(8, 0x43),
                         Value.make_sbits(8, 0x44))))
Exemplo n.º 2
0
 def test_sign_convert_tuple_value(self):
   # type is (u8, (u16, s8)
   t = TupleType(
       (BitsType(signed=False, size=8),
        TupleType(
            (BitsType(signed=False, size=16), BitsType(signed=True, size=8)))))
   self.assertEqual(
       sample_runner.sign_convert_value(
           t,
           Value.make_tuple((Value.make_ubits(8, 0x42),
                             Value.make_tuple((Value.make_ubits(16, 0x33),
                                               Value.make_ubits(8, 0x44)))))),
       Value.make_tuple(
           (Value.make_ubits(8, 0x42),
            Value.make_tuple(
                (Value.make_ubits(16, 0x33), Value.make_sbits(8, 0x44))))))