public void Switch() { var builder = new StatementListBuilder(); builder .AddSwitch(0, "Physics") .AddCase(7, "0") .AddReturn(12, "\"None\"") .AddJump(19, 232) .AddDefaultCase(229) .AddReturn(232, "\"Unknown\""); VerifyText(builder, "switch (Physics)", "{", " case 0:", " return \"None\";", "}", "return \"Unknown\";"); }
public void SwitchNoBreak() { var builder = new StatementListBuilder(); builder .AddSwitch(0, "SplitscreenType") .AddCase(7, "0") .AddCase(12, "2") .AddReturn(17, "true") .AddDefaultCase(72) .AddReturn(75, "false") .AddErrorReturn(77, "// invalid"); VerifyText(builder, "switch (SplitscreenType)", "{", " case 0:", " case 2:", " return true;", " default:", " return false;", "}"); }