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

Side by Side Diff: courgette/bsdiff_memory_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | « content/test/layout_browsertest.cc ('k') | crypto/ec_private_key_unittest.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "courgette/third_party/bsdiff.h" 5 #include "courgette/third_party/bsdiff.h"
6 6
7 #include "courgette/base_test_unittest.h" 7 #include "courgette/base_test_unittest.h"
8 #include "courgette/courgette.h" 8 #include "courgette/courgette.h"
9 #include "courgette/streams.h" 9 #include "courgette/streams.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 std::string result; 44 std::string result;
45 while (result.length() < length) { 45 while (result.length() < length) {
46 seed = (seed + 17) * 1049 + (seed >> 27); 46 seed = (seed + 17) * 1049 + (seed >> 27);
47 result.append(a[seed & 7]); 47 result.append(a[seed & 7]);
48 } 48 }
49 result.resize(length); 49 result.resize(length);
50 return result; 50 return result;
51 } 51 }
52 52
53 TEST_F(BSDiffMemoryTest, TestEmpty) { 53 TEST_F(BSDiffMemoryTest, TestEmpty) {
54 GenerateAndTestPatch("", ""); 54 GenerateAndTestPatch(std::string(), std::string());
55 } 55 }
56 56
57 TEST_F(BSDiffMemoryTest, TestEmptyVsNonempty) { 57 TEST_F(BSDiffMemoryTest, TestEmptyVsNonempty) {
58 GenerateAndTestPatch("", "xxx"); 58 GenerateAndTestPatch(std::string(), "xxx");
59 } 59 }
60 60
61 TEST_F(BSDiffMemoryTest, TestNonemptyVsEmpty) { 61 TEST_F(BSDiffMemoryTest, TestNonemptyVsEmpty) {
62 GenerateAndTestPatch("xxx", ""); 62 GenerateAndTestPatch("xxx", std::string());
63 } 63 }
64 64
65 TEST_F(BSDiffMemoryTest, TestSmallInputsWithSmallChanges) { 65 TEST_F(BSDiffMemoryTest, TestSmallInputsWithSmallChanges) {
66 std::string file1 = 66 std::string file1 =
67 "I would not, could not, in a box.\n" 67 "I would not, could not, in a box.\n"
68 "I could not, would not, with a fox.\n" 68 "I could not, would not, with a fox.\n"
69 "I will not eat them with a mouse.\n" 69 "I will not eat them with a mouse.\n"
70 "I will not eat them in a house.\n" 70 "I will not eat them in a house.\n"
71 "I will not eat them here or there.\n" 71 "I will not eat them here or there.\n"
72 "I will not eat them anywhere.\n" 72 "I will not eat them anywhere.\n"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 std::string file1 = FileContents("setup1.exe"); 116 std::string file1 = FileContents("setup1.exe");
117 std::string file2 = FileContents("setup2.exe"); 117 std::string file2 = FileContents("setup2.exe");
118 GenerateAndTestPatch(file1, file2); 118 GenerateAndTestPatch(file1, file2);
119 } 119 }
120 120
121 TEST_F(BSDiffMemoryTest, TestDifferentElfs) { 121 TEST_F(BSDiffMemoryTest, TestDifferentElfs) {
122 std::string file1 = FileContents("elf-32-1"); 122 std::string file1 = FileContents("elf-32-1");
123 std::string file2 = FileContents("elf-32-2"); 123 std::string file2 = FileContents("elf-32-2");
124 GenerateAndTestPatch(file1, file2); 124 GenerateAndTestPatch(file1, file2);
125 } 125 }
OLDNEW
« no previous file with comments | « content/test/layout_browsertest.cc ('k') | crypto/ec_private_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698