-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #740.
- Loading branch information
Császár Mátyás
authored
Jul 17, 2023
1 parent
3153e94
commit 1ae04f8
Showing
5 changed files
with
62 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* -*- tab-width: 4; -*- */ | ||
/* vi: set sw=2 ts=4 expandtab: */ | ||
// Copyright 2022-2023 The Khronos Group Inc. | ||
// Copyright 2022-2023 RasterGrid Kft. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "vkformat_enum.h" | ||
#include "gtest/gtest.h" | ||
|
||
|
||
extern "C" { | ||
VkFormat stringToVkFormat(const char* str); | ||
} | ||
|
||
// ------------------------------------------------------------------------------------------------- | ||
|
||
class StringToVkFormatTest : public ::testing::Test { | ||
protected: | ||
StringToVkFormatTest() {} | ||
}; | ||
|
||
// ------------------------------------------------------------------------------------------------- | ||
|
||
namespace { | ||
|
||
TEST_F(StringToVkFormatTest, stringToVkFormat) { | ||
EXPECT_EQ(stringToVkFormat("UNDEFINED"), VK_FORMAT_UNDEFINED); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_UNDEFINED"), VK_FORMAT_UNDEFINED); | ||
EXPECT_EQ(stringToVkFormat("Not a format"), VK_FORMAT_UNDEFINED); | ||
|
||
EXPECT_EQ(stringToVkFormat("R4G4_UNORM_PACK8"), VK_FORMAT_R4G4_UNORM_PACK8); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_R4G4_UNORM_PACK8"), VK_FORMAT_R4G4_UNORM_PACK8); | ||
|
||
EXPECT_EQ(stringToVkFormat("R8G8B8_UNORM"), VK_FORMAT_R8G8B8_UNORM); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_R8G8B8_UNORM"), VK_FORMAT_R8G8B8_UNORM); | ||
EXPECT_EQ(stringToVkFormat("R8G8B8_SNORM"), VK_FORMAT_R8G8B8_SNORM); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_R8G8B8_SNORM"), VK_FORMAT_R8G8B8_SNORM); | ||
|
||
EXPECT_EQ(stringToVkFormat("ASTC_6x6_UNORM_BLOCK"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
EXPECT_EQ(stringToVkFormat("ASTC_6X6_UNORM_BLOCK"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
EXPECT_EQ(stringToVkFormat("astc_6x6_unorm_block"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_ASTC_6x6_UNORM_BLOCK"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_ASTC_6X6_UNORM_BLOCK"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_ASTC_6X6_UNORM_BLOCK"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
EXPECT_EQ(stringToVkFormat("vk_format_astc_6x6_unorm_block"), VK_FORMAT_ASTC_6x6_UNORM_BLOCK); | ||
|
||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_ASTC_6x6_UNORM"), VK_FORMAT_UNDEFINED); | ||
EXPECT_EQ(stringToVkFormat("VK_FORMAT_ASTC_6x6_UNORM_BLOC"), VK_FORMAT_UNDEFINED); | ||
EXPECT_EQ(stringToVkFormat("K_FORMAT_ASTC_6x6_UNORM_BLOCK"), VK_FORMAT_UNDEFINED); | ||
EXPECT_EQ(stringToVkFormat("_ASTC_6x6_UNORM_BLOCK"), VK_FORMAT_UNDEFINED); | ||
EXPECT_EQ(stringToVkFormat("STC_6x6_UNORM_BLOCK"), VK_FORMAT_UNDEFINED); | ||
} | ||
|
||
} // namespace |