BlockIt
|
00001 import unittest 00002 import blockit.basegrammar as gram 00003 00004 class TestBaseGrammar(unittest.TestCase): 00005 00006 def setUp(self): 00007 pass 00008 00009 def tearDown(self): 00010 pass 00011 00012 def testParseHex(self): 00013 """Checks to ensure proper parsing of hex values""" 00014 00015 teststr = """ 00016 0x01 axb 0xAA 00017 0xG1 00018 """ 00019 00020 ctr = 0 00021 for match,start,end in gram.HEX_NUM.scanString(teststr): 00022 ctr += 1 00023 self.failUnlessEqual(ctr, 2, "Found more matches than exist") 00024 00025 00026 if __name__ == '__main__': 00027 suite = unittest.TestLoader().loadTestsFromTestCase(TestBaseGrammar) 00028 unittest.TextTestRunner(verbosity=2).run(suite)