Make compilation input strings const.
authorDejan Mircevski <deki@google.com>
Tue, 13 Oct 2015 16:46:13 +0000 (12:46 -0400)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000 (12:55 -0400)
Also rerun clang-format.

13 files changed:
test/NamedId.cpp
test/TextToBinary.Annotation.cpp
test/TextToBinary.Barrier.cpp
test/TextToBinary.Constant.cpp
test/TextToBinary.ControlFlow.cpp
test/TextToBinary.Debug.cpp
test/TextToBinary.DeviceSideEnqueue.cpp
test/TextToBinary.Function.cpp
test/TextToBinary.Group.cpp
test/TextToBinary.Image.cpp
test/TextToBinary.Memory.cpp
test/TextToBinary.ModeSetting.cpp
test/TextToBinary.TypeDeclaration.cpp

index ea20918..f3b65b1 100644 (file)
@@ -84,7 +84,7 @@ using IdValidityTest =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<IdCheckCase>>;
 
 TEST_P(IdValidityTest, IdTypes) {
-  std::string input = GetParam().id + " = OpTypeVoid";
+  const std::string input = GetParam().id + " = OpTypeVoid";
   SetText(input);
   if (GetParam().valid) {
     CompileSuccessfully(input);
index e0201ca..1d2a0c2 100644 (file)
@@ -116,14 +116,16 @@ struct DecorateEnumCase {
   std::string enum_name;
 };
 
-using OpDecorateEnumTest = spvtest::TextToBinaryTestBase<
-    ::testing::TestWithParam<DecorateEnumCase>>;
+using OpDecorateEnumTest =
+    spvtest::TextToBinaryTestBase<::testing::TestWithParam<DecorateEnumCase>>;
 
 TEST_P(OpDecorateEnumTest, AnyEnumDecoration) {
   // This string should assemble, but should not validate.
-  std::string input = "OpDecorate %1 " + GetParam().enum_name + " " + GetParam().name;
+  const std::string input =
+      "OpDecorate %1 " + GetParam().enum_name + " " + GetParam().name;
   EXPECT_THAT(CompiledInstructions(input),
-              Eq(MakeInstruction(spv::OpDecorate, {1, GetParam().enum_value, GetParam().value})));
+              Eq(MakeInstruction(spv::OpDecorate, {1, GetParam().enum_value,
+                                                   GetParam().value})));
 }
 
 // Test OpDecorate BuiltIn.
@@ -234,7 +236,8 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest,
 TEST_F(TextToBinaryTest, CombinedFPFastMathMask) {
   // Sample a single combination.  This ensures we've integrated
   // the instruction parsing logic with spvTextParseMask.
-  const std::string input = "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ";
+  const std::string input =
+      "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ";
   const uint32_t expected_enum = spv::DecorationFPFastMathMode;
   const uint32_t expected_mask = spv::FPFastMathModeNotNaNMask |
                                  spv::FPFastMathModeNotInfMask |
@@ -258,8 +261,9 @@ using OpDecorateLinkageTest = spvtest::TextToBinaryTestBase<
 
 TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) {
   // This string should assemble, but should not validate.
-  std::string input = "OpDecorate %1 LinkageAttributes \"" + GetParam().external_name +
-                      "\" " + GetParam().linkage_type_name;
+  const std::string input = "OpDecorate %1 LinkageAttributes \"" +
+                            GetParam().external_name + "\" " +
+                            GetParam().linkage_type_name;
   std::vector<uint32_t> expected_operands{1, spv::DecorationLinkageAttributes};
   std::vector<uint32_t> encoded_external_name =
       MakeVector(GetParam().external_name);
@@ -283,19 +287,17 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest,
 #undef CASE
 // clang-format on
 
-
 // Test OpGroupMemberDecorate
 
 TEST_F(TextToBinaryTest, GroupMemberDecorateGoodOneTarget) {
   EXPECT_THAT(CompiledInstructions("OpGroupMemberDecorate %group %id0 42"),
-              Eq(MakeInstruction(spv::OpGroupMemberDecorate,
-                                {1, 2, 42})));
+              Eq(MakeInstruction(spv::OpGroupMemberDecorate, {1, 2, 42})));
 }
 
 TEST_F(TextToBinaryTest, GroupMemberDecorateGoodTwoTargets) {
-  EXPECT_THAT(CompiledInstructions("OpGroupMemberDecorate %group %id0 96 %id1 42"),
-              Eq(MakeInstruction(spv::OpGroupMemberDecorate,
-                                {1, 2, 96, 3, 42})));
+  EXPECT_THAT(
+      CompiledInstructions("OpGroupMemberDecorate %group %id0 96 %id1 42"),
+      Eq(MakeInstruction(spv::OpGroupMemberDecorate, {1, 2, 96, 3, 42})));
 }
 
 TEST_F(TextToBinaryTest, GroupMemberDecorateMissingGroupId) {
index 2078064..067948b 100644 (file)
@@ -43,32 +43,32 @@ using ::testing::Eq;
 using OpMemoryBarrier = spvtest::TextToBinaryTest;
 
 TEST_F(OpMemoryBarrier, Good) {
-  std::string input = "OpMemoryBarrier %1 %2\n";
+  const std::string input = "OpMemoryBarrier %1 %2\n";
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpMemoryBarrier, {1, 2})));
   EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input));
 }
 
 TEST_F(OpMemoryBarrier, BadMissingScopeId) {
-  std::string input = "OpMemoryBarrier\n";
+  const std::string input = "OpMemoryBarrier\n";
   EXPECT_THAT(CompileFailure(input),
               Eq("Expected operand, found end of stream."));
 }
 
 TEST_F(OpMemoryBarrier, BadInvalidScopeId) {
-  std::string input = "OpMemoryBarrier 99\n";
+  const std::string input = "OpMemoryBarrier 99\n";
   EXPECT_THAT(CompileFailure(input),
               Eq("Expected id to start with %."));
 }
 
 TEST_F(OpMemoryBarrier, BadMissingMemorySemanticsId) {
-  std::string input = "OpMemoryBarrier %scope\n";
+  const std::string input = "OpMemoryBarrier %scope\n";
   EXPECT_THAT(CompileFailure(input),
               Eq("Expected operand, found end of stream."));
 }
 
 TEST_F(OpMemoryBarrier, BadInvalidMemorySemanticsId) {
-  std::string input = "OpMemoryBarrier %scope 14\n";
+  const std::string input = "OpMemoryBarrier %scope 14\n";
   EXPECT_THAT(CompileFailure(input),
               Eq("Expected id to start with %."));
 }
