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

Side by Side Diff: base/version_unittest.cc

Issue 985573003: Support 32-bit subversion fields in base::Version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename back Created 5 years, 9 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/version.h" 5 #include "base/version.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 25 matching lines...) Expand all
36 {"", 0, false}, 36 {"", 0, false},
37 {" ", 0, false}, 37 {" ", 0, false},
38 {"\t", 0, false}, 38 {"\t", 0, false},
39 {"\n", 0, false}, 39 {"\n", 0, false},
40 {" ", 0, false}, 40 {" ", 0, false},
41 {".", 0, false}, 41 {".", 0, false},
42 {" . ", 0, false}, 42 {" . ", 0, false},
43 {"0", 1, true}, 43 {"0", 1, true},
44 {"0.", 0, false}, 44 {"0.", 0, false},
45 {"0.0", 2, true}, 45 {"0.0", 2, true},
46 {"65537.0", 0, false}, 46 {"4294967295.0", 2, true},
47 {"4294967296.0", 0, false},
47 {"-1.0", 0, false}, 48 {"-1.0", 0, false},
48 {"1.-1.0", 0, false}, 49 {"1.-1.0", 0, false},
49 {"1,--1.0", 0, false}, 50 {"1,--1.0", 0, false},
50 {"+1.0", 0, false}, 51 {"+1.0", 0, false},
51 {"1.+1.0", 0, false}, 52 {"1.+1.0", 0, false},
52 {"1+1.0", 0, false}, 53 {"1+1.0", 0, false},
53 {"++1.0", 0, false}, 54 {"++1.0", 0, false},
54 {"1.0a", 0, false}, 55 {"1.0a", 0, false},
55 {"1.2.3.4.5.6.7.8.9.0", 10, true}, 56 {"1.2.3.4.5.6.7.8.9.0", 10, true},
56 {"02.1", 0, false}, 57 {"02.1", 0, false},
57 {"0.01", 2, true}, 58 {"0.01", 2, true},
58 {"f.1", 0, false}, 59 {"f.1", 0, false},
59 {"15.007.20011", 3, true}, 60 {"15.007.20011", 3, true},
61 {"15.5.28.130162", 4, true},
60 }; 62 };
61 63
62 for (size_t i = 0; i < arraysize(cases); ++i) { 64 for (size_t i = 0; i < arraysize(cases); ++i) {
63 Version version(cases[i].input); 65 Version version(cases[i].input);
64 EXPECT_EQ(cases[i].success, version.IsValid()); 66 EXPECT_EQ(cases[i].success, version.IsValid());
65 if (cases[i].success) 67 if (cases[i].success)
66 EXPECT_EQ(cases[i].parts, version.components().size()); 68 EXPECT_EQ(cases[i].parts, version.components().size());
67 } 69 }
68 } 70 }
69 71
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 {"*", false}, 141 {"*", false},
140 {"*.2", false}, 142 {"*.2", false},
141 }; 143 };
142 for (size_t i = 0; i < arraysize(cases); ++i) { 144 for (size_t i = 0; i < arraysize(cases); ++i) {
143 EXPECT_EQ(Version::IsValidWildcardString(cases[i].version), 145 EXPECT_EQ(Version::IsValidWildcardString(cases[i].version),
144 cases[i].expected) << cases[i].version << "?" << cases[i].expected; 146 cases[i].expected) << cases[i].version << "?" << cases[i].expected;
145 } 147 }
146 } 148 }
147 149
148 } // namespace 150 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698