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