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

Side by Side Diff: third_party/WebKit/Source/wtf/StringHasherTest.cpp

Issue 2386843002: reflow comments in wtf (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 TEST(StringHasherTest, StringHasher_addCharacter) { 66 TEST(StringHasherTest, StringHasher_addCharacter) {
67 StringHasher hasher; 67 StringHasher hasher;
68 68
69 // Hashing a single character. 69 // Hashing a single character.
70 hasher = StringHasher(); 70 hasher = StringHasher();
71 hasher.addCharacter(0); 71 hasher.addCharacter(0);
72 EXPECT_EQ(singleNullCharacterHash, hasher.hash()); 72 EXPECT_EQ(singleNullCharacterHash, hasher.hash());
73 EXPECT_EQ(singleNullCharacterHash & 0xFFFFFF, 73 EXPECT_EQ(singleNullCharacterHash & 0xFFFFFF,
74 hasher.hashWithTop8BitsMasked()); 74 hasher.hashWithTop8BitsMasked());
75 75
76 // Hashing five characters, checking the intermediate state after each is adde d. 76 // Hashing five characters, checking the intermediate state after each is
77 // added.
77 hasher = StringHasher(); 78 hasher = StringHasher();
78 hasher.addCharacter(testAUChars[0]); 79 hasher.addCharacter(testAUChars[0]);
79 EXPECT_EQ(testAHash1, hasher.hash()); 80 EXPECT_EQ(testAHash1, hasher.hash());
80 EXPECT_EQ(testAHash1 & 0xFFFFFF, hasher.hashWithTop8BitsMasked()); 81 EXPECT_EQ(testAHash1 & 0xFFFFFF, hasher.hashWithTop8BitsMasked());
81 hasher.addCharacter(testAUChars[1]); 82 hasher.addCharacter(testAUChars[1]);
82 EXPECT_EQ(testAHash2, hasher.hash()); 83 EXPECT_EQ(testAHash2, hasher.hash());
83 EXPECT_EQ(testAHash2 & 0xFFFFFF, hasher.hashWithTop8BitsMasked()); 84 EXPECT_EQ(testAHash2 & 0xFFFFFF, hasher.hashWithTop8BitsMasked());
84 hasher.addCharacter(testAUChars[2]); 85 hasher.addCharacter(testAUChars[2]);
85 EXPECT_EQ(testAHash3, hasher.hash()); 86 EXPECT_EQ(testAHash3, hasher.hash());
86 EXPECT_EQ(testAHash3 & 0xFFFFFF, hasher.hashWithTop8BitsMasked()); 87 EXPECT_EQ(testAHash3 & 0xFFFFFF, hasher.hashWithTop8BitsMasked());
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 EXPECT_EQ(singleNullCharacterHash & 0xFFFFFF, 419 EXPECT_EQ(singleNullCharacterHash & 0xFFFFFF,
419 StringHasher::hashMemory<2>(nullUChars)); 420 StringHasher::hashMemory<2>(nullUChars));
420 421
421 EXPECT_EQ(testAHash5 & 0xFFFFFF, StringHasher::hashMemory(testAUChars, 10)); 422 EXPECT_EQ(testAHash5 & 0xFFFFFF, StringHasher::hashMemory(testAUChars, 10));
422 EXPECT_EQ(testAHash5 & 0xFFFFFF, StringHasher::hashMemory<10>(testAUChars)); 423 EXPECT_EQ(testAHash5 & 0xFFFFFF, StringHasher::hashMemory<10>(testAUChars));
423 EXPECT_EQ(testBHash5 & 0xFFFFFF, StringHasher::hashMemory(testBUChars, 10)); 424 EXPECT_EQ(testBHash5 & 0xFFFFFF, StringHasher::hashMemory(testBUChars, 10));
424 EXPECT_EQ(testBHash5 & 0xFFFFFF, StringHasher::hashMemory<10>(testBUChars)); 425 EXPECT_EQ(testBHash5 & 0xFFFFFF, StringHasher::hashMemory<10>(testBUChars));
425 } 426 }
426 427
427 } // namespace WTF 428 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/StringHasher.h ('k') | third_party/WebKit/Source/wtf/TerminatedArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698