Skip to content

Commit

Permalink
[WGSL] Add missing tests for 270436@main
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264497
rdar://118180741

Reviewed by Mike Wyrzykowski.

For some reason the test wasn't included in the original commit.

* Source/WebGPU/WGSL/tests/invalid/constants.wgsl: Added.

Canonical link: https://commits.webkit.org/270521@main
  • Loading branch information
tadeuzagallo committed Nov 10, 2023
1 parent de08c24 commit 43c8caa
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions Source/WebGPU/WGSL/tests/invalid/constants.wgsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// RUN: %not %wgslc | %check


fn testOutOfBounds()
{
{
const x = array(0);
// CHECK-L: index -1 is out of bounds [0..0]
_ = x[-1];
// CHECK-NOT-L: index 0 is out of bounds [0..0]
_ = x[0];
// CHECK-L: index 1 is out of bounds [0..0]
_ = x[1];
}

{
const x = mat2x2(0, 0, 0, 0);
// CHECK-L: index -1 is out of bounds [0..1]
_ = x[-1];
// CHECK-NOT-L: index 0 is out of bounds [0..1]
_ = x[0];
// CHECK-NOT-L: index 1 is out of bounds [0..1]
_ = x[1];
// CHECK-L: index 2 is out of bounds [0..1]
_ = x[2];
}

{
const x = vec2(0);
// CHECK-L: index -1 is out of bounds [0..1]
_ = x[-1];
// CHECK-NOT-L: index 0 is out of bounds [0..1]
_ = x[0];
// CHECK-NOT-L: index 1 is out of bounds [0..1]
_ = x[1];
// CHECK-L: index 2 is out of bounds [0..1]
_ = x[2];
}
}

fn main()
{
testOutOfBounds();
}

0 comments on commit 43c8caa

Please sign in to comment.