diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M15-SP2/b124443/b124443.cs b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M15-SP2/b124443/b124443.cs index 5fa3c2a088e06e..b154e817f6ab86 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M15-SP2/b124443/b124443.cs +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M15-SP2/b124443/b124443.cs @@ -4,151 +4,124 @@ using System; using Xunit; -delegate void TestDelegate(); + public class ArrayBounds { - internal static void f1a() - { - int [] a = new int[4]; - for (int i=0; i < a.Length; --i) - { - a[i]=1; - } - } - internal static void f2a() - { - int [] a = new int[4]; - for (int i=0; i < a.Length; --i) - { - int b = a[i]; - } - } - internal static void f3a() - { - int [] a = new int[4]; - for (int i=0; i < a.Length; --i) - { - Console.WriteLine(a[i]); - } - } - internal static void f4a() - { - int [] a = new int[4]; - for (int i=0; i < a.Length; a[i]=i,--i) - { - // empty - } - } - - // ++i - internal static void f1b() - { - int [] a = new int[4]; - for (int i=0; i <= a.Length; ++i) - { - a[i]=1; - } - } - internal static void f2b() - { - int [] a = new int[4]; - for (int i=0; i <= a.Length; ++i) - { - int b = a[i]; - } - } - internal static void f3b() - { - int [] a = new int[4]; - for (int i=0; i <= a.Length; ++i) - { - Console.WriteLine(a[i]); - } - } - internal static void f4b() - { - int [] a = new int[4]; - for (int i=0; i <= a.Length; a[i]=i,++i) - { - // empty - } - } - - // ++i, 0x7fff - internal static void f1c() - { - bool [] a = new bool[0x7fff]; - for (short i=0x7ff0; i < a.Length+1; ++i) - { - a[i]=true; - } - } - internal static void f2c() - { - bool [] a = new bool[0x7fff]; - for (short i=0x7ff0; i < a.Length+1; ++i) - { - bool b = a[i]; - } - } - internal static void f3c() - { - bool [] a = new bool[0x7fff]; - for (short i=0x7ffe; i < a.Length+1; ++i) - { - Console.WriteLine(a[i]); - } - } - internal static void f4c() - { - bool [] a = new bool[0x7fff]; - for (short i=0x7ff0; i < a.Length+1; ++i) - { - a[i] = true; - } - } - - static int RunTests(TestDelegate d) - { - try - { - Console.Write(d.Method.Name + ": "); - d(); - } - catch (IndexOutOfRangeException) - { - Console.WriteLine("IndexOutOfRangeException caught as expected"); - return 100; - } - catch (Exception e) - { - Console.WriteLine("FAILED"); - Console.WriteLine(e); - return 1; - } + internal static void f1a() + { + int [] a = new int[4]; + for (int i=0; i < a.Length; --i) + { + a[i]=1; + } + } + internal static void f2a() + { + int [] a = new int[4]; + for (int i=0; i < a.Length; --i) + { + int b = a[i]; + } + } + internal static void f3a() + { + int [] a = new int[4]; + for (int i=0; i < a.Length; --i) + { + Console.WriteLine(a[i]); + } + } + internal static void f4a() + { + int [] a = new int[4]; + for (int i=0; i < a.Length; a[i]=i,--i) + { + // empty + } + } - Console.WriteLine("PASSED"); - return 100; - } + // ++i + internal static void f1b() + { + int [] a = new int[4]; + for (int i=0; i <= a.Length; ++i) + { + a[i]=1; + } + } + internal static void f2b() + { + int [] a = new int[4]; + for (int i=0; i <= a.Length; ++i) + { + int b = a[i]; + } + } + internal static void f3b() + { + int [] a = new int[4]; + for (int i=0; i <= a.Length; ++i) + { + Console.WriteLine(a[i]); + } + } + internal static void f4b() + { + int [] a = new int[4]; + for (int i=0; i <= a.Length; a[i]=i,++i) + { + // empty + } + } - [Fact] - public static int TestEntryPoint() - { - if (RunTests(new TestDelegate(f1a))!=100) return 1; - if (RunTests(new TestDelegate(f2a))!=100) return 1; - if (RunTests(new TestDelegate(f3a))!=100) return 1; - if (RunTests(new TestDelegate(f4a))!=100) return 1; - if (RunTests(new TestDelegate(f1b))!=100) return 1; - if (RunTests(new TestDelegate(f2b))!=100) return 1; - if (RunTests(new TestDelegate(f3b))!=100) return 1; - if (RunTests(new TestDelegate(f4b))!=100) return 1; - if (RunTests(new TestDelegate(f1c))!=100) return 1; - if (RunTests(new TestDelegate(f2c))!=100) return 1; - if (RunTests(new TestDelegate(f3c))!=100) return 1; - if (RunTests(new TestDelegate(f4c))!=100) return 1; + // ++i, 0x7fff + internal static void f1c() + { + bool [] a = new bool[0x7fff]; + for (short i=0x7ff0; i < a.Length+1; ++i) + { + a[i]=true; + } + } + internal static void f2c() + { + bool [] a = new bool[0x7fff]; + for (short i=0x7ff0; i < a.Length+1; ++i) + { + bool b = a[i]; + } + } + internal static void f3c() + { + bool [] a = new bool[0x7fff]; + for (short i=0x7ffe; i < a.Length+1; ++i) + { + Console.WriteLine(a[i]); + } + } + internal static void f4c() + { + bool [] a = new bool[0x7fff]; + for (short i=0x7ff0; i < a.Length+1; ++i) + { + a[i] = true; + } + } - Console.WriteLine(); - Console.WriteLine("PASSED"); - return 100; - } + [Fact] + public static void TestEntryPoint() + { + Assert.Throws(f1a); + Assert.Throws(f2a); + Assert.Throws(f3a); + Assert.Throws(f4a); + Assert.Throws(f1b); + Assert.Throws(f2b); + Assert.Throws(f3b); + Assert.Throws(f4b); + Assert.Throws(f1c); + Assert.Throws(f2c); + Assert.Throws(f3c); + Assert.Throws(f4c); + } } diff --git a/src/tests/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs b/src/tests/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs index 844073eded6b32..2ff702cf3d6a69 100644 --- a/src/tests/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs +++ b/src/tests/JIT/Regression/JitBlue/DevDiv_278365/DevDiv_278365.cs @@ -13,6 +13,7 @@ public class Program { [MethodImpl(MethodImplOptions.NoInlining)] + [Fact] public static int Bar() { int sum = 0; @@ -31,20 +32,4 @@ public static int Bar() return 100; } } - - [Fact] - public static int TestEntryPoint() - { - try - { - if (Bar() != 100) - return 0; - } - catch (Exception) - { - } - - Console.WriteLine("Pass"); - return 100; - } } diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_46240/Runtime_46240.cs b/src/tests/JIT/Regression/JitBlue/Runtime_46240/Runtime_46240.cs index aea06360139466..fe16cbabbf9b76 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_46240/Runtime_46240.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_46240/Runtime_46240.cs @@ -31,7 +31,7 @@ public static S GetS() } [MethodImpl(MethodImplOptions.NoInlining)] - public static int TestS() + public static void TestS() { // Use all available registers to push some locals on stack // and force multi-reg->stack copies with small types @@ -58,56 +58,23 @@ public static int TestS() TestS(s3); TestS(s2); TestS(s1); - - return 100; } } public class Runtime_46240 { [Fact] - public static int TestEntryPoint() + public static void TestEntryPoint() { - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - if (Tester.TestS() != 100) - { - return 101; - } - return 100; + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); + Tester.TestS(); } } diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_85225/Runtime_85225.cs b/src/tests/JIT/Regression/JitBlue/Runtime_85225/Runtime_85225.cs index 249fd4af0c075d..566c8cb5e9428f 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_85225/Runtime_85225.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_85225/Runtime_85225.cs @@ -21,6 +21,7 @@ static void Consume(bool x) { } public static uint s_2; [MethodImpl(MethodImplOptions.NoInlining)] + [Fact] public static int Test1() { int vr0 = default(int); @@ -42,6 +43,7 @@ public class C0 public static sbyte s_44; [MethodImpl(MethodImplOptions.NoInlining)] + [Fact] public static int Test2() { try @@ -58,12 +60,13 @@ public static int Test2() public static uint s_4; [MethodImpl(MethodImplOptions.NoInlining)] + [Fact] public static int Test3() { return M17(0); } - public static int M17(long arg0) + static int M17(long arg0) { short var0 = default(short); if ((ulong)((-s_4) & arg0) >= 1) @@ -78,6 +81,7 @@ public static int M17(long arg0) public static int[] s_12 = new int[] { 0 }; [MethodImpl(MethodImplOptions.NoInlining)] + [Fact] public static int Test4() { s_12[0] = -2147483648; @@ -86,22 +90,4 @@ public static int Test4() return vr9 ? 0 : 100; } } - - [Fact] - public static int TestEntryPoint() - { - if (Program.Test1() != 100) - return 0; - - if (Program.Test2() != 100) - return 0; - - if (Program.Test3() != 100) - return 0; - - if (Program.Test4() != 100) - return 0; - - return 100; - } } diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_85382/Runtime_85382.cs b/src/tests/JIT/Regression/JitBlue/Runtime_85382/Runtime_85382.cs index 0b39426f7d436d..61df2bc3ab40aa 100644 --- a/src/tests/JIT/Regression/JitBlue/Runtime_85382/Runtime_85382.cs +++ b/src/tests/JIT/Regression/JitBlue/Runtime_85382/Runtime_85382.cs @@ -10,89 +10,78 @@ public class Test { // This is trying to verify that we properly zero-extend on all platforms. - public class Program - { - public static long s_15; - public static sbyte s_17; - public static ushort s_21 = 36659; - public static int Test() - { - s_15 = ~1; - return M40(0); - } + public class Program + { + public static long s_15; + public static sbyte s_17; + public static ushort s_21 = 36659; - [MethodImpl(MethodImplOptions.NoInlining)] - public static void Consume(ushort x) { } + [Fact] + public static int Test() + { + s_15 = ~1; + return M40(0); + } - [MethodImpl(MethodImplOptions.NoInlining)] - public static int M40(ushort arg0) - { - for (int var0 = 0; var0 < 2; var0++) - { - arg0 = 65535; - arg0 &= (ushort)(s_15++ >> s_17); - arg0 %= s_21; - } + [MethodImpl(MethodImplOptions.NoInlining)] + static void Consume(ushort x) { } - Consume(arg0); + [MethodImpl(MethodImplOptions.NoInlining)] + static int M40(ushort arg0) + { + for (int var0 = 0; var0 < 2; var0++) + { + arg0 = 65535; + arg0 &= (ushort)(s_15++ >> s_17); + arg0 %= s_21; + } - if (arg0 != 28876) - { - return 0; - } - return 100; - } - } + Consume(arg0); - public class Program2 - { - public static long s_15; - public static sbyte s_17; - public static ushort s_21 = 36659; - public static int Test() - { - s_15 = ~1; - return M40(); - } + if (arg0 != 28876) + { + return 0; + } + return 100; + } + } - [MethodImpl(MethodImplOptions.NoInlining)] - public static void Consume(ushort x) { } + public class Program2 + { + public static long s_15; + public static sbyte s_17; + public static ushort s_21 = 36659; - [MethodImpl(MethodImplOptions.NoInlining)] - public static int M40() - { - S s = default; - for (int var0 = 0; var0 < 2; var0++) - { - s.U = 65535; - s.U &= (ushort)(s_15++ >> s_17); - s.U %= s_21; - } + [Fact] + public static int Test() + { + s_15 = ~1; + return M40(); + } - Consume(s.U); + [MethodImpl(MethodImplOptions.NoInlining)] + static void Consume(ushort x) { } - if (s.U != 28876) - { - return 0; - } - return 100; - } + [MethodImpl(MethodImplOptions.NoInlining)] + static int M40() + { + S s = default; + for (int var0 = 0; var0 < 2; var0++) + { + s.U = 65535; + s.U &= (ushort)(s_15++ >> s_17); + s.U %= s_21; + } - public struct S { public ushort U; } - } + Consume(s.U); - [Fact] - public static int TestEntryPoint() { - if (Test.Program.Test() != 100) - { - return 0; - } + if (s.U != 28876) + { + return 0; + } + return 100; + } - if (Test.Program2.Test() != 100) - { - return 0; - } - - return 100; - } + public struct S { public ushort U; } + } } diff --git a/src/tests/JIT/SIMD/BitwiseOperations.cs b/src/tests/JIT/SIMD/BitwiseOperations.cs index 9e68aa0992f1ce..5d87fdfeb3d01f 100644 --- a/src/tests/JIT/SIMD/BitwiseOperations.cs +++ b/src/tests/JIT/SIMD/BitwiseOperations.cs @@ -24,7 +24,8 @@ static float NextFloat(Random random) return (float)(mantissa * exponent); } - static int TestDouble() + [Fact] + public static int TestDouble() { Random random = new Random(Seed); double[] arr1 = new double[] { NextFloat(random), NextFloat(random), NextFloat(random), NextFloat(random) }; @@ -76,7 +77,8 @@ static byte[] GenerateByteArray(int size, Random random) return arr; } - static int TestBool() + [Fact] + public static int TestBool() { Random random = new Random(Seed); byte[] arr1 = GenerateByteArray(64, random); @@ -108,20 +110,5 @@ static int TestBool() } return 100; } - - [Fact] - public static int TestEntryPoint() - { - if (TestDouble() != 100) - { - return 0; - } - if (TestBool() != 100) - { - return 0; - } - - return 100; - } } } diff --git a/src/tests/JIT/jit64/gc/regress/vswhidbey/143837.cs b/src/tests/JIT/jit64/gc/regress/vswhidbey/143837.cs index b2d613f90f04ca..78917db971f1f5 100644 --- a/src/tests/JIT/jit64/gc/regress/vswhidbey/143837.cs +++ b/src/tests/JIT/jit64/gc/regress/vswhidbey/143837.cs @@ -11,16 +11,6 @@ public class Test_143837 public static DerivedClass static_DerivedClass; [Fact] - public static int TestEntryPoint() - { - if (Test1() != 100) return 1; - - if (Test2() != 100) return 1; - - Console.WriteLine("Pass"); - return 100; - } - public static int Test1() { try @@ -54,6 +44,7 @@ public static int Test1() return -1; } + [Fact] public static int Test2() { try diff --git a/src/tests/JIT/opt/InstructionCombining/NegMulOrDivToConst.cs b/src/tests/JIT/opt/InstructionCombining/NegMulOrDivToConst.cs index 65cfccd257e815..486cdfaaa9acfe 100644 --- a/src/tests/JIT/opt/InstructionCombining/NegMulOrDivToConst.cs +++ b/src/tests/JIT/opt/InstructionCombining/NegMulOrDivToConst.cs @@ -20,7 +20,8 @@ namespace TestIntLimits public class Program { [MethodImpl(MethodImplOptions.NoInlining)] - static int CheckMulNeg() + [Fact] + public static int CheckMulNeg() { bool fail = false; if (MulNeg7(3) != -7 * 3) @@ -88,7 +89,6 @@ static int CheckMulNeg() if (fail) { - Console.WriteLine("CheckMulNeg failed"); return 101; } return 100; @@ -125,7 +125,8 @@ static int CheckedMulNeg0(int a) } [MethodImpl(MethodImplOptions.NoInlining)] - static int CheckNegMul() + [Fact] + public static int CheckNegMul() { bool fail = false; if (NegMul7(3) != -7 * 3) @@ -163,7 +164,6 @@ static int CheckNegMul() if (fail) { - Console.WriteLine("CheckNegMul failed"); return 101; } return 100; @@ -190,7 +190,8 @@ static int CheckedNegMulIntMinValue(int a) } [MethodImpl(MethodImplOptions.NoInlining)] - static int CheckDivNeg() + [Fact] + public static int CheckDivNeg() { bool fail = false; @@ -220,7 +221,6 @@ static int CheckDivNeg() if (fail) { - Console.WriteLine("CheckDivNeg failed"); return 101; } return 100; @@ -264,7 +264,8 @@ static long LongDivNeg1000(long a) static long LongDivNeg1(long a) => -a / 1; [MethodImpl(MethodImplOptions.NoInlining)] - static int CheckNegDiv() + [Fact] + public static int CheckNegDiv() { bool fail = false; @@ -310,7 +311,6 @@ static int CheckNegDiv() if (fail) { - Console.WriteLine("CheckNegDiv failed"); return 101; } return 100; @@ -339,28 +339,5 @@ static int CheckNegDiv() [MethodImpl(MethodImplOptions.NoInlining)] static long LongNegDivMinus1(long a) => -(a / -1); - - [Fact] - public static int TestEntryPoint() - { - if (CheckMulNeg() != 100) - { - return 101; - } - if (CheckNegMul() != 100) - { - return 101; - } - if (CheckDivNeg() != 100) - { - return 101; - } - if (CheckNegDiv() != 100) - { - return 101; - } - - return 100; - } } }