OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 #define CHECK_PARSE_EQ(input, expected) CHECK_EQ(expected, *Parse(input)) | 120 #define CHECK_PARSE_EQ(input, expected) CHECK_EQ(expected, *Parse(input)) |
121 #define CHECK_SIMPLE(input, simple) CHECK_EQ(simple, CheckSimple(input)); | 121 #define CHECK_SIMPLE(input, simple) CHECK_EQ(simple, CheckSimple(input)); |
122 #define CHECK_MIN_MAX(input, min, max) \ | 122 #define CHECK_MIN_MAX(input, min, max) \ |
123 { MinMaxPair min_max = CheckMinMaxMatch(input); \ | 123 { MinMaxPair min_max = CheckMinMaxMatch(input); \ |
124 CHECK_EQ(min, min_max.min_match); \ | 124 CHECK_EQ(min, min_max.min_match); \ |
125 CHECK_EQ(max, min_max.max_match); \ | 125 CHECK_EQ(max, min_max.max_match); \ |
126 } | 126 } |
127 | 127 |
128 TEST(Parser) { | 128 TEST(Parser) { |
129 V8::Initialize(NULL); | 129 V8::Initialize(NULL); |
| 130 |
| 131 CHECK_PARSE_ERROR("?"); |
| 132 |
130 CHECK_PARSE_EQ("abc", "'abc'"); | 133 CHECK_PARSE_EQ("abc", "'abc'"); |
131 CHECK_PARSE_EQ("", "%"); | 134 CHECK_PARSE_EQ("", "%"); |
132 CHECK_PARSE_EQ("abc|def", "(| 'abc' 'def')"); | 135 CHECK_PARSE_EQ("abc|def", "(| 'abc' 'def')"); |
133 CHECK_PARSE_EQ("abc|def|ghi", "(| 'abc' 'def' 'ghi')"); | 136 CHECK_PARSE_EQ("abc|def|ghi", "(| 'abc' 'def' 'ghi')"); |
134 CHECK_PARSE_EQ("^xxx$", "(: @^i 'xxx' @$i)"); | 137 CHECK_PARSE_EQ("^xxx$", "(: @^i 'xxx' @$i)"); |
135 CHECK_PARSE_EQ("ab\\b\\d\\bcd", "(: 'ab' @b [0-9] @b 'cd')"); | 138 CHECK_PARSE_EQ("ab\\b\\d\\bcd", "(: 'ab' @b [0-9] @b 'cd')"); |
136 CHECK_PARSE_EQ("\\w|\\d", "(| [0-9 A-Z _ a-z] [0-9])"); | 139 CHECK_PARSE_EQ("\\w|\\d", "(| [0-9 A-Z _ a-z] [0-9])"); |
137 CHECK_PARSE_EQ("a*", "(# 0 - g 'a')"); | 140 CHECK_PARSE_EQ("a*", "(# 0 - g 'a')"); |
138 CHECK_PARSE_EQ("a*?", "(# 0 - n 'a')"); | 141 CHECK_PARSE_EQ("a*?", "(# 0 - n 'a')"); |
139 CHECK_PARSE_EQ("abc+", "(: 'ab' (# 1 - g 'c'))"); | 142 CHECK_PARSE_EQ("abc+", "(: 'ab' (# 1 - g 'c'))"); |
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 ASSERT_EQ(10, list->at(0).from()); | 1649 ASSERT_EQ(10, list->at(0).from()); |
1647 ASSERT_EQ(30, list->at(0).to()); | 1650 ASSERT_EQ(30, list->at(0).to()); |
1648 } | 1651 } |
1649 | 1652 |
1650 | 1653 |
1651 | 1654 |
1652 TEST(Graph) { | 1655 TEST(Graph) { |
1653 V8::Initialize(NULL); | 1656 V8::Initialize(NULL); |
1654 Execute("\\b\\w+\\b", false, true, true); | 1657 Execute("\\b\\w+\\b", false, true, true); |
1655 } | 1658 } |
OLD | NEW |