2021-09-11 12:40:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "test_pattern.hpp"
|
|
|
|
|
|
|
|
namespace hex::test {
|
|
|
|
|
2021-09-11 12:41:18 +00:00
|
|
|
class TestPatternPlacement : public TestPattern {
|
2021-09-11 12:40:53 +00:00
|
|
|
public:
|
2021-09-11 21:13:49 +00:00
|
|
|
TestPatternPlacement() : TestPattern("Placement") {
|
2021-09-11 12:41:18 +00:00
|
|
|
// placementVar
|
|
|
|
{
|
2021-09-12 18:28:32 +00:00
|
|
|
addPattern(create<PatternDataUnsigned>("u32", "placementVar", 0x00, sizeof(u32)));
|
2021-09-11 12:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// placementArray
|
|
|
|
{
|
2021-09-12 18:28:32 +00:00
|
|
|
auto placementArray = create<PatternDataStaticArray>("u8", "placementArray", 0x10, sizeof(u8) * 10);
|
|
|
|
placementArray->setEntries(create<PatternDataUnsigned>("u8", "", 0x10, sizeof(u8)), 10);
|
2021-09-11 12:41:18 +00:00
|
|
|
addPattern(placementArray);
|
|
|
|
}
|
|
|
|
|
2021-09-11 12:40:53 +00:00
|
|
|
}
|
2021-09-11 12:41:18 +00:00
|
|
|
~TestPatternPlacement() override = default;
|
2021-09-11 12:40:53 +00:00
|
|
|
|
|
|
|
[[nodiscard]]
|
|
|
|
std::string getSourceCode() const override {
|
|
|
|
return R"(
|
2021-09-11 12:41:18 +00:00
|
|
|
u32 placementVar @ 0x00;
|
|
|
|
u8 placementArray[10] @ 0x10;
|
2021-09-11 12:40:53 +00:00
|
|
|
)";
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|