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

Function TEST

test/opt/c_interface_test.cpp:24–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace {
23
24TEST(OptimizerCInterface, DefaultConsumerWithValidationNoPassesForInvalidInput) {
25 const uint32_t spirv[] = {
26 0xDEADFEED, // Invalid Magic
27 0x00010100, // Version 1.1
28 0x00000000, // No Generator
29 0x01000000, // Bound
30 0x00000000, // Schema
31 0x00020011, // OpCapability
32 0x00000001, // Shader
33 0x00020011, // OpCapability
34 0x00000005, // Linkage
35 0x0003000E, // OpMemoryModel
36 0x00000000, // Logical
37 0x00000001 // GLSL450
38 };
39
40 auto optimizer = spvOptimizerCreate(SPV_ENV_UNIVERSAL_1_1);
41 ASSERT_NE(optimizer, nullptr);
42
43 // Do not register any passes
44
45 auto options = spvOptimizerOptionsCreate();
46 ASSERT_NE(options, nullptr);
47 spvOptimizerOptionsSetRunValidator(options, true);
48
49 spv_binary binary = nullptr;
50 EXPECT_NE(SPV_SUCCESS,
51 spvOptimizerRun(optimizer, spirv, sizeof(spirv) / sizeof(uint32_t),
52 &binary, options));
53 ASSERT_EQ(binary, nullptr);
54
55 spvOptimizerOptionsDestroy(options);
56
57 spvOptimizerDestroy(optimizer);
58}
59
60TEST(OptimizerCInterface, SpecifyConsumerWithValidationNoPassesForInvalidInput) {
61 const uint32_t spirv[] = {

Callers

nothing calls this directly

Tested by

no test coverage detected