MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / MakeSwitchTestCase

Function MakeSwitchTestCase

test/text_to_binary.control_flow_test.cpp:239–258  ·  view source on GitHub ↗

Constructs a SwitchTestCase from the given integer_width, signedness, constant value string, and expected encoded constant.

Source from the content-addressed store, hash-verified

237// Constructs a SwitchTestCase from the given integer_width, signedness,
238// constant value string, and expected encoded constant.
239SwitchTestCase MakeSwitchTestCase(uint32_t integer_width,
240 uint32_t integer_signedness,
241 std::string constant_str,
242 std::vector<uint32_t> encoded_constant,
243 std::string case_value_str,
244 std::vector<uint32_t> encoded_case_value) {
245 std::stringstream ss;
246 ss << integer_width << " " << integer_signedness;
247 return SwitchTestCase{
248 ss.str(),
249 constant_str,
250 case_value_str,
251 {Concatenate(
252 {MakeInstruction(spv::Op::OpTypeInt,
253 {1, integer_width, integer_signedness}),
254 MakeInstruction(spv::Op::OpConstant,
255 Concatenate({{1, 2}, encoded_constant})),
256 MakeInstruction(spv::Op::OpSwitch,
257 Concatenate({{2, 3}, encoded_case_value, {4}}))})}};
258}
259
260INSTANTIATE_TEST_SUITE_P(
261 TextToBinaryOpSwitchValid1Word, OpSwitchValidTest,

Calls 3

ConcatenateFunction · 0.85
MakeInstructionFunction · 0.85
strMethod · 0.45

Tested by

no test coverage detected