Beispiel #1
0
 def test_convert_to_kilobits_bits_value(self):
     value = "1000bit"
     expected_value = tc_lib.bits_to_kilobits(1000, self.base_unit)
     self.assertEqual(
         expected_value,
         tc_lib.convert_to_kilobits(value, self.base_unit)
     )
Beispiel #2
0
 def test_convert_to_kilobits_megabits_value(self):
     value = "1mbit"
     expected_value = tc_lib.bits_to_kilobits(
         self.base_unit ** 2, self.base_unit)
     self.assertEqual(
         expected_value,
         tc_lib.convert_to_kilobits(value, self.base_unit)
     )
Beispiel #3
0
 def test_bits_to_kilobits(self):
     test_values = [
         (0, 0),  # 0 bites should be 0 kilobites
         (1, 1),  # 1 bit should be 1 kilobit
         (1023, 1),  # 1023 bits should be 1 kilobit
         (1024, 1),  # 1024 bits should be 1 kilobit
         (1025, 2),  # 1025 bits should be 2 kilobits
     ]
     for input_bits, expected_kilobits in test_values:
         self.assertEqual(expected_kilobits, tc_lib.bits_to_kilobits(input_bits, self.base_unit))
Beispiel #4
0
 def test_bits_to_kilobits(self):
     test_values = [
         (0, 0),  # 0 bites should be 0 kilobites
         (1, 1),  # 1 bit should be 1 kilobit
         (999, 1),  # 999 bits should be 1 kilobit
         (1000, 1),  # 1000 bits should be 1 kilobit
         (1001, 2)  # 1001 bits should be 2 kilobits
     ]
     for input_bits, expected_kilobits in test_values:
         self.assertEqual(
             expected_kilobits,
             tc_lib.bits_to_kilobits(input_bits, self.base_unit))