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

Side by Side Diff: base/version_unittest.cc

Issue 7541015: Add a convenience function to Version (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « base/version.cc ('k') | no next file » | 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/version.h" 6 #include "base/version.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 class VersionTest : public testing::Test { 9 class VersionTest : public testing::Test {
10 }; 10 };
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 {"1.1", "1.0.1", 1}, 78 {"1.1", "1.0.1", 1},
79 {"1.1", "1.0.1", 1}, 79 {"1.1", "1.0.1", 1},
80 {"1.0.0", "1.0", 0}, 80 {"1.0.0", "1.0", 0},
81 {"1.0.3", "1.0.20", -1}, 81 {"1.0.3", "1.0.20", -1},
82 }; 82 };
83 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { 83 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
84 scoped_ptr<Version> lhs(Version::GetVersionFromString(cases[i].lhs)); 84 scoped_ptr<Version> lhs(Version::GetVersionFromString(cases[i].lhs));
85 scoped_ptr<Version> rhs(Version::GetVersionFromString(cases[i].rhs)); 85 scoped_ptr<Version> rhs(Version::GetVersionFromString(cases[i].rhs));
86 EXPECT_EQ(lhs->CompareTo(*rhs), cases[i].expected) << 86 EXPECT_EQ(lhs->CompareTo(*rhs), cases[i].expected) <<
87 cases[i].lhs << " ? " << cases[i].rhs; 87 cases[i].lhs << " ? " << cases[i].rhs;
88
89 EXPECT_EQ(lhs->IsOlderThan(cases[i].rhs), (cases[i].expected == -1));
88 } 90 }
89 } 91 }
OLDNEW
« no previous file with comments | « base/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698