index a8c49e0..9cc8613 100644 (file)
@@ -45,7 +45,7 @@ using SamplerAddressingModeTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::SamplerAddressingMode>>>;
 
 TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) {
-  std::string input =
+  const std::string input =
       "%result = OpConstantSampler %type " + GetParam().name() + " 0 Nearest";
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpConstantSampler,
@@ -77,7 +77,7 @@ using SamplerFilterModeTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::SamplerFilterMode>>>;
 
 TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) {
-  std::string input =
+  const std::string input =
       "%result = OpConstantSampler %type Clamp 0 " + GetParam().name();
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpConstantSampler,
@@ -110,10 +110,10 @@ using OpConstantValidTest =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<ConstantTestCase>>;
 
 TEST_P(OpConstantValidTest, ValidTypes) {
-  std::string input = "%1 = " + GetParam().constant_type +
-                      "\n"
-                      "%2 = OpConstant %1 " +
-                      GetParam().constant_value + "\n";
+  const std::string input = "%1 = " + GetParam().constant_type +
+                            "\n"
+                            "%2 = OpConstant %1 " +
+                            GetParam().constant_value + "\n";
   std::vector<uint32_t> instructions;
   EXPECT_THAT(CompiledInstructions(input),
               Eq(GetParam().expected_instructions));
@@ -142,9 +142,9 @@ using OpConstantInvalidTypeTest =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<std::string>>;
 
 TEST_P(OpConstantInvalidTypeTest, InvalidTypes) {
-  std::string input = "%1 = " + GetParam() +
-                      "\n"
-                      "%2 = OpConstant %1 0\n";
+  const std::string input = "%1 = " + GetParam() +
+                            "\n"
+                            "%2 = OpConstant %1 0\n";
   EXPECT_THAT(
       CompileFailure(input),
       Eq("Type for Constant must be a scalar floating point or integer type"));
index 181f4b3..d65fffb 100644 (file)
@@ -46,7 +46,7 @@ using OpSelectionMergeTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::SelectionControlMask>>>;
 
 TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) {
-  std::string input = "OpSelectionMerge %1 " + GetParam().name();
+  const std::string input = "OpSelectionMerge %1 " + GetParam().name();
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpSelectionMerge, {1, GetParam().value()})));
@@ -77,7 +77,7 @@ using OpLoopMergeTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::LoopControlMask>>>;
 
 TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) {
-  std::string input = "OpLoopMerge %merge %continue " + GetParam().name();
+  const std::string input = "OpLoopMerge %merge %continue " + GetParam().name();
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpLoopMerge, {1, 2, GetParam().value()})));
@@ -112,10 +112,9 @@ TEST_F(TextToBinaryTest, SwitchGoodOneTarget) {
   EXPECT_THAT(CompiledInstructions("%1 = OpTypeInt 32 0\n"
                                    "%2 = OpConstant %1 52\n"
                                    "OpSwitch %2 %default 12 %target0"),
-              Eq(Concatenate({
-                  MakeInstruction(spv::OpTypeInt, {1, 32, 0}),
-                  MakeInstruction(spv::OpConstant, {1, 2, 52}),
-                  MakeInstruction(spv::OpSwitch, {2, 3, 12, 4})})));
+              Eq(Concatenate({MakeInstruction(spv::OpTypeInt, {1, 32, 0}),
+                              MakeInstruction(spv::OpConstant, {1, 2, 52}),
+                              MakeInstruction(spv::OpSwitch, {2, 3, 12, 4})})));
 }
 
 TEST_F(TextToBinaryTest, SwitchGoodTwoTargets) {
@@ -173,20 +172,19 @@ TEST_F(TextToBinaryTest, SwitchBadMissingTarget) {
               Eq("Expected operand, found end of stream."));
 }
 
