Skip to content

Commit bbec9d5

Browse files
committed
Fix failing tests
1 parent 5bc8cfa commit bbec9d5

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

kitty_tests/slang.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,50 +29,50 @@ def check(src: str, expected: SlangFile) -> None:
2929
float4 psMain() : SV_Target {
3030
return float4(1, 0, 0, 1);
3131
}
32-
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.vertex, 'drawTriangle'), EntryPoint(Stage.fragment, 'psMain')}), ''))
32+
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.vertex, 'drawTriangle'), EntryPoint(Stage.fragment, 'psMain')}), '', {}, ()))
3333

3434
# Empty source
35-
check('', SlangFile('', '', frozenset(), frozenset(), ''))
35+
check('', SlangFile('', '', frozenset(), frozenset(), '', {}, ()))
3636

3737
# Only line comments and block comments, no code
38-
check('// just a comment\n/* block comment */', SlangFile('', '', frozenset(), frozenset(), ''))
38+
check('// just a comment\n/* block comment */', SlangFile('', '', frozenset(), frozenset(), '', {}, ()))
3939

4040
# Module and import declarations
4141
check('''
4242
module mymodule;
4343
import utils;
4444
import helpers;
45-
''', SlangFile('', '', frozenset({'utils', 'helpers'}), frozenset(), 'mymodule'))
45+
''', SlangFile('', '', frozenset({'utils', 'helpers'}), frozenset(), 'mymodule', {}, ()))
4646

4747
# pixel stage maps to Stage.fragment
4848
check('''
4949
[shader("pixel")]
5050
float4 pixelMain() : SV_Target { return float4(0); }
51-
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.fragment, 'pixelMain')}), ''))
51+
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.fragment, 'pixelMain')}), '', {}, ()))
5252

5353
# Block comment stripping removes multi-line comments before parsing
5454
check('''
5555
/* This is a block comment
5656
spanning multiple lines */
5757
[shader("vertex")]
5858
void vertMain() {}
59-
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.vertex, 'vertMain')}), ''))
59+
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.vertex, 'vertMain')}), '', {}, ()))
6060

6161
# Block comment containing a shader attribute must not create a false entry point
6262
check('''
6363
/* [shader("vertex")]
6464
void shouldNotBeDetected() {} */
6565
[shader("fragment")]
6666
void fragMain() {}
67-
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.fragment, 'fragMain')}), ''))
67+
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.fragment, 'fragMain')}), '', {}, ()))
6868

6969
# Multiple [attr] lines between [shader(...)] and the function declaration are skipped
7070
check('''
7171
[shader("fragment")]
7272
[numthreads(4, 4, 1)]
7373
[SomeOtherAttribute]
7474
float4 fragMain() : SV_Target { return float4(0); }
75-
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.fragment, 'fragMain')}), ''))
75+
''', SlangFile('', '', frozenset(), frozenset({EntryPoint(Stage.fragment, 'fragMain')}), '', {}, ()))
7676

7777
# Multiple entry points: vertex, pixel, and fragment stages
7878
check('''
@@ -88,7 +88,7 @@ def check(src: str, expected: SlangFile) -> None:
8888
EntryPoint(Stage.vertex, 'vsMain'),
8989
EntryPoint(Stage.fragment, 'psMain'),
9090
EntryPoint(Stage.fragment, 'fsMain'),
91-
}), ''))
91+
}), '', {}, ()))
9292

9393
# module, imports and entry points together
9494
check('''
@@ -97,25 +97,25 @@ def check(src: str, expected: SlangFile) -> None:
9797
9898
[shader("vertex")]
9999
void vsMain() {}
100-
''', SlangFile('', '', frozenset({'common'}), frozenset({EntryPoint(Stage.vertex, 'vsMain')}), 'myshader'))
100+
''', SlangFile('', '', frozenset({'common'}), frozenset({EntryPoint(Stage.vertex, 'vsMain')}), 'myshader', {}, ()))
101101

102102
def test_slang_ordering(self):
103103
# Test topological_sort with a manually constructed linear chain: a <- b <- c
104104
graph: dict[str, SlangFile] = {
105-
'a': SlangFile('', '', frozenset(), frozenset(), 'a'),
106-
'b': SlangFile('', '', frozenset({'a'}), frozenset(), 'b'),
107-
'c': SlangFile('', '', frozenset({'b'}), frozenset(), 'c'),
105+
'a': SlangFile('', '', frozenset(), frozenset(), 'a', {}, ()),
106+
'b': SlangFile('', '', frozenset({'a'}), frozenset(), 'b', {}, ()),
107+
'c': SlangFile('', '', frozenset({'b'}), frozenset(), 'c', {}, ()),
108108
}
109109
order = topological_sort(graph)
110110
self.assertLess(order.index('a'), order.index('b'))
111111
self.assertLess(order.index('b'), order.index('c'))
112112

113113
# Diamond dependency: base <- left, base <- right, left + right <- top
114114
diamond: dict[str, SlangFile] = {
115-
'base': SlangFile('', '', frozenset(), frozenset(), 'base'),
116-
'left': SlangFile('', '', frozenset({'base'}), frozenset(), 'left'),
117-
'right': SlangFile('', '', frozenset({'base'}), frozenset(), 'right'),
118-
'top': SlangFile('', '', frozenset({'left', 'right'}), frozenset(), 'top'),
115+
'base': SlangFile('', '', frozenset(), frozenset(), 'base', {}, ()),
116+
'left': SlangFile('', '', frozenset({'base'}), frozenset(), 'left', {}, ()),
117+
'right': SlangFile('', '', frozenset({'base'}), frozenset(), 'right', {}, ()),
118+
'top': SlangFile('', '', frozenset({'left', 'right'}), frozenset(), 'top', {}, ()),
119119
}
120120
order2 = topological_sort(diamond)
121121
self.assertLess(order2.index('base'), order2.index('left'))
@@ -125,7 +125,7 @@ def test_slang_ordering(self):
125125

126126
# Node with an import not present in the graph is silently skipped
127127
partial: dict[str, SlangFile] = {
128-
'x': SlangFile('', '', frozenset({'missing'}), frozenset(), 'x'),
128+
'x': SlangFile('', '', frozenset({'missing'}), frozenset(), 'x', {}, ()),
129129
}
130130
self.assertEqual(topological_sort(partial), ['x'])
131131

0 commit comments

Comments
 (0)