示例#1
0
class TestBaseWindow(unittest.TestCase):
    def setUp(self):
        self.w = BaseWindow(4)

    def test_is_valid_seq_negative(self):
        self.assertFalse(self.w.is_valid_seq(-1))

    def test_is_valid_seq_too_large(self):
        self.assertFalse(self.w.is_valid_seq(15))

    def test_is_valid_seq(self):
        self.assertTrue(self.w.is_valid_seq(0))
示例#2
0
class TestBaseWindowIsValidSeq16(unittest.TestCase):

    def setUp(self):
        self.w = BaseWindow(16)

    def test_negative(self):
        self.assertFalse(self.w.is_valid_seq(-1))

    def test_first_valid(self):
        self.assertTrue(self.w.is_valid_seq(0))

    def test_last_valid(self):
        self.assertTrue(self.w.is_valid_seq(65535))

    def test_too_large(self):
        self.assertFalse(self.w.is_valid_seq(65536))

    def test_too_large2(self):
        self.assertFalse(self.w.is_valid_seq(100000))
示例#3
0
 def test_create_1(self):
     w = BaseWindow(1)
     self.assertEqual(w.size, 1)
     self.assertEqual(w.expected_seq, 0)
     self.assertEqual(w.max_seq, 2)
示例#4
0
 def setUp(self):
     self.w = BaseWindow(16)
示例#5
0
 def test_create_limited_invalid2(self):
     with self.assertRaises(ValueError):
         BaseWindow(3, size=10)
示例#6
0
 def test_create_invalid2(self):
     with self.assertRaises(ValueError):
         BaseWindow(0)
示例#7
0
 def test_create_4_limited(self):
     w = BaseWindow(4, size=8)
     self.assertEqual(w.size, 8)
     self.assertEqual(w.expected_seq, 0)
     self.assertEqual(w.max_seq, 16)
示例#8
0
 def test_create(self):
     w = BaseWindow(4)
     self.assertEqual(w.size, 8)
     self.assertEqual(w.expected_seq, 1)
     self.assertEqual(w.last_seq, 0)
     self.assertEqual(w.max_seq, 15)