コード例 #1
0
ファイル: test_util.py プロジェクト: Hetal728/SMP-ClassiCube
 def testRemove(self):
     d = iter(util.IntervalDifferential([3, 5], 10))
     self.assertEquals(d.next(), (3, 0))
     self.assertEquals(d.next(), (2, 1))
     self.assertEquals(d.next(), (1, 0))
     d.removeInterval(3)
     self.assertEquals(d.next(), (4, 0))
     self.assertEquals(d.next(), (5, 0))
     d.removeInterval(5)
     self.assertEquals(d.next(), (10, None))
     self.assertRaises(ValueError, d.removeInterval, 10)
コード例 #2
0
ファイル: test_util.py プロジェクト: Hetal728/SMP-ClassiCube
 def testInsert(self):
     d = iter(util.IntervalDifferential([], 10))
     self.assertEquals(d.next(), (10, None))
     d.addInterval(3)
     self.assertEquals(d.next(), (3, 0))
     self.assertEquals(d.next(), (3, 0))
     d.addInterval(6)
     self.assertEquals(d.next(), (3, 0))
     self.assertEquals(d.next(), (3, 0))
     self.assertEquals(d.next(), (0, 1))
     self.assertEquals(d.next(), (3, 0))
     self.assertEquals(d.next(), (3, 0))
     self.assertEquals(d.next(), (0, 1))
コード例 #3
0
ファイル: test_util.py プロジェクト: Hetal728/SMP-ClassiCube
 def testPair(self):
     d = iter(util.IntervalDifferential([5, 7], 10))
     for i in range(100):
         self.assertEquals(d.next(), (5, 0))
         self.assertEquals(d.next(), (2, 1))
         self.assertEquals(d.next(), (3, 0))
         self.assertEquals(d.next(), (4, 1))
         self.assertEquals(d.next(), (1, 0))
         self.assertEquals(d.next(), (5, 0))
         self.assertEquals(d.next(), (1, 1))
         self.assertEquals(d.next(), (4, 0))
         self.assertEquals(d.next(), (3, 1))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (5, 0))
         self.assertEquals(d.next(), (0, 1))
コード例 #4
0
ファイル: test_util.py プロジェクト: Hetal728/SMP-ClassiCube
 def testTriple(self):
     d = iter(util.IntervalDifferential([2, 4, 5], 10))
     for i in range(100):
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (0, 1))
         self.assertEquals(d.next(), (1, 2))
         self.assertEquals(d.next(), (1, 0))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (0, 1))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (0, 2))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (0, 1))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (1, 2))
         self.assertEquals(d.next(), (1, 0))
         self.assertEquals(d.next(), (0, 1))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (2, 0))
         self.assertEquals(d.next(), (0, 1))
         self.assertEquals(d.next(), (0, 2))
コード例 #5
0
ファイル: test_util.py プロジェクト: Hetal728/SMP-ClassiCube
 def testSingle(self):
     d = iter(util.IntervalDifferential([5], 10))
     for i in range(100):
         self.assertEquals(d.next(), (5, 0))
コード例 #6
0
ファイル: test_util.py プロジェクト: Hetal728/SMP-ClassiCube
 def testDefault(self):
     d = iter(util.IntervalDifferential([], 10))
     for i in range(100):
         self.assertEquals(d.next(), (10, None))