diff --git a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs index c4547842f40804c50e0b5e40a41e92e8bde784c6..aa3451de6ba16b5a0cc612b7876c424ec1d0d7e3 100644 --- a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/ComparisonTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open NUnit.Framework +open FSharp.TestHelpers [] module ``Comparison Tests`` = @@ -16,4 +17,27 @@ module ``Comparison Tests`` = Assert.IsFalse (W System.Double.NaN = W System.Double.NaN) Assert.IsTrue ((W System.Double.NaN).Equals(W System.Double.NaN)) - Assert.areEqual (compare (W System.Double.NaN) (W System.Double.NaN)) 0 \ No newline at end of file + Assert.areEqual (compare (W System.Double.NaN) (W System.Double.NaN)) 0 + + [] + let ``Comparisons with wrapped NaN in FSI``() = + // Regression test for FSHARP1.0:5640 + // This is a sanity test: more coverage in FSHARP suite... + + CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] + """ +type 'a www = W of 'a + +let assertTrue a = + if (not a) then failwithf "Expected true, but found false." + () + +let p = W System.Double.NaN = W System.Double.NaN +let q = (W System.Double.NaN).Equals(W System.Double.NaN) +let z = compare (W System.Double.NaN) (W System.Double.NaN) + +assertTrue (not p) +assertTrue q +assertTrue (z = 0) + """ + [] \ No newline at end of file diff --git a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs index c2ad00ab3fb51168c7e48160d1b17d98aedd98c7..b655b26d0390fde6222907f1c3b4b8b7aa395d60 100644 --- a/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/LanguagePrimitives/StringFormatTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open NUnit.Framework +open FSharp.TestHelpers [] module ``String Format Tests`` = @@ -137,3 +138,70 @@ module ``String Format Tests`` = Assert.areEqual (string infinityf) "Infinity" Assert.areEqual (string nanf) "NaN" Assert.areEqual (string (new System.Guid("210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"))) "210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0" + + [] + let ``string constructor in FSI``() = + // Regression test for FSHARP1.0:5894 + + CompilerAssert.RunScriptWithOptions [| "--langversion:preview" |] + """ +let assertEqual a b = + if a <> b then failwithf "Expected '%s', but got '%s'" a b + () + +assertEqual (string 1.0f) "1" +assertEqual (string 1.00001f) "1.00001" +assertEqual (string -1.00001f) "-1.00001" +assertEqual (string 1.0) "1" +assertEqual (string 1.00001) "1.00001" +assertEqual (string -1.00001) "-1.00001" +assertEqual (string System.SByte.MaxValue) "127" +assertEqual (string System.SByte.MinValue) "-128" +assertEqual (string 0y) "0" +assertEqual (string -1y) "-1" +assertEqual (string 1y) "1" +assertEqual (string System.Byte.MaxValue) "255" +assertEqual (string System.Byte.MinValue) "0" +assertEqual (string 0uy) "0" +assertEqual (string 1uy) "1" +assertEqual (string System.Int16.MaxValue) "32767" +assertEqual (string System.Int16.MinValue) "-32768" +assertEqual (string 0s) "0" +assertEqual (string -10s) "-10" +assertEqual (string 10s) "10" +assertEqual (string System.UInt16.MaxValue) "65535" +assertEqual (string System.UInt16.MinValue) "0" +assertEqual (string 0us) "0" +assertEqual (string 110us) "110" +assertEqual (string System.Int32.MaxValue) "2147483647" +assertEqual (string System.Int32.MinValue) "-2147483648" +assertEqual (string 0) "0" +assertEqual (string -10) "-10" +assertEqual (string 10) "10" +assertEqual (string System.UInt32.MaxValue) "4294967295" +assertEqual (string System.UInt32.MinValue) "0" +assertEqual (string 0u) "0" +assertEqual (string 10u) "10" +assertEqual (string System.Int64.MaxValue) "9223372036854775807" +assertEqual (string System.Int64.MinValue) "-9223372036854775808" +assertEqual (string 0L) "0" +assertEqual (string -10L) "-10" +assertEqual (string 10L) "10" +assertEqual (string System.UInt64.MaxValue) "18446744073709551615" +assertEqual (string System.UInt64.MinValue) "0" +assertEqual (string 0UL) "0" +assertEqual (string 10UL) "10" +assertEqual (string System.Decimal.MaxValue) "79228162514264337593543950335" +assertEqual (string System.Decimal.MinValue) "-79228162514264337593543950335" +assertEqual (string System.Decimal.Zero) "0" +assertEqual (string 12345678M) "12345678" +assertEqual (string -12345678M) "-12345678" +assertEqual (string -infinity) "-Infinity" +assertEqual (string infinity) "Infinity" +assertEqual (string nan) "NaN" +assertEqual (string -infinityf) "-Infinity" +assertEqual (string infinityf) "Infinity" +assertEqual (string nanf) "NaN" +assertEqual (string (new System.Guid("210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0"))) "210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0" + """ + [] diff --git a/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/anytostring01.fsx b/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/anytostring01.fsx deleted file mode 100644 index ba675c60d732b94d0ef633ab7438c66eaf8857cd..0000000000000000000000000000000000000000 --- a/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/anytostring01.fsx +++ /dev/null @@ -1,128 +0,0 @@ -// #Regression #Libraries #LanguagePrimitives #ReqNOMT -// Regression test for FSHARP1.0:5894 - -//val it : string = "1" -//val it : string = "1.00001" -//val it : string = "-1.00001" -//val it : string = "1" -//val it : string = "1.00001" -//val it : string = "-1.00001" -//val it : string = "127" -//val it : string = "-128" -//val it : string = "0" -//val it : string = "-1" -//val it : string = "1" -//val it : string = "255" -//val it : string = "0" -//val it : string = "0" -//val it : string = "1" -//val it : string = "32767" -//val it : string = "-32768" -//val it : string = "0" -//val it : string = "-10" -//val it : string = "10" -//val it : string = "65535" -//val it : string = "0" -//val it : string = "0" -//val it : string = "110" -//val it : string = "2147483647" -//val it : string = "-2147483648" -//val it : string = "0" -//val it : string = "-10" -//val it : string = "10" -//val it : string = "4294967295" -//val it : string = "0" -//val it : string = "0" -//val it : string = "10" -//val it : string = "9223372036854775807" -//val it : string = "-9223372036854775808" -//val it : string = "0" -//val it : string = "-10" -//val it : string = "10" -//val it : string = "18446744073709551615" -//val it : string = "0" -//val it : string = "0" -//val it : string = "10" -//val it : string = "79228162514264337593543950335" -//val it : string = "-79228162514264337593543950335" -//val it : string = "0" -//val it : string = "12345678" -//val it : string = "-12345678" -//val it : string = "-Infinity" -//val it : string = "Infinity" -//val it : string = "NaN" -//val it : string = "-Infinity" -//val it : string = "Infinity" -//val it : string = "NaN" -//val it : string = "210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0" - - (string 1.0f);; - (string 1.00001f);; - (string -1.00001f);; - - (string 1.0);; - (string 1.00001);; - (string -1.00001);; - - (string System.SByte.MaxValue);; - (string System.SByte.MinValue);; - (string 0y);; - (string -1y);; - (string 1y);; - - (string System.Byte.MaxValue);; - (string System.Byte.MinValue);; - (string 0uy);; - (string 1uy);; - - (string System.Int16.MaxValue);; - (string System.Int16.MinValue);; - (string 0s);; - (string -10s);; - (string 10s);; - - (string System.UInt16.MaxValue);; - (string System.UInt16.MinValue);; - (string 0us);; - (string 110us);; - - (string System.Int32.MaxValue);; - (string System.Int32.MinValue);; - (string 0);; - (string -10);; - (string 10);; - - (string System.UInt32.MaxValue);; - (string System.UInt32.MinValue);; - (string 0u);; - (string 10u);; - - (string System.Int64.MaxValue);; - (string System.Int64.MinValue);; - (string 0L);; - (string -10L);; - (string 10L);; - - (string System.UInt64.MaxValue);; - (string System.UInt64.MinValue);; - (string 0UL);; - (string 10UL);; - - (string System.Decimal.MaxValue);; - (string System.Decimal.MinValue);; - (string System.Decimal.Zero);; - (string 12345678M);; - (string -12345678M);; - - (string -infinity);; - (string infinity);; - (string nan);; - - (string -infinityf);; - (string infinityf);; - (string nanf);; - - (string (new System.Guid("210f4d6b-cb42-4b09-baa1-f1aa8e59d4b0")));; - -#q;; - diff --git a/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/compare01.fsx b/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/compare01.fsx deleted file mode 100644 index ec7f3be5534fb9c4f143fe9c5d24ad3a9e815bf7..0000000000000000000000000000000000000000 --- a/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/compare01.fsx +++ /dev/null @@ -1,22 +0,0 @@ -// #Regression #Libraries #LanguagePrimitives #ReqNOMT -// Regression test for FSHARP1.0:5640 -// This is a sanity test: more coverage in FSHARP suite... -//type 'a www = \| W of 'a -//val p : bool = false -//val q : bool = true -//val z : int = 0 -//0 -//val it : unit = \(\) - -type 'a www = W of 'a -let p = W System.Double.NaN = W System.Double.NaN;; - -let q = (W System.Double.NaN).Equals(W System.Double.NaN);; - -let z = compare (W System.Double.NaN) (W System.Double.NaN);; - -printfn "%A" (if (not p) && q && (z=0) then 0 else 1);; - -#q;; - - diff --git a/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/env.lst b/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/env.lst deleted file mode 100644 index 7e5badf890303077d8334dbc8a0a6ffd43a5c7bd..0000000000000000000000000000000000000000 --- a/tests/fsharpqa/Source/Libraries/Core/LanguagePrimitives/env.lst +++ /dev/null @@ -1,2 +0,0 @@ -NoMT SOURCE=anytostring01.fsx FSIMODE=PIPE COMPILE_ONLY=1 # anytostring01.fsx -NoMT SOURCE=compare01.fsx FSIMODE=PIPE COMPILE_ONLY=1 # compare01.fsx