Negative test for ImageFormat.
authorDejan Mircevski <deki@google.com>
Tue, 13 Oct 2015 16:54:47 +0000 (12:54 -0400)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000 (12:55 -0400)
source/operand.cpp
test/TextToBinary.TypeDeclaration.cpp

index 26abffb..c76d8c3 100644 (file)
@@ -1339,7 +1339,7 @@ const char* spvOperandTypeStr(spv_operand_type_t type) {
     case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE:
       return "sampler filter mode";
     case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT:
-      return "sampler image format";
+      return "image format";
     case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE:
       return "floating pointer fast math mode";
     case SPV_OPERAND_TYPE_FP_ROUNDING_MODE:
index ecc7f76..1fbfb15 100644 (file)
@@ -135,6 +135,11 @@ INSTANTIATE_TEST_CASE_P(
 #undef CASE
 // clang-format on
 
+TEST_F(ImageFormatTest, WrongFormat) {
+  EXPECT_THAT(CompileFailure("%r = OpTypeImage %t 1D  2 3 0 4 xxyyzz"),
+              Eq("Invalid image format 'xxyyzz'."));
+}
+
 // Test AccessQualifier enums via OpTypePipe.
 
 using OpTypePipeTest = spvtest::TextToBinaryTestBase<
@@ -200,9 +205,6 @@ TEST_F(OpTypeForwardPointerTest, WrongClass) {
               Eq("Invalid storage class 'xxyyzz'."));
 }
 
-// TODO(dneto): error message test for sampler addressing mode
-// TODO(dneto): error message test for sampler image format
-
 // TODO(dneto): OpTypeVoid
 // TODO(dneto): OpTypeBool
 // TODO(dneto): OpTypeInt