-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add testing for vk_enum_string_helper.h #63
Conversation
constexpr auto values = magic_enum::enum_values<VkResult>(); | ||
for (auto val : values) { | ||
auto magic_str = magic_enum::enum_name(val); | ||
|
||
auto str = string_VkResult(val); | ||
|
||
EXPECT_STREQ(magic_str.data(), str); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/Neargye/magic_enum#examples
magic_enum makes testing these functions quite easy.
Note I didn't add testing for each enum possible. I just picked a few significant ones. Since we are mainly testing the code generation above anything else.
Use magic_enum to test vk_enum_string_helper.h closes #46
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initial reaction: we are grabbing another 3rd party library just to test one of the easier code gen code
after thinking more:
- its a header only dep (less worry about compiling)
- its only for testing, so people need to opt-in to this anyway
- we should have "some" tests
@@ -31,20 +31,6 @@ def generate(self): | |||
#include <vulkan/vulkan.h> | |||
''') | |||
|
|||
# TODO - this should be moved into different generated util file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... can take action now to move this in VVL so it doesn't break when we switch over to VUL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial thought is that VVL will use an internal only vk_enum_string_helper.hpp
Since I want to make vk_enum_string_helper.h C compatible.
Use magic_enum to test vk_enum_string_helper.h
closes #46