def testpush(self): threshold = 3 top = StackNode(10) s = Stack(top) sos = SetOfStacks(s, threshold) top = StackNode(11) sos.push(top) top = StackNode(12) sos.push(top) self.assertEqual(sos.size(), 1) top = StackNode(13) sos.push(top) self.assertEqual(s.size(), 3) self.assertEqual(sos.size(), 2)
def testpop(self): threshold = 3 s = Stack(StackNode(10)) sos = SetOfStacks(s, threshold) sos.push(StackNode(11)) sos.push(StackNode(12)) sos.push(StackNode(13)) n = sos.pop() self.assertEqual(n.data, 13) self.assertEqual(sos.size(), 1)
def testsize(self): threshold = 3 top = StackNode(10) s = Stack(top) sos = SetOfStacks(s, threshold) self.assertTrue(sos.size() == 1)