summaryrefslogtreecommitdiffstats
path: root/sync/api/attachments/attachment_id_unittest.cc
blob: dae5182e708f61d8b11b770b9f564cb9d17abaf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "sync/api/attachments/attachment.h"

#include <string>

#include "testing/gtest/include/gtest/gtest.h"

namespace syncer {

class AttachmentIdTest : public testing::Test {};

TEST_F(AttachmentIdTest, Create_IsUnique) {
  AttachmentId id1 = AttachmentId::Create(0, 0);
  AttachmentId id2 = AttachmentId::Create(0, 0);
  EXPECT_NE(id1, id2);
}

TEST_F(AttachmentIdTest, OperatorEqual) {
  AttachmentId id1 = AttachmentId::Create(0, 0);
  AttachmentId id2(id1);
  EXPECT_EQ(id1, id2);
}

TEST_F(AttachmentIdTest, OperatorLess) {
  AttachmentId id1 = AttachmentId::Create(0, 0);
  EXPECT_FALSE(id1 < id1);

  AttachmentId id2 = AttachmentId::Create(0, 0);
  EXPECT_FALSE(id1 < id1);

  EXPECT_NE(id1, id2);
  if (id1 < id2) {
    EXPECT_FALSE(id2 < id1);
  } else {
    EXPECT_TRUE(id2 < id1);
  }
}

}  // namespace syncer