• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1group basic "Basic Tests"
2
3	case correct_phases
4		version 300 es
5		expect compile_fail
6		both ""
7			#version 300 es
8			#define e +1
9			${DECLARATIONS}
10			void main()
11			{
12				mediump int n = 1e;
13				${OUTPUT}
14			}
15		""
16	end
17
18	case invalid_identifier
19		version 300 es
20		expect compile_fail
21		both ""
22			#version 300 es
23			#define e +1
24			${DECLARATIONS}
25			void main()
26			{
27				mediump int 1xyz = 1;
28				${OUTPUT}
29			}
30		""
31	end
32
33	case null_directive
34		version 300 es
35		values { output float out0 = 0.0; }
36		both ""
37			#version 300 es
38			precision mediump float;
39			${DECLARATIONS}
40
41			#
42		# // comment
43	/*sfd*/		# /* */
44
45			void main()
46			{
47				out0 = 0.0;
48				${OUTPUT}
49			}
50		""
51	end
52
53	case invalid_directive
54		version 300 es
55		expect compile_fail
56		both ""
57			#version 300 es
58			#defin AAA
59			${DECLARATIONS}
60
61			void main()
62			{
63				${OUTPUT}
64			}
65		""
66	end
67
68	case missing_identifier
69		version 300 es
70		expect compile_fail
71		both ""
72			#version 300 es
73			#define
74			${DECLARATIONS}
75
76			void main()
77			{
78				${OUTPUT}
79			}
80		""
81	end
82
83	case empty_object
84		version 300 es
85		values { output float out0 = -1.0; }
86		both ""
87			#version 300 es
88			precision mediump float;
89			${DECLARATIONS}
90
91			# define VALUE
92
93			void main()
94			{
95				out0 = VALUE - 1.0;
96				${OUTPUT}
97			}
98		""
99	end
100
101	case empty_function
102		version 300 es
103		values { output float out0 = -1.0; }
104		both ""
105			#version 300 es
106			precision mediump float;
107			${DECLARATIONS}
108
109			# define VALUE(a)
110
111			void main()
112			{
113				out0 = VALUE(2.0) - 1.0;
114				${OUTPUT}
115			}
116		""
117	end
118
119	case empty_directive
120		version 300 es
121		values { output float out0 = 1.0; }
122		both ""
123			#version 300 es
124			precision mediump float;
125			${DECLARATIONS}
126
127			#
128
129			void main()
130			{
131				out0 = 1.0;
132				${OUTPUT}
133			}
134		""
135	end
136
137end # basic
138
139group definitions "Symbol Definition Tests"
140
141	case define_value_and_function
142		version 300 es
143		values { output float out0 = 6.0; }
144
145		both ""
146			#version 300 es
147			precision mediump float;
148			${DECLARATIONS:single-line}
149			#	define		VALUE			(1.5 + 2.5)
150			#	define		FUNCTION(__LINE__, b)	__LINE__+b
151
152			void main()
153			{
154				out0 = FUNCTION(VALUE, ((0.2) + 1.8) );
155				${OUTPUT}
156			}
157		""
158	end
159
160	case undefine_object_invalid_syntax
161		version 300 es
162		expect compile_fail
163		both ""
164			#version 300 es
165			precision mediump float;
166			#define		VAL			2.0
167			#undef		VAL	sdflkjfds
168			#define		VAL			1.0
169			${DECLARATIONS}
170
171			void main()
172			{
173				${POSITION_FRAG_COLOR} = vec4(VAL);
174			}
175		""
176	end
177
178	case undefine_invalid_object_1
179		version 300 es
180		expect compile_fail
181		both ""
182			#version 300 es
183			precision mediump float;
184			#undef __LINE__
185			${DECLARATIONS}
186
187			void main()
188			{
189				${POSITION_FRAG_COLOR} = vec4(__LINE__);
190			}
191		""
192	end
193
194	case undefine_invalid_object_2
195		version 300 es
196		expect compile_fail
197		both ""
198			#version 300 es
199			precision mediump float;
200			#undef __FILE__
201			${DECLARATIONS}
202
203			void main()
204			{
205				${POSITION_FRAG_COLOR} = vec4(__FILE__);
206			}
207		""
208	end
209
210	case undefine_invalid_object_3
211		version 300 es
212		expect compile_fail
213		both ""
214			#version 300 es
215			precision mediump float;
216			#undef __VERSION__
217			${DECLARATIONS}
218
219			void main()
220			{
221				${POSITION_FRAG_COLOR} = vec4(__VERSION__);
222			}
223		""
224	end
225
226	case undefine_invalid_object_4
227		version 300 es
228		expect compile_fail
229		both ""
230			#version 300 es
231			precision mediump float;
232			#undef GL_ES
233			${DECLARATIONS}
234
235			void main()
236			{
237				${POSITION_FRAG_COLOR} = vec4(GL_ES);
238			}
239		""
240	end
241
242	case undefine_function
243		version 300 es
244		values { output float out0 = 1.0; }
245		both ""
246			#version 300 es
247			precision mediump float;
248			#define		FUNCTION(a,b) a+b
249			#undef		FUNCTION
250			#define		FUNCTION(a,b) a-b
251			${DECLARATIONS}
252
253			void main()
254			{
255				out0 = FUNCTION(3.0, 2.0);
256				${OUTPUT}
257			}
258		""
259	end
260
261end # definitions
262
263group invalid_definitions "Invalid Definition Tests"
264
265	case define_non_identifier
266		version 300 es
267		expect compile_fail
268		both ""
269			#version 300 es
270			precision mediump float;
271			#define 123 321
272			${DECLARATIONS}
273
274			void main()
275			{
276				${POSITION_FRAG_COLOR} = vec4(1.0);
277			}
278		""
279	end
280
281	case undef_non_identifier_1
282		version 300 es
283		expect compile_fail
284		both ""
285			#version 300 es
286			precision mediump float;
287			#undef 123
288			${DECLARATIONS}
289
290			void main()
291			{
292				${POSITION_FRAG_COLOR} = vec4(1.0);
293			}
294		""
295	end
296
297	case undef_non_identifier_2
298		version 300 es
299		expect compile_fail
300		both ""
301			#version 300 es
302			precision mediump float;
303			#undef foo.bar
304			${DECLARATIONS}
305
306			void main()
307			{
308				${POSITION_FRAG_COLOR} = vec4(1.0);
309			}
310		""
311	end
312
313
314end # invalid_definitions
315
316group object_redefinitions "Object Redefinition Tests"
317
318	case invalid_object_ident
319		version 300 es
320		expect compile_fail
321		both ""
322			#version 300 es
323			precision mediump float;
324			${DECLARATIONS}
325			# define AAA			2.0
326			# define AAAA			2.1
327			# define VALUE (AAA - 1.0)
328			# define VALUE (AAAA - 1.0)
329
330			void main()
331			{
332				${POSITION_FRAG_COLOR} = vec4(VALUE);
333			}
334		""
335	end
336
337	case invalid_object_whitespace
338		version 300 es
339		expect compile_fail
340		both ""
341			#version 300 es
342			precision mediump float;
343			${DECLARATIONS}
344			# define AAA			2.0
345			# define VALUE (AAA - 1.0)
346			# define VALUE (AAA- 1.0)
347
348			void main()
349			{
350				${POSITION_FRAG_COLOR} = vec4(VALUE);
351			}
352		""
353	end
354
355	case invalid_object_op
356		version 300 es
357		expect compile_fail
358		both ""
359			#version 300 es
360			precision mediump float;
361			${DECLARATIONS}
362			# define AAA			2.0
363			# define VALUE (AAA - 1.0)
364			# define VALUE (AAA + 1.0)
365
366			void main()
367			{
368				${POSITION_FRAG_COLOR} = vec4(VALUE);
369			}
370		""
371	end
372
373	case invalid_object_floatval_1
374		version 300 es
375		expect compile_fail
376		both ""
377			#version 300 es
378			precision mediump float;
379			${DECLARATIONS}
380			# define AAA			2.0
381			# define VALUE (AAA - 1.0)
382			# define VALUE (AAA - 1.1)
383
384			void main()
385			{
386				${POSITION_FRAG_COLOR} = vec4(VALUE);
387			}
388		""
389	end
390
391	case invalid_object_floatval_2
392		version 300 es
393		expect compile_fail
394		both ""
395			#version 300 es
396			precision mediump float;
397			${DECLARATIONS}
398			# define AAA			2.0
399			# define VALUE (AAA - 1.0)
400			# define VALUE (AAA - 1.0e-1)
401
402			void main()
403			{
404				${POSITION_FRAG_COLOR} = vec4(VALUE);
405			}
406		""
407	end
408
409	case invalid_object_intval_1
410		version 300 es
411		expect compile_fail
412		both ""
413			#version 300 es
414			precision mediump float;
415			${DECLARATIONS}
416			# define AAA			2
417			# define VALUE (AAA - 1)
418			# define VALUE (AAA - 2)
419
420			void main()
421			{
422				${POSITION_FRAG_COLOR} = vec4(VALUE);
423			}
424		""
425	end
426
427	case invalid_object_intval_2
428		version 300 es
429		expect compile_fail
430		both ""
431			#version 300 es
432			precision mediump float;
433			${DECLARATIONS}
434			# define AAA			2
435			# define VALUE (AAA - 1)
436			# define VALUE (AAA - 0x1)
437
438			void main()
439			{
440				${POSITION_FRAG_COLOR} = vec4(VALUE);
441			}
442		""
443	end
444
445	case redefine_object_1
446		version 300 es
447		values { output float out0 = 6.0; }
448
449		both ""
450			#version 300 es
451			precision mediump float;
452			${DECLARATIONS}
453			#	define  VAL1 1.0
454			#define		VAL2 2.0
455
456			#define RES2 (RES1 * VAL2)
457			#define RES1	(VAL2 / VAL1)
458			#define RES2	(RES1 * VAL2)
459			#define VALUE	(RES2 + RES1)
460
461			void main()
462			{
463				out0 = VALUE;
464				${OUTPUT}
465			}
466		""
467	end
468
469	case redefine_object_ifdef
470		version 300 es
471		values { output float out0 = 1.0; }
472
473		both ""
474			#version 300 es
475			precision mediump float;
476			${DECLARATIONS}
477			#define ADEFINE 1
478			#define ADEFINE 1
479
480			#ifdef ADEFINE
481			#define VALUE 1.0
482			#else
483			#define VALUE 0.0
484			#endif
485
486			void main()
487			{
488				out0 = VALUE;
489				${OUTPUT}
490			}
491		""
492	end
493
494	case redefine_object_undef_ifdef
495		version 300 es
496		values { output float out0 = 1.0; }
497
498		both ""
499			#version 300 es
500			precision mediump float;
501			${DECLARATIONS}
502			#define ADEFINE 1
503			#define ADEFINE 1
504			#undef ADEFINE
505
506			#ifdef ADEFINE
507			#define VALUE 0.0
508			#else
509			#define VALUE 1.0
510			#endif
511
512			void main()
513			{
514				out0 = VALUE;
515				${OUTPUT}
516			}
517		""
518	end
519
520	case redefine_object_ifndef
521		version 300 es
522		values { output float out0 = 1.0; }
523
524		both ""
525			#version 300 es
526			precision mediump float;
527			${DECLARATIONS}
528			#define ADEFINE 1
529			#define ADEFINE 1
530
531			#ifndef ADEFINE
532			#define VALUE 0.0
533			#else
534			#define VALUE 1.0
535			#endif
536
537			void main()
538			{
539				out0 = VALUE;
540				${OUTPUT}
541			}
542		""
543	end
544
545	case redefine_object_defined_1
546		version 300 es
547		values { output float out0 = 1.0; }
548
549		both ""
550			#version 300 es
551			precision mediump float;
552			${DECLARATIONS}
553			#define ADEFINE 1
554			#define ADEFINE 1
555
556			#if defined(ADEFINE)
557			#define VALUE 1.0
558			#else
559			#define VALUE 0.0
560			#endif
561
562			void main()
563			{
564				out0 = VALUE;
565				${OUTPUT}
566			}
567		""
568	end
569
570	case redefine_object_defined_2
571		version 300 es
572		values { output float out0 = 1.0; }
573
574		both ""
575			#version 300 es
576			precision mediump float;
577			${DECLARATIONS}
578			#define ADEFINE 1
579			#define ADEFINE 1
580
581			#if defined ADEFINE
582			#define VALUE 1.0
583			#else
584			#define VALUE 0.0
585			#endif
586
587			void main()
588			{
589				out0 = VALUE;
590				${OUTPUT}
591			}
592		""
593	end
594
595	case redefine_object_comment
596		version 300 es
597		values { output float out0 = 6.0; }
598
599		both ""
600			#version 300 es
601			precision mediump float;
602			${DECLARATIONS}
603			#	define  VAL1 1.0
604			#define		VAL2 2.0
605
606			#define RES2 /* fdsjklfdsjkl dsfjkhfdsjkh fdsjklhfdsjkh */ (RES1 * VAL2)
607			#define RES1	(VAL2 / VAL1)
608			#define RES2	/* ewrlkjhsadf */ (RES1 * VAL2)
609			#define VALUE	(RES2 + RES1)
610
611			void main()
612			{
613				out0 = VALUE;
614				${OUTPUT}
615			}
616		""
617	end
618
619	case redefine_object_multiline_comment
620		version 300 es
621		values { output float out0 = 6.0; }
622
623		both ""
624			#version 300 es
625			precision mediump float;
626			${DECLARATIONS}
627			#	define  VAL1 1.0
628			#define		VAL2 2.0
629
630			#define RES2 /* fdsjklfdsjkl
631							dsfjkhfdsjkh
632							fdsjklhfdsjkh */ (RES1 * VAL2)
633			#define RES1	(VAL2 / VAL1)
634			#define RES2	/* ewrlkjhsadf */ (RES1 * VAL2)
635			#define VALUE	(RES2 + RES1)
636
637			void main()
638			{
639				out0 = VALUE;
640				${OUTPUT}
641			}
642		""
643	end
644
645end # object_redefinitions
646
647group invalid_redefinitions "Invalid Redefinitions Tests"
648
649	case invalid_identifier_1
650		version 300 es
651		values { output int out0 = 1; }
652		both ""
653			#version 300 es
654			precision mediump float;
655			${DECLARATIONS}
656			# define __VALUE__	1
657
658			void main()
659			{
660				out0 = __VALUE__;
661				${OUTPUT}
662			}
663		""
664	end
665
666	case invalid_identifier_2
667		version 300 es
668		expect compile_fail
669		both ""
670			#version 300 es
671			precision mediump float;
672			${DECLARATIONS}
673			# define GL_VALUE	1.0
674
675			void main()
676			{
677				${POSITION_FRAG_COLOR} = vec4(GL_VALUE);
678			}
679		""
680	end
681
682end # invalid_redefinitions
683
684group comments "Comment Tests"
685
686	case multiline_comment_define
687		version 300 es
688		values { output float out0 = 4.2; }
689		both ""
690			#version 300 es
691			precision mediump float;
692			${DECLARATIONS}
693			#define VALUE /* current
694						value */ 4.2
695
696			void main()
697			{
698				out0 = VALUE;
699				${OUTPUT}
700			}
701		""
702	end
703
704	case nested_comment
705		version 300 es
706		values { output float out0 = 1.0; }
707		both ""
708			#version 300 es
709			precision mediump float;
710			${DECLARATIONS}
711			void main()
712			{
713				out0 = 0.0;
714				/* /* */
715				out0 = 1.0;
716				// */
717				${OUTPUT}
718			}
719		""
720	end
721
722	case invalid_comment
723		version 300 es
724		expect compile_fail
725		both ""
726			#version 300 es
727			precision mediump float;
728			${DECLARATIONS}
729			void main()
730			{
731				/* /* */ */
732				${POSITION_FRAG_COLOR} = 1.0;
733			}
734		""
735	end
736
737	case unterminated_comment_1
738		version 300 es
739		expect compile_fail
740		both ""
741			#version 300 es
742			precision mediump float;
743			${DECLARATIONS}
744			void main()
745			{
746				/*
747			}
748		""
749	end
750
751	case unterminated_comment_2
752		version 300 es
753		expect compile_fail
754		both ""
755			#version 300 es
756			/*
757			precision mediump float;
758			${DECLARATIONS}
759			void main()
760			{
761			}
762		""
763	end
764
765end # comments
766
767group line_continuation "Line Continuation Tests"
768
769	case comment
770		version 300 es
771		values { output float out0 = 1.0; }
772		both ""
773			#version 300 es
774			precision mediump float;
775			${DECLARATIONS}
776
777			void main ()
778			{
779				out0 = 1.0;
780				// comment \\
781				out0 = -1.0;
782				${OUTPUT}
783			}
784		""
785	end
786
787	case define
788		version 300 es
789		values { output float out0 = 1.0; }
790		both ""
791			#version 300 es
792			precision mediump float;
793			${DECLARATIONS}
794			#define A(X) \\
795				(-1.0*(X))
796
797			void main ()
798			{
799				out0 = A(-1.0);
800				${OUTPUT}
801			}
802		""
803	end
804
805	case preprocessing_token
806		version 300 es
807		values { output float out0 = 1.0; }
808		both ""
809			#version 300 es
810			precision mediump float;
811			${DECLARATIONS}
812			#def\\
813			ine A(X) (-1.0*(X))
814
815			void main ()
816			{
817				out0 = A(-1.0);
818				${OUTPUT}
819			}
820		""
821	end
822
823	case token
824		version 300 es
825		values { output float out0 = 1.0; }
826		both ""
827			#version 300 es
828			precision mediump float;
829			${DECLARATIONS}
830
831			void main ()
832			{
833				float f\\
834			oo = 1.0;
835				out0 = foo;
836				${OUTPUT}
837			}
838		""
839	end
840
841	case middle_of_line
842		version 300 es
843		values { output float out0 = 1.0; }
844		both ""
845			#version 300 es
846			precision mediump float;
847			${DECLARATIONS}
848			#define A a \\ b
849			#define B 1.0
850
851			void main ()
852			{
853				out0 = B;
854				${OUTPUT}
855			}
856		""
857	end
858
859end # line_continuation
860
861group function_definitions "Function Definitions Tests"
862
863	case same_object_and_function_param
864		version 300 es
865		values { output float out0 = 1.0; }
866
867		both ""
868			#version 300 es
869			precision mediump float;
870			${DECLARATIONS}
871			#define VALUE 1.0
872			#define FUNCTION(VALUE, B)	(VALUE-B)
873
874			void main()
875			{
876				out0 = FUNCTION(3.0, 2.0);
877				${OUTPUT}
878			}
879		""
880	end
881
882	case complex_func
883		version 300 es
884		values { output float out0 = 518.5; }
885		both ""
886			#version 300 es
887			precision mediump float;
888			${DECLARATIONS}
889			#define AAA(a,b)	a*(BBB(a,b))
890			#define BBB(a,b)	a-b
891
892			void main()
893			{
894				out0 = BBB(AAA(8.0/4.0, 2.0)*BBB(2.0*2.0,0.75*2.0), AAA(40.0,10.0*BBB(5.0,3.0)));
895				${OUTPUT}
896			}
897		""
898	end
899
900	case function_definition_with_comments
901		version 300 es
902		values { output float out0 = 3.0; }
903		both ""
904			#version 300 es
905			precision mediump float;
906			${DECLARATIONS}
907			/* sdfljk */			#/* sdfljk */define /* sdfljk */ FUNC( /* jklsfd*/a /*sfdjklh*/, /*sdfklj */b /*sdfklj*/)		a+b
908
909			void main()
910			{
911				out0 = FUNC(1.0, 2.0);
912				${OUTPUT}
913			}
914		""
915	end
916
917end # function_definitions
918
919group recursion "Recursions Tests"
920
921	case recursion_1
922		version 300 es
923		expect compile_fail
924		both ""
925			#version 300 es
926			precision mediump float;
927			${DECLARATIONS}
928			# define AAA	AAA
929
930			void main()
931			{
932				${POSITION_FRAG_COLOR} = vec4(AAA);
933			}
934		""
935	end
936
937	case recursion_2
938		version 300 es
939		expect compile_fail
940		both ""
941			#version 300 es
942			precision mediump float;
943			${DECLARATIONS}
944			# define AAA	BBB
945			#define BBB		AAA
946
947			void main()
948			{
949				${POSITION_FRAG_COLOR} = vec4(AAA);
950			}
951		""
952	end
953
954	case recursion_3
955		version 300 es
956		expect compile_fail
957		both ""
958			#version 300 es
959			precision mediump float;
960			${DECLARATIONS}
961			# define AAA	(1.0+BBB)
962			#define BBB		(2.0+AAA)
963
964			void main()
965			{
966				${POSITION_FRAG_COLOR} = vec4(AAA);
967			}
968		""
969	end
970
971	case recursion_4
972		version 300 es
973		expect compile_fail
974		both ""
975			#version 300 es
976			precision mediump float;
977			${DECLARATIONS}
978			# define AAA(a)	AAA(a)
979
980			void main()
981			{
982				${POSITION_FRAG_COLOR} = vec4(AAA(1.0));
983			}
984		""
985	end
986
987	case recursion_5
988		version 300 es
989		expect compile_fail
990		both ""
991			#version 300 es
992			precision mediump float;
993			${DECLARATIONS}
994			# define AAA(a, b)	AAA(b, a)
995
996			void main()
997			{
998				${POSITION_FRAG_COLOR} = vec4(AAA(1.0, 2.0));
999			}
1000		""
1001	end
1002
1003end # recursion
1004
1005group function_redefinitions "Function Redefinition Tests"
1006
1007	case function_redefinition_1
1008		version 300 es
1009		values { output float out0 = 3.0; }
1010		both ""
1011			#version 300 es
1012			precision mediump float;
1013			# define FUNC(a,b)		a+b
1014			# define FUNC( a, b)		a+b
1015
1016			${DECLARATIONS}
1017			void main()
1018			{
1019				out0 = FUNC(1.0, 2.0);
1020				${OUTPUT}
1021			}
1022		""
1023	end
1024
1025	case function_redefinition_2
1026		version 300 es
1027		values { output float out0 = 3.0; }
1028		both ""
1029			#version 300 es
1030			precision mediump float;
1031			# define FUNC(a,b)		(a  +b)
1032			# define FUNC( a, b )(a			+b)
1033
1034			${DECLARATIONS}
1035			void main()
1036			{
1037				out0 = FUNC(1.0, 2.0);
1038				${OUTPUT}
1039			}
1040		""
1041	end
1042
1043	case function_redefinition_3
1044		version 300 es
1045		values { output float out0 = 3.0; }
1046		both ""
1047			#version 300 es
1048			precision mediump float;
1049			# define FUNC(a,b)		(a  +b)
1050			# define FUNC(a,b)(a	/* comment
1051									 */ +b)
1052
1053			${DECLARATIONS}
1054			void main()
1055			{
1056				out0 = FUNC(1.0, 2.0);
1057				${OUTPUT}
1058			}
1059		""
1060	end
1061
1062	case invalid_function_redefinition_param_1
1063		version 300 es
1064		expect compile_fail
1065		both ""
1066			#version 300 es
1067			precision mediump float;
1068			# define FUNC(a,b)		a+b
1069			# define FUNC(A,b)		A+b
1070
1071			${DECLARATIONS}
1072			void main()
1073			{
1074				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0));
1075			}
1076		""
1077	end
1078
1079	case invalid_function_redefinition_param_2
1080		version 300 es
1081		expect compile_fail
1082		both ""
1083			#version 300 es
1084			precision mediump float;
1085			# define FUNC(a,b)		a+b
1086			# define FUNC(a,b,c)	a+b+c
1087
1088			${DECLARATIONS}
1089			void main()
1090			{
1091				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0, 3.0));
1092			}
1093		""
1094	end
1095
1096	case invalid_function_redefinition_param_3
1097		version 300 es
1098		expect compile_fail
1099		both ""
1100			#version 300 es
1101			precision mediump float;
1102			# define FUNC(a,b)		a+b
1103			# define FUNC(a,b)		b+a
1104
1105			${DECLARATIONS}
1106			void main()
1107			{
1108				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0));
1109			}
1110		""
1111	end
1112
1113end # functions_redefinitions
1114
1115group invalid_function_definitions "Invalid Function Definition Tests"
1116
1117	case arguments_1
1118		version 300 es
1119		expect compile_fail
1120		both ""
1121			#version 300 es
1122			precision mediump float;
1123			# define FUNC(a,b)		a+b
1124
1125			${DECLARATIONS}
1126			void main()
1127			{
1128				${POSITION_FRAG_COLOR} = vec4(FUNC);
1129			}
1130		""
1131	end
1132
1133	case arguments_2
1134		version 300 es
1135		expect compile_fail
1136		both ""
1137			#version 300 es
1138			precision mediump float;
1139			# define FUNC(a,b)		a+b
1140
1141			${DECLARATIONS}
1142			void main()
1143			{
1144				${POSITION_FRAG_COLOR} = vec4(FUNC());
1145			}
1146		""
1147	end
1148
1149	case arguments_3
1150		version 300 es
1151		expect compile_fail
1152		both ""
1153			#version 300 es
1154			precision mediump float;
1155			# define FUNC(a,b)		a+b
1156
1157			${DECLARATIONS}
1158			void main()
1159			{
1160				${POSITION_FRAG_COLOR} = vec4(FUNC((();
1161			}
1162		""
1163	end
1164
1165	case arguments_4
1166		version 300 es
1167		expect compile_fail
1168		both ""
1169			#version 300 es
1170			precision mediump float;
1171			# define FUNC(a,b)		a+b
1172
1173			${DECLARATIONS}
1174			void main()
1175			{
1176				${POSITION_FRAG_COLOR} = vec4(FUNC));
1177			}
1178		""
1179	end
1180
1181	case arguments_5
1182		version 300 es
1183		expect compile_fail
1184		both ""
1185			#version 300 es
1186			precision mediump float;
1187			# define FUNC(a,b)		a+b
1188
1189			${DECLARATIONS}
1190			void main()
1191			{
1192				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0));
1193			}
1194		""
1195	end
1196
1197	case arguments_6
1198		version 300 es
1199		expect compile_fail
1200		both ""
1201			#version 300 es
1202			precision mediump float;
1203			# define FUNC(a,b)		a+b
1204
1205			${DECLARATIONS}
1206			void main()
1207			{
1208				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0);
1209			}
1210		""
1211	end
1212
1213	case arguments_7
1214		version 300 es
1215		expect compile_fail
1216		both ""
1217			#version 300 es
1218			precision mediump float;
1219			# define FUNC(a,b)		a+b
1220
1221			${DECLARATIONS}
1222			void main()
1223			{
1224				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,));
1225			}
1226		""
1227	end
1228
1229	case arguments_8
1230		version 300 es
1231		expect compile_fail
1232		both ""
1233			#version 300 es
1234			precision mediump float;
1235			# define FUNC(a,b)		a+b
1236
1237			${DECLARATIONS}
1238			void main()
1239			{
1240				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0, 2.0, 3.0));
1241			}
1242		""
1243	end
1244
1245	case unique_param_name
1246		version 300 es
1247		expect compile_fail
1248		both ""
1249			#version 300 es
1250			precision mediump float;
1251			# define FUNC(a,a)		a+a
1252
1253			${DECLARATIONS}
1254			void main()
1255			{
1256				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1257			}
1258		""
1259	end
1260
1261	case argument_list_1
1262		version 300 es
1263		expect compile_fail
1264		both ""
1265			#version 300 es
1266			precision mediump float;
1267			# define FUNC(a b)		a+b
1268
1269			${DECLARATIONS}
1270			void main()
1271			{
1272				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1273			}
1274		""
1275	end
1276
1277	case argument_list_2
1278		version 300 es
1279		expect compile_fail
1280		both ""
1281			#version 300 es
1282			precision mediump float;
1283			# define FUNC(a + b)		a+b
1284
1285			${DECLARATIONS}
1286			void main()
1287			{
1288				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1289			}
1290		""
1291	end
1292
1293	case argument_list_3
1294		version 300 es
1295		expect compile_fail
1296		both ""
1297			#version 300 es
1298			precision mediump float;
1299			# define FUNC(,a,b)		a+b
1300
1301			${DECLARATIONS}
1302			void main()
1303			{
1304				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1305			}
1306		""
1307	end
1308
1309	case no_closing_parenthesis_1
1310		version 300 es
1311		expect compile_fail
1312		both ""
1313			#version 300 es
1314			precision mediump float;
1315			# define FUNC(
1316
1317			${DECLARATIONS}
1318			void main()
1319			{
1320				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1321			}
1322		""
1323	end
1324
1325	case no_closing_parenthesis_2
1326		version 300 es
1327		expect compile_fail
1328		both ""
1329			#version 300 es
1330			precision mediump float;
1331			# define FUNC(A  a+b
1332
1333			${DECLARATIONS}
1334			void main()
1335			{
1336				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1337			}
1338		""
1339	end
1340
1341	case no_closing_parenthesis_3
1342		version 300 es
1343		expect compile_fail
1344		both ""
1345			#version 300 es
1346			precision mediump float;
1347			# define FUNC(A,B,C  a+b
1348
1349			${DECLARATIONS}
1350			void main()
1351			{
1352				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0));
1353			}
1354		""
1355	end
1356
1357	case no_closing_parenthesis_4
1358		version 300 es
1359		expect compile_fail
1360		both ""
1361			#version 300 es
1362			precision mediump float;
1363			# define FUNC(
1364		""
1365	end
1366
1367end # invalid_function_definitions
1368
1369group semantic "Semantic Tests"
1370
1371	case ops_as_arguments
1372		version 300 es
1373		values { output float out0 = 20.0; }
1374		both ""
1375			#version 300 es
1376			precision mediump float;
1377			${DECLARATIONS}
1378			#define FOO(a, b)		(1 a 9) b 2
1379
1380			void main()
1381			{
1382				out0 = float(FOO(+, *));
1383				${OUTPUT}
1384			}
1385		""
1386	end
1387
1388	case correct_order
1389		version 300 es
1390		values { output float out0 = 1.0; }
1391		both ""
1392			#version 300 es
1393			precision mediump float;
1394			${DECLARATIONS}
1395			#define FUNC(A) A
1396			#define A 2.0
1397
1398			void main()
1399			{
1400				out0 = FUNC(A - 1.0);
1401				${OUTPUT}
1402			}
1403		""
1404	end
1405
1406end # semantic
1407
1408group predefined_macros "Predefined Macros Tests"
1409
1410	case version
1411		version 300 es
1412		values { output float out0 = 300.0; }
1413		both ""
1414			#version 300 es
1415			precision mediump float;
1416			${DECLARATIONS}
1417			void main()
1418			{
1419				#define AAA __VERSION__
1420				out0 = float(AAA);
1421				${OUTPUT}
1422			}
1423		""
1424	end
1425
1426	case gl_es_1
1427		version 300 es
1428		values { output float out0 = 1.0; }
1429		both ""
1430			#version 300 es
1431			precision mediump float;
1432			${DECLARATIONS}
1433
1434			void main()
1435			{
1436				out0 = float(GL_ES);
1437				${OUTPUT}
1438			}
1439		""
1440	end
1441
1442	case gl_es_2
1443		version 300 es
1444		values { output float out0 = 1.0; }
1445		both ""
1446			#version 300 es
1447			precision mediump float;
1448			${DECLARATIONS}
1449			#define AAA(A) A
1450
1451			void main()
1452			{
1453				out0 = float(AAA(GL_ES));
1454				${OUTPUT}
1455			}
1456		""
1457	end
1458
1459	case line_1
1460		version 300 es
1461		values { output float out0 = 2.0; }
1462		both ""
1463			#version 300 es
1464			const mediump int line = __LINE__;
1465			precision mediump float;
1466			${DECLARATIONS}
1467			void main()
1468			{
1469				out0 = float(line);
1470				${OUTPUT}
1471			}
1472		""
1473	end
1474
1475	case file
1476		version 300 es
1477		values { output float out0 = 0.0; }
1478		both ""
1479			#version 300 es
1480			precision mediump float;
1481			${DECLARATIONS}
1482			void main()
1483			{
1484				out0 = float(__FILE__);
1485				${OUTPUT}
1486			}
1487		""
1488	end
1489
1490	case if_gl_es
1491		version 300 es
1492		values { output float out0 = 1.0; }
1493		both ""
1494			#version 300 es
1495			precision mediump float;
1496			${DECLARATIONS}
1497			void main()
1498			{
1499	#if GL_ES
1500				out0 = 1.0;
1501	#else
1502				out0 = -1.0;
1503	#endif
1504				${OUTPUT}
1505			}
1506		""
1507	end
1508
1509	case if_version
1510		version 300 es
1511		values { output float out0 = 1.0; }
1512		both ""
1513			#version 300 es
1514			precision mediump float;
1515			${DECLARATIONS}
1516			void main()
1517			{
1518	#if __VERSION__ == 300
1519				out0 = 1.0;
1520	#else
1521				out0 = -1.0;
1522	#endif
1523				${OUTPUT}
1524			}
1525		""
1526	end
1527
1528	case invalid_token_pasting
1529		version 300 es
1530		expect compile_fail
1531		both ""
1532			#version 300 es
1533			precision mediump float;
1534			${DECLARATIONS}
1535			#define OUT(N) token##N
1536
1537			void main()
1538			{
1539				float token0 = 1.0;
1540				${POSITION_FRAG_COLOR} = vec4(OUT(0));
1541			}
1542		""
1543	end
1544
1545end # predefined_macros
1546
1547group conditional_inclusion "Conditional Inclusion Tests"
1548
1549	case basic_1
1550		version 300 es
1551		values { output float out0 = 1.0; }
1552		both ""
1553			#version 300 es
1554			precision mediump float;
1555			${DECLARATIONS}
1556			void main()
1557			{
1558	#define AAA asdf
1559
1560	#if defined AAA && !defined(BBB)
1561				out0 = 1.0;
1562	#else
1563				out0 = 0.0;
1564	#endif
1565				${OUTPUT}
1566			}
1567		""
1568	end
1569
1570	case basic_2
1571		version 300 es
1572		values { output float out0 = 1.0; }
1573		both ""
1574			#version 300 es
1575			precision mediump float;
1576			${DECLARATIONS}
1577			void main()
1578			{
1579	#define AAA defined(BBB)
1580
1581	#if !AAA
1582				out0 = 1.0;
1583	#else
1584				out0 = 0.0;
1585	#endif
1586				${OUTPUT}
1587			}
1588		""
1589	end
1590
1591	case basic_3
1592		version 300 es
1593		values { output float out0 = 1.0; }
1594		both ""
1595			#version 300 es
1596			precision mediump float;
1597			${DECLARATIONS}
1598			void main()
1599			{
1600	#if 0
1601				out0 = -1.0;
1602	#elif 0
1603				out0 = -2.0;
1604	#elif 1
1605				out0 = 1.0;
1606	#else
1607				out0 = -3.0;
1608	#endif
1609				${OUTPUT}
1610			}
1611		""
1612	end
1613
1614	case basic_4
1615		version 300 es
1616		values { output float out0 = 1.0; }
1617		both ""
1618			#version 300 es
1619			precision mediump float;
1620			${DECLARATIONS}
1621			void main()
1622			{
1623	#if 0
1624				out0 = -1.0;
1625	#elif 0
1626				out0 = -2.0;
1627	#else
1628				out0 = 1.0;
1629	#endif
1630				${OUTPUT}
1631			}
1632		""
1633	end
1634
1635	case basic_5
1636		version 300 es
1637		values { output float out0 = 1.0; }
1638		both ""
1639			#version 300 es
1640			precision mediump float;
1641			${DECLARATIONS}
1642			void main()
1643			{
1644	#if 1
1645				out0 = 1.0;
1646	#elif 0
1647				out0 = -2.0;
1648	#else
1649				out0 = -1.0;
1650	#endif
1651				${OUTPUT}
1652			}
1653		""
1654	end
1655
1656	case expression
1657		version 300 es
1658		values { output float out0 = 1.0; }
1659		both ""
1660			#version 300 es
1661			precision mediump float;
1662			${DECLARATIONS}
1663			void main()
1664			{
1665	#if !((~2 >> 1) & 1)
1666				out0 = 1.0;
1667	#else
1668				out0 = -1.0;
1669	#endif
1670				${OUTPUT}
1671			}
1672		""
1673	end
1674
1675end # conditional_inclusion
1676
1677group invalid_ops "Invalid Operations Tests"
1678
1679	case invalid_op_1
1680		version 300 es
1681		expect compile_fail
1682		both ""
1683			#version 300 es
1684			precision mediump float;
1685			${DECLARATIONS}
1686			void main()
1687			{
1688	#if !((~(+ ++1 - - - -1) >> 1) & 1)
1689				${POSITION_FRAG_COLOR} = vec4(-1.0);
1690	#else
1691				${POSITION_FRAG_COLOR} = vec4(1.0);
1692	#endif
1693			}
1694		""
1695	end
1696
1697	case invalid_op_2
1698		version 300 es
1699		expect compile_fail
1700		both ""
1701			#version 300 es
1702			precision mediump float;
1703			${DECLARATIONS}
1704			void main()
1705			{
1706	#if !((~(+ + +1 - -- -1) >> 1) & 1)
1707				${POSITION_FRAG_COLOR} = vec4(-1.0);
1708	#else
1709				${POSITION_FRAG_COLOR} = vec4(1.0);
1710	#endif
1711			}
1712		""
1713	end
1714
1715	case invalid_defined_expected_identifier_1
1716		version 300 es
1717		expect compile_fail
1718		both ""
1719			#version 300 es
1720			precision mediump float;
1721			#define AAA 1
1722
1723			${DECLARATIONS}
1724			void main()
1725			{
1726	#if defined
1727				${POSITION_FRAG_COLOR} = vec4(1.0);
1728	#endif
1729			}
1730		""
1731	end
1732
1733	case invalid_defined_expected_identifier_2
1734		version 300 es
1735		expect compile_fail
1736		both ""
1737			#version 300 es
1738			precision mediump float;
1739			#define AAA 1
1740
1741			${DECLARATIONS}
1742			void main()
1743			{
1744	#if defined()
1745				${POSITION_FRAG_COLOR} = vec4(1.0);
1746	#endif
1747			}
1748		""
1749	end
1750
1751	case invalid_defined_expected_identifier_3
1752		version 300 es
1753		expect compile_fail
1754		both ""
1755			#version 300 es
1756			precision mediump float;
1757			#define AAA 1
1758
1759			${DECLARATIONS}
1760			void main()
1761			{
1762	#if defined(
1763				${POSITION_FRAG_COLOR} = vec4(1.0);
1764	#endif
1765			}
1766		""
1767	end
1768
1769	case invalid_defined_expected_identifier_4
1770		version 300 es
1771		expect compile_fail
1772		both ""
1773			#version 300 es
1774			precision mediump float;
1775			#define AAA 1
1776
1777			${DECLARATIONS}
1778			void main()
1779			{
1780	#if defined)
1781				${POSITION_FRAG_COLOR} = vec4(1.0);
1782	#endif
1783			}
1784		""
1785	end
1786
1787	case invalid_defined_expected_identifier_5
1788		version 300 es
1789		expect compile_fail
1790		both ""
1791			#version 300 es
1792			precision mediump float;
1793			#define AAA 1
1794
1795			${DECLARATIONS}
1796			void main()
1797			{
1798	#if defined((AAA))
1799				${POSITION_FRAG_COLOR} = vec4(FUNC(1.0,2.0);
1800	#endif
1801			}
1802		""
1803	end
1804
1805	case invalid_defined_expected_rparen
1806		version 300 es
1807		expect compile_fail
1808		both ""
1809			#version 300 es
1810			precision mediump float;
1811			#define AAA 1
1812
1813			${DECLARATIONS}
1814			void main()
1815			{
1816	#if defined(AAA
1817				${POSITION_FRAG_COLOR} = vec4(1.0);
1818	#endif
1819			}
1820		""
1821	end
1822
1823	case defined_define
1824		version 300 es
1825		values { output float out0 = 1.0; }
1826		both ""
1827			#version 300 es
1828			precision mediump float;
1829			${DECLARATIONS}
1830	#define define 1
1831	#define AAA 1.0
1832
1833			void main()
1834			{
1835				out0 = AAA;
1836				${OUTPUT}
1837			}
1838		""
1839	end
1840
1841end # invalid_ops
1842
1843group undefined_identifiers "Undefined Identifiers Tests"
1844
1845	case valid_undefined_identifier_1
1846		version 300 es
1847		values { output float out0 = 1.0; }
1848		both ""
1849			#version 300 es
1850			precision mediump float;
1851			${DECLARATIONS}
1852			void main()
1853			{
1854	#if 1 || AAA
1855				out0 = 1.0;
1856	#else
1857				out0 = -1.0;
1858	#endif
1859				${OUTPUT}
1860			}
1861		""
1862	end
1863
1864	case valid_undefined_identifier_2
1865		version 300 es
1866		values { output float out0 = 1.0; }
1867		both ""
1868			#version 300 es
1869			precision mediump float;
1870			${DECLARATIONS}
1871			void main()
1872			{
1873	#if 0 && AAA
1874				out0 = -1.0;
1875	#else
1876				out0 = 1.0;
1877	#endif
1878				${OUTPUT}
1879			}
1880		""
1881	end
1882
1883	case undefined_identifier_1
1884		version 300 es
1885		expect compile_fail
1886		both ""
1887			#version 300 es
1888			precision mediump float;
1889			${DECLARATIONS}
1890			void main()
1891			{
1892	#if 1 - CCC + (-AAA || BBB)
1893				${POSITION_FRAG_COLOR} = vec4(1.0);
1894	#else
1895				${POSITION_FRAG_COLOR} = vec4(-1.0);
1896	#endif
1897			}
1898		""
1899	end
1900
1901	case undefined_identifier_2
1902		version 300 es
1903		expect compile_fail
1904		both ""
1905			#version 300 es
1906			precision mediump float;
1907			${DECLARATIONS}
1908			void main()
1909			{
1910	#if !A
1911				${POSITION_FRAG_COLOR} = vec4(1.0);
1912	#else
1913				${POSITION_FRAG_COLOR} = vec4(-1.0);
1914	#endif
1915			}
1916		""
1917	end
1918
1919	case undefined_identifier_3
1920		version 300 es
1921		expect compile_fail
1922		both ""
1923			#version 300 es
1924			precision mediump float;
1925			${DECLARATIONS}
1926			void main()
1927			{
1928	#if -A
1929				${POSITION_FRAG_COLOR} = vec4(1.0);
1930	#else
1931				${POSITION_FRAG_COLOR} = vec4(-1.0);
1932	#endif
1933			}
1934		""
1935	end
1936
1937	case undefined_identifier_4
1938		version 300 es
1939		expect compile_fail
1940		both ""
1941			#version 300 es
1942			precision mediump float;
1943			${DECLARATIONS}
1944			void main()
1945			{
1946	#if ~A
1947				${POSITION_FRAG_COLOR} = vec4(1.0);
1948	#else
1949				${POSITION_FRAG_COLOR} = vec4(-1.0);
1950	#endif
1951			}
1952		""
1953	end
1954
1955	case undefined_identifier_5
1956		version 300 es
1957		expect compile_fail
1958		both ""
1959			#version 300 es
1960			precision mediump float;
1961			${DECLARATIONS}
1962			void main()
1963			{
1964	#if A && B
1965				${POSITION_FRAG_COLOR} = vec4(1.0);
1966	#else
1967				${POSITION_FRAG_COLOR} = vec4(-1.0);
1968	#endif
1969			}
1970		""
1971	end
1972
1973	case undefined_identifier_6
1974		version 300 es
1975		expect compile_fail
1976		both ""
1977			#version 300 es
1978			precision mediump float;
1979			${DECLARATIONS}
1980			void main()
1981			{
1982    #define A 1
1983	#if A && B
1984				${POSITION_FRAG_COLOR} = vec4(1.0);
1985	#else
1986				${POSITION_FRAG_COLOR} = vec4(-1.0);
1987	#endif
1988			}
1989		""
1990	end
1991
1992	case undefined_identifier_7
1993		version 300 es
1994		expect compile_fail
1995		both ""
1996			#version 300 es
1997			precision mediump float;
1998			${DECLARATIONS}
1999			void main()
2000			{
2001    #define B 1
2002	#if A && B
2003				${POSITION_FRAG_COLOR} = vec4(1.0);
2004	#else
2005				${POSITION_FRAG_COLOR} = vec4(-1.0);
2006	#endif
2007			}
2008		""
2009	end
2010
2011	case undefined_identifier_8
2012		version 300 es
2013		expect compile_fail
2014		both ""
2015			#version 300 es
2016			precision mediump float;
2017			${DECLARATIONS}
2018			void main()
2019			{
2020    #define B 1
2021	#define A 2
2022	#undef A
2023	#if A && B
2024				${POSITION_FRAG_COLOR} = vec4(1.0);
2025	#else
2026				${POSITION_FRAG_COLOR} = vec4(-1.0);
2027	#endif
2028			}
2029		""
2030	end
2031
2032	case undefined_identifier_9
2033		version 300 es
2034		expect compile_fail
2035		both ""
2036			#version 300 es
2037			precision mediump float;
2038			${DECLARATIONS}
2039			void main()
2040			{
2041	#if A || B
2042				${POSITION_FRAG_COLOR} = vec4(1.0);
2043	#else
2044				${POSITION_FRAG_COLOR} = vec4(-1.0);
2045	#endif
2046			}
2047		""
2048	end
2049
2050	case undefined_identifier_10
2051		version 300 es
2052		expect compile_fail
2053		both ""
2054			#version 300 es
2055			precision mediump float;
2056			${DECLARATIONS}
2057			void main()
2058			{
2059    #define A 0
2060	#if A || B
2061				${POSITION_FRAG_COLOR} = vec4(1.0);
2062	#else
2063				${POSITION_FRAG_COLOR} = vec4(-1.0);
2064	#endif
2065			}
2066		""
2067	end
2068
2069	case undefined_identifier_11
2070		version 300 es
2071		expect compile_fail
2072		both ""
2073			#version 300 es
2074			precision mediump float;
2075			${DECLARATIONS}
2076			void main()
2077			{
2078    #define A 0
2079	#define B 2
2080	#undef B
2081	#if A || B
2082				${POSITION_FRAG_COLOR} = vec4(1.0);
2083	#else
2084				${POSITION_FRAG_COLOR} = vec4(-1.0);
2085	#endif
2086			}
2087		""
2088	end
2089
2090	case undefined_identifier_12
2091		version 300 es
2092		expect compile_fail
2093		both ""
2094			#version 300 es
2095			precision mediump float;
2096			${DECLARATIONS}
2097			void main()
2098			{
2099    #define B 1
2100	#if A || B
2101				${POSITION_FRAG_COLOR} = vec4(1.0);
2102	#else
2103				${POSITION_FRAG_COLOR} = vec4(-1.0);
2104	#endif
2105			}
2106		""
2107	end
2108
2109end # undefined_identifiers
2110
2111group invalid_conditionals "Invalid Conditionals Tests"
2112
2113	case empty_if
2114		version 300 es
2115		expect compile_fail
2116		both ""
2117			#version 300 es
2118			precision mediump float;
2119			${DECLARATIONS}
2120			void main()
2121			{
2122	#if
2123				${POSITION_FRAG_COLOR} = vec4(1.0);
2124			}
2125		""
2126	end
2127
2128	case empty_ifdef
2129		version 300 es
2130		expect compile_fail
2131		both ""
2132			#version 300 es
2133			precision mediump float;
2134			${DECLARATIONS}
2135			void main()
2136			{
2137	#ifdef
2138				${POSITION_FRAG_COLOR} = vec4(1.0);
2139			}
2140		""
2141	end
2142
2143	case empty_ifndef
2144		version 300 es
2145		expect compile_fail
2146		both ""
2147			#version 300 es
2148			precision mediump float;
2149			${DECLARATIONS}
2150			void main()
2151			{
2152	#ifndef
2153				${POSITION_FRAG_COLOR} = vec4(1.0);
2154			}
2155		""
2156	end
2157
2158	case invalid_ifdef
2159		version 300 es
2160		expect compile_fail
2161		both ""
2162			#version 300 es
2163			precision mediump float;
2164			${DECLARATIONS}
2165			void main()
2166			{
2167	#ifdef 1
2168				${POSITION_FRAG_COLOR} = vec4(1.0);
2169	#endif
2170			}
2171		""
2172	end
2173
2174	case invalid_ifndef
2175		version 300 es
2176		expect compile_fail
2177		both ""
2178			#version 300 es
2179			precision mediump float;
2180			${DECLARATIONS}
2181			void main()
2182			{
2183	#ifndef 1
2184				${POSITION_FRAG_COLOR} = vec4(1.0);
2185	#endif
2186			}
2187		""
2188	end
2189
2190	case empty_if_defined
2191		version 300 es
2192		expect compile_fail
2193		both ""
2194			#version 300 es
2195			precision mediump float;
2196			${DECLARATIONS}
2197			void main()
2198			{
2199	#if defined
2200				${POSITION_FRAG_COLOR} = vec4(1.0);
2201			}
2202		""
2203	end
2204
2205	case unterminated_if_1
2206		version 300 es
2207		expect compile_fail
2208		both ""
2209			#version 300 es
2210			precision mediump float;
2211			${DECLARATIONS}
2212			void main()
2213			{
2214	#if 1
2215				${POSITION_FRAG_COLOR} = vec4(1.0);
2216			}
2217		""
2218	end
2219
2220	case unterminated_if_2
2221		version 300 es
2222		expect compile_fail
2223		both ""
2224			#version 300 es
2225			precision mediump float;
2226			${DECLARATIONS}
2227			void main()
2228			{
2229	#if 0
2230				${POSITION_FRAG_COLOR} = vec4(1.0);
2231			}
2232		""
2233	end
2234
2235	case unterminated_ifdef
2236		version 300 es
2237		expect compile_fail
2238		both ""
2239			#version 300 es
2240			precision mediump float;
2241			${DECLARATIONS}
2242			void main()
2243			{
2244	#ifdef FOOBAR
2245				${POSITION_FRAG_COLOR} = vec4(1.0);
2246			}
2247		""
2248	end
2249
2250	case unterminated_ifndef
2251		version 300 es
2252		expect compile_fail
2253		both ""
2254			#version 300 es
2255			precision mediump float;
2256			${DECLARATIONS}
2257			void main()
2258			{
2259	#ifndef GL_ES
2260				${POSITION_FRAG_COLOR} = vec4(1.0);
2261			}
2262		""
2263	end
2264
2265	case unterminated_else_1
2266		version 300 es
2267		expect compile_fail
2268		both ""
2269			#version 300 es
2270			precision mediump float;
2271			${DECLARATIONS}
2272			void main()
2273			{
2274	#if 1
2275	#else
2276				${POSITION_FRAG_COLOR} = vec4(1.0);
2277			}
2278		""
2279	end
2280
2281	case unterminated_else_2
2282		version 300 es
2283		expect compile_fail
2284		both ""
2285			#version 300 es
2286			precision mediump float;
2287			${DECLARATIONS}
2288			void main()
2289			{
2290	#if 0
2291	#else
2292				${POSITION_FRAG_COLOR} = vec4(1.0);
2293			}
2294		""
2295	end
2296
2297	case unterminated_elif_1
2298		version 300 es
2299		expect compile_fail
2300		both ""
2301			#version 300 es
2302			precision mediump float;
2303			${DECLARATIONS}
2304			void main()
2305			{
2306	#if 0
2307	#elif 1
2308				${POSITION_FRAG_COLOR} = vec4(1.0);
2309			}
2310		""
2311	end
2312
2313	case unterminated_elif_2
2314		version 300 es
2315		expect compile_fail
2316		both ""
2317			#version 300 es
2318			precision mediump float;
2319			${DECLARATIONS}
2320			void main()
2321			{
2322	#if 1
2323	#elif 0
2324				${POSITION_FRAG_COLOR} = vec4(1.0);
2325			}
2326		""
2327	end
2328
2329	case unterminated_elif_3
2330		version 300 es
2331		expect compile_fail
2332		both ""
2333			#version 300 es
2334			precision mediump float;
2335			${DECLARATIONS}
2336			void main()
2337			{
2338	#if 0
2339	#elif 0
2340				${POSITION_FRAG_COLOR} = vec4(2.0);
2341			}
2342		""
2343	end
2344
2345	case elif_after_else
2346		version 300 es
2347		expect compile_fail
2348		both ""
2349			#version 300 es
2350			precision mediump float;
2351			${DECLARATIONS}
2352			void main()
2353			{
2354	#if 0
2355				${POSITION_FRAG_COLOR} = vec4(1.0);
2356	#else
2357				${POSITION_FRAG_COLOR} = vec4(-1.0);
2358	#elif 1
2359				${POSITION_FRAG_COLOR} = vec4(0.0);
2360	#endif
2361			}
2362		""
2363	end
2364
2365	case else_without_if
2366		version 300 es
2367		expect compile_fail
2368		both ""
2369			#version 300 es
2370			precision mediump float;
2371			${DECLARATIONS}
2372			void main()
2373			{
2374	#else
2375				${POSITION_FRAG_COLOR} = vec4(1.0);
2376	#endif
2377			}
2378		""
2379	end
2380
2381	case elif_without_if
2382		version 300 es
2383		expect compile_fail
2384		both ""
2385			#version 300 es
2386			precision mediump float;
2387			${DECLARATIONS}
2388			void main()
2389			{
2390	#elif 1
2391				${POSITION_FRAG_COLOR} = vec4(1.0);
2392	#endif
2393			}
2394		""
2395	end
2396
2397	case endif_without_if
2398		version 300 es
2399		expect compile_fail
2400		both ""
2401			#version 300 es
2402			precision mediump float;
2403			${DECLARATIONS}
2404			void main()
2405			{
2406				${POSITION_FRAG_COLOR} = vec4(1.0);
2407	#endif
2408			}
2409		""
2410	end
2411
2412	case else_after_else
2413		version 300 es
2414		expect compile_fail
2415		both ""
2416			#version 300 es
2417			precision mediump float;
2418			${DECLARATIONS}
2419			void main()
2420			{
2421	#if !GL_ES
2422			${POSITION_FRAG_COLOR} = vec4(1.0);
2423	#else
2424			${POSITION_FRAG_COLOR} = vec4(-1.0);
2425	#else
2426			${POSITION_FRAG_COLOR} = vec4(-1.0);
2427	#endif
2428			}
2429		""
2430	end
2431
2432	case nested_elif_without_if
2433		version 300 es
2434		expect compile_fail
2435		both ""
2436			#version 300 es
2437			precision mediump float;
2438			${DECLARATIONS}
2439			void main()
2440			{
2441	#if 1
2442			${POSITION_FRAG_COLOR} = vec4(1.0);
2443	#	elif
2444			${POSITION_FRAG_COLOR} = vec4(0.0);
2445	#	endif
2446	#endif
2447			}
2448		""
2449	end
2450
2451	case if_float
2452		version 300 es
2453		expect compile_fail
2454		both ""
2455			#version 300 es
2456			precision mediump float;
2457			${DECLARATIONS}
2458			void main()
2459			{
2460	#if 1.231
2461			${POSITION_FRAG_COLOR} = vec4(1.0);
2462	#	elif
2463			${POSITION_FRAG_COLOR} = vec4(0.0);
2464	#	endif
2465	#endif
2466			}
2467		""
2468	end
2469
2470	case tokens_after_if
2471		version 300 es
2472		expect compile_fail
2473		both ""
2474			#version 300 es
2475			precision mediump float;
2476			${DECLARATIONS}
2477			void main()
2478			{
2479	#if 1 foobar
2480				${POSITION_FRAG_COLOR} = vec4(1.0);
2481	#endif
2482			}
2483		""
2484	end
2485
2486	case tokens_after_elif
2487		version 300 es
2488		expect compile_fail
2489		both ""
2490			#version 300 es
2491			precision mediump float;
2492			${DECLARATIONS}
2493			void main()
2494			{
2495	#if 0
2496	#elif foobar
2497				${POSITION_FRAG_COLOR} = vec4(1.0);
2498	#endif
2499			}
2500		""
2501	end
2502
2503	case tokens_after_else
2504		version 300 es
2505		expect compile_fail
2506		both ""
2507			#version 300 es
2508			precision mediump float;
2509			${DECLARATIONS}
2510			void main()
2511			{
2512	#if 1
2513	#else foobar 1.231
2514	#endif
2515				${POSITION_FRAG_COLOR} = vec4(1.0);
2516			}
2517		""
2518	end
2519
2520	case tokens_after_endif
2521		version 300 es
2522		expect compile_fail
2523		both ""
2524			#version 300 es
2525			precision mediump float;
2526			${DECLARATIONS}
2527			void main()
2528			{
2529	#if 1
2530	#else
2531	#endif foobar
2532				${POSITION_FRAG_COLOR} = vec4(1.0);
2533			}
2534		""
2535	end
2536
2537	case tokens_after_ifdef
2538		version 300 es
2539		expect compile_fail
2540		both ""
2541			#version 300 es
2542			precision mediump float;
2543			${DECLARATIONS}
2544			void main()
2545			{
2546	#ifdef FOOBAR foobar
2547	#else
2548	#endif
2549				${POSITION_FRAG_COLOR} = vec4(1.0);
2550			}
2551		""
2552	end
2553
2554	case tokens_after_ifndef
2555		version 300 es
2556		expect compile_fail
2557		both ""
2558			#version 300 es
2559			precision mediump float;
2560			${DECLARATIONS}
2561			void main()
2562			{
2563	#ifndef FOOBAR ,, +- << barbar
2564	#else
2565	#endif
2566				${POSITION_FRAG_COLOR} = vec4(1.0);
2567			}
2568		""
2569	end
2570
2571	case unterminated_nested_blocks
2572		version 300 es
2573		expect compile_fail
2574		both ""
2575			#version 300 es
2576			precision mediump float;
2577			${DECLARATIONS}
2578			void main()
2579			{
2580	#if 1
2581	#	if 1
2582				${POSITION_FRAG_COLOR} = vec4(1.0);
2583			}
2584		""
2585	end
2586
2587end # invalid_conditionals
2588
2589group conditionals "Conditionals Tests"
2590
2591	case ifdef_1
2592		version 300 es
2593		values { output float out0 = 1.0; }
2594		both ""
2595	#version 300 es
2596	#define AAA
2597			precision mediump float;
2598			${DECLARATIONS}
2599			void main()
2600			{
2601	#ifdef AAA
2602				out0 = 1.0;
2603	#else
2604				out0 = -1.0;
2605	#endif
2606				${OUTPUT}
2607			}
2608		""
2609	end
2610
2611	case ifdef_2
2612		version 300 es
2613		values { output float out0 = 1.0; }
2614		both ""
2615	#version 300 es
2616	#define AAA
2617			precision mediump float;
2618			${DECLARATIONS}
2619			void main()
2620			{
2621	#if defined  ( AAA)
2622				out0 = 1.0;
2623	#else
2624				out0 = -1.0;
2625	#endif
2626				${OUTPUT}
2627			}
2628		""
2629	end
2630
2631	case ifdef_3
2632		version 300 es
2633		values { output float out0 = 1.0; }
2634		both ""
2635			#version 300 es
2636			precision mediump float;
2637			${DECLARATIONS}
2638			void main()
2639			{
2640	#ifdef AAA
2641				out0 = -1.0;
2642	#else
2643				out0 = 1.0;
2644	#endif
2645				${OUTPUT}
2646			}
2647		""
2648	end
2649
2650	case ifndef_1
2651		version 300 es
2652		values { output float out0 = 1.0; }
2653		both ""
2654			#version 300 es
2655			precision mediump float;
2656			${DECLARATIONS}
2657			void main()
2658			{
2659	#ifndef AAA
2660				out0 = 1.0;
2661	#else
2662				out0 = -1.0;
2663	#endif
2664				${OUTPUT}
2665			}
2666		""
2667	end
2668
2669	case ifndef_2
2670		version 300 es
2671		values { output float out0 = 1.0; }
2672		both ""
2673			#version 300 es
2674			precision mediump float;
2675			${DECLARATIONS}
2676	#define AAA
2677			void main()
2678			{
2679	#ifndef AAA
2680				out0 = -1.0;
2681	#else
2682				out0 = 1.0;
2683	#endif
2684				${OUTPUT}
2685			}
2686		""
2687	end
2688
2689	case mixed_conditional_inclusion
2690		version 300 es
2691		values { output float out0 = 1.0; }
2692		both ""
2693			#version 300 es
2694			precision mediump float;
2695			${DECLARATIONS}
2696			void main()
2697			{
2698	#ifndef AAA
2699				out0 = 1.0;
2700	#elif 1
2701				out0 = -1.0;
2702	#endif
2703				${OUTPUT}
2704			}
2705		""
2706	end
2707
2708	case nested_if_1
2709		version 300 es
2710		values { output float out0 = 1.0; }
2711		both ""
2712			#version 300 es
2713			precision mediump float;
2714			${DECLARATIONS}
2715			void main()
2716			{
2717	#if GL_ES
2718	#	if __VERSION__ != 300
2719				out0 = -1.0;
2720	#	else
2721				out0 = 1.0;
2722	#	endif
2723	#endif
2724				${OUTPUT}
2725			}
2726		""
2727	end
2728
2729	case nested_if_2
2730		version 300 es
2731		values { output float out0 = 1.0; }
2732		both ""
2733			#version 300 es
2734			precision mediump float;
2735			${DECLARATIONS}
2736			void main()
2737			{
2738	#if 1
2739	#	if 0
2740				out0 = -1.0;
2741	#	else
2742	#		if 0
2743				out0 = -1.0;
2744	#		elif 1
2745				out0 = 1.0;
2746	#		else
2747				out0 = -1.0;
2748	#		endif
2749	#	endif
2750	#endif
2751				${OUTPUT}
2752			}
2753		""
2754	end
2755
2756	case nested_if_3
2757		version 300 es
2758		values { output float out0 = 1.0; }
2759		both ""
2760			#version 300 es
2761			precision mediump float;
2762			${DECLARATIONS}
2763			void main()
2764			{
2765	#if 0
2766	#	if 1
2767				out0 = -1.0;
2768	#	endif
2769	#else
2770				out0 = 1.0;
2771	#endif
2772				${OUTPUT}
2773			}
2774		""
2775	end
2776
2777end # conditionals
2778
2779group directive "Directive Tests"
2780
2781	case version_is_less
2782		expect compile_fail
2783		version 300 es
2784		both ""
2785			#version 3 es
2786			precision mediump float;
2787			${DECLARATIONS}
2788			void main()
2789			{
2790				${POSITION_FRAG_COLOR} = vec4(1.0);
2791			}
2792		""
2793	end
2794
2795	case version_is_more
2796		expect compile_fail
2797		version 300 es
2798		both ""
2799			#version 3000 es
2800			precision mediump float;
2801			${DECLARATIONS}
2802			void main()
2803			{
2804				${POSITION_FRAG_COLOR} = vec4(1.0);
2805			}
2806		""
2807	end
2808
2809	case version_missing_es
2810		expect compile_fail
2811		version 300 es
2812		both ""
2813			#version 300
2814			precision mediump float;
2815			${DECLARATIONS}
2816			void main()
2817			{
2818				${POSITION_FRAG_COLOR} = vec4(1.0);
2819			}
2820		""
2821	end
2822
2823	case version_missing
2824		expect compile_fail
2825		version 300 es
2826		both ""
2827			#version
2828			precision mediump float;
2829			${DECLARATIONS}
2830			void main()
2831			{
2832				${POSITION_FRAG_COLOR} = vec4(1.0);
2833			}
2834		""
2835	end
2836
2837	case version_not_first_statement_1
2838		expect compile_fail
2839		version 300 es
2840		both ""
2841			precision mediump float;
2842			#version 300 es
2843			${DECLARATIONS}
2844			void main()
2845			{
2846				${POSITION_FRAG_COLOR} = vec4(1.0);
2847			}
2848		""
2849	end
2850
2851	case version_not_first_statement_2
2852		expect compile_fail
2853		version 300 es
2854		both ""
2855			#define FOO BAR
2856			#version 300 es
2857			precision mediump float;
2858			${DECLARATIONS}
2859			void main()
2860			{
2861				${POSITION_FRAG_COLOR} = vec4(1.0);
2862			}
2863		""
2864	end
2865
2866	case version_invalid_token_1
2867		expect compile_fail
2868		version 300 es
2869		both ""
2870			#version 300 es.0
2871			precision mediump float;
2872			${DECLARATIONS}
2873			void main()
2874			{
2875				${POSITION_FRAG_COLOR} = vec4(1.0);
2876			}
2877		""
2878	end
2879
2880	case version_invalid_token_2
2881		expect compile_fail
2882		version 300 es
2883		both ""
2884			#version foobar
2885			precision mediump float;
2886			${DECLARATIONS}
2887			void main()
2888			{
2889				${POSITION_FRAG_COLOR} = vec4(1.0);
2890			}
2891		""
2892	end
2893
2894	case invalid_version
2895		expect compile_fail
2896		version 300 es
2897		both ""
2898			#version AAA
2899			precision mediump float;
2900			${DECLARATIONS}
2901			void main()
2902			{
2903				${POSITION_FRAG_COLOR} = vec4(1.0);
2904			}
2905		""
2906	end
2907
2908	case additional_tokens
2909		expect compile_fail
2910		version 300 es
2911		both ""
2912			#version 300 es foobar
2913			precision mediump float;
2914			${DECLARATIONS}
2915			void main()
2916			{
2917				${POSITION_FRAG_COLOR} = vec4(1.0);
2918			}
2919		""
2920	end
2921
2922	case error_with_no_tokens
2923		version 300 es
2924		expect compile_fail
2925		both ""
2926			#version 300 es
2927			#error
2928			precision mediump float;
2929			${DECLARATIONS}
2930			void main()
2931			{
2932				${POSITION_FRAG_COLOR} = vec4(1.0);
2933			}
2934		""
2935	end
2936
2937	case error
2938		version 300 es
2939		expect compile_fail
2940		both ""
2941			#version 300 es
2942			#define AAA asdf
2943			#error 1 * AAA /* comment */
2944			precision mediump float;
2945			${DECLARATIONS}
2946			void main()
2947			{
2948				${POSITION_FRAG_COLOR} = vec4(1.0);
2949			}
2950		""
2951	end
2952
2953end # directive
2954
2955group builtin "Built-in Symbol Tests"
2956
2957	case line
2958		version 300 es
2959		values { output float out0 = 1.0; }
2960		both ""
2961			#version 300 es
2962			precision mediump float;
2963			${DECLARATIONS}
2964			void main()
2965			{
2966			#line 1
2967				out0 = float(__LINE__);
2968				${OUTPUT}
2969			}
2970		""
2971	end
2972
2973	case line_and_file
2974		version 300 es
2975		values { output vec4 out0 = vec4(234.0, 234.0, 10.0, 10.0); }
2976		both ""
2977			#version 300 es
2978			precision mediump float;
2979			${DECLARATIONS}
2980			void main()
2981			{
2982	#line 234 10
2983				out0 = vec4(__LINE__, __LINE__, __FILE__, __FILE__);
2984				${OUTPUT}
2985			}
2986		""
2987	end
2988
2989end # builtin
2990
2991group pragmas "Pragma Tests"
2992
2993	case pragma_vertex
2994		version 300 es
2995		values { output float out0 = 1.0; }
2996		vertex ""
2997			#version 300 es
2998			#pragma
2999			#pragma STDGL invariant(all)
3000			#pragma debug(off)
3001			#pragma optimize(off)
3002
3003			${VERTEX_DECLARATIONS}
3004			void main()
3005			{
3006				${VERTEX_OUTPUT}
3007			}
3008		""
3009		fragment ""
3010			#version 300 es
3011			precision mediump float;
3012			${FRAGMENT_DECLARATIONS}
3013			void main()
3014			{
3015				out0 = 1.0;
3016				${FRAGMENT_OUTPUT}
3017			}
3018		""
3019	end
3020
3021	case pragma_fragment
3022		version 300 es
3023		values { output float out0 = 1.0; }
3024		vertex ""
3025			#version 300 es
3026			${VERTEX_DECLARATIONS}
3027			void main()
3028			{
3029				${VERTEX_OUTPUT}
3030			}
3031		""
3032		fragment ""
3033			#version 300 es
3034			#pragma
3035			#pragma debug(off)
3036			#pragma optimize(off)
3037
3038			precision mediump float;
3039			${FRAGMENT_DECLARATIONS}
3040			void main()
3041			{
3042				out0 = 1.0;
3043				${FRAGMENT_OUTPUT}
3044			}
3045		""
3046	end
3047
3048	case pragma_macro_exp
3049		version 300 es
3050		values { output float out0 = 1.0; }
3051		both ""
3052	#version 300 es
3053	#define off	INVALID
3054	/* pragma line not macro expanded */
3055	#pragma debug(off)
3056
3057			precision mediump float;
3058			${DECLARATIONS}
3059			void main()
3060			{
3061				out0 = 1.0;
3062				${OUTPUT}
3063			}
3064		""
3065	end
3066
3067end # pragmas
3068
3069group extensions "Extension Tests"
3070
3071	case basic
3072		version 300 es
3073		values { output float out0 = 1.0; }
3074		both ""
3075			#version 300 es
3076			#extension all : warn
3077
3078			precision mediump float;
3079			${DECLARATIONS}
3080			void main()
3081			{
3082				out0 = 1.0;
3083				${OUTPUT}
3084			}
3085		""
3086	end
3087
3088	case macro_exp
3089		version 300 es
3090		values { output float out0 = 1.0; }
3091		both ""
3092			#version 300 es
3093			#define warn enable
3094
3095			#extension all : warn
3096
3097			precision mediump float;
3098			${DECLARATIONS}
3099			void main()
3100			{
3101				out0 = 1.0;
3102				${OUTPUT}
3103			}
3104		""
3105	end
3106
3107	case missing_extension_name
3108		version 300 es
3109		expect compile_fail
3110		both ""
3111			#version 300 es
3112			#extension
3113			precision mediump float;
3114			${DECLARATIONS}
3115			void main()
3116			{
3117				${POSITION_FRAG_COLOR} = vec4(1.0);
3118			}
3119		""
3120	end
3121
3122	case invalid_extension_name
3123		version 300 es
3124		expect compile_fail
3125		both ""
3126			#version 300 es
3127			#extension 2 : all
3128			precision mediump float;
3129			${DECLARATIONS}
3130			void main()
3131			{
3132				${POSITION_FRAG_COLOR} = vec4(1.0);
3133			}
3134		""
3135	end
3136
3137	case missing_colon
3138		version 300 es
3139		expect compile_fail
3140		both ""
3141			#version 300 es
3142			#extension all
3143			precision mediump float;
3144			${DECLARATIONS}
3145			void main()
3146			{
3147				${POSITION_FRAG_COLOR} = vec4(1.0);
3148			}
3149		""
3150	end
3151
3152	case expected_colon
3153		version 300 es
3154		expect compile_fail
3155		both ""
3156			#version 300 es
3157			#extension all ;
3158			precision mediump float;
3159			${DECLARATIONS}
3160			void main()
3161			{
3162				${POSITION_FRAG_COLOR} = vec4(1.0);
3163			}
3164		""
3165	end
3166
3167	case missing_behavior
3168		version 300 es
3169		expect compile_fail
3170		both ""
3171			#version 300 es
3172			#extension all :
3173			precision mediump float;
3174			${DECLARATIONS}
3175			void main()
3176			{
3177				${POSITION_FRAG_COLOR} = vec4(1.0);
3178			}
3179		""
3180	end
3181
3182	case invalid_behavior_1
3183		version 300 es
3184		expect compile_fail
3185		both ""
3186			#version 300 es
3187			#extension all : WARN
3188			precision mediump float;
3189			${DECLARATIONS}
3190			void main()
3191			{
3192				${POSITION_FRAG_COLOR} = vec4(1.0);
3193			}
3194		""
3195	end
3196
3197	case invalid_behavior_2
3198		version 300 es
3199		expect compile_fail
3200		both ""
3201			#version 300 es
3202			#extension all : require
3203			precision mediump float;
3204			${DECLARATIONS}
3205			void main()
3206			{
3207				${POSITION_FRAG_COLOR} = vec4(1.0);
3208			}
3209		""
3210	end
3211
3212	case invalid_behavior_3
3213		version 300 es
3214		expect compile_fail
3215		both ""
3216			#version 300 es
3217			#extension all : enable
3218			precision mediump float;
3219			${DECLARATIONS}
3220			void main()
3221			{
3222				${POSITION_FRAG_COLOR} = vec4(1.0);
3223			}
3224		""
3225	end
3226
3227	case invalid_char_in_name
3228		version 300 es
3229		expect compile_fail
3230		both ""
3231			#version 300 es
3232			#extension all� : warn
3233			precision mediump float;
3234			${DECLARATIONS}
3235			void main()
3236			{
3237				${POSITION_FRAG_COLOR} = vec4(1.0);
3238			}
3239		""
3240	end
3241
3242	case invalid_char_in_behavior
3243		version 300 es
3244		expect compile_fail
3245		both ""
3246			#version 300 es
3247			#extension all : war�n
3248			precision mediump float;
3249			${DECLARATIONS}
3250			void main()
3251			{
3252				${POSITION_FRAG_COLOR} = vec4(1.0);
3253			}
3254		""
3255	end
3256
3257	case unterminated_comment
3258		version 300 es
3259		expect compile_fail
3260		both ""
3261			#version 300 es
3262			#extension all : warn /*asd
3263			precision mediump float;
3264			${DECLARATIONS}
3265			void main()
3266			{
3267				${POSITION_FRAG_COLOR} = vec4(1.0);
3268			}
3269		""
3270	end
3271
3272	case after_non_preprocessing_tokens
3273		version 300 es
3274		expect compile_fail
3275		both ""
3276			#version 300 es
3277			#extension all : warn
3278
3279			precision mediump float;
3280			${DECLARATIONS}
3281			void main()
3282			{
3283			#extension all : disable
3284				${POSITION_FRAG_COLOR} = vec4(1.0);
3285			}
3286		""
3287	end
3288end # extensions
3289
3290group expressions "Expression Tests"
3291
3292	case shift_left
3293		version 300 es
3294		values { output float out0 = 1.0; }
3295		both ""
3296			#version 300 es
3297			precision mediump float;
3298			${DECLARATIONS}
3299			void main()
3300			{
3301				#define VAL 4
3302				out0 = 0.0;
3303				#if (VAL << 2) == 16
3304					out0 = 1.0;
3305				#endif
3306				${OUTPUT}
3307			}
3308		""
3309	end
3310
3311	case shift_right
3312		version 300 es
3313		values { output float out0 = 1.0; }
3314		both ""
3315			#version 300 es
3316			precision mediump float;
3317			${DECLARATIONS}
3318			void main()
3319			{
3320				#define VAL 5
3321				out0 = 0.0;
3322				#if (VAL >> 1) == 2
3323					out0 = 1.0;
3324				#endif
3325				${OUTPUT}
3326			}
3327		""
3328	end
3329
3330	case cmp_less_than
3331		version 300 es
3332		values { output float out0 = 1.0; }
3333		both ""
3334			#version 300 es
3335			precision mediump float;
3336			${DECLARATIONS}
3337			void main()
3338			{
3339				#define VAL 5
3340				out0 = 0.0;
3341				#if (VAL < 6) && (-VAL < -4)
3342					out0 = 1.0;
3343				#endif
3344				${OUTPUT}
3345			}
3346		""
3347	end
3348
3349	case less_or_equal
3350		version 300 es
3351		values { output float out0 = 1.0; }
3352		both ""
3353			#version 300 es
3354			precision mediump float;
3355			${DECLARATIONS}
3356			void main()
3357			{
3358				#define VAL 6
3359				out0 = 0.0;
3360				#if (VAL <= 6) && (-VAL <= -6)
3361					out0 = 1.0;
3362				#endif
3363				${OUTPUT}
3364			}
3365		""
3366	end
3367
3368	case or
3369		version 300 es
3370		values { output float out0 = 1.0; }
3371		both ""
3372			#version 300 es
3373			precision mediump float;
3374			${DECLARATIONS}
3375			void main()
3376			{
3377				#define VAL 6
3378				out0 = 0.0;
3379				#if (VAL | 5) == 7
3380					out0 = 1.0;
3381				#endif
3382				${OUTPUT}
3383			}
3384		""
3385	end
3386
3387	case and
3388		version 300 es
3389		values { output float out0 = 1.0; }
3390		both ""
3391			#version 300 es
3392			precision mediump float;
3393			${DECLARATIONS}
3394			void main()
3395			{
3396				#define VAL 6
3397				out0 = 0.0;
3398				#if (VAL & 5) == 4
3399					out0 = 1.0;
3400				#endif
3401				${OUTPUT}
3402			}
3403		""
3404	end
3405
3406	case xor
3407		version 300 es
3408		values { output float out0 = 1.0; }
3409		both ""
3410			#version 300 es
3411			precision mediump float;
3412			${DECLARATIONS}
3413			void main()
3414			{
3415				#define VAL 6
3416				out0 = 0.0;
3417				#if (VAL ^ 5) == 3
3418					out0 = 1.0;
3419				#endif
3420				${OUTPUT}
3421			}
3422		""
3423	end
3424
3425	case mod
3426		version 300 es
3427		values { output float out0 = 1.0; }
3428		both ""
3429			#version 300 es
3430			precision mediump float;
3431			${DECLARATIONS}
3432			void main()
3433			{
3434				#define VAL 12
3435				out0 = 0.0;
3436				#if (VAL % 5) == 2
3437					out0 = 1.0;
3438				#endif
3439				${OUTPUT}
3440			}
3441		""
3442	end
3443
3444	case parenthesis_value
3445		version 300 es
3446		values { output float out0 = 1.0; }
3447		both ""
3448			#version 300 es
3449			precision mediump float;
3450			${DECLARATIONS}
3451			void main()
3452			{
3453				#define VAL ((  (4   ) )  )
3454				out0 = 0.0;
3455				#if VAL >= 4
3456					out0 = 1.0;
3457				#endif
3458				${OUTPUT}
3459			}
3460		""
3461	end
3462
3463	case parenthesis_tricky
3464		version 300 es
3465		values { output float out0 = 1.0; }
3466		both ""
3467			#version 300 es
3468			precision mediump float;
3469			${DECLARATIONS}
3470			void main()
3471			{
3472				#define VAL ((  (4   ) )
3473				out0 = 0.0;
3474				#if VAL) >= 4
3475					out0 = 1.0;
3476				#endif
3477				${OUTPUT}
3478			}
3479		""
3480	end
3481
3482	case parenthesis_if_no
3483		version 300 es
3484		values { output float out0 = 1.0; }
3485		both ""
3486			#version 300 es
3487			precision mediump float;
3488			${DECLARATIONS}
3489			void main()
3490			{
3491				#define VAL 4
3492				out0 = 0.0;
3493				#if VAL >= 4
3494					out0 = 1.0;
3495				#endif
3496				${OUTPUT}
3497			}
3498		""
3499	end
3500
3501	case parenthesis_if
3502		version 300 es
3503		values { output float out0 = 1.0; }
3504		both ""
3505			#version 300 es
3506			precision mediump float;
3507			${DECLARATIONS}
3508			void main()
3509			{
3510				#define VAL 4
3511				out0 = 0.0;
3512				#if (VAL >= 4)
3513					out0 = 1.0;
3514				#endif
3515				${OUTPUT}
3516			}
3517		""
3518	end
3519
3520	case parenthesis_multi_if
3521		version 300 es
3522		values { output float out0 = 1.0; }
3523		both ""
3524			#version 300 es
3525			precision mediump float;
3526			${DECLARATIONS}
3527			void main()
3528			{
3529				#define VAL (4)
3530				out0 = 0.0;
3531				#if (((VAL)) >= (4))
3532					out0 = 1.0;
3533				#endif
3534				${OUTPUT}
3535			}
3536		""
3537	end
3538
3539	case parenthesis_single_if
3540		version 300 es
3541		values { output float out0 = 1.0; }
3542		both ""
3543			#version 300 es
3544			precision mediump float;
3545			${DECLARATIONS}
3546			void main()
3547			{
3548				#define VAL 4
3549				out0 = 0.0;
3550				#if (VAL >= 4)
3551					out0 = 1.0;
3552				#endif
3553				${OUTPUT}
3554			}
3555		""
3556	end
3557
3558	case parenthesis_ifelse_true
3559		version 300 es
3560		values { output float out0 = 1.0; }
3561		both ""
3562			#version 300 es
3563			precision mediump float;
3564			${DECLARATIONS}
3565			void main()
3566			{
3567				#define VAL 4
3568				#if (VAL >= 4)
3569					out0 = 1.0;
3570				#else
3571					out0 = 0.0;
3572				#endif
3573				${OUTPUT}
3574			}
3575		""
3576	end
3577
3578	case parenthesis_ifelse_false
3579		version 300 es
3580		values { output float out0 = 1.0; }
3581		both ""
3582			#version 300 es
3583			precision mediump float;
3584			${DECLARATIONS}
3585			void main()
3586			{
3587				#define VAL 4
3588				#if (VAL > 4)
3589					out0 = 0.0;
3590				#else
3591					out0 = 1.0;
3592				#endif
3593				${OUTPUT}
3594			}
3595		""
3596	end
3597
3598	case eval_basic_0
3599		version 300 es
3600		values { output float out0 = 1.0; }
3601		both ""
3602			#version 300 es
3603			precision mediump float;
3604			${DECLARATIONS}
3605			void main()
3606			{
3607				#if -4 + 5 == 1
3608					out0 = 1.0;
3609				#else
3610					out0 = 0.0;
3611				#endif
3612				${OUTPUT}
3613			}
3614		""
3615	end
3616
3617	case eval_basic_1
3618		version 300 es
3619		values { output float out0 = 1.0; }
3620		both ""
3621			#version 300 es
3622			precision mediump float;
3623			${DECLARATIONS}
3624			void main()
3625			{
3626				#if (2 * 2) - 3 >= 0
3627					out0 = 1.0;
3628				#else
3629					out0 = 0.0;
3630				#endif
3631				${OUTPUT}
3632			}
3633		""
3634	end
3635
3636	case eval_simple_precedence_0
3637		version 300 es
3638		values { output float out0 = 1.0; }
3639		both ""
3640			#version 300 es
3641			precision mediump float;
3642			${DECLARATIONS}
3643			void main()
3644			{
3645				#if 2 * 3 - 3 == 3
3646					out0 = 1.0;
3647				#else
3648					out0 = 0.0;
3649				#endif
3650				${OUTPUT}
3651			}
3652		""
3653	end
3654
3655	case eval_simple_precedence_1
3656		version 300 es
3657		values { output float out0 = 1.0; }
3658		both ""
3659			#version 300 es
3660			precision mediump float;
3661			${DECLARATIONS}
3662			void main()
3663			{
3664				#if 2 - 2 / 2 == 1
3665					out0 = 1.0;
3666				#else
3667					out0 = 0.0;
3668				#endif
3669				${OUTPUT}
3670			}
3671		""
3672	end
3673
3674end # expressions
3675
3676group invalid_expressions "Invalid Expression Tests"
3677
3678	case invalid_unary_expr
3679		version 300 es
3680		expect compile_fail
3681		both ""
3682			#version 300 es
3683			precision mediump float;
3684			${DECLARATIONS}
3685			void main()
3686			{
3687			#if !
3688				${POSITION_FRAG_COLOR} = vec4(1.0);
3689			}
3690		""
3691	end
3692
3693	case invalid_binary_expr
3694		version 300 es
3695		expect compile_fail
3696		both ""
3697			#version 300 es
3698			precision mediump float;
3699			${DECLARATIONS}
3700			void main()
3701			{
3702			#if 3+4+
3703				${POSITION_FRAG_COLOR} = vec4(1.0);
3704			}
3705		""
3706	end
3707
3708	case missing_expr
3709		version 300 es
3710		expect compile_fail
3711		both ""
3712			#version 300 es
3713			precision mediump float;
3714			${DECLARATIONS}
3715			void main()
3716			{
3717			#if
3718				${POSITION_FRAG_COLOR} = vec4(1.0);
3719			}
3720		""
3721	end
3722
3723	case invalid_expr_1
3724		version 300 es
3725		expect compile_fail
3726		both ""
3727			#version 300 es
3728			precision mediump float;
3729			${DECLARATIONS}
3730			void main()
3731			{
3732			#if 4 4
3733				${POSITION_FRAG_COLOR} = vec4(1.0);
3734			}
3735		""
3736	end
3737
3738	case invalid_expr_2
3739		version 300 es
3740		expect compile_fail
3741		both ""
3742			#version 300 es
3743			precision mediump float;
3744			${DECLARATIONS}
3745			void main()
3746			{
3747			#if 4 * * 4
3748				${POSITION_FRAG_COLOR} = vec4(1.0);
3749			}
3750		""
3751	end
3752
3753	case invalid_expr_3
3754		version 300 es
3755		expect compile_fail
3756		both ""
3757			#version 300 es
3758			precision mediump float;
3759			${DECLARATIONS}
3760			void main()
3761			{
3762			#if (4)(4)
3763				${POSITION_FRAG_COLOR} = vec4(1.0);
3764			}
3765		""
3766	end
3767
3768	case unopened_parenthesis
3769		version 300 es
3770		expect compile_fail
3771		both ""
3772			#version 300 es
3773			precision mediump float;
3774			${DECLARATIONS}
3775			void main()
3776			{
3777			#if 4)
3778				${POSITION_FRAG_COLOR} = vec4(1.0);
3779			}
3780		""
3781	end
3782
3783	case unclosed_parenthesis
3784		version 300 es
3785		expect compile_fail
3786		both ""
3787			#version 300 es
3788			precision mediump float;
3789			${DECLARATIONS}
3790			void main()
3791			{
3792			#if ((4 + 7)
3793				${POSITION_FRAG_COLOR} = vec4(1.0);
3794			}
3795		""
3796	end
3797
3798end # invalid_expressions
3799
3800group operator_precedence "Operator precedence"
3801
3802
3803	case modulo_vs_not
3804		version 300 es
3805		values { output float out0 = 1.0; }
3806		both ""
3807			#version 300 es
3808			#if ( 8 % ! 0 ) == 0
3809			#define VAL 1.0
3810			#else
3811			#define VAL 0.0
3812			#endif
3813
3814			precision mediump float;
3815			${DECLARATIONS}
3816			void main()
3817			{
3818				out0 = VAL;
3819				${OUTPUT}
3820			}
3821		""
3822	end
3823
3824	case div_vs_not
3825		version 300 es
3826		values { output float out0 = 1.0; }
3827		both ""
3828			#version 300 es
3829			#if ( 8 / ! 0 ) == 8
3830			#define VAL 1.0
3831			#else
3832			#define VAL 0.0
3833			#endif
3834
3835			precision mediump float;
3836			${DECLARATIONS}
3837			void main()
3838			{
3839				out0 = VAL;
3840				${OUTPUT}
3841			}
3842		""
3843	end
3844
3845	case mul_vs_not
3846		version 300 es
3847		values { output float out0 = 1.0; }
3848		both ""
3849			#version 300 es
3850			#if ( 8 * ! 0 ) == 8
3851			#define VAL 1.0
3852			#else
3853			#define VAL 0.0
3854			#endif
3855
3856			precision mediump float;
3857			${DECLARATIONS}
3858			void main()
3859			{
3860				out0 = VAL;
3861				${OUTPUT}
3862			}
3863		""
3864	end
3865
3866	case modulo_vs_bit_invert
3867		version 300 es
3868		values { output float out0 = 1.0; }
3869		both ""
3870			#version 300 es
3871			#if ( 8 % ~ 4 ) == 3
3872			#define VAL 1.0
3873			#else
3874			#define VAL 0.0
3875			#endif
3876
3877			precision mediump float;
3878			${DECLARATIONS}
3879			void main()
3880			{
3881				out0 = VAL;
3882				${OUTPUT}
3883			}
3884		""
3885	end
3886
3887	case modulo_vs_minus
3888		version 300 es
3889		values { output float out0 = 1.0; }
3890		both ""
3891			#version 300 es
3892			#if ( 8 % - 2 ) == 0
3893			#define VAL 1.0
3894			#else
3895			#define VAL 0.0
3896			#endif
3897
3898			precision mediump float;
3899			${DECLARATIONS}
3900			void main()
3901			{
3902				out0 = VAL;
3903				${OUTPUT}
3904			}
3905		""
3906	end
3907
3908	case modulo_vs_plus
3909		version 300 es
3910		values { output float out0 = 1.0; }
3911		both ""
3912			#version 300 es
3913			#if ( 8 % + 2 ) == 0
3914			#define VAL 1.0
3915			#else
3916			#define VAL 0.0
3917			#endif
3918
3919			precision mediump float;
3920			${DECLARATIONS}
3921			void main()
3922			{
3923				out0 = VAL;
3924				${OUTPUT}
3925			}
3926		""
3927	end
3928
3929	case div_vs_bit_invert
3930		version 300 es
3931		values { output float out0 = 1.0; }
3932		both ""
3933			#version 300 es
3934			#if ( 8 / ~ 2 ) == -2
3935			#define VAL 1.0
3936			#else
3937			#define VAL 0.0
3938			#endif
3939
3940			precision mediump float;
3941			${DECLARATIONS}
3942			void main()
3943			{
3944				out0 = VAL;
3945				${OUTPUT}
3946			}
3947		""
3948	end
3949
3950	case div_vs_minus
3951		version 300 es
3952		values { output float out0 = 1.0; }
3953		both ""
3954			#version 300 es
3955			#if ( 8 / - 2 ) == -4
3956			#define VAL 1.0
3957			#else
3958			#define VAL 0.0
3959			#endif
3960
3961			precision mediump float;
3962			${DECLARATIONS}
3963			void main()
3964			{
3965				out0 = VAL;
3966				${OUTPUT}
3967			}
3968		""
3969	end
3970
3971	case div_vs_plus
3972		version 300 es
3973		values { output float out0 = 1.0; }
3974		both ""
3975			#version 300 es
3976			#if ( 8 / + 2 ) == 4
3977			#define VAL 1.0
3978			#else
3979			#define VAL 0.0
3980			#endif
3981
3982			precision mediump float;
3983			${DECLARATIONS}
3984			void main()
3985			{
3986				out0 = VAL;
3987				${OUTPUT}
3988			}
3989		""
3990	end
3991
3992	case mul_vs_bit_invert
3993		version 300 es
3994		values { output float out0 = 1.0; }
3995		both ""
3996			#version 300 es
3997			#if ( 8 * ~ 2 ) == -24
3998			#define VAL 1.0
3999			#else
4000			#define VAL 0.0
4001			#endif
4002
4003			precision mediump float;
4004			${DECLARATIONS}
4005			void main()
4006			{
4007				out0 = VAL;
4008				${OUTPUT}
4009			}
4010		""
4011	end
4012
4013	case mul_vs_minus
4014		version 300 es
4015		values { output float out0 = 1.0; }
4016		both ""
4017			#version 300 es
4018			#if ( 8 * - 2 ) == -16
4019			#define VAL 1.0
4020			#else
4021			#define VAL 0.0
4022			#endif
4023
4024			precision mediump float;
4025			${DECLARATIONS}
4026			void main()
4027			{
4028				out0 = VAL;
4029				${OUTPUT}
4030			}
4031		""
4032	end
4033
4034	case mul_vs_plus
4035		version 300 es
4036		values { output float out0 = 1.0; }
4037		both ""
4038			#version 300 es
4039			#if ( 8 * + 2 ) == 16
4040			#define VAL 1.0
4041			#else
4042			#define VAL 0.0
4043			#endif
4044
4045			precision mediump float;
4046			${DECLARATIONS}
4047			void main()
4048			{
4049				out0 = VAL;
4050				${OUTPUT}
4051			}
4052		""
4053	end
4054
4055	case sub_vs_modulo
4056		version 300 es
4057		values { output float out0 = 1.0; }
4058		both ""
4059			#version 300 es
4060			#if ( 8 - 3 % 2 ) == 7
4061			#define VAL 1.0
4062			#else
4063			#define VAL 0.0
4064			#endif
4065
4066			precision mediump float;
4067			${DECLARATIONS}
4068			void main()
4069			{
4070				out0 = VAL;
4071				${OUTPUT}
4072			}
4073		""
4074	end
4075
4076	case sub_vs_div
4077		version 300 es
4078		values { output float out0 = 1.0; }
4079		both ""
4080			#version 300 es
4081			#if ( 8 - 3 / 2 ) == 7
4082			#define VAL 1.0
4083			#else
4084			#define VAL 0.0
4085			#endif
4086
4087			precision mediump float;
4088			${DECLARATIONS}
4089			void main()
4090			{
4091				out0 = VAL;
4092				${OUTPUT}
4093			}
4094		""
4095	end
4096
4097	case sub_vs_mul
4098		version 300 es
4099		values { output float out0 = 1.0; }
4100		both ""
4101			#version 300 es
4102			#if ( 8 - 3 * 2 ) == 2
4103			#define VAL 1.0
4104			#else
4105			#define VAL 0.0
4106			#endif
4107
4108			precision mediump float;
4109			${DECLARATIONS}
4110			void main()
4111			{
4112				out0 = VAL;
4113				${OUTPUT}
4114			}
4115		""
4116	end
4117
4118	case add_vs_modulo
4119		version 300 es
4120		values { output float out0 = 1.0; }
4121		both ""
4122			#version 300 es
4123			#if ( 8 + 3 % 2 ) == 9
4124			#define VAL 1.0
4125			#else
4126			#define VAL 0.0
4127			#endif
4128
4129			precision mediump float;
4130			${DECLARATIONS}
4131			void main()
4132			{
4133				out0 = VAL;
4134				${OUTPUT}
4135			}
4136		""
4137	end
4138
4139	case add_vs_div
4140		version 300 es
4141		values { output float out0 = 1.0; }
4142		both ""
4143			#version 300 es
4144			#if ( 8 + 3 / 2 ) == 9
4145			#define VAL 1.0
4146			#else
4147			#define VAL 0.0
4148			#endif
4149
4150			precision mediump float;
4151			${DECLARATIONS}
4152			void main()
4153			{
4154				out0 = VAL;
4155				${OUTPUT}
4156			}
4157		""
4158	end
4159
4160	case add_vs_mul
4161		version 300 es
4162		values { output float out0 = 1.0; }
4163		both ""
4164			#version 300 es
4165			#if ( 8 + 3 * 2 ) == 14
4166			#define VAL 1.0
4167			#else
4168			#define VAL 0.0
4169			#endif
4170
4171			precision mediump float;
4172			${DECLARATIONS}
4173			void main()
4174			{
4175				out0 = VAL;
4176				${OUTPUT}
4177			}
4178		""
4179	end
4180
4181	case rshift_vs_sub
4182		version 300 es
4183		values { output float out0 = 1.0; }
4184		both ""
4185			#version 300 es
4186			#if ( 8 >> 3 - 2 ) == 4
4187			#define VAL 1.0
4188			#else
4189			#define VAL 0.0
4190			#endif
4191
4192			precision mediump float;
4193			${DECLARATIONS}
4194			void main()
4195			{
4196				out0 = VAL;
4197				${OUTPUT}
4198			}
4199		""
4200	end
4201
4202	case rshift_vs_add
4203		version 300 es
4204		values { output float out0 = 1.0; }
4205		both ""
4206			#version 300 es
4207			#if ( 8 >> 3 + 2 ) == 0
4208			#define VAL 1.0
4209			#else
4210			#define VAL 0.0
4211			#endif
4212
4213			precision mediump float;
4214			${DECLARATIONS}
4215			void main()
4216			{
4217				out0 = VAL;
4218				${OUTPUT}
4219			}
4220		""
4221	end
4222
4223	case lshift_vs_sub
4224		version 300 es
4225		values { output float out0 = 1.0; }
4226		both ""
4227			#version 300 es
4228			#if ( 8 << 3 - 2 ) == 16
4229			#define VAL 1.0
4230			#else
4231			#define VAL 0.0
4232			#endif
4233
4234			precision mediump float;
4235			${DECLARATIONS}
4236			void main()
4237			{
4238				out0 = VAL;
4239				${OUTPUT}
4240			}
4241		""
4242	end
4243
4244	case lshift_vs_add
4245		version 300 es
4246		values { output float out0 = 1.0; }
4247		both ""
4248			#version 300 es
4249			#if ( 8 << 3 + 2 ) == 256
4250			#define VAL 1.0
4251			#else
4252			#define VAL 0.0
4253			#endif
4254
4255			precision mediump float;
4256			${DECLARATIONS}
4257			void main()
4258			{
4259				out0 = VAL;
4260				${OUTPUT}
4261			}
4262		""
4263	end
4264
4265	case greater_or_equal_vs_rshift
4266		version 300 es
4267		values { output float out0 = 1.0; }
4268		both ""
4269			#version 300 es
4270			#if ( 8 >= 3 >> 2 ) == 1
4271			#define VAL 1.0
4272			#else
4273			#define VAL 0.0
4274			#endif
4275
4276			precision mediump float;
4277			${DECLARATIONS}
4278			void main()
4279			{
4280				out0 = VAL;
4281				${OUTPUT}
4282			}
4283		""
4284	end
4285
4286	case greater_or_equal_vs_lshift
4287		version 300 es
4288		values { output float out0 = 1.0; }
4289		both ""
4290			#version 300 es
4291			#if ( 8 >= 3 << 2 ) == 0
4292			#define VAL 1.0
4293			#else
4294			#define VAL 0.0
4295			#endif
4296
4297			precision mediump float;
4298			${DECLARATIONS}
4299			void main()
4300			{
4301				out0 = VAL;
4302				${OUTPUT}
4303			}
4304		""
4305	end
4306
4307	case less_or_equal_vs_rshift
4308		version 300 es
4309		values { output float out0 = 1.0; }
4310		both ""
4311			#version 300 es
4312			#if ( 8 <= 3 >> 2 ) == 0
4313			#define VAL 1.0
4314			#else
4315			#define VAL 0.0
4316			#endif
4317
4318			precision mediump float;
4319			${DECLARATIONS}
4320			void main()
4321			{
4322				out0 = VAL;
4323				${OUTPUT}
4324			}
4325		""
4326	end
4327
4328	case less_or_equal_vs_lshift
4329		version 300 es
4330		values { output float out0 = 1.0; }
4331		both ""
4332			#version 300 es
4333			#if ( 8 <= 3 << 2 ) == 1
4334			#define VAL 1.0
4335			#else
4336			#define VAL 0.0
4337			#endif
4338
4339			precision mediump float;
4340			${DECLARATIONS}
4341			void main()
4342			{
4343				out0 = VAL;
4344				${OUTPUT}
4345			}
4346		""
4347	end
4348
4349	case greater_vs_rshift
4350		version 300 es
4351		values { output float out0 = 1.0; }
4352		both ""
4353			#version 300 es
4354			#if ( 8 > 3 >> 2 ) == 1
4355			#define VAL 1.0
4356			#else
4357			#define VAL 0.0
4358			#endif
4359
4360			precision mediump float;
4361			${DECLARATIONS}
4362			void main()
4363			{
4364				out0 = VAL;
4365				${OUTPUT}
4366			}
4367		""
4368	end
4369
4370	case greater_vs_lshift
4371		version 300 es
4372		values { output float out0 = 1.0; }
4373		both ""
4374			#version 300 es
4375			#if ( 8 > 3 << 2 ) == 0
4376			#define VAL 1.0
4377			#else
4378			#define VAL 0.0
4379			#endif
4380
4381			precision mediump float;
4382			${DECLARATIONS}
4383			void main()
4384			{
4385				out0 = VAL;
4386				${OUTPUT}
4387			}
4388		""
4389	end
4390
4391	case less_vs_rshift
4392		version 300 es
4393		values { output float out0 = 1.0; }
4394		both ""
4395			#version 300 es
4396			#if ( 8 < 3 >> 2 ) == 0
4397			#define VAL 1.0
4398			#else
4399			#define VAL 0.0
4400			#endif
4401
4402			precision mediump float;
4403			${DECLARATIONS}
4404			void main()
4405			{
4406				out0 = VAL;
4407				${OUTPUT}
4408			}
4409		""
4410	end
4411
4412	case less_vs_lshift
4413		version 300 es
4414		values { output float out0 = 1.0; }
4415		both ""
4416			#version 300 es
4417			#if ( 8 < 3 << 2 ) == 1
4418			#define VAL 1.0
4419			#else
4420			#define VAL 0.0
4421			#endif
4422
4423			precision mediump float;
4424			${DECLARATIONS}
4425			void main()
4426			{
4427				out0 = VAL;
4428				${OUTPUT}
4429			}
4430		""
4431	end
4432
4433	case not_equal_vs_greater_or_equal
4434		version 300 es
4435		values { output float out0 = 1.0; }
4436		both ""
4437			#version 300 es
4438			#if ( 8 != 3 >= 2 ) == 1
4439			#define VAL 1.0
4440			#else
4441			#define VAL 0.0
4442			#endif
4443
4444			precision mediump float;
4445			${DECLARATIONS}
4446			void main()
4447			{
4448				out0 = VAL;
4449				${OUTPUT}
4450			}
4451		""
4452	end
4453
4454	case not_equal_vs_less_or_equal
4455		version 300 es
4456		values { output float out0 = 1.0; }
4457		both ""
4458			#version 300 es
4459			#if ( 8 != 3 <= 2 ) == 1
4460			#define VAL 1.0
4461			#else
4462			#define VAL 0.0
4463			#endif
4464
4465			precision mediump float;
4466			${DECLARATIONS}
4467			void main()
4468			{
4469				out0 = VAL;
4470				${OUTPUT}
4471			}
4472		""
4473	end
4474
4475	case not_equal_vs_greater
4476		version 300 es
4477		values { output float out0 = 1.0; }
4478		both ""
4479			#version 300 es
4480			#if ( 8 != 3 > 2 ) == 1
4481			#define VAL 1.0
4482			#else
4483			#define VAL 0.0
4484			#endif
4485
4486			precision mediump float;
4487			${DECLARATIONS}
4488			void main()
4489			{
4490				out0 = VAL;
4491				${OUTPUT}
4492			}
4493		""
4494	end
4495
4496	case not_equal_vs_less
4497		version 300 es
4498		values { output float out0 = 1.0; }
4499		both ""
4500			#version 300 es
4501			#if ( 8 != 3 < 2 ) == 1
4502			#define VAL 1.0
4503			#else
4504			#define VAL 0.0
4505			#endif
4506
4507			precision mediump float;
4508			${DECLARATIONS}
4509			void main()
4510			{
4511				out0 = VAL;
4512				${OUTPUT}
4513			}
4514		""
4515	end
4516
4517	case equal_vs_greater_or_equal
4518		version 300 es
4519		values { output float out0 = 1.0; }
4520		both ""
4521			#version 300 es
4522			#if ( 8 == 3 >= 2 ) == 0
4523			#define VAL 1.0
4524			#else
4525			#define VAL 0.0
4526			#endif
4527
4528			precision mediump float;
4529			${DECLARATIONS}
4530			void main()
4531			{
4532				out0 = VAL;
4533				${OUTPUT}
4534			}
4535		""
4536	end
4537
4538	case equal_vs_less_or_equal
4539		version 300 es
4540		values { output float out0 = 1.0; }
4541		both ""
4542			#version 300 es
4543			#if ( 8 == 3 <= 2 ) == 0
4544			#define VAL 1.0
4545			#else
4546			#define VAL 0.0
4547			#endif
4548
4549			precision mediump float;
4550			${DECLARATIONS}
4551			void main()
4552			{
4553				out0 = VAL;
4554				${OUTPUT}
4555			}
4556		""
4557	end
4558
4559	case equal_vs_greater
4560		version 300 es
4561		values { output float out0 = 1.0; }
4562		both ""
4563			#version 300 es
4564			#if ( 8 == 3 > 2 ) == 0
4565			#define VAL 1.0
4566			#else
4567			#define VAL 0.0
4568			#endif
4569
4570			precision mediump float;
4571			${DECLARATIONS}
4572			void main()
4573			{
4574				out0 = VAL;
4575				${OUTPUT}
4576			}
4577		""
4578	end
4579
4580	case equal_vs_less
4581		version 300 es
4582		values { output float out0 = 1.0; }
4583		both ""
4584			#version 300 es
4585			#if ( 8 == 3 < 2 ) == 0
4586			#define VAL 1.0
4587			#else
4588			#define VAL 0.0
4589			#endif
4590
4591			precision mediump float;
4592			${DECLARATIONS}
4593			void main()
4594			{
4595				out0 = VAL;
4596				${OUTPUT}
4597			}
4598		""
4599	end
4600
4601	case bitwise_and_vs_not_equal
4602		version 300 es
4603		values { output float out0 = 1.0; }
4604		both ""
4605			#version 300 es
4606			#if ( 8 & 3 != 2 ) == 0
4607			#define VAL 1.0
4608			#else
4609			#define VAL 0.0
4610			#endif
4611
4612			precision mediump float;
4613			${DECLARATIONS}
4614			void main()
4615			{
4616				out0 = VAL;
4617				${OUTPUT}
4618			}
4619		""
4620	end
4621
4622	case bitwise_and_vs_equal
4623		version 300 es
4624		values { output float out0 = 1.0; }
4625		both ""
4626			#version 300 es
4627			#if ( 8 & 3 == 2 ) == 0
4628			#define VAL 1.0
4629			#else
4630			#define VAL 0.0
4631			#endif
4632
4633			precision mediump float;
4634			${DECLARATIONS}
4635			void main()
4636			{
4637				out0 = VAL;
4638				${OUTPUT}
4639			}
4640		""
4641	end
4642
4643	case xor_vs_bitwise_and
4644		version 300 es
4645		values { output float out0 = 1.0; }
4646		both ""
4647			#version 300 es
4648			#if ( 8 ^ 3 & 2 ) == 10
4649			#define VAL 1.0
4650			#else
4651			#define VAL 0.0
4652			#endif
4653
4654			precision mediump float;
4655			${DECLARATIONS}
4656			void main()
4657			{
4658				out0 = VAL;
4659				${OUTPUT}
4660			}
4661		""
4662	end
4663
4664	case bitwise_or_vs_xor
4665		version 300 es
4666		values { output float out0 = 1.0; }
4667		both ""
4668			#version 300 es
4669			#if ( 8 | 3 ^ 2 ) == 9
4670			#define VAL 1.0
4671			#else
4672			#define VAL 0.0
4673			#endif
4674
4675			precision mediump float;
4676			${DECLARATIONS}
4677			void main()
4678			{
4679				out0 = VAL;
4680				${OUTPUT}
4681			}
4682		""
4683	end
4684
4685	case logical_and_vs_bitwise_or
4686		version 300 es
4687		values { output float out0 = 1.0; }
4688		both ""
4689			#version 300 es
4690			#if ( 0 && 3 | 2 )
4691			#define VAL 0.0
4692			#else
4693			#define VAL 1.0
4694			#endif
4695
4696			precision mediump float;
4697			${DECLARATIONS}
4698			void main()
4699			{
4700				out0 = VAL;
4701				${OUTPUT}
4702			}
4703		""
4704	end
4705
4706	case logical_and_vs_bitwise_and
4707		version 300 es
4708		values { output float out0 = 1.0; }
4709		both ""
4710			#version 300 es
4711			#if ( 0 && 4 & 2 )
4712			#define VAL 0.0
4713			#else
4714			#define VAL 1.0
4715			#endif
4716
4717			precision mediump float;
4718			${DECLARATIONS}
4719			void main()
4720			{
4721				out0 = VAL;
4722				${OUTPUT}
4723			}
4724		""
4725	end
4726
4727	case logical_or_vs_logical_and
4728		version 300 es
4729		values { output float out0 = 1.0; }
4730		both ""
4731			#version 300 es
4732			#if ( 0 || 4 && 0 )
4733			#define VAL 0.0
4734			#else
4735			#define VAL 1.0
4736			#endif
4737
4738			precision mediump float;
4739			${DECLARATIONS}
4740			void main()
4741			{
4742				out0 = VAL;
4743				${OUTPUT}
4744			}
4745		""
4746	end
4747
4748end # operator_precedence
4749