Chromium Code Reviews

Side by Side Diff: Source/core/html/track/vtt/BufferedLineReaderTest.cpp

Issue 811863003: replace COMPILE_ASSERT with static_assert in core/html/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « Source/core/html/parser/CompactHTMLToken.cpp ('k') | Source/core/html/track/vtt/VTTCue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013, Opera Software ASA. All rights reserved. 2 * Copyright (C) 2013, Opera Software ASA. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 183 matching lines...)
194 "aaaaaaaaaaaaaaaa", 194 "aaaaaaaaaaaaaaaa",
195 "bbbbbbbbbb", 195 "bbbbbbbbbb",
196 "ccccccccccccc", 196 "ccccccccccccc",
197 "", 197 "",
198 "dddddd", 198 "dddddd",
199 "", 199 "",
200 "eeeeeeeeee" 200 "eeeeeeeeee"
201 }; 201 };
202 const LineBreakType breaks[] = { Lf, Lf, Lf, Lf, Lf, Lf, Lf }; 202 const LineBreakType breaks[] = { Lf, Lf, Lf, Lf, Lf, Lf, Lf };
203 const size_t numTestLines = WTF_ARRAY_LENGTH(lines); 203 const size_t numTestLines = WTF_ARRAY_LENGTH(lines);
204 COMPILE_ASSERT(numTestLines == WTF_ARRAY_LENGTH(breaks), DifferentLengths_li nes_and_breaks); 204 static_assert(numTestLines == WTF_ARRAY_LENGTH(breaks), "number of test line s and breaks should be the same");
205 String data = MakeTestData(lines, breaks, numTestLines); 205 String data = MakeTestData(lines, breaks, numTestLines);
206 206
207 for (size_t k = 0; k < WTF_ARRAY_LENGTH(blockSizes); ++k) { 207 for (size_t k = 0; k < WTF_ARRAY_LENGTH(blockSizes); ++k) {
208 size_t lineCount = 0; 208 size_t lineCount = 0;
209 BufferedLineReader reader; 209 BufferedLineReader reader;
210 size_t blockSize = blockSizes[k]; 210 size_t blockSize = blockSizes[k];
211 for (size_t i = 0; i < data.length(); i += blockSize) { 211 for (size_t i = 0; i < data.length(); i += blockSize) {
212 reader.append(data.substring(i, blockSize)); 212 reader.append(data.substring(i, blockSize));
213 213
214 String line; 214 String line;
(...skipping 12 matching lines...)
227 "aaaaaaaaaaaaaaaa", 227 "aaaaaaaaaaaaaaaa",
228 "bbbbbbbbbb", 228 "bbbbbbbbbb",
229 "ccccccccccccc", 229 "ccccccccccccc",
230 "", 230 "",
231 "dddddd", 231 "dddddd",
232 "eeeeeeeeee", 232 "eeeeeeeeee",
233 "fffffffffffffffffff" 233 "fffffffffffffffffff"
234 }; 234 };
235 const LineBreakType breaks[] = { Cr, Lf, CrLf, Cr, Lf, CrLf, Lf }; 235 const LineBreakType breaks[] = { Cr, Lf, CrLf, Cr, Lf, CrLf, Lf };
236 const size_t numTestLines = WTF_ARRAY_LENGTH(lines); 236 const size_t numTestLines = WTF_ARRAY_LENGTH(lines);
237 COMPILE_ASSERT(numTestLines == WTF_ARRAY_LENGTH(breaks), DifferentLengths_li nes_and_breaks); 237 static_assert(numTestLines == WTF_ARRAY_LENGTH(breaks), "number of test line s and breaks should be the same");
238 String data = MakeTestData(lines, breaks, numTestLines); 238 String data = MakeTestData(lines, breaks, numTestLines);
239 239
240 for (size_t k = 0; k < WTF_ARRAY_LENGTH(blockSizes); ++k) { 240 for (size_t k = 0; k < WTF_ARRAY_LENGTH(blockSizes); ++k) {
241 size_t lineCount = 0; 241 size_t lineCount = 0;
242 BufferedLineReader reader; 242 BufferedLineReader reader;
243 size_t blockSize = blockSizes[k]; 243 size_t blockSize = blockSizes[k];
244 for (size_t i = 0; i < data.length(); i += blockSize) { 244 for (size_t i = 0; i < data.length(); i += blockSize) {
245 reader.append(data.substring(i, blockSize)); 245 reader.append(data.substring(i, blockSize));
246 246
247 String line; 247 String line;
(...skipping 35 matching lines...)
283 TEST(BufferedLineReader, NormalizedNUL) 283 TEST(BufferedLineReader, NormalizedNUL)
284 { 284 {
285 BufferedLineReader reader; 285 BufferedLineReader reader;
286 reader.append(String("X\0Y\n", 4)); 286 reader.append(String("X\0Y\n", 4));
287 String line; 287 String line;
288 ASSERT_TRUE(reader.getLine(line)); 288 ASSERT_TRUE(reader.getLine(line));
289 ASSERT_EQ(line[1], WTF::Unicode::replacementCharacter); 289 ASSERT_EQ(line[1], WTF::Unicode::replacementCharacter);
290 } 290 }
291 291
292 } // namespace 292 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/parser/CompactHTMLToken.cpp ('k') | Source/core/html/track/vtt/VTTCue.cpp » ('j') | no next file with comments »

Powered by Google App Engine