Add unit test for control statements in do-while loop.
Change-Id: I8309940f8e40d0e84847ae272830896d010c39de Bug: skia:11219 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359138 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
04a1b4b971
commit
798021ada3
@ -302,6 +302,7 @@ sksl_shared_tests = [
|
||||
"/sksl/shared/DependentInitializers.sksl",
|
||||
"/sksl/shared/DerivativesUnused.sksl",
|
||||
"/sksl/shared/Discard.sksl",
|
||||
"/sksl/shared/DoWhileControlFlow.sksl",
|
||||
"/sksl/shared/Enum.sksl",
|
||||
"/sksl/shared/FragCoordsFlipY.sksl",
|
||||
"/sksl/shared/FragCoordsNew.sksl",
|
||||
|
19
resources/sksl/shared/DoWhileControlFlow.sksl
Normal file
19
resources/sksl/shared/DoWhileControlFlow.sksl
Normal file
@ -0,0 +1,19 @@
|
||||
half4 main() {
|
||||
half4 x = half4(1, 1, 1, 1);
|
||||
|
||||
// Verify that break is allowed in a do-while loop.
|
||||
do {
|
||||
x.r -= 0.25;
|
||||
if (x.r <= 0) break;
|
||||
} while (x.a == 1);
|
||||
|
||||
// Verify that continue is allowed in a do-while loop.
|
||||
do {
|
||||
x.b -= 0.25;
|
||||
if (x.a == 1) continue; // should always happen
|
||||
x.g = 0;
|
||||
} while (x.b > 0);
|
||||
|
||||
// x contains green.
|
||||
return x;
|
||||
}
|
4
tests/sksl/shared/DoWhileControlFlow.asm.frag
Normal file
4
tests/sksl/shared/DoWhileControlFlow.asm.frag
Normal file
@ -0,0 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 7: break statement must be inside a loop or switch
|
||||
1 error
|
4
tests/sksl/shared/DoWhileControlFlow.glsl
Normal file
4
tests/sksl/shared/DoWhileControlFlow.glsl
Normal file
@ -0,0 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 7: break statement must be inside a loop or switch
|
||||
1 error
|
4
tests/sksl/shared/DoWhileControlFlow.metal
Normal file
4
tests/sksl/shared/DoWhileControlFlow.metal
Normal file
@ -0,0 +1,4 @@
|
||||
### Compilation failed:
|
||||
|
||||
error: 7: break statement must be inside a loop or switch
|
||||
1 error
|
Loading…
Reference in New Issue
Block a user