Esempio n. 1
0
 def testParseMemoryInterval(self):
   self.assertEqual(
       command_parser.Interval(1024, True, 2048, True),
       command_parser.parse_memory_interval("[1k, 2k]"))
   self.assertEqual(
       command_parser.Interval(1024, False, 2048, False),
       command_parser.parse_memory_interval("(1kB, 2kB)"))
   self.assertEqual(
       command_parser.Interval(1024, False, 2048, True),
       command_parser.parse_memory_interval("(1k, 2k]"))
   self.assertEqual(
       command_parser.Interval(1024, True, 2048, False),
       command_parser.parse_memory_interval("[1k, 2k)"))
   self.assertEqual(
       command_parser.Interval(0, False, 2048, True),
       command_parser.parse_memory_interval("<=2k"))
   self.assertEqual(
       command_parser.Interval(11, True, float("inf"), False),
       command_parser.parse_memory_interval(">=11"))
   self.assertEqual(
       command_parser.Interval(0, False, 2048, False),
       command_parser.parse_memory_interval("<2k"))
   self.assertEqual(
       command_parser.Interval(11, False, float("inf"), False),
       command_parser.parse_memory_interval(">11"))
Esempio n. 2
0
 def testParseMemoryInterval(self):
   self.assertEquals(
       command_parser.Interval(1024, True, 2048, True),
       command_parser.parse_memory_interval("[1k, 2k]"))
   self.assertEquals(
       command_parser.Interval(1024, False, 2048, False),
       command_parser.parse_memory_interval("(1kB, 2kB)"))
   self.assertEquals(
       command_parser.Interval(1024, False, 2048, True),
       command_parser.parse_memory_interval("(1k, 2k]"))
   self.assertEquals(
       command_parser.Interval(1024, True, 2048, False),
       command_parser.parse_memory_interval("[1k, 2k)"))
   self.assertEquals(
       command_parser.Interval(0, False, 2048, True),
       command_parser.parse_memory_interval("<=2k"))
   self.assertEquals(
       command_parser.Interval(11, True, float("inf"), False),
       command_parser.parse_memory_interval(">=11"))
   self.assertEquals(command_parser.Interval(0, False, 2048, False),
                     command_parser.parse_memory_interval("<2k"))
   self.assertEquals(
       command_parser.Interval(11, False, float("inf"), False),
       command_parser.parse_memory_interval(">11"))
Esempio n. 3
0
 def testInvalidMemoryIntervalRaisesException(self):
   with self.assertRaisesRegexp(
       ValueError,
       r"Invalid interval \[5k, 3k\]. Start of interval must be less than or "
       "equal to end of interval."):
     command_parser.parse_memory_interval("[5k, 3k]")
Esempio n. 4
0
 def testInvalidMemoryIntervalRaisesException(self):
     with self.assertRaisesRegexp(
             ValueError,
             r"Invalid interval \[5k, 3k\]. Start of interval must be less than or "
             "equal to end of interval."):
         command_parser.parse_memory_interval("[5k, 3k]")