OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "sync/api/attachments/attachment.h" | 5 #include "sync/api/attachments/attachment.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace syncer { | 11 namespace syncer { |
12 | 12 |
| 13 namespace { |
| 14 |
| 15 } // namespace |
| 16 |
13 class AttachmentIdTest : public testing::Test {}; | 17 class AttachmentIdTest : public testing::Test {}; |
14 | 18 |
15 TEST_F(AttachmentIdTest, Create_IsUnique) { | 19 TEST_F(AttachmentIdTest, Create_IsUnique) { |
16 AttachmentId id1 = AttachmentId::Create(0, 0); | 20 AttachmentId id1 = AttachmentId::Create(); |
17 AttachmentId id2 = AttachmentId::Create(0, 0); | 21 AttachmentId id2 = AttachmentId::Create(); |
18 EXPECT_NE(id1, id2); | 22 EXPECT_NE(id1, id2); |
19 } | 23 } |
20 | 24 |
21 TEST_F(AttachmentIdTest, OperatorEqual) { | 25 TEST_F(AttachmentIdTest, OperatorEqual) { |
22 AttachmentId id1 = AttachmentId::Create(0, 0); | 26 AttachmentId id1 = AttachmentId::Create(); |
23 AttachmentId id2(id1); | 27 AttachmentId id2(id1); |
24 EXPECT_EQ(id1, id2); | 28 EXPECT_EQ(id1, id2); |
25 } | 29 } |
26 | 30 |
27 TEST_F(AttachmentIdTest, OperatorLess) { | 31 TEST_F(AttachmentIdTest, OperatorLess) { |
28 AttachmentId id1 = AttachmentId::Create(0, 0); | 32 AttachmentId id1 = AttachmentId::Create(); |
29 EXPECT_FALSE(id1 < id1); | 33 EXPECT_FALSE(id1 < id1); |
30 | 34 |
31 AttachmentId id2 = AttachmentId::Create(0, 0); | 35 AttachmentId id2 = AttachmentId::Create(); |
32 EXPECT_FALSE(id1 < id1); | 36 EXPECT_FALSE(id1 < id1); |
33 | 37 |
34 EXPECT_NE(id1, id2); | 38 EXPECT_NE(id1, id2); |
35 if (id1 < id2) { | 39 if (id1 < id2) { |
36 EXPECT_FALSE(id2 < id1); | 40 EXPECT_FALSE(id2 < id1); |
37 } else { | 41 } else { |
38 EXPECT_TRUE(id2 < id1); | 42 EXPECT_TRUE(id2 < id1); |
39 } | 43 } |
40 } | 44 } |
41 | 45 |
42 } // namespace syncer | 46 } // namespace syncer |
OLD | NEW |