-struct SwitchTestCase{
+struct SwitchTestCase {
   std::string constant_type_args;
   std::vector<uint32_t> expected_instructions;
 };
 
-using OpSwitchValidTest = spvtest::TextToBinaryTestBase<
-  ::testing::TestWithParam<SwitchTestCase>>;
+using OpSwitchValidTest =
+    spvtest::TextToBinaryTestBase<::testing::TestWithParam<SwitchTestCase>>;
 
-TEST_P(OpSwitchValidTest, ValidTypes)
-{
-  std::string input =
-      "%1 = OpTypeInt " + GetParam().constant_type_args + "\n"
-      "%2 = OpConstant %1 0\n"
-      "OpSwitch %2 %default 32 %4\n";
+TEST_P(OpSwitchValidTest, ValidTypes) {
+  const std::string input = "%1 = OpTypeInt " + GetParam().constant_type_args +
+                            "\n"
+                            "%2 = OpConstant %1 0\n"
+                            "OpSwitch %2 %default 32 %4\n";
   std::vector<uint32_t> instructions;
   EXPECT_THAT(CompiledInstructions(input),
               Eq(GetParam().expected_instructions));
@@ -212,14 +210,14 @@ INSTANTIATE_TEST_CASE_P(
 #undef CASE
 // clang-format on
 
-using OpSwitchInvalidTypeTestCase = spvtest::TextToBinaryTestBase<
-  ::testing::TestWithParam<std::string>>;
+using OpSwitchInvalidTypeTestCase =
+    spvtest::TextToBinaryTestBase<::testing::TestWithParam<std::string>>;
 
-TEST_P(OpSwitchInvalidTypeTestCase, InvalidTypes)
-{
-  std::string input =
-      "%1 = " + GetParam() + "\n"
-      "%3 = OpCopyObject %1 %2\n" // We only care the type of the expression
+TEST_P(OpSwitchInvalidTypeTestCase, InvalidTypes) {
+  const std::string input =
+      "%1 = " + GetParam() +
+      "\n"
+      "%3 = OpCopyObject %1 %2\n"  // We only care the type of the expression
       "%4 = OpSwitch %3 %default 32 %c\n";
   EXPECT_THAT(CompileFailure(input),
               Eq(std::string(
@@ -256,7 +254,7 @@ INSTANTIATE_TEST_CASE_P(
     }));
 // clang-format on
 
-//TODO(awoloszyn): Add tests for switch with different operand widths
+// TODO(awoloszyn): Add tests for switch with different operand widths
 //                 once non-32-bit support is in.
 // TODO(dneto): OpPhi
 // TODO(dneto): OpLoopMerge
index 145e04f..f1262e4 100644 (file)
@@ -71,8 +71,9 @@ using OpSourceTest =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<LanguageCase>>;
 
 TEST_P(OpSourceTest, AnyLanguage) {
-  std::string input = std::string("OpSource ") + GetParam().language_name +
-                      " " + std::to_string(GetParam().version);
+  const 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(),
@@ -89,7 +90,7 @@ TEST_F(OpSourceTest, WrongLanguage) {
 
 TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalFileId) {
   // In the grammar, the file id is an OperandOptionalId.
-  std::string input = "OpSource GLSL 450 %file_id";
+  const std::string input = "OpSource GLSL 450 %file_id";
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpSource, {spv::SourceLanguageGLSL, 450, 1})));
@@ -97,7 +98,8 @@ TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalFileId) {
 
 TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) {
   std::string fake_source = "To be or not to be";
-  std::string input = "OpSource GLSL 450 %file_id \"" + fake_source + "\"";
+  const std::string input =
+      "OpSource GLSL 450 %file_id \"" + fake_source + "\"";
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpSource, {spv::SourceLanguageGLSL, 450, 1},
@@ -111,7 +113,8 @@ using OpSourceContinuedTest =
 
 TEST_P(OpSourceContinuedTest, AnyExtension) {
   // TODO(dneto): utf-8, quoting, escaping
-  std::string input = std::string("OpSourceContinued \"") + GetParam() + "\"";
+  const std::string input =
+      std::string("OpSourceContinued \"") + GetParam() + "\"";
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpSourceContinued, MakeVector(GetParam()))));
@@ -129,7 +132,8 @@ using OpSourceExtensionTest =
 
 TEST_P(OpSourceExtensionTest, AnyExtension) {
   // TODO(dneto): utf-8, quoting, escaping
-  std::string input = std::string("OpSourceExtension \"") + GetParam() + "\"";
+  const std::string input =
+      std::string("OpSourceExtension \"") + GetParam() + "\"";
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpSourceExtension, MakeVector(GetParam()))));
@@ -155,7 +159,8 @@ using OpStringTest =
 
 TEST_P(OpStringTest, AnyString) {
   // TODO(dneto): utf-8, quoting, escaping
-  std::string input = std::string("%result = OpString \"") + GetParam() + "\"";
+  const std::string input =
+      std::string("%result = OpString \"") + GetParam() + "\"";
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpString, {1}, MakeVector(GetParam()))));
 }
