Skip to content
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

Merged
merged 1 commit into from
Aug 16, 2023
Merged

Add testing for vk_enum_string_helper.h #63

merged 1 commit into from
Aug 16, 2023

Conversation

juan-lunarg
Copy link
Contributor

Use magic_enum to test vk_enum_string_helper.h

closes #46

Comment on lines +13 to +20
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);
}
Copy link
Contributor Author

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
Copy link
Contributor

@spencer-lunarg spencer-lunarg left a 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
Copy link
Contributor

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

Copy link
Contributor Author

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.

@juan-lunarg juan-lunarg merged commit 6999ef9 into KhronosGroup:main Aug 16, 2023
10 checks passed
@juan-lunarg juan-lunarg deleted the juan/46 branch August 16, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add testing for vk_enum_string_helper.h
2 participants