From eb4ab74b8ed9c4c074ab0160e7b9efa4c1b97ac3 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 14 Sep 2017 22:55:39 +0200 Subject: [PATCH] Add test case for constant 2147483648. Closes #609. --- .../CorrectnessTestRunner.cs | 6 +++ .../ICSharpCode.Decompiler.Tests.csproj | 1 + .../TestCases/Correctness/TrickyTypes.cs | 50 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs diff --git a/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs b/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs index e77de2aee..6847b650b 100644 --- a/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs +++ b/ICSharpCode.Decompiler.Tests/CorrectnessTestRunner.cs @@ -156,6 +156,12 @@ namespace ICSharpCode.Decompiler.Tests RunCS(options: options); } + [Test] + public void TrickyTypes([ValueSource("defaultOptions")] CompilerOptions options) + { + RunCS(options: options); + } + [Test] public void Capturing([ValueSource("defaultOptions")] CompilerOptions options) { diff --git a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj index 1c43e8aa7..b6e8c6ac7 100644 --- a/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj +++ b/ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj @@ -56,6 +56,7 @@ + diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs new file mode 100644 index 000000000..aa26df728 --- /dev/null +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/TrickyTypes.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2017 AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; + +namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness +{ + class TrickyTypes + { + static void Main() + { + InterestingConstants(); + } + + static void Print(T val) + { + Console.Write(typeof(T).Name + ": "); + if (val == null) + Console.WriteLine("null"); + else + Console.WriteLine(val); + } + + static void InterestingConstants() + { + long val1 = 2147483648L; + uint val2 = 2147483648u; + Console.WriteLine("InterestingConstants:"); + Print(val1); + Print(2147483648L); + Print(val2); + Print(2147483648u); + } + } +}