@@ -170,7 +175,8 @@ using OpNameTest =
 
 TEST_P(OpNameTest, AnyString) {
   // TODO(dneto): utf-8, quoting, escaping
-  std::string input = std::string("OpName %target \"") + GetParam() + "\"";
+  const std::string input =
+      std::string("OpName %target \"") + GetParam() + "\"";
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpName, {1}, MakeVector(GetParam()))));
 }
@@ -185,7 +191,7 @@ using OpMemberNameTest =
 
 TEST_P(OpMemberNameTest, AnyString) {
   // TODO(dneto): utf-8, quoting, escaping
-  std::string input =
+  const std::string input =
       std::string("OpMemberName %type 42 \"") + GetParam() + "\"";
   EXPECT_THAT(
       CompiledInstructions(input),
index f12c5fd..1c50565 100644 (file)
@@ -48,7 +48,7 @@ using OpEnqueueKernelGood =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<KernelEnqueueCase>>;
 
 TEST_P(OpEnqueueKernelGood, Sample) {
-  std::string input =
+  const std::string input =
       "%result = OpEnqueueKernel %type %queue %flags %NDRange %num_events"
       " %wait_events %ret_event %invoke %param %param_size %param_align " +
       GetParam().local_size_source;
index 845f0fb..534ae5c 100644 (file)
@@ -45,8 +45,8 @@ using OpFunctionControlTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::FunctionControlMask>>>;
 
 TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) {
-  std::string input = "%result_id = OpFunction %result_type " +
-                      GetParam().name() + " %function_type ";
+  const std::string input = "%result_id = OpFunction %result_type " +
+                            GetParam().name() + " %function_type ";
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpFunction, {1, 2, GetParam().value(), 3})));
index da741d0..cb9eb84 100644 (file)
@@ -44,11 +44,11 @@ using GroupOperationTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::GroupOperation>>>;
 
 TEST_P(GroupOperationTest, AnyGroupOperation) {
-  std::string input =
+  const std::string input =
       "%result = OpGroupIAdd %type %scope " + GetParam().name() + " %x";
-  EXPECT_THAT(CompiledInstructions(input),
-              Eq(MakeInstruction(spv::OpGroupIAdd,
-                                 {1, 2, 3, GetParam().value(), 4})));
+  EXPECT_THAT(
+      CompiledInstructions(input),
+      Eq(MakeInstruction(spv::OpGroupIAdd, {1, 2, 3, GetParam().value(), 4})));
 }
 
 // clang-format off
