OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <sys/stat.h> | 5 #include <sys/stat.h> |
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 118 } |
119 | 119 |
120 TEST(UtilsTest, TempFilenameTest) { | 120 TEST(UtilsTest, TempFilenameTest) { |
121 const string original = "/foo.XXXXXX"; | 121 const string original = "/foo.XXXXXX"; |
122 const string result = utils::TempFilename(original); | 122 const string result = utils::TempFilename(original); |
123 EXPECT_EQ(original.size(), result.size()); | 123 EXPECT_EQ(original.size(), result.size()); |
124 EXPECT_TRUE(utils::StringHasPrefix(result, "/foo.")); | 124 EXPECT_TRUE(utils::StringHasPrefix(result, "/foo.")); |
125 EXPECT_FALSE(utils::StringHasSuffix(result, "XXXXXX")); | 125 EXPECT_FALSE(utils::StringHasSuffix(result, "XXXXXX")); |
126 } | 126 } |
127 | 127 |
| 128 TEST(UtilsTest, RootDeviceTest) { |
| 129 EXPECT_EQ("/dev/sda", utils::RootDevice("/dev/sda3")); |
| 130 EXPECT_EQ("/dev/mmc0", utils::RootDevice("/dev/mmc0p3")); |
| 131 } |
| 132 |
| 133 TEST(UtilsTest, PartitionNumberTest) { |
| 134 EXPECT_EQ("3", utils::PartitionNumber("/dev/sda3")); |
| 135 EXPECT_EQ("3", utils::PartitionNumber("/dev/mmc0p3")); |
| 136 } |
| 137 |
128 } // namespace chromeos_update_engine | 138 } // namespace chromeos_update_engine |
OLD | NEW |