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