Negative test for ExecutionModel.
authorDejan Mircevski <deki@google.com>
Fri, 9 Oct 2015 17:44:22 +0000 (13:44 -0400)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000 (12:55 -0400)
test/TextToBinary.ModeSetting.cpp

index 76b3e46..6f26b3e 100644 (file)
@@ -55,8 +55,8 @@ struct MemoryModelCase {
   std::string memory_name;
 };
 
-using OpMemoryModelTest = spvtest::TextToBinaryTestBase<
-    ::testing::TestWithParam<MemoryModelCase>>;
+using OpMemoryModelTest =
+    spvtest::TextToBinaryTestBase<::testing::TestWithParam<MemoryModelCase>>;
 
 TEST_P(OpMemoryModelTest, AnyMemoryModelCase) {
   std::string input = "OpMemoryModel " + GetParam().addressing_name + " " +
@@ -98,8 +98,8 @@ struct EntryPointCase {
   std::string entry_point_name;
 };
 
-using OpEntryPointTest = spvtest::TextToBinaryTestBase<
-    ::testing::TestWithParam<EntryPointCase>>;
+using OpEntryPointTest =
+    spvtest::TextToBinaryTestBase<::testing::TestWithParam<EntryPointCase>>;
 
 TEST_P(OpEntryPointTest, AnyEntryPointCase) {
   // TODO(dneto): utf-8, escaping, quoting cases for entry point name.
@@ -126,6 +126,11 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest,
 #undef CASE
 // clang-format on
 
+TEST_F(OpEntryPointTest, WrongModel) {
+  EXPECT_THAT(CompileFailure("OpEntryPoint xxyyzz %1 \"fun\""),
+              Eq("Invalid execution model 'xxyyzz'."));
+}
+
 // Test OpExecutionMode
 
 using OpExecutionModeTest = spvtest::TextToBinaryTestBase<