mirror of
https://github.com/xenia-project/SPIRV-Tools.git
synced 2024-11-27 13:10:32 +00:00
Move ImmediateInt tests into their own file.
This is in preparation of adding many more tests in accordance with the evolved spec. Also sort the test-source lines in CMakeLists.
This commit is contained in:
parent
95ec7284f7
commit
f184109d7b
@ -159,23 +159,24 @@ if (TARGET gtest)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryEndianness.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryHeaderGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryToText.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ExtInstGLSLstd450.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Comment.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/DiagnosticPrint.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ExtInstGLSLstd450.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/FixWord.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ImmediateInt.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/LibspirvMacros.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/NamedId.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeTableGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeIsVariable.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeRequiresCapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeMake.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeRequiresCapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeSplit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeTableGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OperandTableGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextAdvance.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextLiteral.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextWordGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/DiagnosticPrint.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextLiteral.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextWordGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ValidateID.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/main.cpp)
|
||||
|
55
test/ImmediateInt.cpp
Normal file
55
test/ImmediateInt.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright (c) 2015 The Khronos Group Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and/or associated documentation files (the
|
||||
// "Materials"), to deal in the Materials without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
// permit persons to whom the Materials are furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Materials.
|
||||
//
|
||||
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
// https://www.khronos.org/registry/
|
||||
//
|
||||
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
#include "TestFixture.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using test_fixture::TextToBinaryTest;
|
||||
|
||||
TEST_F(TextToBinaryTest, ImmediateIntOpCode) {
|
||||
SetText("!0x00FF00FF");
|
||||
ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(&text, opcodeTable, operandTable,
|
||||
extInstTable, &binary, &diagnostic));
|
||||
EXPECT_EQ(0x00FF00FF, binary->code[5]);
|
||||
spvBinaryDestroy(binary);
|
||||
if (diagnostic) {
|
||||
spvDiagnosticPrint(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TextToBinaryTest, ImmediateIntOperand) {
|
||||
SetText("OpCapability !0x00FF00FF");
|
||||
EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(&text, opcodeTable, operandTable,
|
||||
extInstTable, &binary, &diagnostic));
|
||||
EXPECT_EQ(0x00FF00FF, binary->code[6]);
|
||||
spvBinaryDestroy(binary);
|
||||
if (diagnostic) {
|
||||
spvDiagnosticPrint(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
@ -255,28 +255,6 @@ TEST_F(TextToBinaryTest, InvalidPrefix) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TextToBinaryTest, ImmediateIntOpCode) {
|
||||
SetText("!0x00FF00FF");
|
||||
ASSERT_EQ(SPV_SUCCESS, spvTextToBinary(&text, opcodeTable, operandTable,
|
||||
extInstTable, &binary, &diagnostic));
|
||||
EXPECT_EQ(0x00FF00FF, binary->code[5]);
|
||||
spvBinaryDestroy(binary);
|
||||
if (diagnostic) {
|
||||
spvDiagnosticPrint(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TextToBinaryTest, ImmediateIntOperand) {
|
||||
SetText("OpCapability !0x00FF00FF");
|
||||
EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(&text, opcodeTable, operandTable,
|
||||
extInstTable, &binary, &diagnostic));
|
||||
EXPECT_EQ(0x00FF00FF, binary->code[6]);
|
||||
spvBinaryDestroy(binary);
|
||||
if (diagnostic) {
|
||||
spvDiagnosticPrint(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(TextToBinaryTest, StringSpace) {
|
||||
SetText("OpSourceExtension \"string with spaces\"");
|
||||
EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(&text, opcodeTable, operandTable,
|
||||
|
Loading…
Reference in New Issue
Block a user