2023-05-26 17:57:26 +01:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "oi/ContainerInfo.h"
|
|
|
|
|
|
|
|
TEST(ContainerInfoTest, matcher) {
|
|
|
|
ContainerInfo info{"std::vector", SEQ_TYPE, "vector"};
|
|
|
|
|
2024-01-23 18:15:43 +00:00
|
|
|
EXPECT_TRUE(info.matches("std::vector<int>"));
|
|
|
|
EXPECT_TRUE(info.matches("std::vector<std::list<int>>"));
|
|
|
|
EXPECT_TRUE(info.matches("std::vector"));
|
2023-05-26 17:57:26 +01:00
|
|
|
|
2024-01-23 18:15:43 +00:00
|
|
|
EXPECT_FALSE(info.matches("vector"));
|
|
|
|
EXPECT_FALSE(info.matches("non_std::vector<int>"));
|
|
|
|
EXPECT_FALSE(info.matches("std::vector_other<int>"));
|
|
|
|
EXPECT_FALSE(info.matches("std::list<std::vector<int>>"));
|
|
|
|
EXPECT_FALSE(info.matches("std::vector::value_type"));
|
|
|
|
EXPECT_FALSE(info.matches("std::vector<int>::value_type"));
|
|
|
|
EXPECT_FALSE(info.matches("std::vector<std::vector<int>>::value_type"));
|
2023-05-26 17:57:26 +01:00
|
|
|
// Uh-oh, here's a case that I don't think regexes are powerful enough to
|
2024-01-23 18:15:43 +00:00
|
|
|
// match: EXPECT_FALSE(info.matches("std::vector<int>::subtype<bool>"));
|
2023-05-26 17:57:26 +01:00
|
|
|
}
|