1/*#pragma settings RewriteSwitchStatements*/ 2 3uniform half4 colorGreen, colorRed; 4 5bool switch_with_break_in_while_loop(int x) { 6 int val = 0; 7 int i = 0; 8 switch (x) { 9 case 1: while (i < 10) { ++i; ++val; break; ++val; } 10 default: ++val; 11 } 12 return val == 2; 13} 14 15bool switch_with_continue_in_while_loop(int x) { 16 int val = 0; 17 int i = 0; 18 switch (x) { 19 case 1: while (i < 10) { ++i; ++val; continue; ++val; } 20 default: ++val; 21 } 22 return val == 11; 23} 24 25bool while_loop_with_break_in_switch(int x) { 26 int val = 0; 27 int i = 0; 28 while (i < 10) { 29 ++i; 30 switch (x) { 31 case 1: ++val; break; 32 default: return false; 33 } 34 ++val; 35 } 36 return val == 20; 37} 38 39bool switch_with_break_in_do_while_loop(int x) { 40 int val = 0; 41 int i = 0; 42 switch (x) { 43 case 1: do { ++i; ++val; break; ++val; } while (i < 10); 44 default: ++val; 45 } 46 return val == 2; 47} 48 49bool switch_with_continue_in_do_while_loop(int x) { 50 int val = 0; 51 int i = 0; 52 switch (x) { 53 case 1: do { ++i; ++val; continue; ++val; } while (i < 10); 54 default: ++val; 55 } 56 return val == 11; 57} 58 59bool do_while_loop_with_break_in_switch(int x) { 60 int val = 0; 61 int i = 0; 62 do { 63 ++i; 64 switch (x) { 65 case 1: ++val; break; 66 default: return false; 67 } 68 ++val; 69 } while (i < 10); 70 return val == 20; 71} 72 73half4 main(float2 coords) { 74 int x = int(colorGreen.g); 75 return (switch_with_break_in_while_loop(x) && 76 switch_with_continue_in_while_loop(x) && 77 while_loop_with_break_in_switch(x) && 78 switch_with_break_in_do_while_loop(x) && 79 switch_with_continue_in_do_while_loop(x) && 80 do_while_loop_with_break_in_switch(x)) ? colorGreen : colorRed; 81} 82