2022-12-19 14:37:51 +00:00
|
|
|
includes = ["vector"]
|
|
|
|
definitions = '''
|
|
|
|
namespace MyNS {
|
|
|
|
enum class ScopedEnum {
|
|
|
|
Zero = 0,
|
|
|
|
One = 1,
|
|
|
|
Two = 2,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum UNSCOPED_ENUM {
|
|
|
|
ZERO = 0,
|
|
|
|
ONE = 1,
|
|
|
|
TWO = 2,
|
|
|
|
};
|
2023-06-23 16:56:39 +01:00
|
|
|
|
|
|
|
enum class EnumWithGaps {
|
|
|
|
Five = 5,
|
|
|
|
MinusTwo = -2,
|
|
|
|
Twenty = 20,
|
|
|
|
};
|
2022-12-19 14:37:51 +00:00
|
|
|
} // MyNS
|
2023-06-23 16:56:39 +01:00
|
|
|
|
|
|
|
template <MyNS::ScopedEnum val>
|
|
|
|
class MyClass {
|
|
|
|
int n;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <MyNS::EnumWithGaps val>
|
|
|
|
class ClassGaps {
|
|
|
|
int n;
|
|
|
|
};
|
2022-12-19 14:37:51 +00:00
|
|
|
'''
|
|
|
|
|
|
|
|
[cases]
|
|
|
|
[cases.scoped_enum_type]
|
|
|
|
param_types = ["const std::vector<MyNS::ScopedEnum>&"]
|
|
|
|
setup = "return {};"
|
2023-06-23 16:56:39 +01:00
|
|
|
[cases.scoped_enum_val_cast]
|
2022-12-19 14:37:51 +00:00
|
|
|
param_types = ["const std::array<int, static_cast<size_t>(MyNS::ScopedEnum::Two)>&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '[{"staticSize":8, "dynamicSize":0, "length":2, "capacity":2, "elementStaticSize":4}]'
|
2023-06-23 16:56:39 +01:00
|
|
|
|
|
|
|
[cases.scoped_enum_val]
|
|
|
|
param_types = ["const MyClass<MyNS::ScopedEnum::One>&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '[{"staticSize":4, "dynamicSize":0, "exclusiveSize":0}]'
|
|
|
|
[cases.scoped_enum_val_gaps]
|
|
|
|
param_types = ["const ClassGaps<MyNS::EnumWithGaps::Twenty>&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '[{"staticSize":4, "dynamicSize":0, "exclusiveSize":0}]'
|
|
|
|
[cases.scoped_enum_val_negative]
|
|
|
|
param_types = ["const ClassGaps<MyNS::EnumWithGaps::MinusTwo>&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '[{"staticSize":4, "dynamicSize":0, "exclusiveSize":0}]'
|
|
|
|
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.unscoped_enum_type]
|
|
|
|
param_types = ["const std::vector<MyNS::UNSCOPED_ENUM>&"]
|
|
|
|
setup = "return {};"
|
2023-06-23 16:56:39 +01:00
|
|
|
[cases.unscoped_enum_val_cast]
|
2022-12-19 14:37:51 +00:00
|
|
|
param_types = ["const std::array<int, MyNS::ONE>&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '[{"staticSize":4, "dynamicSize":0, "length":1, "capacity":1, "elementStaticSize":4}]'
|