index 9aae9e1..b7d5d6b 100644 (file)
@@ -46,11 +46,11 @@ struct ImageOperandsCase {
 
 // Test all kinds of image operands.
 
-using ImageOperandsTest = spvtest::TextToBinaryTestBase<
-    ::testing::TestWithParam<ImageOperandsCase>>;
+using ImageOperandsTest =
+    spvtest::TextToBinaryTestBase<::testing::TestWithParam<ImageOperandsCase>>;
 
 TEST_P(ImageOperandsTest, Sample) {
-  std::string input =
+  const std::string input =
       "%result = OpImageFetch %type %image %coord " + GetParam().image_operands;
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpImageFetch, {1, 2, 3, 4},
index 124cb39..675859b 100644 (file)
@@ -79,7 +79,7 @@ using StorageClassTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::StorageClass>>>;
 
 TEST_P(StorageClassTest, AnyStorageClass) {
-  std::string input = "%1 = OpVariable %2 " + GetParam().name();
+  const std::string input = "%1 = OpVariable %2 " + GetParam().name();
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpVariable, {1, 2, GetParam().value()})));
 }
index e39fcb0..ec3910a 100644 (file)
@@ -59,8 +59,8 @@ using OpMemoryModelTest =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<MemoryModelCase>>;
 
 TEST_P(OpMemoryModelTest, AnyMemoryModelCase) {
-  std::string input = "OpMemoryModel " + GetParam().addressing_name + " " +
-                      GetParam().memory_name;
+  const std::string input = "OpMemoryModel " + GetParam().addressing_name +
+                            " " + GetParam().memory_name;
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpMemoryModel, {GetParam().get_addressing_value(),
@@ -110,8 +110,8 @@ using OpEntryPointTest =
 
 TEST_P(OpEntryPointTest, AnyEntryPointCase) {
   // TODO(dneto): utf-8, escaping, quoting cases for entry point name.
-  std::string input = "OpEntryPoint " + GetParam().execution_name + " %1 \"" +
-                      GetParam().entry_point_name + "\"";
+  const std::string input = "OpEntryPoint " + GetParam().execution_name +
+                            " %1 \"" + GetParam().entry_point_name + "\"";
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpEntryPoint,
                                  {GetParam().get_execution_value(), 1},
@@ -205,7 +205,7 @@ using OpCapabilityTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::Capability>>>;
 
 TEST_P(OpCapabilityTest, AnyCapability) {
-  std::string input = "OpCapability " + GetParam().name();
+  const std::string input = "OpCapability " + GetParam().name();
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpCapability, {GetParam().value()})));
 }
index 90200b3..ecc7f76 100644 (file)
@@ -44,8 +44,8 @@ using DimTest =
     spvtest::TextToBinaryTestBase<::testing::TestWithParam<EnumCase<spv::Dim>>>;
 
 TEST_P(DimTest, AnyDim) {
-  std::string input = "%imageType = OpTypeImage %sampledType " +
-                      GetParam().name() + " 2 3 0 4 Rgba8";
+  const std::string input = "%imageType = OpTypeImage %sampledType " +
+                            GetParam().name() + " 2 3 0 4 Rgba8";
   EXPECT_THAT(
       CompiledInstructions(input),
       Eq(MakeInstruction(spv::OpTypeImage, {1, 2, GetParam().value(), 2, 3, 0,
@@ -79,7 +79,7 @@ using ImageFormatTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::ImageFormat>>>;
 
 TEST_P(ImageFormatTest, AnyImageFormat) {
-  std::string input =
+  const std::string input =
       "%imageType = OpTypeImage %sampledType 1D  2 3 0 4 " + GetParam().name();
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpTypeImage, {1, 2, spv::Dim1D, 2, 3, 0,
@@ -141,7 +141,7 @@ using OpTypePipeTest = spvtest::TextToBinaryTestBase<
     ::testing::TestWithParam<EnumCase<spv::AccessQualifier>>>;
 
 TEST_P(OpTypePipeTest, AnyAccessQualifier) {
-  std::string input = "%1 = OpTypePipe " + GetParam().name();
+  const std::string input = "%1 = OpTypePipe " + GetParam().name();
   EXPECT_THAT(CompiledInstructions(input),
               Eq(MakeInstruction(spv::OpTypePipe, {1, GetParam().value()})));
 }