summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/modules/unscoped-enum-visibility/unscoped_enum_user.slang
blob: e20f387fb8f44ccb7ede716b6df7262bbb25a34a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//TEST:COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
//
// Test for public unscoped enum constants visibility across module boundaries
//
// This test verifies that unscoped enum constants are visible across module
// boundaries when the enum is declared as public.
//

import unscoped_enum_lib;

//TEST_INPUT: set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
RWStructuredBuffer<uint> outputBuffer;

[numthreads(1,1,1)]
void computeMain()
{
    // These should all be visible due to the public unscoped enum
    TestEnum e1 = CASE_A; // Should work - unscoped access
    TestEnum e2 = TestEnum.CASE_B; // Should work - scoped access
    
    // CHECK: 0
    outputBuffer[0] = (uint)e1;
    // CHECK: 1  
    outputBuffer[1] = (uint)e2;
    // CHECK: 0
    outputBuffer[2] = (uint)CASE_A;
    // CHECK: 1
    outputBuffer[3] = (uint)CASE_B;
}