MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / TEST

Function TEST

Testing/OpenNITester/ListTests.cpp:124–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124TEST(ListTests, TestAll)
125{
126 static TestStruct sValues[] =
127 {
128 { 1, 1.1 },
129 { 2, 2.2 },
130 { 3, 3.3 },
131 { 4, 4.4 },
132 };
133
134 // test empty
135 TestList list;
136 TestCurrentListState(list, 0, NULL);
137
138 // test Clear() when empty
139 ASSERT_EQ(list.Clear(), XN_STATUS_OK);
140 TestCurrentListState(list, 0, NULL);
141
142 // make sure AddBefore and AddAfter fail when receiving End()
143 ASSERT_EQ(list.AddBefore(list.End(), sValues[0]), XN_STATUS_ILLEGAL_POSITION);
144 ASSERT_EQ(list.AddAfter(list.End(), sValues[0]), XN_STATUS_ILLEGAL_POSITION);
145
146 // test AddLast when empty
147 ASSERT_EQ(list.AddLast(sValues[0]), XN_STATUS_OK);
148 TestCurrentListState(list, 1, sValues);
149
150 // test Clear when only one
151 ASSERT_EQ(list.Clear(), XN_STATUS_OK);
152 TestCurrentListState(list, 0, NULL);
153
154 // test AddFirst when empty
155 ASSERT_EQ(list.AddFirst(sValues[2]), XN_STATUS_OK);
156 TestCurrentListState(list, 1, sValues + 2);
157
158 // test AddFirst when having one
159 ASSERT_EQ(list.AddFirst(sValues[1]), XN_STATUS_OK);
160 TestCurrentListState(list, 2, sValues + 1);
161
162 // test AddBefore in the beginning
163 ASSERT_EQ(list.AddBefore(list.Begin(), sValues[0]), XN_STATUS_OK);
164 TestCurrentListState(list, 3, sValues);
165
166 // test Remove by value
167 ASSERT_EQ(list.Remove(sValues[1]), XN_STATUS_OK);
168 TestStruct aTemp[] =
169 {
170 sValues[0],
171 sValues[2]
172 };
173 TestCurrentListState(list, 2, aTemp);
174
175 // and Remove by iterator
176 ASSERT_EQ(list.Remove(++list.Begin()), XN_STATUS_OK);
177 TestCurrentListState(list, 1, sValues);
178
179 // test AddLast when having one
180 ASSERT_EQ(list.AddLast(sValues[1]), XN_STATUS_OK);
181 TestCurrentListState(list, 2, sValues);

Callers

nothing calls this directly

Calls 11

TestCurrentListStateFunction · 0.85
ReverseBeginMethod · 0.80
ClearMethod · 0.45
AddBeforeMethod · 0.45
EndMethod · 0.45
AddAfterMethod · 0.45
AddLastMethod · 0.45
AddFirstMethod · 0.45
BeginMethod · 0.45
RemoveMethod · 0.45
FindMethod · 0.45

Tested by

no test coverage detected