Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/plugin/InstancesTest.cpp

Issue 29330403: Issue #1467, #3397 - Rewrite the map from threads to tabs (Closed)
Left Patch Set: rebase / fix copyright year Created Feb. 8, 2016, 6:43 p.m.
Right Patch Set: add comment; new function body Created July 17, 2016, 4:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« src/plugin/Instances.h ('K') | « src/plugin/PluginWbPassThrough.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 11 matching lines...) Expand all
22 TEST(SyncMap, Instantiate) 22 TEST(SyncMap, Instantiate)
23 { 23 {
24 SyncMapOne s; 24 SyncMapOne s;
25 } 25 }
26 26
27 TEST(SyncMap, OrdinaryAdded) 27 TEST(SyncMap, OrdinaryAdded)
28 { 28 {
29 SyncMapOne s; 29 SyncMapOne s;
30 ASSERT_TRUE(s.AddIfAbsent(1, 11)); 30 ASSERT_TRUE(s.AddIfAbsent(1, 11));
31 ASSERT_TRUE(s.Locate(1) == 11); 31 ASSERT_TRUE(s.Locate(1) == 11);
32 ASSERT_TRUE(s.RemoveAndCheck(1)); 32 ASSERT_TRUE(s.RemoveIfPresent(1));
33 } 33 }
34 34
35 TEST(SyncMap, OrdinaryNotAdded1) 35 TEST(SyncMap, OrdinaryNotAdded1)
36 { 36 {
37 SyncMapOne s; 37 SyncMapOne s;
38 ASSERT_TRUE(s.Locate(1) == 0); 38 ASSERT_TRUE(s.Locate(1) == 0);
39 } 39 }
40 40
41 TEST(SyncMap, OrdinaryNotAdded2) 41 TEST(SyncMap, OrdinaryNotAdded2)
42 { 42 {
43 SyncMapOne s; 43 SyncMapOne s;
44 ASSERT_TRUE(s.AddIfAbsent(1, 11)); 44 ASSERT_TRUE(s.AddIfAbsent(1, 11));
45 ASSERT_TRUE(s.AddIfAbsent(2, 22)); 45 ASSERT_TRUE(s.AddIfAbsent(2, 22));
46 ASSERT_TRUE(s.Locate(7) == 0); 46 ASSERT_TRUE(s.Locate(7) == 0);
47 } 47 }
48 48
49 TEST(SyncMap, WrongAddedTwice) 49 TEST(SyncMap, WrongAddedTwice)
50 { 50 {
51 SyncMapOne s; 51 SyncMapOne s;
52 ASSERT_TRUE(s.AddIfAbsent(3, 11)); 52 ASSERT_TRUE(s.AddIfAbsent(3, 11));
53 ASSERT_FALSE(s.AddIfAbsent(3, 22)); 53 ASSERT_FALSE(s.AddIfAbsent(3, 22));
54 } 54 }
55 55
56 TEST(SyncMap, AcceptableAddedRemovedAddedAgain) 56 TEST(SyncMap, AcceptableAddedRemovedAddedAgain)
57 { 57 {
58 SyncMapOne s; 58 SyncMapOne s;
59 ASSERT_TRUE(s.AddIfAbsent(1, 11)); 59 ASSERT_TRUE(s.AddIfAbsent(1, 11));
60 ASSERT_TRUE(s.RemoveAndCheck(1)); 60 ASSERT_TRUE(s.RemoveIfPresent(1));
61 ASSERT_TRUE(s.AddIfAbsent(1, 22)); 61 ASSERT_TRUE(s.AddIfAbsent(1, 22));
62 } 62 }
63 63
64 TEST(SyncMap, WrongRemovedButNotAdded) 64 TEST(SyncMap, WrongRemovedButNotAdded)
65 { 65 {
66 SyncMapOne s; 66 SyncMapOne s;
67 ASSERT_FALSE(s.RemoveAndCheck(3)); 67 ASSERT_FALSE(s.RemoveIfPresent(3));
68 } 68 }
69 69
LEFTRIGHT

Powered by Google App Engine
This is Rietveld