Constructs a SwitchTestCase from the given integer_width, signedness, constant value string, and expected encoded constant.
| 237 | // Constructs a SwitchTestCase from the given integer_width, signedness, |
| 238 | // constant value string, and expected encoded constant. |
| 239 | SwitchTestCase 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 | |
| 260 | INSTANTIATE_TEST_SUITE_P( |
| 261 | TextToBinaryOpSwitchValid1Word, OpSwitchValidTest, |
no test coverage detected