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

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

Issue 1506753002: [test] Test expectations in cctest should use CHECK and not DCHECK. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « test/cctest/test-inobject-slack-tracking.cc ('k') | test/cctest/test-macro-assembler-x64.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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 int diff_parameter = 0; 114 int diff_parameter = 0;
115 115
116 for (DiffChunkStruct* chunk = first_chunk; 116 for (DiffChunkStruct* chunk = first_chunk;
117 chunk != NULL; 117 chunk != NULL;
118 chunk = chunk->next) { 118 chunk = chunk->next) {
119 int diff_pos1 = chunk->pos1; 119 int diff_pos1 = chunk->pos1;
120 int similar_part_length = diff_pos1 - pos1; 120 int similar_part_length = diff_pos1 - pos1;
121 int diff_pos2 = pos2 + similar_part_length; 121 int diff_pos2 = pos2 + similar_part_length;
122 122
123 DCHECK_EQ(diff_pos2, chunk->pos2); 123 CHECK_EQ(diff_pos2, chunk->pos2);
124 124
125 for (int j = 0; j < similar_part_length; j++) { 125 for (int j = 0; j < similar_part_length; j++) {
126 DCHECK(pos1 + j < len1); 126 CHECK(pos1 + j < len1);
127 DCHECK(pos2 + j < len2); 127 CHECK(pos2 + j < len2);
128 DCHECK_EQ(s1[pos1 + j], s2[pos2 + j]); 128 CHECK_EQ(s1[pos1 + j], s2[pos2 + j]);
129 } 129 }
130 diff_parameter += chunk->len1 + chunk->len2; 130 diff_parameter += chunk->len1 + chunk->len2;
131 pos1 = diff_pos1 + chunk->len1; 131 pos1 = diff_pos1 + chunk->len1;
132 pos2 = diff_pos2 + chunk->len2; 132 pos2 = diff_pos2 + chunk->len2;
133 } 133 }
134 { 134 {
135 // After last chunk. 135 // After last chunk.
136 int similar_part_length = len1 - pos1; 136 int similar_part_length = len1 - pos1;
137 DCHECK_EQ(similar_part_length, len2 - pos2); 137 CHECK_EQ(similar_part_length, len2 - pos2);
138 USE(len2); 138 USE(len2);
139 for (int j = 0; j < similar_part_length; j++) { 139 for (int j = 0; j < similar_part_length; j++) {
140 DCHECK(pos1 + j < len1); 140 CHECK(pos1 + j < len1);
141 DCHECK(pos2 + j < len2); 141 CHECK(pos2 + j < len2);
142 DCHECK_EQ(s1[pos1 + j], s2[pos2 + j]); 142 CHECK_EQ(s1[pos1 + j], s2[pos2 + j]);
143 } 143 }
144 } 144 }
145 145
146 if (expected_diff_parameter != -1) { 146 if (expected_diff_parameter != -1) {
147 DCHECK_EQ(expected_diff_parameter, diff_parameter); 147 CHECK_EQ(expected_diff_parameter, diff_parameter);
148 } 148 }
149 } 149 }
150 150
151 151
152 void CompareStrings(const char* s1, const char* s2, 152 void CompareStrings(const char* s1, const char* s2,
153 int expected_diff_parameter = -1) { 153 int expected_diff_parameter = -1) {
154 CompareStringsOneWay(s1, s2, expected_diff_parameter); 154 CompareStringsOneWay(s1, s2, expected_diff_parameter);
155 CompareStringsOneWay(s2, s1, expected_diff_parameter); 155 CompareStringsOneWay(s2, s1, expected_diff_parameter);
156 } 156 }
157 157
(...skipping 12 matching lines...) Expand all
170 CompareStrings("cat", "cut", 2); 170 CompareStrings("cat", "cut", 2);
171 CompareStrings("ct", "cut", 1); 171 CompareStrings("ct", "cut", 1);
172 CompareStrings("cat", "ct", 1); 172 CompareStrings("cat", "ct", 1);
173 CompareStrings("cat", "cat", 0); 173 CompareStrings("cat", "cat", 0);
174 CompareStrings("", "", 0); 174 CompareStrings("", "", 0);
175 CompareStrings("cat", "", 3); 175 CompareStrings("cat", "", 3);
176 CompareStrings("a cat", "a capybara", 7); 176 CompareStrings("a cat", "a capybara", 7);
177 CompareStrings("abbabababababaaabbabababababbabbbbbbbababa", 177 CompareStrings("abbabababababaaabbabababababbabbbbbbbababa",
178 "bbbbabababbbabababbbabababababbabbababa"); 178 "bbbbabababbbabababbbabababababbabbababa");
179 } 179 }
OLDNEW
« no previous file with comments | « test/cctest/test-inobject-slack-tracking.cc ('k') | test/cctest/test-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698