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