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

Function TEST

test/c_interface_test.cpp:32–57  ·  view source on GitHub ↗

The default consumer is a null std::function.

Source from the content-addressed store, hash-verified

30
31// The default consumer is a null std::function.
32TEST(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.
60TEST(CInterface, DefaultConsumerNullDiagnosticForInvalidAssembling) {

Callers

nothing calls this directly

Calls 9

spvContextCreateFunction · 0.85
spvTextToBinaryFunction · 0.85
spvValidateFunction · 0.85
spvBinaryToTextFunction · 0.85
spvTextDestroyFunction · 0.85
spvBinaryDestroyFunction · 0.85
spvContextDestroyFunction · 0.85
spvDiagnosticDestroyFunction · 0.85

Tested by

no test coverage detected