Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: test/cctest/test-regexp.cc

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-profile-generator.cc ('k') | test/cctest/test-reloc-info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 CHECK(result.tree != NULL); 130 CHECK(result.tree != NULL);
131 CHECK(result.error.is_null()); 131 CHECK(result.error.is_null());
132 int min_match = result.tree->min_match(); 132 int min_match = result.tree->min_match();
133 int max_match = result.tree->max_match(); 133 int max_match = result.tree->max_match();
134 MinMaxPair pair = { min_match, max_match }; 134 MinMaxPair pair = { min_match, max_match };
135 return pair; 135 return pair;
136 } 136 }
137 137
138 138
139 #define CHECK_PARSE_ERROR(input) CHECK(!CheckParse(input)) 139 #define CHECK_PARSE_ERROR(input) CHECK(!CheckParse(input))
140 #define CHECK_PARSE_EQ(input, expected) CHECK_EQ(expected, *Parse(input)) 140 #define CHECK_PARSE_EQ(input, expected) CHECK_EQ(expected, Parse(input).get())
141 #define CHECK_SIMPLE(input, simple) CHECK_EQ(simple, CheckSimple(input)); 141 #define CHECK_SIMPLE(input, simple) CHECK_EQ(simple, CheckSimple(input));
142 #define CHECK_MIN_MAX(input, min, max) \ 142 #define CHECK_MIN_MAX(input, min, max) \
143 { MinMaxPair min_max = CheckMinMaxMatch(input); \ 143 { MinMaxPair min_max = CheckMinMaxMatch(input); \
144 CHECK_EQ(min, min_max.min_match); \ 144 CHECK_EQ(min, min_max.min_match); \
145 CHECK_EQ(max, min_max.max_match); \ 145 CHECK_EQ(max, min_max.max_match); \
146 } 146 }
147 147
148 TEST(Parser) { 148 TEST(Parser) {
149 V8::Initialize(NULL); 149 V8::Initialize(NULL);
150 150
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 V8::Initialize(NULL); 397 V8::Initialize(NULL);
398 v8::HandleScope scope(CcTest::isolate()); 398 v8::HandleScope scope(CcTest::isolate());
399 Zone zone(CcTest::i_isolate()); 399 Zone zone(CcTest::i_isolate());
400 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); 400 FlatStringReader reader(CcTest::i_isolate(), CStrVector(input));
401 RegExpCompileData result; 401 RegExpCompileData result;
402 CHECK(!v8::internal::RegExpParser::ParseRegExp( 402 CHECK(!v8::internal::RegExpParser::ParseRegExp(
403 &reader, false, &result, &zone)); 403 &reader, false, &result, &zone));
404 CHECK(result.tree == NULL); 404 CHECK(result.tree == NULL);
405 CHECK(!result.error.is_null()); 405 CHECK(!result.error.is_null());
406 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS); 406 SmartArrayPointer<char> str = result.error->ToCString(ALLOW_NULLS);
407 CHECK_EQ(expected, *str); 407 CHECK_EQ(expected, str.get());
408 } 408 }
409 409
410 410
411 TEST(Errors) { 411 TEST(Errors) {
412 const char* kEndBackslash = "\\ at end of pattern"; 412 const char* kEndBackslash = "\\ at end of pattern";
413 ExpectError("\\", kEndBackslash); 413 ExpectError("\\", kEndBackslash);
414 const char* kUnterminatedGroup = "Unterminated group"; 414 const char* kUnterminatedGroup = "Unterminated group";
415 ExpectError("(foo", kUnterminatedGroup); 415 ExpectError("(foo", kUnterminatedGroup);
416 const char* kInvalidGroup = "Invalid group"; 416 const char* kInvalidGroup = "Invalid group";
417 ExpectError("(?", kInvalidGroup); 417 ExpectError("(?", kInvalidGroup);
(...skipping 10 matching lines...) Expand all
428 428
429 // Check that we don't allow more than kMaxCapture captures 429 // Check that we don't allow more than kMaxCapture captures
430 const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures. 430 const int kMaxCaptures = 1 << 16; // Must match RegExpParser::kMaxCaptures.
431 const char* kTooManyCaptures = "Too many captures"; 431 const char* kTooManyCaptures = "Too many captures";
432 HeapStringAllocator allocator; 432 HeapStringAllocator allocator;
433 StringStream accumulator(&allocator); 433 StringStream accumulator(&allocator);
434 for (int i = 0; i <= kMaxCaptures; i++) { 434 for (int i = 0; i <= kMaxCaptures; i++) {
435 accumulator.Add("()"); 435 accumulator.Add("()");
436 } 436 }
437 SmartArrayPointer<const char> many_captures(accumulator.ToCString()); 437 SmartArrayPointer<const char> many_captures(accumulator.ToCString());
438 ExpectError(*many_captures, kTooManyCaptures); 438 ExpectError(many_captures.get(), kTooManyCaptures);
439 } 439 }
440 440
441 441
442 static bool IsDigit(uc16 c) { 442 static bool IsDigit(uc16 c) {
443 return ('0' <= c && c <= '9'); 443 return ('0' <= c && c <= '9');
444 } 444 }
445 445
446 446
447 static bool NotDigit(uc16 c) { 447 static bool NotDigit(uc16 c) {
448 return !IsDigit(c); 448 return !IsDigit(c);
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 ZoneList<CharacterRange> first_only(4, &zone); 1816 ZoneList<CharacterRange> first_only(4, &zone);
1817 ZoneList<CharacterRange> second_only(4, &zone); 1817 ZoneList<CharacterRange> second_only(4, &zone);
1818 ZoneList<CharacterRange> both(4, &zone); 1818 ZoneList<CharacterRange> both(4, &zone);
1819 } 1819 }
1820 1820
1821 1821
1822 TEST(Graph) { 1822 TEST(Graph) {
1823 V8::Initialize(NULL); 1823 V8::Initialize(NULL);
1824 Execute("\\b\\w+\\b", false, true, true); 1824 Execute("\\b\\w+\\b", false, true, true);
1825 } 1825 }
OLDNEW
« no previous file with comments | « test/cctest/test-profile-generator.cc ('k') | test/cctest/test-reloc-info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698