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_defined_1
   2536 		values { output float out0 = 4.0; }
   2537 		both ""
   2538 			precision mediump float;
   2539 			${DECLARATIONS}
   2540 			void main()
   2541 			{
   2542 	#define A 4
   2543 	#line A
   2544 				out0 = float(__LINE__);
   2545 				${OUTPUT}
   2546 			}
   2547 		""
   2548 	end
   2549 
   2550 	case line_defined_2
   2551 		values { output vec4 out0 = vec4(234.0, 234.0, 10.0, 10.0); }
   2552 		both ""
   2553 			precision mediump float;
   2554 			${DECLARATIONS}
   2555 			void main()
   2556 			{
   2557 	#define A 10
   2558 	#line 234 A
   2559 				out0 = vec4(__LINE__, __LINE__, __FILE__, __FILE__);
   2560 				${OUTPUT}
   2561 			}
   2562 		""
   2563 	end
   2564 
   2565 	case empty_line
   2566 		expect compile_fail
   2567 		both ""
   2568 			precision mediump float;
   2569 			void main()
   2570 			{
   2571 	#line
   2572 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2573 			}
   2574 		""
   2575 	end
   2576 
   2577 	case invalid_line_file_1
   2578 		expect compile_fail
   2579 		both ""
   2580 			precision mediump float;
   2581 			void main()
   2582 			{
   2583 	#line 22 1.234
   2584 				${POSITION_FRAG_COLOR} = vec4(__LINE__, __LINE__, __FILE__, __FILE__);
   2585 			}
   2586 		""
   2587 	end
   2588 
   2589 	case invalid_line_file_3
   2590 		expect compile_fail
   2591 		both ""
   2592 			precision mediump float;
   2593 			void main()
   2594 			{
   2595 	#line 233 10 2
   2596 				${POSITION_FRAG_COLOR} = vec4(__LINE__, __LINE__, __FILE__, __FILE__);
   2597 			}
   2598 		""
   2599 	end
   2600 
   2601 	case invalid_line_file_4
   2602 		expect compile_fail
   2603 		both ""
   2604 			precision mediump float;
   2605 			void main()
   2606 			{
   2607 	#line foobar
   2608 				${POSITION_FRAG_COLOR} = vec4(__LINE__, __LINE__, __FILE__, __FILE__);
   2609 			}
   2610 		""
   2611 	end
   2612 
   2613 end # builtin
   2614 
   2615 group pragmas "Pragma Tests"
   2616 
   2617 	case pragma_vertex
   2618 		values { output float out0 = 1.0; }
   2619 
   2620 		vertex ""
   2621 			#pragma
   2622 			#pragma STDGL invariant(all)
   2623 			#pragma debug(off)
   2624 			#pragma optimize(off)
   2625 
   2626 			precision mediump float;
   2627 			${VERTEX_DECLARATIONS}
   2628 			varying float v_val;
   2629 			void main()
   2630 			{
   2631 				v_val = 1.0;
   2632 				${VERTEX_OUTPUT}
   2633 			}
   2634 		""
   2635 		fragment ""
   2636 			precision mediump float;
   2637 			${FRAGMENT_DECLARATIONS}
   2638 			invariant varying float v_val;
   2639 			void main()
   2640 			{
   2641 				out0 = v_val;
   2642 				${FRAGMENT_OUTPUT}
   2643 			}
   2644 		""
   2645 	end
   2646 
   2647 	case pragma_fragment
   2648 		values { output float out0 = 1.0; }
   2649 
   2650 		vertex ""
   2651 			precision mediump float;
   2652 			${VERTEX_DECLARATIONS}
   2653 			varying float v_val;
   2654 			void main()
   2655 			{
   2656 				v_val = 1.0;
   2657 				${VERTEX_OUTPUT}
   2658 			}
   2659 		""
   2660 		fragment ""
   2661 			#pragma
   2662 			#pragma STDGL invariant(all)
   2663 			#pragma debug(off)
   2664 			#pragma optimize(off)
   2665 
   2666 			precision mediump float;
   2667 			${FRAGMENT_DECLARATIONS}
   2668 			varying float v_val;
   2669 			void main()
   2670 			{
   2671 				out0 = v_val;
   2672 				${FRAGMENT_OUTPUT}
   2673 			}
   2674 		""
   2675 	end
   2676 
   2677 	case pragma_macro_exp
   2678 		values { output float out0 = 1.0; }
   2679 		both ""
   2680 	#define off	INVALID
   2681 	/* pragma line not macro expanded */
   2682 	#pragma debug(off)
   2683 
   2684 			precision mediump float;
   2685 			${DECLARATIONS}
   2686 			void main()
   2687 			{
   2688 				out0 = 1.0;
   2689 				${OUTPUT}
   2690 			}
   2691 		""
   2692 	end
   2693 
   2694 	case pragma_unrecognized_debug
   2695 		expect build_successful
   2696 		both ""
   2697 			#pragma debug(1.23)
   2698 
   2699 			// unrecognized preprocessor token
   2700 
   2701 			precision mediump float;
   2702 			void main()
   2703 			{
   2704 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2705 			}
   2706 		""
   2707 	end
   2708 
   2709 	case pragma_unrecognized_token
   2710 		expect build_successful
   2711 		both ""
   2712 			#pragma 
   2713 
   2714 			// trailing bytes form a valid but unrecognized preprocessor token
   2715 
   2716 			precision mediump float;
   2717 			void main()
   2718 			{
   2719 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2720 			}
   2721 		""
   2722 	end
   2723 
   2724 end # pragmas
   2725 
   2726 group extensions "Extension Tests"
   2727 
   2728 	case basic
   2729 		values { output float out0 = 1.0; }
   2730 		both ""
   2731 	#extension all : warn
   2732 
   2733 			precision mediump float;
   2734 			${DECLARATIONS}
   2735 			void main()
   2736 			{
   2737 				out0 = 1.0;
   2738 				${OUTPUT}
   2739 			}
   2740 		""
   2741 	end
   2742 
   2743 	case macro_exp
   2744 		values { output float out0 = 1.0; }
   2745 		both ""
   2746 	#define warn enable
   2747 
   2748 	#extension all : warn
   2749 
   2750 			precision mediump float;
   2751 			${DECLARATIONS}
   2752 			void main()
   2753 			{
   2754 				out0 = 1.0;
   2755 				${OUTPUT}
   2756 			}
   2757 		""
   2758 	end
   2759 
   2760 	case missing_extension_name
   2761 		expect compile_fail
   2762 		both ""
   2763 	#extension
   2764 			precision mediump float;
   2765 			void main()
   2766 			{
   2767 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2768 			}
   2769 		""
   2770 	end
   2771 
   2772 	case invalid_extension_name
   2773 		expect compile_fail
   2774 		both ""
   2775 	#extension 2 : all
   2776 			precision mediump float;
   2777 			void main()
   2778 			{
   2779 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2780 			}
   2781 		""
   2782 	end
   2783 
   2784 	case missing_colon
   2785 		expect compile_fail
   2786 		both ""
   2787 	#extension all
   2788 			precision mediump float;
   2789 			void main()
   2790 			{
   2791 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2792 			}
   2793 		""
   2794 	end
   2795 
   2796 	case expected_colon
   2797 		expect compile_fail
   2798 		both ""
   2799 	#extension all ;
   2800 			precision mediump float;
   2801 			void main()
   2802 			{
   2803 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2804 			}
   2805 		""
   2806 	end
   2807 
   2808 	case missing_behavior
   2809 		expect compile_fail
   2810 		both ""
   2811 	#extension all :
   2812 			precision mediump float;
   2813 			void main()
   2814 			{
   2815 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2816 			}
   2817 		""
   2818 	end
   2819 
   2820 	case invalid_behavior_1
   2821 		expect compile_fail
   2822 		both ""
   2823 	#extension all : WARN
   2824 			precision mediump float;
   2825 			void main()
   2826 			{
   2827 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2828 			}
   2829 		""
   2830 	end
   2831 
   2832 	case invalid_behavior_2
   2833 		expect compile_fail
   2834 		both ""
   2835 	#extension all : require
   2836 			precision mediump float;
   2837 			void main()
   2838 			{
   2839 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2840 			}
   2841 		""
   2842 	end
   2843 
   2844 	case invalid_char_in_name
   2845 		expect compile_fail
   2846 		both ""
   2847 	#extension all : warn
   2848 			precision mediump float;
   2849 			void main()
   2850 			{
   2851 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2852 			}
   2853 		""
   2854 	end
   2855 
   2856 	case invalid_char_in_behavior
   2857 		expect compile_fail
   2858 		both ""
   2859 	#extension all : warn
   2860 			precision mediump float;
   2861 			void main()
   2862 			{
   2863 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2864 			}
   2865 		""
   2866 	end
   2867 
   2868 	case unterminated_comment
   2869 		expect compile_fail
   2870 		both ""
   2871 	#extension all : warn /*asd
   2872 			precision mediump float;
   2873 			void main()
   2874 			{
   2875 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2876 			}
   2877 		""
   2878 	end
   2879 
   2880 	case after_non_preprocessing_tokens
   2881 		expect compile_fail
   2882 		both ""
   2883 	#extension all : warn
   2884 
   2885 			precision mediump float;
   2886 			${DECLARATIONS}
   2887 			void main()
   2888 			{
   2889 	#extension all : disable
   2890 				${POSITION_FRAG_COLOR} = vec4(1.0);
   2891 			}
   2892 		""
   2893 	end
   2894 end # extensions
   2895 
   2896 group expressions "Expression Tests"
   2897 
   2898 	case shift_left
   2899 		values { output float out0 = 1.0; }
   2900 		both ""
   2901 			precision mediump float;
   2902 			${DECLARATIONS}
   2903 			void main()
   2904 			{
   2905 				#define VAL 4
   2906 				out0 = 0.0;
   2907 				#if (VAL << 2) == 16
   2908 					out0 = 1.0;
   2909 				#endif
   2910 				${OUTPUT}
   2911 			}
   2912 		""
   2913 	end
   2914 
   2915 	case shift_right
   2916 		values { output float out0 = 1.0; }
   2917 		both ""
   2918 			precision mediump float;
   2919 			${DECLARATIONS}
   2920 			void main()
   2921 			{
   2922 				#define VAL 5
   2923 				out0 = 0.0;
   2924 				#if (VAL >> 1) == 2
   2925 					out0 = 1.0;
   2926 				#endif
   2927 				${OUTPUT}
   2928 			}
   2929 		""
   2930 	end
   2931 
   2932 	case cmp_less_than
   2933 		values { output float out0 = 1.0; }
   2934 		both ""
   2935 			precision mediump float;
   2936 			${DECLARATIONS}
   2937 			void main()
   2938 			{
   2939 				#define VAL 5
   2940 				out0 = 0.0;
   2941 				#if (VAL < 6) && (-VAL < -4)
   2942 					out0 = 1.0;
   2943 				#endif
   2944 				${OUTPUT}
   2945 			}
   2946 		""
   2947 	end
   2948 
   2949 	case less_or_equal
   2950 		values { output float out0 = 1.0; }
   2951 		both ""
   2952 			precision mediump float;
   2953 			${DECLARATIONS}
   2954 			void main()
   2955 			{
   2956 				#define VAL 6
   2957 				out0 = 0.0;
   2958 				#if (VAL <= 6) && (-VAL <= -6)
   2959 					out0 = 1.0;
   2960 				#endif
   2961 				${OUTPUT}
   2962 			}
   2963 		""
   2964 	end
   2965 
   2966 	case or
   2967 		values { output float out0 = 1.0; }
   2968 		both ""
   2969 			precision mediump float;
   2970 			${DECLARATIONS}
   2971 			void main()
   2972 			{
   2973 				#define VAL 6
   2974 				out0 = 0.0;
   2975 				#if (VAL | 5) == 7
   2976 					out0 = 1.0;
   2977 				#endif
   2978 				${OUTPUT}
   2979 			}
   2980 		""
   2981 	end
   2982 
   2983 	case and
   2984 		values { output float out0 = 1.0; }
   2985 		both ""
   2986 			precision mediump float;
   2987 			${DECLARATIONS}
   2988 			void main()
   2989 			{
   2990 				#define VAL 6
   2991 				out0 = 0.0;
   2992 				#if (VAL & 5) == 4
   2993 					out0 = 1.0;
   2994 				#endif
   2995 				${OUTPUT}
   2996 			}
   2997 		""
   2998 	end
   2999 
   3000 	case xor
   3001 		values { output float out0 = 1.0; }
   3002 		both ""
   3003 			precision mediump float;
   3004 			${DECLARATIONS}
   3005 			void main()
   3006 			{
   3007 				#define VAL 6
   3008 				out0 = 0.0;
   3009 				#if (VAL ^ 5) == 3
   3010 					out0 = 1.0;
   3011 				#endif
   3012 				${OUTPUT}
   3013 			}
   3014 		""
   3015 	end
   3016 
   3017 	case mod
   3018 		values { output float out0 = 1.0; }
   3019 		both ""
   3020 			precision mediump float;
   3021 			${DECLARATIONS}
   3022 			void main()
   3023 			{
   3024 				#define VAL 12
   3025 				out0 = 0.0;
   3026 				#if (VAL % 5) == 2
   3027 					out0 = 1.0;
   3028 				#endif
   3029 				${OUTPUT}
   3030 			}
   3031 		""
   3032 	end
   3033 
   3034 	case parenthesis_value
   3035 		values { output float out0 = 1.0; }
   3036 		both ""
   3037 			precision mediump float;
   3038 			${DECLARATIONS}
   3039 			void main()
   3040 			{
   3041 				#define VAL ((  (4   ) )  )
   3042 				out0 = 0.0;
   3043 				#if VAL >= 4
   3044 					out0 = 1.0;
   3045 				#endif
   3046 				${OUTPUT}
   3047 			}
   3048 		""
   3049 	end
   3050 
   3051 	case parenthesis_tricky
   3052 		values { output float out0 = 1.0; }
   3053 		both ""
   3054 			precision mediump float;
   3055 			${DECLARATIONS}
   3056 			void main()
   3057 			{
   3058 				#define VAL ((  (4   ) )
   3059 				out0 = 0.0;
   3060 				#if VAL) >= 4
   3061 					out0 = 1.0;
   3062 				#endif
   3063 				${OUTPUT}
   3064 			}
   3065 		""
   3066 	end
   3067 
   3068 	case parenthesis_if_no
   3069 		values { output float out0 = 1.0; }
   3070 		both ""
   3071 			precision mediump float;
   3072 			${DECLARATIONS}
   3073 			void main()
   3074 			{
   3075 				#define VAL 4
   3076 				out0 = 0.0;
   3077 				#if VAL >= 4
   3078 					out0 = 1.0;
   3079 				#endif
   3080 				${OUTPUT}
   3081 			}
   3082 		""
   3083 	end
   3084 
   3085 	case parenthesis_if
   3086 		values { output float out0 = 1.0; }
   3087 		both ""
   3088 			precision mediump float;
   3089 			${DECLARATIONS}
   3090 			void main()
   3091 			{
   3092 				#define VAL 4
   3093 				out0 = 0.0;
   3094 				#if (VAL >= 4)
   3095 					out0 = 1.0;
   3096 				#endif
   3097 				${OUTPUT}
   3098 			}
   3099 		""
   3100 	end
   3101 
   3102 	case parenthesis_multi_if
   3103 		values { output float out0 = 1.0; }
   3104 		both ""
   3105 			precision mediump float;
   3106 			${DECLARATIONS}
   3107 			void main()
   3108 			{
   3109 				#define VAL (4)
   3110 				out0 = 0.0;
   3111 				#if (((VAL)) >= (4))
   3112 					out0 = 1.0;
   3113 				#endif
   3114 				${OUTPUT}
   3115 			}
   3116 		""
   3117 	end
   3118 
   3119 	case parenthesis_single_if
   3120 		values { output float out0 = 1.0; }
   3121 		both ""
   3122 			precision mediump float;
   3123 			${DECLARATIONS}
   3124 			void main()
   3125 			{
   3126 				#define VAL 4
   3127 				out0 = 0.0;
   3128 				#if (VAL >= 4)
   3129 					out0 = 1.0;
   3130 				#endif
   3131 				${OUTPUT}
   3132 			}
   3133 		""
   3134 	end
   3135 
   3136 	case parenthesis_ifelse_true
   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 = 1.0;
   3146 				#else
   3147 					out0 = 0.0;
   3148 				#endif
   3149 				${OUTPUT}
   3150 			}
   3151 		""
   3152 	end
   3153 
   3154 	case parenthesis_ifelse_false
   3155 		values { output float out0 = 1.0; }
   3156 		both ""
   3157 			precision mediump float;
   3158 			${DECLARATIONS}
   3159 			void main()
   3160 			{
   3161 				#define VAL 4
   3162 				#if (VAL > 4)
   3163 					out0 = 0.0;
   3164 				#else
   3165 					out0 = 1.0;
   3166 				#endif
   3167 				${OUTPUT}
   3168 			}
   3169 		""
   3170 	end
   3171 
   3172 	case eval_basic_0
   3173 		values { output float out0 = 1.0; }
   3174 		both ""
   3175 			precision mediump float;
   3176 			${DECLARATIONS}
   3177 			void main()
   3178 			{
   3179 				#if -4 + 5 == 1
   3180 					out0 = 1.0;
   3181 				#else
   3182 					out0 = 0.0;
   3183 				#endif
   3184 				${OUTPUT}
   3185 			}
   3186 		""
   3187 	end
   3188 
   3189 	case eval_basic_1
   3190 		values { output float out0 = 1.0; }
   3191 		both ""
   3192 			precision mediump float;
   3193 			${DECLARATIONS}
   3194 			void main()
   3195 			{
   3196 				#if (2 * 2) - 3 >= 0
   3197 					out0 = 1.0;
   3198 				#else
   3199 					out0 = 0.0;
   3200 				#endif
   3201 				${OUTPUT}
   3202 			}
   3203 		""
   3204 	end
   3205 
   3206 	case eval_simple_precedence_0
   3207 		values { output float out0 = 1.0; }
   3208 		both ""
   3209 			precision mediump float;
   3210 			${DECLARATIONS}
   3211 			void main()
   3212 			{
   3213 				#if 2 * 3 - 3 == 3
   3214 					out0 = 1.0;
   3215 				#else
   3216 					out0 = 0.0;
   3217 				#endif
   3218 				${OUTPUT}
   3219 			}
   3220 		""
   3221 	end
   3222 
   3223 	case eval_simple_precedence_1
   3224 		values { output float out0 = 1.0; }
   3225 		both ""
   3226 			precision mediump float;
   3227 			${DECLARATIONS}
   3228 			void main()
   3229 			{
   3230 				#if 2 - 2 / 2 == 1
   3231 					out0 = 1.0;
   3232 				#else
   3233 					out0 = 0.0;
   3234 				#endif
   3235 				${OUTPUT}
   3236 			}
   3237 		""
   3238 	end
   3239 
   3240 	case defined_1
   3241 		values { output float out0 = 1.0; }
   3242 		both ""
   3243 			precision mediump float;
   3244 			${DECLARATIONS}
   3245 			#define X 0
   3246 			void main()
   3247 			{
   3248 				#if defined(X)
   3249 					out0 = 1.0;
   3250 				#else
   3251 					out0 = 0.0;
   3252 				#endif
   3253 				${OUTPUT}
   3254 			}
   3255 		""
   3256 	end
   3257 
   3258 	case defined_2
   3259 		values { output float out0 = 1.0; }
   3260 		both ""
   3261 			precision mediump float;
   3262 			${DECLARATIONS}
   3263 			#define X 0
   3264 			#define Y 1
   3265 			void main()
   3266 			{
   3267 				#if defined(X) == Y
   3268 					out0 = 1.0;
   3269 				#else
   3270 					out0 = 0.0;
   3271 				#endif
   3272 				${OUTPUT}
   3273 			}
   3274 		""
   3275 	end
   3276 
   3277 	case defined_3
   3278 		values { output float out0 = 1.0; }
   3279 		both ""
   3280 			precision mediump float;
   3281 			${DECLARATIONS}
   3282 			#define X 0
   3283 			#define Y 1
   3284 			void main()
   3285 			{
   3286 				#if defined(X) && defined(Y)
   3287 					out0 = 1.0;
   3288 				#else
   3289 					out0 = 0.0;
   3290 				#endif
   3291 				${OUTPUT}
   3292 			}
   3293 		""
   3294 	end
   3295 
   3296 	case defined_4
   3297 		values { output float out0 = 1.0; }
   3298 		both ""
   3299 			precision mediump float;
   3300 			${DECLARATIONS}
   3301 			#define X 0
   3302 			#define Y 1
   3303 			#undef X
   3304 			void main()
   3305 			{
   3306 				#if defined(X) && defined(Y)
   3307 					out0 = 0.0;
   3308 				#else
   3309 					out0 = 1.0;
   3310 				#endif
   3311 				${OUTPUT}
   3312 			}
   3313 		""
   3314 	end
   3315 
   3316 	case defined_5
   3317 		values { output float out0 = 1.0; }
   3318 		both ""
   3319 			precision mediump float;
   3320 			${DECLARATIONS}
   3321 			#define X 0
   3322 			#define Y 1
   3323 			#undef X
   3324 			void main()
   3325 			{
   3326 				#if defined(X) || defined(Y)
   3327 					out0 = 1.0;
   3328 				#else
   3329 					out0 = 0.0;
   3330 				#endif
   3331 				${OUTPUT}
   3332 			}
   3333 		""
   3334 	end
   3335 
   3336 	case defined_6
   3337 		values { output float out0 = 1.0; }
   3338 		both ""
   3339 			precision mediump float;
   3340 			${DECLARATIONS}
   3341 			#define X 0
   3342 			#define Y 1
   3343 			#undef Y
   3344 			void main()
   3345 			{
   3346 				#if defined(X) && (defined(Y) || (X == 0))
   3347 					out0 = 1.0;
   3348 				#else
   3349 					out0 = 0.0;
   3350 				#endif
   3351 				${OUTPUT}
   3352 			}
   3353 		""
   3354 	end
   3355 
   3356 end # expressions
   3357 
   3358 group invalid_expressions "Invalid Expression Tests"
   3359 
   3360 	case invalid_unary_expr
   3361 		expect compile_fail
   3362 		both ""
   3363 			precision mediump float;
   3364 			void main()
   3365 			{
   3366 	#if !
   3367 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3368 			}
   3369 		""
   3370 	end
   3371 
   3372 	case invalid_binary_expr
   3373 		expect compile_fail
   3374 		both ""
   3375 			precision mediump float;
   3376 			void main()
   3377 			{
   3378 	#if 3+4+
   3379 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3380 			}
   3381 		""
   3382 	end
   3383 
   3384 	case missing_expr
   3385 		expect compile_fail
   3386 		both ""
   3387 			precision mediump float;
   3388 			void main()
   3389 			{
   3390 	#if
   3391 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3392 			}
   3393 		""
   3394 	end
   3395 
   3396 	case invalid_expr_1
   3397 		expect compile_fail
   3398 		both ""
   3399 			precision mediump float;
   3400 			void main()
   3401 			{
   3402 	#if 4 4
   3403 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3404 			}
   3405 		""
   3406 	end
   3407 
   3408 	case invalid_expr_2
   3409 		expect compile_fail
   3410 		both ""
   3411 			precision mediump float;
   3412 			void main()
   3413 			{
   3414 	#if 4 * * 4
   3415 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3416 			}
   3417 		""
   3418 	end
   3419 
   3420 	case invalid_expr_3
   3421 		expect compile_fail
   3422 		both ""
   3423 			precision mediump float;
   3424 			void main()
   3425 			{
   3426 	#if (4)(4)
   3427 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3428 			}
   3429 		""
   3430 	end
   3431 
   3432 	case unopened_parenthesis
   3433 		expect compile_fail
   3434 		both ""
   3435 			precision mediump float;
   3436 			void main()
   3437 			{
   3438 	#if 4)
   3439 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3440 			}
   3441 		""
   3442 	end
   3443 
   3444 	case unclosed_parenthesis
   3445 		expect compile_fail
   3446 		both ""
   3447 			precision mediump float;
   3448 			void main()
   3449 			{
   3450 	#if ((4 + 7)
   3451 				${POSITION_FRAG_COLOR} = vec4(1.0);
   3452 			}
   3453 		""
   3454 	end
   3455 
   3456 end # invalid_expressions
   3457 
   3458 group operator_precedence "Operator precedence"
   3459 
   3460 
   3461 	case modulo_vs_not
   3462 		values { output float out0 = 1.0; }
   3463 		both ""
   3464 
   3465 	#if ( 8 % ! 0 ) == 0
   3466 	#define VAL 1.0
   3467 	#else
   3468 	#define VAL 0.0
   3469 	#endif
   3470 			precision mediump float;
   3471 			${DECLARATIONS}
   3472 			void main()
   3473 			{
   3474 				out0 = VAL;
   3475 				${OUTPUT}
   3476 			}
   3477 		""
   3478 	end
   3479 
   3480 	case div_vs_not
   3481 		values { output float out0 = 1.0; }
   3482 		both ""
   3483 
   3484 	#if ( 8 / ! 0 ) == 8
   3485 	#define VAL 1.0
   3486 	#else
   3487 	#define VAL 0.0
   3488 	#endif
   3489 			precision mediump float;
   3490 			${DECLARATIONS}
   3491 			void main()
   3492 			{
   3493 				out0 = VAL;
   3494 				${OUTPUT}
   3495 			}
   3496 		""
   3497 	end
   3498 
   3499 	case mul_vs_not
   3500 		values { output float out0 = 1.0; }
   3501 		both ""
   3502 
   3503 	#if ( 8 * ! 0 ) == 8
   3504 	#define VAL 1.0
   3505 	#else
   3506 	#define VAL 0.0
   3507 	#endif
   3508 			precision mediump float;
   3509 			${DECLARATIONS}
   3510 			void main()
   3511 			{
   3512 				out0 = VAL;
   3513 				${OUTPUT}
   3514 			}
   3515 		""
   3516 	end
   3517 
   3518 	case modulo_vs_bit_invert
   3519 		values { output float out0 = 1.0; }
   3520 		both ""
   3521 
   3522 	#if ( 8 % ~ 4 ) == 3
   3523 	#define VAL 1.0
   3524 	#else
   3525 	#define VAL 0.0
   3526 	#endif
   3527 			precision mediump float;
   3528 			${DECLARATIONS}
   3529 			void main()
   3530 			{
   3531 				out0 = VAL;
   3532 				${OUTPUT}
   3533 			}
   3534 		""
   3535 	end
   3536 
   3537 	case modulo_vs_minus
   3538 		values { output float out0 = 1.0; }
   3539 		both ""
   3540 
   3541 	#if ( 8 % - 2 ) == 0
   3542 	#define VAL 1.0
   3543 	#else
   3544 	#define VAL 0.0
   3545 	#endif
   3546 			precision mediump float;
   3547 			${DECLARATIONS}
   3548 			void main()
   3549 			{
   3550 				out0 = VAL;
   3551 				${OUTPUT}
   3552 			}
   3553 		""
   3554 	end
   3555 
   3556 	case modulo_vs_plus
   3557 		values { output float out0 = 1.0; }
   3558 		both ""
   3559 
   3560 	#if ( 8 % + 2 ) == 0
   3561 	#define VAL 1.0
   3562 	#else
   3563 	#define VAL 0.0
   3564 	#endif
   3565 			precision mediump float;
   3566 			${DECLARATIONS}
   3567 			void main()
   3568 			{
   3569 				out0 = VAL;
   3570 				${OUTPUT}
   3571 			}
   3572 		""
   3573 	end
   3574 
   3575 	case div_vs_bit_invert
   3576 		values { output float out0 = 1.0; }
   3577 		both ""
   3578 
   3579 	#if ( 8 / ~ 2 ) == -2
   3580 	#define VAL 1.0
   3581 	#else
   3582 	#define VAL 0.0
   3583 	#endif
   3584 			precision mediump float;
   3585 			${DECLARATIONS}
   3586 			void main()
   3587 			{
   3588 				out0 = VAL;
   3589 				${OUTPUT}
   3590 			}
   3591 		""
   3592 	end
   3593 
   3594 	case div_vs_minus
   3595 		values { output float out0 = 1.0; }
   3596 		both ""
   3597 
   3598 	#if ( 8 / - 2 ) == -4
   3599 	#define VAL 1.0
   3600 	#else
   3601 	#define VAL 0.0
   3602 	#endif
   3603 			precision mediump float;
   3604 			${DECLARATIONS}
   3605 			void main()
   3606 			{
   3607 				out0 = VAL;
   3608 				${OUTPUT}
   3609 			}
   3610 		""
   3611 	end
   3612 
   3613 	case div_vs_plus
   3614 		values { output float out0 = 1.0; }
   3615 		both ""
   3616 
   3617 	#if ( 8 / + 2 ) == 4
   3618 	#define VAL 1.0
   3619 	#else
   3620 	#define VAL 0.0
   3621 	#endif
   3622 			precision mediump float;
   3623 			${DECLARATIONS}
   3624 			void main()
   3625 			{
   3626 				out0 = VAL;
   3627 				${OUTPUT}
   3628 			}
   3629 		""
   3630 	end
   3631 
   3632 	case mul_vs_bit_invert
   3633 		values { output float out0 = 1.0; }
   3634 		both ""
   3635 
   3636 	#if ( 8 * ~ 2 ) == -24
   3637 	#define VAL 1.0
   3638 	#else
   3639 	#define VAL 0.0
   3640 	#endif
   3641 			precision mediump float;
   3642 			${DECLARATIONS}
   3643 			void main()
   3644 			{
   3645 				out0 = VAL;
   3646 				${OUTPUT}
   3647 			}
   3648 		""
   3649 	end
   3650 
   3651 	case mul_vs_minus
   3652 		values { output float out0 = 1.0; }
   3653 		both ""
   3654 
   3655 	#if ( 8 * - 2 ) == -16
   3656 	#define VAL 1.0
   3657 	#else
   3658 	#define VAL 0.0
   3659 	#endif
   3660 			precision mediump float;
   3661 			${DECLARATIONS}
   3662 			void main()
   3663 			{
   3664 				out0 = VAL;
   3665 				${OUTPUT}
   3666 			}
   3667 		""
   3668 	end
   3669 
   3670 	case mul_vs_plus
   3671 		values { output float out0 = 1.0; }
   3672 		both ""
   3673 
   3674 	#if ( 8 * + 2 ) == 16
   3675 	#define VAL 1.0
   3676 	#else
   3677 	#define VAL 0.0
   3678 	#endif
   3679 			precision mediump float;
   3680 			${DECLARATIONS}
   3681 			void main()
   3682 			{
   3683 				out0 = VAL;
   3684 				${OUTPUT}
   3685 			}
   3686 		""
   3687 	end
   3688 
   3689 	case sub_vs_modulo
   3690 		values { output float out0 = 1.0; }
   3691 		both ""
   3692 
   3693 	#if ( 8 - 3 % 2 ) == 7
   3694 	#define VAL 1.0
   3695 	#else
   3696 	#define VAL 0.0
   3697 	#endif
   3698 			precision mediump float;
   3699 			${DECLARATIONS}
   3700 			void main()
   3701 			{
   3702 				out0 = VAL;
   3703 				${OUTPUT}
   3704 			}
   3705 		""
   3706 	end
   3707 
   3708 	case sub_vs_div
   3709 		values { output float out0 = 1.0; }
   3710 		both ""
   3711 
   3712 	#if ( 8 - 3 / 2 ) == 7
   3713 	#define VAL 1.0
   3714 	#else
   3715 	#define VAL 0.0
   3716 	#endif
   3717 			precision mediump float;
   3718 			${DECLARATIONS}
   3719 			void main()
   3720 			{
   3721 				out0 = VAL;
   3722 				${OUTPUT}
   3723 			}
   3724 		""
   3725 	end
   3726 
   3727 	case sub_vs_mul
   3728 		values { output float out0 = 1.0; }
   3729 		both ""
   3730 
   3731 	#if ( 8 - 3 * 2 ) == 2
   3732 	#define VAL 1.0
   3733 	#else
   3734 	#define VAL 0.0
   3735 	#endif
   3736 			precision mediump float;
   3737 			${DECLARATIONS}
   3738 			void main()
   3739 			{
   3740 				out0 = VAL;
   3741 				${OUTPUT}
   3742 			}
   3743 		""
   3744 	end
   3745 
   3746 	case add_vs_modulo
   3747 		values { output float out0 = 1.0; }
   3748 		both ""
   3749 
   3750 	#if ( 8 + 3 % 2 ) == 9
   3751 	#define VAL 1.0
   3752 	#else
   3753 	#define VAL 0.0
   3754 	#endif
   3755 			precision mediump float;
   3756 			${DECLARATIONS}
   3757 			void main()
   3758 			{
   3759 				out0 = VAL;
   3760 				${OUTPUT}
   3761 			}
   3762 		""
   3763 	end
   3764 
   3765 	case add_vs_div
   3766 		values { output float out0 = 1.0; }
   3767 		both ""
   3768 
   3769 	#if ( 8 + 3 / 2 ) == 9
   3770 	#define VAL 1.0
   3771 	#else
   3772 	#define VAL 0.0
   3773 	#endif
   3774 			precision mediump float;
   3775 			${DECLARATIONS}
   3776 			void main()
   3777 			{
   3778 				out0 = VAL;
   3779 				${OUTPUT}
   3780 			}
   3781 		""
   3782 	end
   3783 
   3784 	case add_vs_mul
   3785 		values { output float out0 = 1.0; }
   3786 		both ""
   3787 
   3788 	#if ( 8 + 3 * 2 ) == 14
   3789 	#define VAL 1.0
   3790 	#else
   3791 	#define VAL 0.0
   3792 	#endif
   3793 			precision mediump float;
   3794 			${DECLARATIONS}
   3795 			void main()
   3796 			{
   3797 				out0 = VAL;
   3798 				${OUTPUT}
   3799 			}
   3800 		""
   3801 	end
   3802 
   3803 	case rshift_vs_sub
   3804 		values { output float out0 = 1.0; }
   3805 		both ""
   3806 
   3807 	#if ( 8 >> 3 - 2 ) == 4
   3808 	#define VAL 1.0
   3809 	#else
   3810 	#define VAL 0.0
   3811 	#endif
   3812 			precision mediump float;
   3813 			${DECLARATIONS}
   3814 			void main()
   3815 			{
   3816 				out0 = VAL;
   3817 				${OUTPUT}
   3818 			}
   3819 		""
   3820 	end
   3821 
   3822 	case rshift_vs_add
   3823 		values { output float out0 = 1.0; }
   3824 		both ""
   3825 
   3826 	#if ( 8 >> 3 + 2 ) == 0
   3827 	#define VAL 1.0
   3828 	#else
   3829 	#define VAL 0.0
   3830 	#endif
   3831 			precision mediump float;
   3832 			${DECLARATIONS}
   3833 			void main()
   3834 			{
   3835 				out0 = VAL;
   3836 				${OUTPUT}
   3837 			}
   3838 		""
   3839 	end
   3840 
   3841 	case lshift_vs_sub
   3842 		values { output float out0 = 1.0; }
   3843 		both ""
   3844 
   3845 	#if ( 8 << 3 - 2 ) == 16
   3846 	#define VAL 1.0
   3847 	#else
   3848 	#define VAL 0.0
   3849 	#endif
   3850 			precision mediump float;
   3851 			${DECLARATIONS}
   3852 			void main()
   3853 			{
   3854 				out0 = VAL;
   3855 				${OUTPUT}
   3856 			}
   3857 		""
   3858 	end
   3859 
   3860 	case lshift_vs_add
   3861 		values { output float out0 = 1.0; }
   3862 		both ""
   3863 
   3864 	#if ( 8 << 3 + 2 ) == 256
   3865 	#define VAL 1.0
   3866 	#else
   3867 	#define VAL 0.0
   3868 	#endif
   3869 			precision mediump float;
   3870 			${DECLARATIONS}
   3871 			void main()
   3872 			{
   3873 				out0 = VAL;
   3874 				${OUTPUT}
   3875 			}
   3876 		""
   3877 	end
   3878 
   3879 	case greater_or_equal_vs_rshift
   3880 		values { output float out0 = 1.0; }
   3881 		both ""
   3882 
   3883 	#if ( 8 >= 3 >> 2 ) == 1
   3884 	#define VAL 1.0
   3885 	#else
   3886 	#define VAL 0.0
   3887 	#endif
   3888 			precision mediump float;
   3889 			${DECLARATIONS}
   3890 			void main()
   3891 			{
   3892 				out0 = VAL;
   3893 				${OUTPUT}
   3894 			}
   3895 		""
   3896 	end
   3897 
   3898 	case greater_or_equal_vs_lshift
   3899 		values { output float out0 = 1.0; }
   3900 		both ""
   3901 
   3902 	#if ( 8 >= 3 << 2 ) == 0
   3903 	#define VAL 1.0
   3904 	#else
   3905 	#define VAL 0.0
   3906 	#endif
   3907 			precision mediump float;
   3908 			${DECLARATIONS}
   3909 			void main()
   3910 			{
   3911 				out0 = VAL;
   3912 				${OUTPUT}
   3913 			}
   3914 		""
   3915 	end
   3916 
   3917 	case less_or_equal_vs_rshift
   3918 		values { output float out0 = 1.0; }
   3919 		both ""
   3920 
   3921 	#if ( 8 <= 3 >> 2 ) == 0
   3922 	#define VAL 1.0
   3923 	#else
   3924 	#define VAL 0.0
   3925 	#endif
   3926 			precision mediump float;
   3927 			${DECLARATIONS}
   3928 			void main()
   3929 			{
   3930 				out0 = VAL;
   3931 				${OUTPUT}
   3932 			}
   3933 		""
   3934 	end
   3935 
   3936 	case less_or_equal_vs_lshift
   3937 		values { output float out0 = 1.0; }
   3938 		both ""
   3939 
   3940 	#if ( 8 <= 3 << 2 ) == 1
   3941 	#define VAL 1.0
   3942 	#else
   3943 	#define VAL 0.0
   3944 	#endif
   3945 			precision mediump float;
   3946 			${DECLARATIONS}
   3947 			void main()
   3948 			{
   3949 				out0 = VAL;
   3950 				${OUTPUT}
   3951 			}
   3952 		""
   3953 	end
   3954 
   3955 	case greater_vs_rshift
   3956 		values { output float out0 = 1.0; }
   3957 		both ""
   3958 
   3959 	#if ( 8 > 3 >> 2 ) == 1
   3960 	#define VAL 1.0
   3961 	#else
   3962 	#define VAL 0.0
   3963 	#endif
   3964 			precision mediump float;
   3965 			${DECLARATIONS}
   3966 			void main()
   3967 			{
   3968 				out0 = VAL;
   3969 				${OUTPUT}
   3970 			}
   3971 		""
   3972 	end
   3973 
   3974 	case greater_vs_lshift
   3975 		values { output float out0 = 1.0; }
   3976 		both ""
   3977 
   3978 	#if ( 8 > 3 << 2 ) == 0
   3979 	#define VAL 1.0
   3980 	#else
   3981 	#define VAL 0.0
   3982 	#endif
   3983 			precision mediump float;
   3984 			${DECLARATIONS}
   3985 			void main()
   3986 			{
   3987 				out0 = VAL;
   3988 				${OUTPUT}
   3989 			}
   3990 		""
   3991 	end
   3992 
   3993 	case less_vs_rshift
   3994 		values { output float out0 = 1.0; }
   3995 		both ""
   3996 
   3997 	#if ( 8 < 3 >> 2 ) == 0
   3998 	#define VAL 1.0
   3999 	#else
   4000 	#define VAL 0.0
   4001 	#endif
   4002 			precision mediump float;
   4003 			${DECLARATIONS}
   4004 			void main()
   4005 			{
   4006 				out0 = VAL;
   4007 				${OUTPUT}
   4008 			}
   4009 		""
   4010 	end
   4011 
   4012 	case less_vs_lshift
   4013 		values { output float out0 = 1.0; }
   4014 		both ""
   4015 
   4016 	#if ( 8 < 3 << 2 ) == 1
   4017 	#define VAL 1.0
   4018 	#else
   4019 	#define VAL 0.0
   4020 	#endif
   4021 			precision mediump float;
   4022 			${DECLARATIONS}
   4023 			void main()
   4024 			{
   4025 				out0 = VAL;
   4026 				${OUTPUT}
   4027 			}
   4028 		""
   4029 	end
   4030 
   4031 	case not_equal_vs_greater_or_equal
   4032 		values { output float out0 = 1.0; }
   4033 		both ""
   4034 
   4035 	#if ( 8 != 3 >= 2 ) == 1
   4036 	#define VAL 1.0
   4037 	#else
   4038 	#define VAL 0.0
   4039 	#endif
   4040 			precision mediump float;
   4041 			${DECLARATIONS}
   4042 			void main()
   4043 			{
   4044 				out0 = VAL;
   4045 				${OUTPUT}
   4046 			}
   4047 		""
   4048 	end
   4049 
   4050 	case not_equal_vs_less_or_equal
   4051 		values { output float out0 = 1.0; }
   4052 		both ""
   4053 
   4054 	#if ( 8 != 3 <= 2 ) == 1
   4055 	#define VAL 1.0
   4056 	#else
   4057 	#define VAL 0.0
   4058 	#endif
   4059 			precision mediump float;
   4060 			${DECLARATIONS}
   4061 			void main()
   4062 			{
   4063 				out0 = VAL;
   4064 				${OUTPUT}
   4065 			}
   4066 		""
   4067 	end
   4068 
   4069 	case not_equal_vs_greater
   4070 		values { output float out0 = 1.0; }
   4071 		both ""
   4072 
   4073 	#if ( 8 != 3 > 2 ) == 1
   4074 	#define VAL 1.0
   4075 	#else
   4076 	#define VAL 0.0
   4077 	#endif
   4078 			precision mediump float;
   4079 			${DECLARATIONS}
   4080 			void main()
   4081 			{
   4082 				out0 = VAL;
   4083 				${OUTPUT}
   4084 			}
   4085 		""
   4086 	end
   4087 
   4088 	case not_equal_vs_less
   4089 		values { output float out0 = 1.0; }
   4090 		both ""
   4091 
   4092 	#if ( 8 != 3 < 2 ) == 1
   4093 	#define VAL 1.0
   4094 	#else
   4095 	#define VAL 0.0
   4096 	#endif
   4097 			precision mediump float;
   4098 			${DECLARATIONS}
   4099 			void main()
   4100 			{
   4101 				out0 = VAL;
   4102 				${OUTPUT}
   4103 			}
   4104 		""
   4105 	end
   4106 
   4107 	case equal_vs_greater_or_equal
   4108 		values { output float out0 = 1.0; }
   4109 		both ""
   4110 
   4111 	#if ( 8 == 3 >= 2 ) == 0
   4112 	#define VAL 1.0
   4113 	#else
   4114 	#define VAL 0.0
   4115 	#endif
   4116 			precision mediump float;
   4117 			${DECLARATIONS}
   4118 			void main()
   4119 			{
   4120 				out0 = VAL;
   4121 				${OUTPUT}
   4122 			}
   4123 		""
   4124 	end
   4125 
   4126 	case equal_vs_less_or_equal
   4127 		values { output float out0 = 1.0; }
   4128 		both ""
   4129 
   4130 	#if ( 8 == 3 <= 2 ) == 0
   4131 	#define VAL 1.0
   4132 	#else
   4133 	#define VAL 0.0
   4134 	#endif
   4135 			precision mediump float;
   4136 			${DECLARATIONS}
   4137 			void main()
   4138 			{
   4139 				out0 = VAL;
   4140 				${OUTPUT}
   4141 			}
   4142 		""
   4143 	end
   4144 
   4145 	case equal_vs_greater
   4146 		values { output float out0 = 1.0; }
   4147 		both ""
   4148 
   4149 	#if ( 8 == 3 > 2 ) == 0
   4150 	#define VAL 1.0
   4151 	#else
   4152 	#define VAL 0.0
   4153 	#endif
   4154 			precision mediump float;
   4155 			${DECLARATIONS}
   4156 			void main()
   4157 			{
   4158 				out0 = VAL;
   4159 				${OUTPUT}
   4160 			}
   4161 		""
   4162 	end
   4163 
   4164 	case equal_vs_less
   4165 		values { output float out0 = 1.0; }
   4166 		both ""
   4167 
   4168 	#if ( 8 == 3 < 2 ) == 0
   4169 	#define VAL 1.0
   4170 	#else
   4171 	#define VAL 0.0
   4172 	#endif
   4173 			precision mediump float;
   4174 			${DECLARATIONS}
   4175 			void main()
   4176 			{
   4177 				out0 = VAL;
   4178 				${OUTPUT}
   4179 			}
   4180 		""
   4181 	end
   4182 
   4183 	case bitwise_and_vs_not_equal
   4184 		values { output float out0 = 1.0; }
   4185 		both ""
   4186 
   4187 	#if ( 8 & 3 != 2 ) == 0
   4188 	#define VAL 1.0
   4189 	#else
   4190 	#define VAL 0.0
   4191 	#endif
   4192 			precision mediump float;
   4193 			${DECLARATIONS}
   4194 			void main()
   4195 			{
   4196 				out0 = VAL;
   4197 				${OUTPUT}
   4198 			}
   4199 		""
   4200 	end
   4201 
   4202 	case bitwise_and_vs_equal
   4203 		values { output float out0 = 1.0; }
   4204 		both ""
   4205 
   4206 	#if ( 8 & 3 == 2 ) == 0
   4207 	#define VAL 1.0
   4208 	#else
   4209 	#define VAL 0.0
   4210 	#endif
   4211 			precision mediump float;
   4212 			${DECLARATIONS}
   4213 			void main()
   4214 			{
   4215 				out0 = VAL;
   4216 				${OUTPUT}
   4217 			}
   4218 		""
   4219 	end
   4220 
   4221 	case xor_vs_bitwise_and
   4222 		values { output float out0 = 1.0; }
   4223 		both ""
   4224 
   4225 	#if ( 8 ^ 3 & 2 ) == 10
   4226 	#define VAL 1.0
   4227 	#else
   4228 	#define VAL 0.0
   4229 	#endif
   4230 			precision mediump float;
   4231 			${DECLARATIONS}
   4232 			void main()
   4233 			{
   4234 				out0 = VAL;
   4235 				${OUTPUT}
   4236 			}
   4237 		""
   4238 	end
   4239 
   4240 	case bitwise_or_vs_xor
   4241 		values { output float out0 = 1.0; }
   4242 		both ""
   4243 
   4244 	#if ( 8 | 3 ^ 2 ) == 9
   4245 	#define VAL 1.0
   4246 	#else
   4247 	#define VAL 0.0
   4248 	#endif
   4249 			precision mediump float;
   4250 			${DECLARATIONS}
   4251 			void main()
   4252 			{
   4253 				out0 = VAL;
   4254 				${OUTPUT}
   4255 			}
   4256 		""
   4257 	end
   4258 
   4259 	case logical_and_vs_bitwise_or
   4260 		values { output float out0 = 1.0; }
   4261 		both ""
   4262 
   4263 	#if ( 0 && 3 | 2 )
   4264 	#define VAL 0.0
   4265 	#else
   4266 	#define VAL 1.0
   4267 	#endif
   4268 			precision mediump float;
   4269 			${DECLARATIONS}
   4270 			void main()
   4271 			{
   4272 				out0 = VAL;
   4273 				${OUTPUT}
   4274 			}
   4275 		""
   4276 	end
   4277 
   4278 	case logical_and_vs_bitwise_and
   4279 		values { output float out0 = 1.0; }
   4280 		both ""
   4281 
   4282 	#if ( 0 && 4 & 2 )
   4283 	#define VAL 0.0
   4284 	#else
   4285 	#define VAL 1.0
   4286 	#endif
   4287 			precision mediump float;
   4288 			${DECLARATIONS}
   4289 			void main()
   4290 			{
   4291 				out0 = VAL;
   4292 				${OUTPUT}
   4293 			}
   4294 		""
   4295 	end
   4296 
   4297 	case logical_or_vs_logical_and
   4298 		values { output float out0 = 1.0; }
   4299 		both ""
   4300 
   4301 	#if ( 0 || 4 && 0 )
   4302 	#define VAL 0.0
   4303 	#else
   4304 	#define VAL 1.0
   4305 	#endif
   4306 			precision mediump float;
   4307 			${DECLARATIONS}
   4308 			void main()
   4309 			{
   4310 				out0 = VAL;
   4311 				${OUTPUT}
   4312 			}
   4313 		""
   4314 	end
   4315 
   4316 end # operator_precedence
   4317