Also, use "class" instead of "type" in the coverage CSV.
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:
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";
-Operand type,Example instruction,Notes,example unit test\r
+Operand class,Example instruction,Notes,example unit test\r
,,,\r
,,,\r
" OperandNone,",UNUSED,not in grammar,\r
" OperandGroupOperation,",GroupIAdd,,GroupOperationTest\r
" OperandKernelEnqueueFlags,",OpEnqueueKernel,"it's an ID, not in grammar",should not have one\r
" OperandKernelProfilingInfo,",OpCaptureEventProfilingInfo,"it's an ID, not in grammar",should not have one\r
-" OperandCapability,",Capability,,OpCapabilityTest
\ No newline at end of file
+" OperandCapability,",Capability,,OpCapabilityTest\r