@@ -21,12 +21,18 @@ def test_linear_arrays_1(self):
2121
2222 libdestruct = inflater (d .memory )
2323
24- assert bp .hit_on (d )
24+ self . assertTrue ( bp .hit_on (d ) )
2525
2626 test1 = libdestruct .inflate (array_of (c_int , 10 ), d .regs .rdi )
2727
28+ self .assertEqual (len (test1 ), 10 )
29+
2830 for i in range (10 ):
29- assert test1 [i ].value == i ** 2
31+ self .assertEqual (test1 [i ].value , i ** 2 )
32+
33+ self .assertEqual (bytes (test1 ), b"" .join ((i ** 2 ).to_bytes (4 , "little" ) for i in range (10 )))
34+
35+ self .assertIn (test1 [0 ], test1 )
3036
3137 d .cont ()
3238
@@ -36,7 +42,7 @@ class test2_t(struct):
3642 test2 = libdestruct .inflate (array_of (test2_t , 10 ), d .regs .rdi )
3743
3844 for i in range (10 ):
39- assert test2 [i ].a .value == i ** 3
45+ self . assertEqual ( test2 [i ].a .value , i ** 3 )
4046
4147 d .cont ()
4248
@@ -47,8 +53,8 @@ class test3_t(struct):
4753 test3 = libdestruct .inflate (array_of (test3_t , 10 ), d .regs .rdi )
4854
4955 for i in range (10 ):
50- assert test3 [i ].a .value == i * 100
51- assert test3 [i ].b .value == i * 1000
56+ self . assertEqual ( test3 [i ].a .value , i * 100 )
57+ self . assertEqual ( test3 [i ].b .value , i * 1000 )
5258
5359 d .cont ()
5460
@@ -59,9 +65,18 @@ class test4_t(struct):
5965 test4 = libdestruct .inflate (array_of (test4_t , 10 ), d .regs .rdi )
6066
6167 for i in range (10 ):
62- assert test4 [i ].a .value == i ** 4
68+ self . assertEqual ( test4 [i ].a .value , i ** 4 )
6369 for j in range (10 ):
64- assert test4 [i ].b [j ].value == (i + 1 ) * j
70+ self .assertEqual (test4 [i ].b [j ].value , (i + 1 ) * j )
71+
72+ with self .assertRaises (NotImplementedError ):
73+ test4 [i ] = 4
74+
75+ with self .assertRaises (NotImplementedError ):
76+ test4 ._set ([1 , 2 , 3 ])
77+
78+ with self .assertRaises (NotImplementedError ):
79+ test4 .set ([1 , 2 , 3 ])
6580
6681 d .kill ()
67- d .terminate ()
82+ d .terminate ()
0 commit comments