| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |