From d412de58b952bade5fef290dfe822fdb20e252dc Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Thu, 30 Nov 2017 23:21:32 +0100 Subject: [PATCH] Commit first test case. --- .../CorrectnessTestRunner.cs | 6 +++++ .../ICSharpCode.Decompiler.Tests.csproj | 1 + .../Correctness/FloatingPointArithmetic.cs | 24 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Correctness/FloatingPointArithmetic.cs diff --git a/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs b/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs index c1fedbd03..38714bff9 100644 --- a/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs @@ -65,6 +65,12 @@ namespace ICSharpCode.Decompiler.Tests RunCS(options: options); } + [Test] + public void FloatingPointArithmetic([ValueSource("defaultOptions")] CompilerOptions options) + { + RunCS(options: options); + } + [Test] public void HelloWorld([ValueSource("defaultOptions")] CompilerOptions options) { diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index b794dcf87..9039c7775 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -61,6 +61,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/FloatingPointArithmetic.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/FloatingPointArithmetic.cs new file mode 100644 index 000000000..f057f77bb --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/FloatingPointArithmetic.cs @@ -0,0 +1,24 @@ +using System; + +namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness +{ + class FloatingPointArithmetic + { + public static int Main(string[] args) + { + Issue999(); + return 0; + } + + static void Issue999() + { + for (float i = -10f; i <= 10f; i += 0.01f) + Console.WriteLine("{1:R}: {0:R}", M(i), i); + } + + static float M(float v) + { + return 0.99f * v + 0.01f; + } + } +}