1
0
mirror of synced 2024-12-04 12:07:57 +01:00
ImHex/tests/include/test_patterns/test_pattern_enums.hpp
2021-09-12 20:29:05 +02:00

38 lines
911 B
C++

#pragma once
#include "test_pattern.hpp"
namespace hex::test {
class TestPatternEnums : public TestPattern {
public:
TestPatternEnums() : TestPattern("Enums"){
auto testEnum = create<PatternDataEnum>("TestEnum", "testEnum", 0x120, sizeof(u32));
testEnum->setEnumValues({
{ s32(0x0000), "A" },
{ s32(0x1234), "B" },
{ s32(0x1235), "C" },
{ s32(0x1236), "D" },
});
addPattern(testEnum);
}
~TestPatternEnums() override = default;
[[nodiscard]]
std::string getSourceCode() const override {
return R"(
enum TestEnum : u32 {
A,
B = 0x1234,
C,
D
};
TestEnum testEnum @ 0x120;
)";
}
};
}