Skip to content

Commit 074d364

Browse files
committed
Add missing PointViewCollection tests
1 parent a464faa commit 074d364

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

tests/pdal/capi/PointViewCollectionTest.c

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void PDALPointViewCollectionTestTeardown(void *arg)
4141
PDALDisposePointViewCollection(gPointViewCollection);
4242
}
4343

44-
TEST PDALHasNextPointViewTest(void)
44+
TEST testPDALHasNextPointView(void)
4545
{
4646
bool hasNext = PDALHasNextPointView(NULL);
4747
ASSERT_FALSE(hasNext);
@@ -53,12 +53,60 @@ TEST PDALHasNextPointViewTest(void)
5353
PASS();
5454
}
5555

56+
TEST testPDALNextPointView(void)
57+
{
58+
ASSERT_FALSE(gPointViewCollection == NULL);
59+
bool hasNext = PDALHasNextPointView(gPointViewCollection);
60+
ASSERT_FALSE(!hasNext);
61+
62+
PDALPointViewPtr view = PDALGetNextPointView(gPointViewCollection);
63+
ASSERT_FALSE(view == NULL);
64+
65+
if (PDALHasNextPointView(gPointViewCollection))
66+
{
67+
PDALPointViewPtr anotherView = PDALGetNextPointView(gPointViewCollection);
68+
ASSERT_FALSE(anotherView == NULL);
69+
ASSERT_FALSE(anotherView == view);
70+
}
71+
72+
PASS();
73+
}
74+
75+
TEST testPDALResetPointViewCollection(void)
76+
{
77+
ASSERT_FALSE(gPointViewCollection == NULL);
78+
bool hasNext = PDALHasNextPointView(gPointViewCollection);
79+
ASSERT_FALSE(!hasNext);
80+
81+
PDALPointViewPtr view = PDALGetNextPointView(gPointViewCollection);
82+
ASSERT_FALSE(view == NULL);
83+
84+
while (PDALHasNextPointView(gPointViewCollection))
85+
{
86+
PDALPointViewPtr anotherView = PDALGetNextPointView(gPointViewCollection);
87+
ASSERT_FALSE(anotherView == NULL);
88+
ASSERT_FALSE(anotherView == view);
89+
}
90+
91+
view = PDALGetNextPointView(gPointViewCollection);
92+
ASSERT_EQ(NULL, view);
93+
94+
PDALResetPointViewCollection(gPointViewCollection);
95+
96+
view = PDALGetNextPointView(gPointViewCollection);
97+
ASSERT_FALSE(view == NULL);
98+
99+
PASS();
100+
}
101+
56102
GREATEST_SUITE(PointViewCollectionTest)
57103
{
58104
SET_SETUP(PDALPointViewCollectionTestSetup, NULL);
59105
SET_TEARDOWN(PDALPointViewCollectionTestTeardown, NULL);
60106

61-
RUN_TEST(PDALHasNextPointViewTest);
107+
RUN_TEST(testPDALHasNextPointView);
108+
RUN_TEST(testPDALNextPointView);
109+
RUN_TEST(testPDALResetPointViewCollection);
62110

63111
SET_SETUP(NULL, NULL);
64112
SET_TEARDOWN(NULL, NULL);

0 commit comments

Comments
 (0)