Esempio n. 1
0
    def test_32bit_number_list_non_blank(self):
        list = [1, 1, 1, 1, 1, 1]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 * 6 + 2 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(6, len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[5])
        self.assertEqual(2 * (2 * 6 + 2 + 1), input._offset)
Esempio n. 2
0
    def test_32bit_number_list_non_blank(self):
        list = [1, 1, 1, 1, 1, 1]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 * 6 + 2 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(6, len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[5])
        self.assertEqual(2 * (2 * 6 + 2 + 1), input._offset)
Esempio n. 3
0
    def test_32bit_number_list_blank(self):
        list = [0, 0, 0, 0, 0, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual((2 + 1) * 2, len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(6, len(result))
        self.assertEqual(0, result[0])
        self.assertEqual(0, result[5])
        self.assertEqual((2 + 1) * 2, input._offset)
Esempio n. 4
0
    def test_32bit_number_list_blank(self):
        list = [0, 0, 0, 0, 0, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual((2 + 1) * 2, len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(6, len(result))
        self.assertEqual(0, result[0])
        self.assertEqual(0, result[5])
        self.assertEqual((2 + 1) * 2, input._offset)
Esempio n. 5
0
    def test_32bit_number_list_combo5(self):
        # zero + zebra
        list = [0, 0, 0, 0, 0, 0, 1]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 1 + 2), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(0, result[0])
        self.assertEqual(1, result[6])
        self.assertEqual(2 * (2 + 1 + 1 + 2), input._offset)
Esempio n. 6
0
    def test_32bit_number_list_combo5(self):
        # zero + zebra
        list = [0, 0, 0, 0, 0, 0, 1]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 1 + 2), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(0, result[0])
        self.assertEqual(1, result[6])
        self.assertEqual(2 * (2 + 1 + 1 + 2), input._offset)
Esempio n. 7
0
    def test_32bit_number_list_combo6(self):
        # zebra + zero
        list = [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 12 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[14])
        self.assertEqual(0, result[15])
        self.assertEqual(0, result[23])
        self.assertEqual(2 * (2 + 1 + 2 * 12 + 1), input._offset)
Esempio n. 8
0
    def test_32bit_number_list_combo4(self):
        # zebra + non-block
        list = [1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 11 + 1 + 2 * 16), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(0, result[14])
        self.assertEqual(1, result[15])
        self.assertEqual(2, result[30])
        self.assertEqual(2 * (2 + 1 + 2 * 11 + 1 + 2 * 16), input._offset)
Esempio n. 9
0
    def test_32bit_number_list_combo3(self):
        # non-blank + zebra
        list = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 16 + 1 + 1 + 2 * 3), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[9])
        self.assertEqual(0, result[16])
        self.assertEqual(1, result[18])
        self.assertEqual(2 * (2 + 1 + 2 * 16 + 1 + 1 + 2 * 3), input._offset)
Esempio n. 10
0
    def test_32bit_number_list_combo1(self):
        # non-blank + blank
        list = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 17 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[15])
        self.assertEqual(0, result[17])
        self.assertEqual(0, result[19])
        self.assertEqual(2 * (2 + 1 + 2 * 17 + 1), input._offset)
Esempio n. 11
0
    def test_32bit_number_list_combo2(self):
        # blank + non-blank
        list = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 1 + 2 * 17), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(0, result[0])
        self.assertEqual(0, result[2])
        self.assertEqual(1, result[3])
        self.assertEqual(1, result[19])
        self.assertEqual(2 * (2 + 1 + 1 + 2 * 17), input._offset)
Esempio n. 12
0
    def test_32bit_number_list_zebra(self):
        list = [1, 0, 1, 0, 1, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 * 3 + 2 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(6, len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(0, result[1])
        self.assertEqual(1, result[2])
        self.assertEqual(0, result[3])
        self.assertEqual(1, result[4])
        self.assertEqual(0, result[5])
        self.assertEqual(2 * (2 * 3 + 2 + 1), input._offset)
Esempio n. 13
0
    def test_32bit_number_list_zebra(self):
        list = [1, 0, 1, 0, 1, 0]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 * 3 + 2 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(6, len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(0, result[1])
        self.assertEqual(1, result[2])
        self.assertEqual(0, result[3])
        self.assertEqual(1, result[4])
        self.assertEqual(0, result[5])
        self.assertEqual(2 * (2 * 3 + 2 + 1), input._offset)
Esempio n. 14
0
    def test_32bit_number_list_combo6(self):
        # zebra + zero
        list = [
            1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
            0, 0
        ]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 12 + 1), len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[14])
        self.assertEqual(0, result[15])
        self.assertEqual(0, result[23])
        self.assertEqual(2 * (2 + 1 + 2 * 12 + 1), input._offset)
Esempio n. 15
0
    def test_32bit_number_list_combo4(self):
        # zebra + non-block
        list = [
            1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
            1, 1, 1, 1, 1, 1, 1, 1, 2
        ]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 11 + 1 + 2 * 16),
                         len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(0, result[14])
        self.assertEqual(1, result[15])
        self.assertEqual(2, result[30])
        self.assertEqual(2 * (2 + 1 + 2 * 11 + 1 + 2 * 16), input._offset)
Esempio n. 16
0
    def test_32bit_number_list_combo3(self):
        # non-blank + zebra
        list = [
            1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1,
            0, 0, 0, 0
        ]

        output = BinaryOutput()
        output.dump_32bit_number_list(list)
        self.assertEqual(2 * (2 + 1 + 2 * 16 + 1 + 1 + 2 * 3),
                         len(output.result()))

        input = BinaryInput(output.result())
        result = input.load_32bit_number_list()
        self.assertEqual(len(list), len(result))
        self.assertEqual(1, result[0])
        self.assertEqual(1, result[9])
        self.assertEqual(0, result[16])
        self.assertEqual(1, result[18])
        self.assertEqual(2 * (2 + 1 + 2 * 16 + 1 + 1 + 2 * 3), input._offset)