Browse Source

Add test case for cast after ternary operator. Closes #765.

pull/863/head
Daniel Grunwald 8 years ago
parent
commit
2eb6658efa
  1. 13
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/ControlFlow.cs

13
ICSharpCode.Decompiler.Tests/TestCases/Correctness/ControlFlow.cs

@ -40,6 +40,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -40,6 +40,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
ForeachWithAssignment(new int[] { 1, 5, 25 });
BreakUnlessContinue(true);
BreakUnlessContinue(false);
TestConditionals();
return 0;
}
@ -136,5 +137,17 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness @@ -136,5 +137,17 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness
}
Console.WriteLine("BreakUnlessContinue (end)");
}
static void TestConditionals()
{
Console.WriteLine(CastAfterConditional(0));
Console.WriteLine(CastAfterConditional(128));
}
static byte CastAfterConditional(int value)
{
byte answer = (byte)(value == 128 ? 255 : 0);
return answer;
}
}
}
Loading…
Cancel
Save