The default consumer is a null std::function.
| 30 | |
| 31 | // The default consumer is a null std::function. |
| 32 | TEST(CInterface, DefaultConsumerNullDiagnosticForValidInput) { |
| 33 | auto context = spvContextCreate(SPV_ENV_UNIVERSAL_1_1); |
| 34 | const char input_text[] = |
| 35 | "OpCapability Shader\n" |
| 36 | "OpCapability Linkage\n" |
| 37 | "OpMemoryModel Logical GLSL450"; |
| 38 | |
| 39 | spv_binary binary = nullptr; |
| 40 | EXPECT_EQ(SPV_SUCCESS, spvTextToBinary(context, input_text, |
| 41 | sizeof(input_text), &binary, nullptr)); |
| 42 | |
| 43 | { |
| 44 | // Sadly the compiler don't allow me to feed binary directly to |
| 45 | // spvValidate(). |
| 46 | spv_const_binary_t b{binary->code, binary->wordCount}; |
| 47 | EXPECT_EQ(SPV_SUCCESS, spvValidate(context, &b, nullptr)); |
| 48 | } |
| 49 | |
| 50 | spv_text text = nullptr; |
| 51 | EXPECT_EQ(SPV_SUCCESS, spvBinaryToText(context, binary->code, |
| 52 | binary->wordCount, 0, &text, nullptr)); |
| 53 | |
| 54 | spvTextDestroy(text); |
| 55 | spvBinaryDestroy(binary); |
| 56 | spvContextDestroy(context); |
| 57 | } |
| 58 | |
| 59 | // The default consumer is a null std::function. |
| 60 | TEST(CInterface, DefaultConsumerNullDiagnosticForInvalidAssembling) { |
nothing calls this directly
no test coverage detected