Example #1
0
 def test_array_append(self):
     s = FloatArray([1, 2, 3])
     s.append(4)
     s.append(10)
     self.assertEqual(s.byte_length(), 20)
     self.assertListEqual(s.values(), [1, 2, 3, 4, 10])
     s.free()
Example #2
0
 def test_array_append(self):
     s = FloatArray([1, 2, 3])
     s.append(4)
     s.append(10)
     self.assertEqual(s.byte_length(), 20)
     self.assertListEqual(s.values(), [1, 2, 3, 4, 10])
     s.free()
Example #3
0
 def test_use_array_after_free_error(self):
     s = FloatArray()
     s.free()
     with self.assertRaises(GaugedUseAfterFreeError):
         len(s)
     with self.assertRaises(GaugedUseAfterFreeError):
         s.values()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.values()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.append(1)
     with self.assertRaises(GaugedUseAfterFreeError):
         s.byte_length()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.buffer()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.clear()
Example #4
0
 def test_use_array_after_free_error(self):
     s = FloatArray()
     s.free()
     with self.assertRaises(GaugedUseAfterFreeError):
         len(s)
     with self.assertRaises(GaugedUseAfterFreeError):
         s.values()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.values()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.append(1)
     with self.assertRaises(GaugedUseAfterFreeError):
         s.byte_length()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.buffer()
     with self.assertRaises(GaugedUseAfterFreeError):
         s.clear()
Example #5
0
 def test_array_clear(self):
     s = FloatArray([1, 2, 3])
     self.assertEqual(s.byte_length(), 12)
     s.clear()
     self.assertEqual(s.byte_length(), 0)
     s.free()
Example #6
0
 def test_array_instantiation_from_list(self):
     s = FloatArray([1, 2, 3])
     self.assertEqual(s.byte_length(), 12)
     self.assertEqual(len(s), 3)
     self.assertListEqual(s.values(), [1, 2, 3])
     s.free()
Example #7
0
 def test_array_empty_array(self):
     s = FloatArray()
     self.assertEqual(s.byte_length(), 0)
     self.assertEqual(len(s), 0)
     self.assertListEqual(s.values(), [])
     s.free()
Example #8
0
 def test_array_clear(self):
     s = FloatArray([1, 2, 3])
     self.assertEqual(s.byte_length(), 12)
     s.clear()
     self.assertEqual(s.byte_length(), 0)
     s.free()
Example #9
0
 def test_array_instantiation_from_list(self):
     s = FloatArray([1, 2, 3])
     self.assertEqual(s.byte_length(), 12)
     self.assertEqual(len(s), 3)
     self.assertListEqual(s.values(), [1, 2, 3])
     s.free()
Example #10
0
 def test_array_empty_array(self):
     s = FloatArray()
     self.assertEqual(s.byte_length(), 0)
     self.assertEqual(len(s), 0)
     self.assertListEqual(s.values(), [])
     s.free()