Esempio n. 1
0
		def test(self):
			self.assertEqual(len(self.data), self.data_length)
			set_table_id(self.data, 1)
			self.assertEqual(self.data[0], 1, 'error setting table id')
			set_section_syntax_indicator(self.data, True)
			self.assertTrue(sparser.get_section_syntax_indicator(self.data), 'Error setting section syntax indicator')
			set_section_syntax_indicator(self.data, False)
			self.assertFalse(sparser.get_section_syntax_indicator(self.data), 'Error setting section syntax indicator')
			set_section_syntax_indicator(self.data, True)
			self.assertTrue(sparser.get_section_syntax_indicator(self.data), 'Error setting section syntax indicator')
			set_private_indicator(self.data, False)
			self.assertFalse(sparser.get_private_indicator(self.data), 'Error setting private indicator')
			set_section_length(self.data, self.data_length - 3)
			self.assertEqual(sparser.get_section_length(self.data), self.data_length-3, 'error setting section length')
			set_table_id_extension(self.data, 20)
			self.assertEqual(sparser.get_table_id_extension(self.data), 20, 'error setting table id extension')
			set_version_number(self.data, 10)
			self.assertEqual(sparser.get_version_number(self.data), 10, 'error setting version number')
			set_current_next_indicator(self.data, True)
			self.assertTrue(sparser.get_current_next_indicator(self.data), 'Error setting current next indicator')
			set_section_number(self.data, 25)
			self.assertEqual(sparser.get_section_number(self.data), 25, 'error setting section number')
			set_last_section_number(self.data, 35)
			self.assertEqual(sparser.get_last_section_number(self.data), 35, 'error setting last section number')
			self.data_contents = random.sample(range(256), self.data_length-8)
			actual_data_contents = sparser.get_data(self.data)
			set_data(self.data, self.data_contents, 8)
			actual_data_contents = sparser.get_data(self.data)
			self.assertEqual(actual_data_contents, self.data_contents, 'error setting section data')
Esempio n. 2
0
		def test(self):
			self.data_contents = random.sample(range(256), self.data_length-8)
			set_data(self.data, self.data_contents, 8)
			set_last_section_number(self.data, 35)
			set_section_number(self.data, 25)
			set_current_next_indicator(self.data, True)
			set_version_number(self.data, 10)
			set_table_id_extension(self.data, 20)
			set_section_length(self.data, self.data_length - 3)
			set_private_indicator(self.data, False)
			set_section_syntax_indicator(self.data, True)
			set_table_id(self.data, 1)
			
			self.assertEqual(len(self.data), self.data_length)
			self.assertEqual(self.data[0], 1)
			self.assertTrue(sparser.get_section_syntax_indicator(self.data))
			self.assertFalse(sparser.get_private_indicator(self.data))
			self.assertEqual(sparser.get_section_length(self.data), self.data_length-3)
			self.assertEqual(sparser.get_table_id_extension(self.data), 20)
			self.assertEqual(sparser.get_version_number(self.data), 10)
			self.assertTrue(sparser.get_current_next_indicator(self.data))
			self.assertEqual(sparser.get_section_number(self.data), 25)
			self.assertEqual(sparser.get_last_section_number(self.data), 35)
			actual_data_contents = sparser.get_data(self.data)
			self.assertEqual(actual_data_contents, self.data_contents)
Esempio n. 3
0
        def test(self):
            self.data_contents = random.sample(range(256),
                                               self.data_length - 8)
            set_data(self.data, self.data_contents, 8)
            set_last_section_number(self.data, 35)
            set_section_number(self.data, 25)
            set_current_next_indicator(self.data, True)
            set_version_number(self.data, 10)
            set_table_id_extension(self.data, 20)
            set_section_length(self.data, self.data_length - 3)
            set_private_indicator(self.data, False)
            set_section_syntax_indicator(self.data, True)
            set_table_id(self.data, 1)

            self.assertEqual(len(self.data), self.data_length)
            self.assertEqual(self.data[0], 1)
            self.assertTrue(sparser.get_section_syntax_indicator(self.data))
            self.assertFalse(sparser.get_private_indicator(self.data))
            self.assertEqual(sparser.get_section_length(self.data),
                             self.data_length - 3)
            self.assertEqual(sparser.get_table_id_extension(self.data), 20)
            self.assertEqual(sparser.get_version_number(self.data), 10)
            self.assertTrue(sparser.get_current_next_indicator(self.data))
            self.assertEqual(sparser.get_section_number(self.data), 25)
            self.assertEqual(sparser.get_last_section_number(self.data), 35)
            actual_data_contents = sparser.get_data(self.data)
            self.assertEqual(actual_data_contents, self.data_contents)
Esempio n. 4
0
 def test(self):
     self.assertEqual(len(self.data), self.data_length)
     set_table_id(self.data, 1)
     self.assertEqual(self.data[0], 1, 'error setting table id')
     set_section_syntax_indicator(self.data, True)
     self.assertTrue(sparser.get_section_syntax_indicator(self.data),
                     'Error setting section syntax indicator')
     set_section_syntax_indicator(self.data, False)
     self.assertFalse(sparser.get_section_syntax_indicator(self.data),
                      'Error setting section syntax indicator')
     set_section_syntax_indicator(self.data, True)
     self.assertTrue(sparser.get_section_syntax_indicator(self.data),
                     'Error setting section syntax indicator')
     set_private_indicator(self.data, False)
     self.assertFalse(sparser.get_private_indicator(self.data),
                      'Error setting private indicator')
     set_section_length(self.data, self.data_length - 3)
     self.assertEqual(sparser.get_section_length(self.data),
                      self.data_length - 3,
                      'error setting section length')
     set_table_id_extension(self.data, 20)
     self.assertEqual(sparser.get_table_id_extension(self.data), 20,
                      'error setting table id extension')
     set_version_number(self.data, 10)
     self.assertEqual(sparser.get_version_number(self.data), 10,
                      'error setting version number')
     set_current_next_indicator(self.data, True)
     self.assertTrue(sparser.get_current_next_indicator(self.data),
                     'Error setting current next indicator')
     set_section_number(self.data, 25)
     self.assertEqual(sparser.get_section_number(self.data), 25,
                      'error setting section number')
     set_last_section_number(self.data, 35)
     self.assertEqual(sparser.get_last_section_number(self.data), 35,
                      'error setting last section number')
     self.data_contents = random.sample(range(256),
                                        self.data_length - 8)
     actual_data_contents = sparser.get_data(self.data)
     set_data(self.data, self.data_contents, 8)
     actual_data_contents = sparser.get_data(self.data)
     self.assertEqual(actual_data_contents, self.data_contents,
                      'error setting section data')