Skip to content

Commit

Permalink
more tests for enums
Browse files Browse the repository at this point in the history
- added test also for ColorSpace
  • Loading branch information
kalwalt committed Oct 24, 2023
1 parent c17486d commit f60f661
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions tests/webarkit_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@
#include <WebARKitManager.h>
#include <WebARKitTrackers/WebARKitOpticalTracking/WebARKitEnums.h>

class WebARKitEnumTest : public testing::TestWithParam<webarkit::TRACKER_TYPE> {};
class WebARKitEnumTest : public testing::TestWithParam<std::tuple<webarkit::TRACKER_TYPE, webarkit::ColorSpace>> {};


TEST_P(WebARKitEnumTest, TestEnumValues) {
webarkit::TRACKER_TYPE value = GetParam();
EXPECT_TRUE(value == webarkit::TRACKER_TYPE::AKAZE_TRACKER ||
value == webarkit::TRACKER_TYPE::ORB_TRACKER ||
value == webarkit::TRACKER_TYPE::FREAK_TRACKER);
webarkit::TRACKER_TYPE tracker_value = std::get<0>(GetParam());
webarkit::ColorSpace color_value = std::get<1>(GetParam());
EXPECT_TRUE(tracker_value == webarkit::TRACKER_TYPE::AKAZE_TRACKER ||
tracker_value == webarkit::TRACKER_TYPE::ORB_TRACKER ||
tracker_value == webarkit::TRACKER_TYPE::FREAK_TRACKER ||
tracker_value == webarkit::TRACKER_TYPE::TEBLID_TRACKER);
EXPECT_TRUE(color_value == webarkit::ColorSpace::RGB ||
color_value == webarkit::ColorSpace::RGBA ||
color_value == webarkit::ColorSpace::GRAY);
}

INSTANTIATE_TEST_SUITE_P(WebARKitEnumTestSuite, WebARKitEnumTest,
testing::ValuesIn({webarkit::TRACKER_TYPE::AKAZE_TRACKER,
webarkit::TRACKER_TYPE::ORB_TRACKER,
webarkit::TRACKER_TYPE::FREAK_TRACKER}));

testing::Combine(testing::ValuesIn({webarkit::TRACKER_TYPE::AKAZE_TRACKER,
webarkit::TRACKER_TYPE::ORB_TRACKER,
webarkit::TRACKER_TYPE::FREAK_TRACKER,
webarkit::TRACKER_TYPE::TEBLID_TRACKER}),
testing::ValuesIn({webarkit::ColorSpace::RGB,
webarkit::ColorSpace::RGBA,
webarkit::ColorSpace::GRAY})));

// Check WebARKitManager initialisation.
TEST(WebARKitTest, InitialiseBaseTest) {
Expand Down

0 comments on commit f60f661

Please sign in to comment.