| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 def test_hash(self): | 44 def test_hash(self): |
| 45 for (left, right) in self.__equal_pairs: | 45 for (left, right) in self.__equal_pairs: |
| 46 self.assertEqual(hash(left), hash(right)) | 46 self.assertEqual(hash(left), hash(right)) |
| 47 | 47 |
| 48 def test_classes(self): | 48 def test_classes(self): |
| 49 # class regex, should match, should not match | 49 # class regex, should match, should not match |
| 50 data = [ | 50 data = [ |
| 51 ("1-2", "12", "ab"), | 51 ("1-2", "12", "ab"), |
| 52 ("a-zA-Z", "abyzABYZ" , "123"), | 52 ("a-zA-Z", "abyzABYZ" , "123"), |
| 53 ("a-zA-Z0g" , "abyzABYZ0" , "123"), | 53 ("a-zA-Z0g" , "abyzABYZ0" , "123"), |
| 54 ("a-z:ws::lit:" , "abc" , "123"), | 54 ("a-z:whitespace::letter:" , "abc" , "123"), |
| 55 ] | 55 ] |
| 56 classes = {} | 56 classes = {} |
| 57 for (string, match, no_match) in data: | 57 for (string, match, no_match) in data: |
| 58 for invert in [False, True]: | 58 for invert in [False, True]: |
| 59 if invert: | 59 if invert: |
| 60 regex = "[^%s]" % string | 60 regex = "[^%s]" % string |
| 61 token = "NOT_CLASS" | 61 token = "NOT_CLASS" |
| 62 else: | 62 else: |
| 63 regex = "[%s]" % string | 63 regex = "[%s]" % string |
| 64 token = "CLASS" | 64 token = "CLASS" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 self.assertTrue(key.matches_char('A')) | 79 self.assertTrue(key.matches_char('A')) |
| 80 | 80 |
| 81 | 81 |
| 82 def test_disjoint_keys(self): | 82 def test_disjoint_keys(self): |
| 83 key1 = TransitionKey([(1, 10)]) | 83 key1 = TransitionKey([(1, 10)]) |
| 84 key2 = TransitionKey([(5, 15)]) | 84 key2 = TransitionKey([(5, 15)]) |
| 85 disjoint_set = TransitionKey.disjoint_keys(set([key1, key2])) | 85 disjoint_set = TransitionKey.disjoint_keys(set([key1, key2])) |
| 86 self.assertTrue(TransitionKey([(1, 4)]) in disjoint_set) | 86 self.assertTrue(TransitionKey([(1, 4)]) in disjoint_set) |
| 87 self.assertTrue(TransitionKey([(5, 10)]) in disjoint_set) | 87 self.assertTrue(TransitionKey([(5, 10)]) in disjoint_set) |
| 88 self.assertTrue(TransitionKey([(11, 15)]) in disjoint_set) | 88 self.assertTrue(TransitionKey([(11, 15)]) in disjoint_set) |
| OLD | NEW |