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

Side by Side Diff: chrome/browser/sync/syncable/syncable_id_unittest.cc

Issue 194065: Initial commit of sync engine code to browser/sync.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixes to gtest include path, reverted syncapi. Created 11 years, 3 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/syncable/syncable_id.h"
6
7 #include <vector>
8
9 #include "chrome/test/sync/engine/test_id_factory.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 using std::vector;
13
14 namespace syncable {
15
16 using browser_sync::TestIdFactory;
17
18 class SyncableIdTest : public testing::Test { };
19
20 TEST(SyncableIdTest, TestIDCreation) {
21 vector<Id> v;
22 v.push_back(TestIdFactory::FromNumber(5));
23 v.push_back(TestIdFactory::FromNumber(1));
24 v.push_back(TestIdFactory::FromNumber(-5));
25 v.push_back(TestIdFactory::MakeLocal("A"));
26 v.push_back(TestIdFactory::MakeLocal("B"));
27 v.push_back(TestIdFactory::MakeServer("A"));
28 v.push_back(TestIdFactory::MakeServer("B"));
29 v.push_back(Id::CreateFromServerId("-5"));
30 v.push_back(Id::CreateFromClientString("A"));
31 v.push_back(Id::CreateFromServerId("A"));
32
33 for (vector<Id>::iterator i = v.begin(); i != v.end(); ++i) {
34 for (vector<Id>::iterator j = v.begin(); j != i; ++j) {
35 ASSERT_NE(*i, *j) << "mis equated two distinct ids";
36 }
37 ASSERT_EQ(*i, *i) << "self-equality failed";
38 Id copy1 = *i;
39 Id copy2 = *i;
40 ASSERT_EQ(copy1, copy2) << "equality after copy failed";
41 }
42 }
43
44 } // namespace syncable
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698