Esempio n. 1
0
 def test_set_static(self):
     for size in sizes:
         bs = bigstruct.BigStruct([(i + 1, i + 1, i + 1) for i in range(size)])
         for i in range(size):
             bs.set_static(i + 1, i + 100)
         for i in range(size):
             self.assertEqual(bs[i + 1], i + 100)
Esempio n. 2
0
 def test_set_static(self):
     bs = bigstruct.BigStruct([(i + 1, str(i + 1), i + 1)
                               for i in range(101)])
     for i in range(101):
         bs.set_static(str(i + 1), i + 100)
     for i in range(101):
         self.assertEqual(bs[str(i + 1)], i + 100)
Esempio n. 3
0
 def test_get(self):
     for size in sizes:
         bs = bigstruct.BigStruct([(i + 1, i + 1, i + 1) for i in range(size)])
         vm = VM()
         bs.initialize(vm)
         for i in range(size):
             vm.dup0()
             bs.get(i + 1, vm)
             self.assertEqual(vm.stack[0], i + 1)
             vm.pop()
Esempio n. 4
0
 def test_get(self):
     bs = bigstruct.BigStruct([(i + 1, str(i + 1), i + 1)
                               for i in range(101)])
     vm = VM()
     bs.initialize(vm)
     for i in range(101):
         vm.dup0()
         bs.get(str(i + 1), vm)
         self.assertEqual(vm.stack[0], i + 1)
         vm.pop()
Esempio n. 5
0
 def test_getset(self):
     vm = VM()
     bs = bigstruct.BigStruct([(i + 1, i + 1, i + 1) for i in range(101)])
     bs.initialize(vm)
     vm.dup0()
     bs.get(13, vm)
     self.assertEqual(vm.stack[0], 13)
     vm.pop()
     vm.push(666)
     vm.swap1()
     bs.set_val(25, vm)
     vm.pop()
Esempio n. 6
0
 def test_single(self):
     bigstruct.BigStruct([(1, 1, 1)])
Esempio n. 7
0
 def test_contains(self):
     bs = bigstruct.BigStruct([(i + 1, i + 1, i + 1) for i in range(101)])
     self.assertTrue(50 in bs)
     self.assertFalse(105 in bs)