Negative test for SourceLanguage.

Also, use "class" instead of "type" in the coverage CSV.
This commit is contained in:
Dejan Mircevski 2015-10-09 11:06:10 -04:00 коммит произвёл David Neto
Родитель f6b865110c
Коммит d2c81cf34a
3 изменённых файлов: 12 добавлений и 6 удалений

Просмотреть файл

@ -1520,7 +1520,7 @@ const char* spvOperandTypeStr(spv_operand_type_t type) {
case SPV_OPERAND_TYPE_LITERAL_STRING:
return "literal string";
case SPV_OPERAND_TYPE_SOURCE_LANGUAGE:
return "source langauge";
return "source language";
case SPV_OPERAND_TYPE_EXECUTION_MODEL:
return "execution model";
case SPV_OPERAND_TYPE_ADDRESSING_MODEL:

Просмотреть файл

@ -73,14 +73,20 @@ using OpSourceTest =
TEST_P(OpSourceTest, AnyLanguage) {
std::string input = std::string("OpSource ") + GetParam().language_name +
" " + std::to_string(GetParam().version);
EXPECT_THAT(CompiledInstructions(input),
Eq(MakeInstruction(spv::OpSource, {GetParam().get_language_value(),
GetParam().version})));
EXPECT_THAT(
CompiledInstructions(input),
Eq(MakeInstruction(spv::OpSource, {GetParam().get_language_value(),
GetParam().version})));
}
INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceTest,
::testing::ValuesIn(kLanguageCases));
TEST_F(OpSourceTest, WrongLanguage) {
EXPECT_THAT(CompileFailure("OpSource xxyyzz 12345"),
Eq("Invalid source language 'xxyyzz'."));
}
TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalFileId) {
// In the grammar, the file id is an OperandOptionalId.
std::string input = "OpSource GLSL 450 %file_id";

Просмотреть файл

@ -1,4 +1,4 @@
Operand type,Example instruction,Notes,example unit test
Operand class,Example instruction,Notes,example unit test
,,,
,,,
" OperandNone,",UNUSED,not in grammar,
@ -42,4 +42,4 @@ Operand type,Example instruction,Notes,example unit test
" OperandGroupOperation,",GroupIAdd,,GroupOperationTest
" OperandKernelEnqueueFlags,",OpEnqueueKernel,"it's an ID, not in grammar",should not have one
" OperandKernelProfilingInfo,",OpCaptureEventProfilingInfo,"it's an ID, not in grammar",should not have one
" OperandCapability,",Capability,,OpCapabilityTest
" OperandCapability,",Capability,,OpCapabilityTest

1 Operand type Operand class Example instruction Notes example unit test
2
3
4 OperandNone, UNUSED not in grammar
42 OperandGroupOperation, GroupIAdd GroupOperationTest
43 OperandKernelEnqueueFlags, OpEnqueueKernel it's an ID, not in grammar should not have one
44 OperandKernelProfilingInfo, OpCaptureEventProfilingInfo it's an ID, not in grammar should not have one
45 OperandCapability, Capability OpCapabilityTest