Lines Matching refs:tree

26 // Tests for the red-black tree class.
50 PODRedBlackTree<int> tree(arena);
53 tree.add(i);
61 PODRedBlackTree<int> tree;
62 tree.add(5);
63 ASSERT_TRUE(tree.checkInvariants());
64 EXPECT_TRUE(tree.contains(5));
69 PODRedBlackTree<int> tree;
70 tree.add(4);
71 ASSERT_TRUE(tree.checkInvariants());
72 EXPECT_TRUE(tree.contains(4));
73 tree.add(3);
74 ASSERT_TRUE(tree.checkInvariants());
75 EXPECT_TRUE(tree.contains(3));
76 tree.add(5);
77 ASSERT_TRUE(tree.checkInvariants());
78 EXPECT_TRUE(tree.contains(5));
79 EXPECT_TRUE(tree.contains(4));
80 EXPECT_TRUE(tree.contains(3));
85 PODRedBlackTree<int> tree;
86 tree.add(3);
87 ASSERT_TRUE(tree.checkInvariants());
88 tree.add(3);
89 ASSERT_TRUE(tree.checkInvariants());
90 tree.add(3);
91 ASSERT_TRUE(tree.checkInvariants());
92 EXPECT_EQ(3, tree.size());
93 EXPECT_TRUE(tree.contains(3));
98 PODRedBlackTree<int> tree;
99 tree.add(5);
100 ASSERT_TRUE(tree.checkInvariants());
101 EXPECT_TRUE(tree.contains(5));
102 tree.remove(5);
103 ASSERT_TRUE(tree.checkInvariants());
104 EXPECT_FALSE(tree.contains(5));
109 PODRedBlackTree<int> tree;
110 tree.add(4);
111 ASSERT_TRUE(tree.checkInvariants());
112 EXPECT_TRUE(tree.contains(4));
113 tree.add(3);
114 ASSERT_TRUE(tree.checkInvariants());
115 EXPECT_TRUE(tree.contains(3));
116 tree.add(5);
117 ASSERT_TRUE(tree.checkInvariants());
118 EXPECT_TRUE(tree.contains(5));
119 EXPECT_TRUE(tree.contains(4));
120 EXPECT_TRUE(tree.contains(3));
121 tree.remove(4);
122 ASSERT_TRUE(tree.checkInvariants());
123 EXPECT_TRUE(tree.contains(3));
124 EXPECT_FALSE(tree.contains(4));
125 EXPECT_TRUE(tree.contains(5));
126 tree.remove(5);
127 ASSERT_TRUE(tree.checkInvariants());
128 EXPECT_TRUE(tree.contains(3));
129 EXPECT_FALSE(tree.contains(4));
130 EXPECT_FALSE(tree.contains(5));
131 EXPECT_EQ(1, tree.size());
136 PODRedBlackTree<int> tree;
137 tree.add(3);
138 ASSERT_TRUE(tree.checkInvariants());
139 tree.add(3);
140 ASSERT_TRUE(tree.checkInvariants());
141 tree.add(3);
142 ASSERT_TRUE(tree.checkInvariants());
143 EXPECT_EQ(3, tree.size());
144 EXPECT_TRUE(tree.contains(3));
145 tree.remove(3);
146 ASSERT_TRUE(tree.checkInvariants());
147 tree.remove(3);
148 ASSERT_TRUE(tree.checkInvariants());
149 EXPECT_EQ(1, tree.size());
150 EXPECT_TRUE(tree.contains(3));
151 tree.remove(3);
152 ASSERT_TRUE(tree.checkInvariants());
153 EXPECT_EQ(0, tree.size());
154 EXPECT_FALSE(tree.contains(3));
160 PODRedBlackTree<int> tree;
161 tree.add(5113);
162 ASSERT_TRUE(tree.checkInvariants());
163 tree.add(4517);
164 ASSERT_TRUE(tree.checkInvariants());
165 tree.add(3373);
166 ASSERT_TRUE(tree.checkInvariants());
167 tree.add(9307);
168 ASSERT_TRUE(tree.checkInvariants());
169 tree.add(7077);
170 ASSERT_TRUE(tree.checkInvariants());
178 // Build the tree.
179 PODRedBlackTree<int> tree;
183 tree.add(value);
184 ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
187 // Churn the tree's contents.
193 tree.remove(value);
194 ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;
198 tree.add(value);
199 ASSERT_TRUE(tree.checkInvariants()) << "Test failed for seed " << seed;