1
2case empty_condition
3	version 300 es
4	expect compile_fail
5	both ""
6		#version 300 es
7		precision mediump float;
8		${DECLARATIONS}
9
10		void main ()
11		{
12			switch ()
13			{
14				case 1:
15					${POSITION_FRAG_COLOR} = vec4(1.0);
16			}
17
18			${OUTPUT}
19		}
20	""
21end
22
23case condition_float
24	version 300 es
25	expect compile_fail
26	both ""
27		#version 300 es
28		precision mediump float;
29		${DECLARATIONS}
30
31		void main ()
32		{
33			float c = 1.0;
34			switch (c)
35			{
36				case 1:
37					${POSITION_FRAG_COLOR} = vec4(1.0);
38			}
39
40			${OUTPUT}
41		}
42	""
43end
44
45case condition_bool
46	version 300 es
47	expect compile_fail
48	both ""
49		#version 300 es
50		precision mediump float;
51		${DECLARATIONS}
52
53		void main ()
54		{
55			bool c = true;
56			switch (c)
57			{
58				case 1:
59					${POSITION_FRAG_COLOR} = vec4(1.0);
60			}
61
62			${OUTPUT}
63		}
64	""
65end
66
67case condition_ivec2
68	version 300 es
69	expect compile_fail
70	both ""
71		#version 300 es
72		precision mediump float;
73		${DECLARATIONS}
74
75		void main ()
76		{
77			ivec2 c = ivec2(1, 1);
78			switch (c)
79			{
80				case 1:
81					${POSITION_FRAG_COLOR} = vec4(1.0);
82			}
83
84			${OUTPUT}
85		}
86	""
87end
88
89case condition_struct
90	version 300 es
91	expect compile_fail
92	both ""
93		#version 300 es
94		precision mediump float;
95		${DECLARATIONS}
96
97		struct S { int m; };
98
99		void main ()
100		{
101			S c = S(1);
102			switch (c)
103			{
104				case 1:
105					${POSITION_FRAG_COLOR} = vec4(1.0);
106			}
107
108			${OUTPUT}
109		}
110	""
111end
112
113case duplicate_label
114	version 300 es
115	expect compile_fail
116	both ""
117		#version 300 es
118		precision mediump float;
119		${DECLARATIONS}
120
121		void main ()
122		{
123			int c = 1;
124			switch (c)
125			{
126				case 1:
127				case 1:
128					break;
129			}
130
131			${OUTPUT}
132		}
133	""
134end
135
136case float_label
137	version 300 es
138	expect compile_fail
139	both ""
140		#version 300 es
141		precision mediump float;
142		${DECLARATIONS}
143
144		void main ()
145		{
146			int c = 1;
147			switch (c)
148			{
149				case 1.0:
150					break;
151			}
152
153			${OUTPUT}
154		}
155	""
156end
157
158case non_const_int_label
159	version 300 es
160	expect compile_fail
161	both ""
162		#version 300 es
163		precision mediump float;
164		${DECLARATIONS}
165
166		void main ()
167		{
168			int c = 1;
169			int l = 2;
170			switch (c)
171			{
172				case l:
173					break;
174			}
175
176			${OUTPUT}
177		}
178	""
179end
180
181case statement_before_label
182	version 300 es
183	expect compile_fail
184	both ""
185		#version 300 es
186		precision mediump float;
187		${DECLARATIONS}
188
189		void main ()
190		{
191			switch (1)
192			{
193					${POSITION_FRAG_COLOR} = vec4(1.0);
194				case 1:
195					${POSITION_FRAG_COLOR} = vec4(0.0);
196			}
197
198			${OUTPUT}
199		}
200	""
201end
202
203case statement_before_default_label
204	version 300 es
205	expect compile_fail
206	both ""
207		#version 300 es
208		precision mediump float;
209		${DECLARATIONS}
210
211		void main ()
212		{
213			switch (1)
214			{
215					${POSITION_FRAG_COLOR} = vec4(1.0);
216				default:
217					${POSITION_FRAG_COLOR} = vec4(0.0);
218			}
219
220			${OUTPUT}
221		}
222	""
223end
224
225case no_statement_after_label
226	version 300 es
227	expect compile_fail
228	both ""
229		#version 300 es
230		precision mediump float;
231		${DECLARATIONS}
232
233		void main ()
234		{
235			switch (1)
236			{
237				case 0:
238					break;
239				case 1:
240			}
241
242			${OUTPUT}
243		}
244	""
245end
246
247case no_statement_after_default_label
248	version 300 es
249	expect compile_fail
250	both ""
251		#version 300 es
252		precision mediump float;
253		${DECLARATIONS}
254
255		void main ()
256		{
257			switch (1)
258			{
259				case 0:
260					break;
261				default:
262			}
263
264			${OUTPUT}
265		}
266	""
267end
268
269case case_in_if
270	version 300 es
271	expect compile_fail
272	both ""
273		#version 300 es
274		precision mediump float;
275		${DECLARATIONS}
276
277		void main ()
278		{
279			float f = 1.0;
280			switch (1)
281			{
282				case 0:
283					f = 0.0;
284					if (f > 0.0)
285					{
286						case 1:
287							f *= 2.0;
288					}
289					break;
290				case 2:
291					break;
292			}
293
294			${OUTPUT}
295		}
296	""
297end
298
299case default_in_if
300	version 300 es
301	expect compile_fail
302	both ""
303		#version 300 es
304		precision mediump float;
305		${DECLARATIONS}
306
307		void main ()
308		{
309			float f = 1.0;
310			switch (1)
311			{
312				case 0:
313					f = 0.0;
314					if (f > 0.0)
315					{
316						default:
317							f *= 2.0;
318					}
319					break;
320				case 2:
321					break;
322			}
323
324			${OUTPUT}
325		}
326	""
327end
328
329case case_in_for_loop
330	version 300 es
331	expect compile_fail
332	both ""
333		#version 300 es
334		precision mediump float;
335		${DECLARATIONS}
336
337		void main ()
338		{
339			float f = 1.0;
340			switch (1)
341			{
342				case 0:
343					f = 0.0;
344					for (int i = 0; i < 2; i++)
345					{
346						case 1:
347							f *= 2.0;
348					}
349					break;
350				case 2:
351					break;
352			}
353
354			${OUTPUT}
355		}
356	""
357end
358
359case default_in_for_loop
360	version 300 es
361	expect compile_fail
362	both ""
363		#version 300 es
364		precision mediump float;
365		${DECLARATIONS}
366
367		void main ()
368		{
369			float f = 1.0;
370			switch (1)
371			{
372				case 0:
373					f = 0.0;
374					for (int i = 0; i < 2; i++)
375					{
376						default:
377							f *= 2.0;
378					}
379					break;
380				case 2:
381					break;
382			}
383
384			${OUTPUT}
385		}
386	""
387end
388
389case case_in_while_loop
390	version 300 es
391	expect compile_fail
392	both ""
393		#version 300 es
394		precision mediump float;
395		${DECLARATIONS}
396
397		void main ()
398		{
399			float f = 1.0;
400			switch (1)
401			{
402				case 0:
403					f = 0.0;
404					while (f > 0.0)
405					{
406						case 1:
407							f *= 2.0;
408					}
409					break;
410				case 2:
411					break;
412			}
413
414			${OUTPUT}
415		}
416	""
417end
418
419case default_in_while_loop
420	version 300 es
421	expect compile_fail
422	both ""
423		#version 300 es
424		precision mediump float;
425		${DECLARATIONS}
426
427		void main ()
428		{
429			float f = 1.0;
430			switch (1)
431			{
432				case 0:
433					f = 0.0;
434					while (f > 0.0)
435					{
436						default:
437							f *= 2.0;
438					}
439					break;
440				case 2:
441					break;
442			}
443
444			${OUTPUT}
445		}
446	""
447end
448
449case case_in_do_while_loop
450	version 300 es
451	expect compile_fail
452	both ""
453		#version 300 es
454		precision mediump float;
455		${DECLARATIONS}
456
457		void main ()
458		{
459			float f = 1.0;
460			switch (1)
461			{
462				case 0:
463					f = 0.0;
464					do
465					{
466						case 1:
467							f *= 2.0;
468					} while (f > 0.0);
469					break;
470				case 2:
471					break;
472			}
473
474			${OUTPUT}
475		}
476	""
477end
478
479case default_in_do_while_loop
480	version 300 es
481	expect compile_fail
482	both ""
483		#version 300 es
484		precision mediump float;
485		${DECLARATIONS}
486
487		void main ()
488		{
489			float f = 1.0;
490			switch (1)
491			{
492				case 0:
493					f = 0.0;
494					do
495					{
496						default:
497							f *= 2.0;
498					} while (f > 0.0);
499					break;
500				case 2:
501					break;
502			}
503
504			${OUTPUT}
505		}
506	""
507end
508
509case missing_colon
510	version 300 es
511	expect compile_fail
512	both ""
513		#version 300 es
514		precision mediump float;
515		${DECLARATIONS}
516
517		void main ()
518		{
519			switch (1)
520			{
521				case 1
522					${POSITION_FRAG_COLOR} = vec4(1.0);
523			}
524
525			${OUTPUT}
526		}
527	""
528end
529
530case missing_opening_brace
531	version 300 es
532	expect compile_fail
533	both ""
534		#version 300 es
535		precision mediump float;
536		${DECLARATIONS}
537
538		void main ()
539		{
540			switch (1)
541				case 1:
542					${POSITION_FRAG_COLOR} = vec4(1.0);
543			}
544
545			${OUTPUT}
546		}
547	""
548end
549
550case missing_closing_brace
551	version 300 es
552	expect compile_fail
553	both ""
554		#version 300 es
555		precision mediump float;
556		${DECLARATIONS}
557
558		void main ()
559		{
560			switch (1)
561			{
562				case 1:
563					${POSITION_FRAG_COLOR} = vec4(1.0);
564
565			${OUTPUT}
566		}
567	""
568end
569
570case double_case
571	version 300 es
572	expect compile_fail
573	both ""
574		#version 300 es
575		precision mediump float;
576		${DECLARATIONS}
577
578		void main ()
579		{
580			switch (1)
581			{
582				case case 1:
583					${POSITION_FRAG_COLOR} = vec4(1.0);
584			}
585
586			${OUTPUT}
587		}
588	""
589end
590
591case double_default_1
592	version 300 es
593	expect compile_fail
594	both ""
595		#version 300 es
596		precision mediump float;
597		${DECLARATIONS}
598
599		void main ()
600		{
601			switch (1)
602			{
603				default:
604					break;
605				default:
606					${POSITION_FRAG_COLOR} = vec4(1.0);
607			}
608
609			${OUTPUT}
610		}
611	""
612end
613
614case double_default_2
615	version 300 es
616	expect compile_fail
617	both ""
618		#version 300 es
619		precision mediump float;
620		${DECLARATIONS}
621
622		void main ()
623		{
624			switch (1)
625			{
626				default default:
627					${POSITION_FRAG_COLOR} = vec4(1.0);
628			}
629
630			${OUTPUT}
631		}
632	""
633end
634