예제 #1
0
 def test_ug_3(self):
   min = LogLocation(0, datetime(datetime.now().year,  2, 13, 18, 31, 30),
                     LogLocation.TOO_LOW,
                     LogLocation.TOO_LOW)
   max = LogLocation(3770000, datetime(datetime.now().year,  2, 14, 7, 7, 39),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   guesses = [min, max]
   new = LogLocation(3779999999, datetime(datetime.now().year,  2, 16, 22, 26, 26),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   answer = [min, max]
   # no update, too high
   tgrep.update_guess(new, guesses)
   self.assertEquals(answer, guesses)
예제 #2
0
 def test_ug_4(self):
   min = LogLocation(0, datetime(datetime.now().year,  2, 13, 18, 31, 30),
                     LogLocation.TOO_LOW,
                     LogLocation.TOO_LOW)
   max = LogLocation(3770000, datetime(datetime.now().year,  2, 14, 7, 7, 39),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   guesses = [min, max]
   new = LogLocation(12345, datetime(datetime.now().year,  2, 13, 19, 0, 0),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_LOW)
   answer = [min, max]
   # no update, in range
   tgrep.update_guess(new, guesses)
   self.assertEquals(answer, guesses)
예제 #3
0
 def test_ug_2(self):
   min = LogLocation(0, datetime(datetime.now().year,  2, 13, 18, 31, 30),
                     LogLocation.TOO_LOW,
                     LogLocation.TOO_LOW)
   max = LogLocation(3770000, datetime(datetime.now().year,  2, 14, 7, 7, 39),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   guesses = [min, max]
   new = LogLocation(2220000, datetime(datetime.now().year,  2, 14, 6, 6, 6),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   answer = [min, new]
   # update high
   tgrep.update_guess(new, guesses)
   self.assertEquals(answer, guesses)
예제 #4
0
 def test_ug_6(self):
   min = LogLocation(0, datetime(datetime.now().year,  2, 13, 18, 31, 30),
                     LogLocation.TOO_LOW,
                     LogLocation.TOO_LOW)
   max = LogLocation(3770000, datetime(datetime.now().year,  2, 14, 7, 7, 39),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   guesses = [min, max]
   new = LogLocation(1234, datetime(datetime.now().year,  2, 13, 19, 0, 0),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   new.set_is_max(True)
   answer = [min, new]
   # update, is_max
   tgrep.update_guess(new, guesses)
   self.assertEquals(answer, guesses)
예제 #5
0
 def test_ug_8(self):
   #//! impl in update_guess
   return
   min = LogLocation(0, datetime(datetime.now().year,  2, 13, 18, 31, 30),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_LOW)
   max = LogLocation(3770000, datetime(datetime.now().year,  2, 14, 7, 7, 39),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   max.set_is_max(True)
   guesses = [min, max]
   new = LogLocation(1234, datetime(datetime.now().year,  2, 13, 19, 0, 0),
                     LogLocation.TOO_HIGH,
                     LogLocation.TOO_HIGH)
   answer = [min, max]
   # ignore, is_max already set for max
   tgrep.update_guess(new, guesses)
   self.assertEquals(answer, guesses)