| 33 | using IRBuilderTest = ::testing::Test; |
| 34 | |
| 35 | bool Validate(const std::vector<uint32_t>& bin) { |
| 36 | spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2; |
| 37 | spv_context spvContext = spvContextCreate(target_env); |
| 38 | spv_diagnostic diagnostic = nullptr; |
| 39 | spv_const_binary_t binary = {bin.data(), bin.size()}; |
| 40 | spv_result_t error = spvValidate(spvContext, &binary, &diagnostic); |
| 41 | if (error != 0) spvDiagnosticPrint(diagnostic); |
| 42 | spvDiagnosticDestroy(diagnostic); |
| 43 | spvContextDestroy(spvContext); |
| 44 | return error == 0; |
| 45 | } |
| 46 | |
| 47 | void Match(const std::string& original, IRContext* context, |
| 48 | bool do_validation = true) { |