| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 for c in no_match: | 70 for c in no_match: |
| 71 self.assertEqual(invert, key.matches_char(c)) | 71 self.assertEqual(invert, key.matches_char(c)) |
| 72 | 72 |
| 73 def test_self_defined_classes(self): | 73 def test_self_defined_classes(self): |
| 74 graph = RegexParser.parse("[a-z]") | 74 graph = RegexParser.parse("[a-z]") |
| 75 classes = { | 75 classes = { |
| 76 'self_defined' : TransitionKey.character_class(graph, {})} | 76 'self_defined' : TransitionKey.character_class(graph, {})} |
| 77 graph = RegexParser.parse("[^:self_defined:]") | 77 graph = RegexParser.parse("[^:self_defined:]") |
| 78 key = TransitionKey.character_class(graph, classes) | 78 key = TransitionKey.character_class(graph, classes) |
| 79 self.assertTrue(key.matches_char('A')) | 79 self.assertTrue(key.matches_char('A')) |
| 80 |
| 81 |
| 82 def test_disjoint_keys(self): |
| 83 key1 = TransitionKey([(1, 10)]) |
| 84 key2 = TransitionKey([(5, 15)]) |
| 85 disjoint_set = TransitionKey.disjoint_keys(set([key1, key2])) |
| 86 self.assertTrue(TransitionKey([(1, 4)]) in disjoint_set) |
| 87 self.assertTrue(TransitionKey([(5, 10)]) in disjoint_set) |
| 88 self.assertTrue(TransitionKey([(11, 15)]) in disjoint_set) |
| OLD | NEW |