def test_reset(self): # the value got up the counter and dropped. must calc the diff. uptime1, uptime2 =9, 10 # find the last value of the system before reset if ARCH == 32: value1 = 2**32 - 1 if ARCH == 64: value1 = 2**64 - 1 value2 = 0 self.assertEqual(myscript.calc_diff(value1, uptime1, value2, uptime2), 1)
def test_reset(self): # the value got up the counter and dropped. must calc the diff. uptime1, uptime2 = 9, 10 # find the last value of the system before reset if ARCH == 32: value1 = 2**32 - 1 if ARCH == 64: value1 = 2**64 - 1 value2 = 0 self.assertEqual(myscript.calc_diff(value1, uptime1, value2, uptime2), 1)
def test_reboot(self): # the host rebooted, uptime2 is smaller than uptime1: must take latest value possible value1, uptime1, value2, uptime2 = 123, 10, 345, 5 self.assertEqual(myscript.calc_diff(value1, uptime1, value2, uptime2), 345)
def test_normal(self): value1, uptime1, value2, uptime2 = 1, 1, 2, 2 self.assertEqual(myscript.calc_diff(value1, uptime1, value2, uptime2), 1)