diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 257bceef898..cc2333f29f1 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -85,6 +85,7 @@ Prior to a **Release** test run, you need to do **all** of these: msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable7 /p:Configuration=Release msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable78 /p:Configuration=Release msbuild src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=Release + msbuild src/fsharp-library-propertytests-build.proj /p:Configuration=Release src\update.cmd release -ngen tests\BuildTestTools.cmd release diff --git a/TESTGUIDE.md b/TESTGUIDE.md index c676493d187..82d128d9923 100644 --- a/TESTGUIDE.md +++ b/TESTGUIDE.md @@ -44,6 +44,7 @@ RunTests.cmd coreunitportable47 RunTests.cmd coreunitportable7 RunTests.cmd coreunitportable78 RunTests.cmd coreunitportable259 +RunTests.cmd coreproperty RunTests.cmd ideunit ``` @@ -102,6 +103,8 @@ To build these unit test binaries, from the `src` directory call - Output binary is `FSharp.Compiler.Unittests.dll` - `msbuild fsharp-library-unittests-build.proj` - Output binary is `FSharp.Core.Unittests.dll` +- `msbuild fsharp-library-propertytests-build.proj` + - Output binary is `FSharp.Core.PropertyTests.dll` You can execute and re-run these tests using any standard NUnit approach - via graphical `nunit.exe` or on the command line via `nunit-console.exe`. diff --git a/appveyor-build.cmd b/appveyor-build.cmd index c6039fa1148..572124dddba 100644 --- a/appveyor-build.cmd +++ b/appveyor-build.cmd @@ -66,6 +66,9 @@ if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure %_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=portable259 /p:Configuration=Release @if ERRORLEVEL 1 echo Error: library unittests build failed portable259 && goto :failure +%_msbuildexe% src/fsharp-library-propertytests-build.proj /p:Configuration=Release +@if ERRORLEVEL 1 echo Error: library propertytests build failed && goto :failure + %_msbuildexe% vsintegration\fsharp-vsintegration-build.proj /p:Configuration=Release @if ERRORLEVEL 1 echo Error: VS integration build failed && goto :failure @@ -94,6 +97,9 @@ call RunTests.cmd release compilerunit call RunTests.cmd release coreunit @if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreunit' failed && goto :failure +call RunTests.cmd release coreproperty +@if ERRORLEVEL 1 echo Error: 'RunTests.cmd release coreproperty' failed && goto :failure + popd goto :eof diff --git a/packages.config b/packages.config index a7462f84250..51fd4f3d3d1 100644 --- a/packages.config +++ b/packages.config @@ -1,5 +1,6 @@ - + + \ No newline at end of file diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index 27b47b1c008..f95d7420e4d 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -29,6 +29,17 @@ true + + + $(OtherFlags) --version:4.4.0.9055 + $(OtherFlags) --version:2.4.0.9055 + $(OtherFlags) --version:3.7.4.9055 + $(OtherFlags) --version:3.47.4.9055 + $(OtherFlags) --version:3.78.4.9055 + $(OtherFlags) --version:3.259.4.9055 + false + + $(OtherFlags) --version:4.4.0.9055 --delaysign+ --keyfile:"$(FSharpSourcesRoot)\fsharp\msft.pubkey" @@ -101,7 +112,10 @@ 2.6.4 2.6.4.14350 $(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\ - $(FSharpSourcesRoot)\..\packages\NUnit.Runners.$(NUnitVersion)\tools\lib\ + $(FSharpSourcesRoot)\..\packages\NUnit.Runners.$(NUnitVersion)\tools\lib\ + 1.0.4 + 1.0.4.0 + $(FSharpSourcesRoot)\..\packages\FsCheck.$(FsCheckVersion)\lib\net45\ diff --git a/src/fsharp-library-propertytests-build.proj b/src/fsharp-library-propertytests-build.proj new file mode 100644 index 00000000000..dcfae47310f --- /dev/null +++ b/src/fsharp-library-propertytests-build.proj @@ -0,0 +1,19 @@ + + + + + net40 + + + + + + + + + + + + + diff --git a/src/fsharp.sln b/src/fsharp.sln index 0e9eb059b59..658bbd5e2bb 100644 --- a/src/fsharp.sln +++ b/src/fsharp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D78E3B57-DAD1-4FE1-9DC8-84F7847B0C77}" ProjectSection(SolutionItems) = preProject @@ -33,54 +33,257 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FsiAnyCPU", "fsharp\fsiAnyC EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Unittests", "fsharp\FSharp.Compiler.Unittests\FSharp.Compiler.Unittests.fsproj", "{A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}" EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core.PropertyTests", "fsharp\FSharp.Core.PropertyTests\FSharp.Core.PropertyTests.fsproj", "{FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Proto|Any CPU = Proto|Any CPU + Proto|Mixed Platforms = Proto|Mixed Platforms Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + VSDebug|Any CPU = VSDebug|Any CPU + VSDebug|Mixed Platforms = VSDebug|Mixed Platforms + VSRelease|Any CPU = VSRelease|Any CPU + VSRelease|Mixed Platforms = VSRelease|Mixed Platforms EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Proto|Any CPU.Build.0 = Proto|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Any CPU.ActiveCfg = Release|Any CPU {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Any CPU.Build.0 = Release|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {C94C257C-3C0A-4858-B5D8-D746498D1F08}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Proto|Any CPU.Build.0 = Proto|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.ActiveCfg = Release|Any CPU {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Any CPU.Build.0 = Release|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {2E4D67B4-522D-4CF7-97E4-BA940F0B18F3}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Proto|Any CPU.Build.0 = Proto|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Release|Any CPU.ActiveCfg = Release|Any CPU {DED3BBD7-53F4-428A-8C9F-27968E768605}.Release|Any CPU.Build.0 = Release|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {DED3BBD7-53F4-428A-8C9F-27968E768605}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {702A7979-BCF9-4C41-853E-3ADFC9897890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {702A7979-BCF9-4C41-853E-3ADFC9897890}.Debug|Any CPU.Build.0 = Debug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Proto|Any CPU.Build.0 = Proto|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {702A7979-BCF9-4C41-853E-3ADFC9897890}.Release|Any CPU.ActiveCfg = Release|Any CPU {702A7979-BCF9-4C41-853E-3ADFC9897890}.Release|Any CPU.Build.0 = Release|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {702A7979-BCF9-4C41-853E-3ADFC9897890}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {D0E98C0D-490B-4C61-9329-0862F6E87645}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D0E98C0D-490B-4C61-9329-0862F6E87645}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Proto|Any CPU.Build.0 = Proto|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {D0E98C0D-490B-4C61-9329-0862F6E87645}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0E98C0D-490B-4C61-9329-0862F6E87645}.Release|Any CPU.Build.0 = Release|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {D0E98C0D-490B-4C61-9329-0862F6E87645}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {649FA588-F02E-457C-9FCF-87E46407481E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {649FA588-F02E-457C-9FCF-87E46407481E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Proto|Any CPU.Build.0 = Proto|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {649FA588-F02E-457C-9FCF-87E46407481E}.Release|Any CPU.ActiveCfg = Release|Any CPU {649FA588-F02E-457C-9FCF-87E46407481E}.Release|Any CPU.Build.0 = Release|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {649FA588-F02E-457C-9FCF-87E46407481E}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Proto|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {88E2D422-6852-46E3-A740-83E391DC7973}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {88E2D422-6852-46E3-A740-83E391DC7973}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Proto|Any CPU.Build.0 = Proto|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {88E2D422-6852-46E3-A740-83E391DC7973}.Release|Any CPU.ActiveCfg = Release|Any CPU {88E2D422-6852-46E3-A740-83E391DC7973}.Release|Any CPU.Build.0 = Release|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {88E2D422-6852-46E3-A740-83E391DC7973}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|Any CPU.Build.0 = Proto|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Any CPU.Build.0 = Release|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {CB7D20C4-6506-406D-9144-5342C3595F03}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Debug|Any CPU.ActiveCfg = Debug|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Proto|Any CPU.ActiveCfg = Proto|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Proto|Mixed Platforms.ActiveCfg = Proto|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Proto|Mixed Platforms.Build.0 = Proto|x86 {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Release|Any CPU.ActiveCfg = Release|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.Release|Mixed Platforms.Build.0 = Release|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.VSDebug|Any CPU.ActiveCfg = VSDebug|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.VSDebug|Mixed Platforms.Build.0 = VSDebug|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.VSRelease|Any CPU.ActiveCfg = VSRelease|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|x86 + {8B3E283D-B5FE-4055-9D80-7E3A32F3967B}.VSRelease|Mixed Platforms.Build.0 = VSRelease|x86 {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Proto|Any CPU.Build.0 = Proto|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Release|Any CPU.Build.0 = Release|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {A8D9641A-9170-4CF4-8FE0-6DB8C134E1B5}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Proto|Any CPU.ActiveCfg = Proto|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Proto|Any CPU.Build.0 = Proto|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Proto|Mixed Platforms.ActiveCfg = Proto|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Proto|Mixed Platforms.Build.0 = Proto|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Release|Any CPU.Build.0 = Release|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSDebug|Any CPU.ActiveCfg = VSDebug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSDebug|Any CPU.Build.0 = VSDebug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSDebug|Mixed Platforms.ActiveCfg = VSDebug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSDebug|Mixed Platforms.Build.0 = VSDebug|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSRelease|Any CPU.ActiveCfg = VSRelease|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSRelease|Any CPU.Build.0 = VSRelease|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSRelease|Mixed Platforms.ActiveCfg = VSRelease|Any CPU + {FFB2A0C4-65F0-47C2-9ADE-0E8FC4F5277A}.VSRelease|Mixed Platforms.Build.0 = VSRelease|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs b/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs new file mode 100644 index 00000000000..0904a1a92c9 --- /dev/null +++ b/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +module FSharp.Core.PropertyTests.CollectionModulesConsistency + +open System +open System.Collections.Generic + +open NUnit.Framework +open FsCheck + +let append<'a when 'a : equality> (xs : list<'a>) (xs2 : list<'a>) = + let s = xs |> Seq.append xs2 + let l = xs |> List.append xs2 + let a = xs |> Seq.toArray |> Array.append (Seq.toArray xs2) + s |> Seq.toArray = a && + l |> List.toArray = a + +let contains<'a when 'a : equality> (xs : 'a []) x = + let s = xs |> Seq.contains x + let l = xs |> List.ofArray |> List.contains x + let a = xs |> Array.contains x + s = a && + l = a + +let choose<'a when 'a : equality> (xs : 'a []) f = + let s = xs |> Seq.choose f + let l = xs |> List.ofArray |> List.choose f + let a = xs |> Array.choose f + s |> Seq.toArray = a && + l |> List.toArray = a + +let collect<'a> (xs : 'a []) f = + let s = xs |> Seq.collect f + let l = xs |> List.ofArray |> List.collect (fun x -> f x |> List.ofArray) + let a = xs |> Array.collect f + s |> Seq.toArray = a && + l |> List.toArray = a + +let compareWith<'a>(xs : 'a []) (xs2 : 'a []) f = + let s = (xs, xs2) ||> Seq.compareWith f + let l = (List.ofArray xs, List.ofArray xs2) ||> List.compareWith f + let a = (xs, xs2) ||> Array.compareWith f + s = a && + l = a + +let concat<'a when 'a : equality> (xs : 'a [][]) = + let s = xs |> Seq.concat + let l = xs |> List.ofArray |> List.map List.ofArray |> List.concat + let a = xs |> Array.concat + s |> Seq.toArray = a && + l |> List.toArray = a + +let countBy<'a> (xs : 'a []) f = + let s = xs |> Seq.countBy f + let l = xs |> List.ofArray |> List.countBy f + let a = xs |> Array.countBy f + s |> Seq.toArray = a && + l |> List.toArray = a + +type Properties = + + static member appendInt xs xs2 = append xs xs2 + static member appendFloat xs xs2 = append xs xs2 + static member appendString xs xs2 = append xs xs2 + + static member average (xs : NonEmptyArray) = + let xs = xs.Get |> Array.map (fun x -> x.Get) + let s = xs |> Seq.average + let l = xs |> List.ofArray |> List.average + let a = xs |> Array.average + s = a && + l = a + + static member averageBy (xs : NonEmptyArray) = + let xs = xs.Get |> Array.map (fun x -> x.Get) + let s = xs |> Seq.averageBy id + let l = xs |> List.ofArray |> List.averageBy id + let a = xs |> Array.averageBy id + s = a && + l = a + + static member containsInt xs x = contains xs x + static member containsString xs x = contains xs x + static member containsFloat xs x = contains xs x + + static member chooseInt xs f = choose xs f + static member chooseString xs f = choose xs f + static member chooseFloat xs f = choose xs f + + static member collectInt xs f = collect xs f + static member collectString xs f = collect xs f + static member collectFloat xs f = collect xs f + + static member compareWithInt xs f = compareWith xs f + static member compareWithString xs f = compareWith xs f + static member compareWithFloat xs f = compareWith xs f + + static member concatInt xs = concat xs + static member concatString xs = concat xs + static member concatFloat xs = concat xs + + static member countByInt xs f = countBy xs f + static member countByString xs f = countBy xs f + static member countByFloat xs f = countBy xs f + +[] +let ``modules consistency`` () = + Check.QuickThrowOnFailureAll() \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.PropertyTests/FSharp.Core.PropertyTests.dll.config b/src/fsharp/FSharp.Core.PropertyTests/FSharp.Core.PropertyTests.dll.config new file mode 100644 index 00000000000..3b892375a23 --- /dev/null +++ b/src/fsharp/FSharp.Core.PropertyTests/FSharp.Core.PropertyTests.dll.config @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.PropertyTests/FSharp.Core.PropertyTests.fsproj b/src/fsharp/FSharp.Core.PropertyTests/FSharp.Core.PropertyTests.fsproj new file mode 100644 index 00000000000..b99275eb4b1 --- /dev/null +++ b/src/fsharp/FSharp.Core.PropertyTests/FSharp.Core.PropertyTests.fsproj @@ -0,0 +1,83 @@ + + + + + ..\.. + {ffb2a0c4-65f0-47c2-9ade-0e8fc4f5277a} + + + + Debug + AnyCPU + 2.0 + true + true + Library + FSharp.Core.PropertyTests + v3.5 + SystematicUnitTests + + false + false + netcore + + + $(DefineConstants);SILVERLIGHT + $(DefineConstants);EXTENSIONTYPING;$(TargetFramework.ToLower()) + + + true + full + false + bin\Debug\ + TRACE;DEBUG;CODE_ANALYSIS; NO_STRONG_NAMES;CODE_ANALYSIS; VS_VERSION_DEV12;EXTENSIONTYPING;net40;OPEN_BUILD;FSHARP_CORE_4_5;FX_ATLEAST_45;FX_ATLEAST_40;FX_ATLEAST_35;BE_SECURITY_TRANSPARENT;QUERIES_IN_FSLIB;PUT_TYPE_PROVIDERS_IN_FSCORE;;FX_ATLEAST_LINQ;OPEN_BUILD;FSHARP_CORE_4_5;FX_ATLEAST_45;FX_ATLEAST_40;FX_ATLEAST_35;BE_SECURITY_TRANSPARENT;QUERIES_IN_FSLIB;PUT_TYPE_PROVIDERS_IN_FSCORE;;FX_ATLEAST_LINQ;OPEN_BUILD;FSHARP_CORE_4_5;FX_ATLEAST_45;FX_ATLEAST_40;FX_ATLEAST_35;BE_SECURITY_TRANSPARENT;QUERIES_IN_FSLIB;PUT_TYPE_PROVIDERS_IN_FSCORE; FX_ATLEAST_LINQ + prompt + 3 + --times --no-jit-optimize --jit-tracking /warnon:3180 --version:4.4.0.9055 --no-jit-optimize --jit-tracking + + + + pdbonly + true + bin\Release\ + $(DefineConstants);TRACE + prompt + 3 + + + + + true + True + $(NUnitLibDir)\nunit.framework.dll + + + true + True + $(FsCheckLibDir)\FsCheck.dll + + + + {DED3BBD7-53F4-428A-8C9F-27968E768605} + FSharp.Core + + + + + + + + + + + + + + + + + FSharp.Core.PropertyTests.dll.config + + + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs b/src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs new file mode 100644 index 00000000000..8f9a1d3e8a0 --- /dev/null +++ b/src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +module FSharp.Core.PropertyTests.Lists + +open System +open System.Collections.Generic + +open NUnit.Framework +open FsCheck + + +let ListContains<'a when 'a : equality> (xs : list<'a>) x = + x :: xs |> List.contains x + +let ListDistinct<'a when 'a : equality> (xs : list<'a>) = + List.distinct xs |> List.countBy id |> List.forall (snd >> (=) 1) + +let ListDistinctBy<'a when 'a : equality> (xs : list<'a>) = + List.distinctBy id xs |> List.countBy id |> List.forall (snd >> (=) 1) + +let ListIndexed<'a> (xs : list<'a>) = + let indices = List.indexed xs |> List.map fst + indices = (indices |> List.sort) && + indices |> List.pairwise |> List.forall (fun (a,b) -> b - a = 1) + +let ListPairwise<'a when 'a : equality> (xs : list<'a>) = + xs.Length > 1 ==> lazy + (xs |> List.pairwise = ((xs |> List.rev |> List.tail |> List.rev, xs |> List.skip 1) ||> List.zip)) + +let ListSplitAt<'a> (xs : list<'a>) index = + (index >= 0 && index < xs.Length) ==> lazy + let a,b = xs |> List.splitAt index + a.Length = index && b.Length = xs.Length - a.Length + +let ListSplitInto<'a when 'a : equality> (xs : list<'a>) count = + (count > 0) ==> lazy + let xss = xs |> List.splitInto count + let lengths = xss |> List.map (fun x -> x.Length) + (xss.Length <= count) && (List.concat xss = xs) && + (if xss.Length > 0 then List.max lengths - List.min lengths <= 1 else true) + +let ListMapFold<'a> (xs : list<'a>) mapF foldF state = + let mapFoldF state next = + mapF next, foldF state next + let result, state' = xs |> List.mapFold mapFoldF state + result = (xs |> List.map mapF) && + state' = (xs |> List.fold foldF state) + +type ListProperties = + static member ListContainsInt xs x = ListContains xs x + static member ListDistinctInt xs = ListDistinct xs + static member ListDistinctByInt xs = ListDistinctBy xs + static member ListIndexedInt xs = ListIndexed xs + static member ListPairwiseInt xs = ListPairwise xs + static member ListSplitAtInt xs x = ListSplitAt xs x + static member ListSplitIntoInt xs x = ListSplitInto xs x + static member ListMapFoldInt xs mapF foldF state = ListMapFold xs mapF foldF state + + static member ListContainsString xs x = ListContains xs x + static member ListDistinctString xs = ListDistinct xs + static member ListDistinctByString xs = ListDistinctBy xs + static member ListIndexedString xs = ListIndexed xs + static member ListPairwiseString xs = ListPairwise xs + static member ListSplitAtString xs x = ListSplitAt xs x + static member ListSplitIntoString xs x = ListSplitInto xs x + static member ListMapFoldString xs mapF foldF state = ListMapFold xs mapF foldF state + + static member ListContainsFloat xs x = ListContains xs x + static member ListDistinctFloat xs = ListDistinct xs + static member ListDistinctByFloat xs = ListDistinctBy xs + static member ListIndexedFloat xs = ListIndexed xs + static member ListPairwiseFloat xs = ListPairwise xs + static member ListSplitAtFloat xs x = ListSplitAt xs x + static member ListSplitIntoFloat xs x = ListSplitInto xs x + static member ListMapFoldFloat xs mapF foldF state = ListMapFold xs mapF foldF state + + static member ``sort behaves like sortby id``(xs:float list) = + let a = List.sortBy id xs |> Seq.toArray + let b = List.sort xs |> Seq.toArray + let result = ref true + for i in 0 .. a.Length - 1 do + if a.[i] <> b.[i] then + if System.Double.IsNaN a.[i] <> System.Double.IsNaN b.[i] then + result := false + !result + +[] +let ``List properties`` () = + Check.QuickThrowOnFailureAll() \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.PropertyTests/SortByStability.fs b/src/fsharp/FSharp.Core.PropertyTests/SortByStability.fs new file mode 100644 index 00000000000..43f1993545e --- /dev/null +++ b/src/fsharp/FSharp.Core.PropertyTests/SortByStability.fs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +module FSharp.Core.PropertyTests.SortByStability + +open System +open System.Collections.Generic + +open NUnit.Framework +open FsCheck + +let sortByStableSeq<'a when 'a : comparison> (xs : 'a []) = + let indexed = xs |> Seq.indexed + let sorted = indexed |> Seq.sortBy snd + sorted |> Seq.pairwise |> Seq.forall (fun ((ia, a),(ib, b)) -> if a = b then ia < ib else true) + +let sortByStableList<'a when 'a : comparison> (xs : 'a []) = + let indexed = xs |> Seq.indexed |> Seq.toList + let sorted = indexed |> List.sortBy snd + sorted |> Seq.pairwise |> Seq.forall (fun ((ia, a),(ib, b)) -> if a = b then ia < ib else true) + +[] +let ``Seq.sortBy is stable`` () = + Check.QuickThrowOnFailure sortByStableSeq + Check.QuickThrowOnFailure sortByStableSeq + +[] +let ``List.sortBy is stable`` () = + Check.QuickThrowOnFailure sortByStableList + Check.QuickThrowOnFailure sortByStableSeq \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index e99b4a025be..770d1877f84 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -1214,8 +1214,14 @@ namespace Microsoft.FSharp.Core when 'T : uint64 = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when 'T : unativeint = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) // Note, these bail out to GenericComparisonWithComparerIntrinsic if called with NaN values, because clt and cgt and ceq all return "false" for that case. - when 'T : float = if (# "clt" x y : bool #) then (-1) else if (# "cgt" x y : bool #) then 1 else if (# "ceq" x y : bool #) then 0 else GenericComparisonWithComparerIntrinsic comp x y - when 'T : float32 = if (# "clt" x y : bool #) then (-1) else if (# "cgt" x y : bool #) then 1 else if (# "ceq" x y : bool #) then 0 else GenericComparisonWithComparerIntrinsic comp x y + when 'T : float = if (# "clt" x y : bool #) then (-1) + elif (# "cgt" x y : bool #) then (1) + elif (# "ceq" x y : bool #) then (0) + else GenericComparisonWithComparerIntrinsic comp x y + when 'T : float32 = if (# "clt" x y : bool #) then (-1) + elif (# "cgt" x y : bool #) then (1) + elif (# "ceq" x y : bool #) then (0) + else GenericComparisonWithComparerIntrinsic comp x y when 'T : char = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when 'T : string = // NOTE: we don't have to null check here because System.String.CompareOrdinal @@ -1284,8 +1290,18 @@ namespace Microsoft.FSharp.Core when 'T : uint32 = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when 'T : uint64 = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when 'T : unativeint = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) - when 'T : float = if (# "clt" x y : bool #) then (-1) else (# "cgt" x y : int #) - when 'T : float32 = if (# "clt" x y : bool #) then (-1) else (# "cgt" x y : int #) + when 'T : float = if (# "clt" x y : bool #) then (-1) + elif (# "cgt" x y : bool #) then (1) + elif (# "ceq" x y : bool #) then (0) + elif (# "ceq" x x : bool #) then (1) + elif (# "ceq" y y : bool #) then (-1) + else (0) + when 'T : float32 = if (# "clt" x y : bool #) then (-1) + elif (# "cgt" x y : bool #) then (1) + elif (# "ceq" x y : bool #) then (0) + elif (# "ceq" x x : bool #) then (1) + elif (# "ceq" y y : bool #) then (-1) + else (0) when 'T : char = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when 'T : string = // NOTE: we don't have to null check here because System.String.CompareOrdinal @@ -4611,6 +4627,7 @@ namespace Microsoft.FSharp.Core when ^T : decimal = System.Decimal.op_Inequality((# "" x:decimal #), (# "" y:decimal #)) + // static comparison (ER mode) with static optimizations for some well-known cases [] let inline compare (x:^T) (y:^T) : int = (if x < y then -1 elif x > y then 1 else 0) @@ -4625,8 +4642,18 @@ namespace Microsoft.FSharp.Core when ^T : uint32 = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when ^T : uint64 = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when ^T : unativeint = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) - when ^T : float = if (# "clt" x y : bool #) then (-1) else (# "cgt" x y : int #) - when ^T : float32 = if (# "clt" x y : bool #) then (-1) else (# "cgt" x y : int #) + when ^T : float = if (# "clt" x y : bool #) then (-1) + elif (# "cgt" x y : bool #) then (1) + elif (# "ceq" x y : bool #) then (0) + elif (# "ceq" x x : bool #) then (1) + elif (# "ceq" y y : bool #) then (-1) + else (0) + when ^T : float32 = if (# "clt" x y : bool #) then (-1) + elif (# "cgt" x y : bool #) then (1) + elif (# "ceq" x y : bool #) then (1) + elif (# "ceq" x x : bool #) then (1) + elif (# "ceq" y y : bool #) then (-1) + else (0) when ^T : char = if (# "clt.un" x y : bool #) then (-1) else (# "cgt.un" x y : int #) when ^T : string = // NOTE: we don't have to null check here because System.String.CompareOrdinal diff --git a/tests/RunTests.cmd b/tests/RunTests.cmd index 5377c8a0472..86771aeb156 100644 --- a/tests/RunTests.cmd +++ b/tests/RunTests.cmd @@ -51,6 +51,10 @@ if /I "%2" == "compilerunit" ( set compilerunitsuffix=net40 goto :COMPILERUNIT ) +if /I "%2" == "coreproperty" ( + set corepropertysuffix=net40 + goto :COREPROPERTY +) if /I "%2" == "coreunit" ( set coreunitsuffix=net40 goto :COREUNIT @@ -190,6 +194,18 @@ echo "%NUNITPATH%\nunit-console.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFI goto :EOF +:COREPROPERTY + +set XMLFILE=CoreUnit_%corepropertytsuffix%_Xml.xml +set OUTPUTFILE=CoreUnit_%corepropertysuffix%_Output.log +set ERRORFILE=CoreUnit_%corepropertysuffix%_Error.log + +echo "%NUNITPATH%\nunit-console.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\..\..\%corepropertysuffix%\bin\FSharp.Core.PropertyTests.dll + "%NUNITPATH%\nunit-console.exe" /nologo /result=%XMLFILE% /output=%OUTPUTFILE% /err=%ERRORFILE% /work=%RESULTSDIR% %FSCBINPATH%\..\..\%corepropertysuffix%\bin\FSharp.Core.PropertyTests.dll + +goto :EOF + + :COMPILERUNIT set XMLFILE=ComplierUnit_%compilerunitsuffix%_Xml.xml diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx index bd0320bfb8b..472e74ea318 100644 --- a/tests/fsharp/core/libtest/test.fsx +++ b/tests/fsharp/core/libtest/test.fsx @@ -2840,59 +2840,14 @@ o A positive infinity is considered greater than all other values, but equal to *) open System -let nan1 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) -let nan2 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) - -do printf "checking floating point relational operators\n" -let _ = check "d3wiojd30a" ((Double.NaN > Double.NaN)) false -check "d3wiojd30a" (if (Double.NaN > Double.NaN) then "a" else "b") "b" -check "d3wiojd30b" ((Double.NaN >= Double.NaN)) false -check "d3wiojd30b" (if (Double.NaN >= Double.NaN) then "a" else "b") "b" -check "d3wiojd30c" ((Double.NaN < Double.NaN)) false -check "d3wiojd30c" (if (Double.NaN < Double.NaN) then "a" else "b") "b" -check "d3wiojd30d" ((Double.NaN <= Double.NaN)) false -check "d3wiojd30d" (if (Double.NaN <= Double.NaN) then "a" else "b") "b" -check "d3wiojd30e" ((Double.NaN = Double.NaN)) false -check "d3wiojd30e" (if (Double.NaN = Double.NaN) then "a" else "b") "b" -check "d3wiojd30q" ((Double.NaN <> Double.NaN)) true -check "d3wiojd30w" ((Double.NaN > 1.0)) false -check "d3wiojd30e" ((Double.NaN >= 1.0)) false -check "d3wiojd30r" ((Double.NaN < 1.0)) false -check "d3wiojd30t" ((Double.NaN <= 1.0)) false -check "d3wiojd30y" ((Double.NaN = 1.0)) false -check "d3wiojd30u" ((Double.NaN <> 1.0)) true -check "d3wiojd30i" ((1.0 > Double.NaN)) false -check "d3wiojd30o" ((1.0 >= Double.NaN)) false -check "d3wiojd30p" ((1.0 < Double.NaN)) false -check "d3wiojd30a" ((1.0 <= Double.NaN)) false -check "d3wiojd30s" ((1.0 = Double.NaN)) false -check "d3wiojd30d" ((1.0 <> Double.NaN)) true -check "d3wiojd30a" ((nan1 > Double.NaN)) false -check "d3wiojd30b" ((nan1 >= nan2)) false -check "d3wiojd30c" ((nan1 < nan2)) false -check "d3wiojd30d" ((nan1 <= nan2)) false -check "d3wiojd30e" ((nan1 = nan2)) false -check "d3wiojd30q" ((nan1 <> nan2)) true -check "d3wiojd30w" ((nan1 > 1.0)) false -check "d3wiojd30e" ((nan1 >= 1.0)) false -check "d3wiojd30r" ((nan1 < 1.0)) false -check "d3wiojd30t" ((nan1 <= 1.0)) false -check "d3wiojd30y" ((nan1 = 1.0)) false -check "d3wiojd30u" ((nan1 <> 1.0)) true -check "d3wiojd30i" ((1.0 > nan2)) false -check "d3wiojd30o" ((1.0 >= nan2)) false -check "d3wiojd30p" ((1.0 < nan2)) false -check "d3wiojd30a" ((1.0 <= nan2)) false -check "d3wiojd30s" ((1.0 = nan2)) false -check "d3wiojd30d" ((1.0 <> nan2)) true -check "d3wiojd30f" ((Double.NegativeInfinity = Double.NegativeInfinity)) true -check "d3wiojd30g" ((Double.NegativeInfinity < Double.PositiveInfinity)) true -check "d3wiojd30h" ((Double.NegativeInfinity > Double.PositiveInfinity)) false -check "d3wiojd30j" ((Double.NegativeInfinity <= Double.NegativeInfinity)) true - -module SameTestsUsingNonStructuralComparison1 = - open NonStructuralComparison +(* ----- NaN tests for DOUBLE ----- *) + +module DoubleNaN = + let nan1 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + let nan2 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + do printf "checking floating point relational operators\n" + let _ = check "d3wiojd30a" ((Double.NaN > Double.NaN)) false check "d3wiojd30a" (if (Double.NaN > Double.NaN) then "a" else "b") "b" check "d3wiojd30b" ((Double.NaN >= Double.NaN)) false check "d3wiojd30b" (if (Double.NaN >= Double.NaN) then "a" else "b") "b" @@ -2938,10 +2893,99 @@ module SameTestsUsingNonStructuralComparison1 = check "d3wiojd30h" ((Double.NegativeInfinity > Double.PositiveInfinity)) false check "d3wiojd30j" ((Double.NegativeInfinity <= Double.NegativeInfinity)) true + check "D1nancompare01" (0 = (compare Double.NaN Double.NaN)) true + check "D1nancompare02" (0 = (compare Double.NaN nan1)) true + check "D1nancompare03" (0 = (compare nan1 Double.NaN)) true + check "D1nancompare04" (0 = (compare nan1 nan1)) true + check "D1nancompare05" (1 = (compare 1. Double.NaN)) true + check "D1nancompare06" (1 = (compare 0. Double.NaN)) true + check "D1nancompare07" (1 = (compare -1. Double.NaN)) true + check "D1nancompare08" (1 = (compare Double.NegativeInfinity Double.NaN)) true + check "D1nancompare09" (1 = (compare Double.PositiveInfinity Double.NaN)) true + check "D1nancompare10" (1 = (compare Double.MaxValue Double.NaN)) true + check "D1nancompare11" (1 = (compare Double.MinValue Double.NaN)) true + check "D1nancompare12" (-1 = (compare Double.NaN 1.)) true + check "D1nancompare13" (-1 = (compare Double.NaN 0.)) true + check "D1nancompare14" (-1 = (compare Double.NaN -1.)) true + check "D1nancompare15" (-1 = (compare Double.NaN Double.NegativeInfinity)) true + check "D1nancompare16" (-1 = (compare Double.NaN Double.PositiveInfinity)) true + check "D1nancompare17" (-1 = (compare Double.NaN Double.MaxValue)) true + check "D1nancompare18" (-1 = (compare Double.NaN Double.MinValue)) true + +module DoubleNaNNonStructuralComparison1 = + open NonStructuralComparison + let nan1 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + let nan2 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + + check "d3wiojd30a" (if (Double.NaN > Double.NaN) then "a" else "b") "b" + check "d3wiojd30b" ((Double.NaN >= Double.NaN)) false + check "d3wiojd30b" (if (Double.NaN >= Double.NaN) then "a" else "b") "b" + check "d3wiojd30c" ((Double.NaN < Double.NaN)) false + check "d3wiojd30c" (if (Double.NaN < Double.NaN) then "a" else "b") "b" + check "d3wiojd30d" ((Double.NaN <= Double.NaN)) false + check "d3wiojd30d" (if (Double.NaN <= Double.NaN) then "a" else "b") "b" + check "d3wiojd30e" ((Double.NaN = Double.NaN)) false + check "d3wiojd30e" (if (Double.NaN = Double.NaN) then "a" else "b") "b" + check "d3wiojd30q" ((Double.NaN <> Double.NaN)) true + check "d3wiojd30w" ((Double.NaN > 1.0)) false + check "d3wiojd30e" ((Double.NaN >= 1.0)) false + check "d3wiojd30r" ((Double.NaN < 1.0)) false + check "d3wiojd30t" ((Double.NaN <= 1.0)) false + check "d3wiojd30y" ((Double.NaN = 1.0)) false + check "d3wiojd30u" ((Double.NaN <> 1.0)) true + check "d3wiojd30i" ((1.0 > Double.NaN)) false + check "d3wiojd30o" ((1.0 >= Double.NaN)) false + check "d3wiojd30p" ((1.0 < Double.NaN)) false + check "d3wiojd30a" ((1.0 <= Double.NaN)) false + check "d3wiojd30s" ((1.0 = Double.NaN)) false + check "d3wiojd30d" ((1.0 <> Double.NaN)) true + check "d3wiojd30a" ((nan1 > Double.NaN)) false + check "d3wiojd30b" ((nan1 >= nan2)) false + check "d3wiojd30c" ((nan1 < nan2)) false + check "d3wiojd30d" ((nan1 <= nan2)) false + check "d3wiojd30e" ((nan1 = nan2)) false + check "d3wiojd30q" ((nan1 <> nan2)) true + check "d3wiojd30w" ((nan1 > 1.0)) false + check "d3wiojd30e" ((nan1 >= 1.0)) false + check "d3wiojd30r" ((nan1 < 1.0)) false + check "d3wiojd30t" ((nan1 <= 1.0)) false + check "d3wiojd30y" ((nan1 = 1.0)) false + check "d3wiojd30u" ((nan1 <> 1.0)) true + check "d3wiojd30i" ((1.0 > nan2)) false + check "d3wiojd30o" ((1.0 >= nan2)) false + check "d3wiojd30p" ((1.0 < nan2)) false + check "d3wiojd30a" ((1.0 <= nan2)) false + check "d3wiojd30s" ((1.0 = nan2)) false + check "d3wiojd30d" ((1.0 <> nan2)) true + check "d3wiojd30f" ((Double.NegativeInfinity = Double.NegativeInfinity)) true + check "d3wiojd30g" ((Double.NegativeInfinity < Double.PositiveInfinity)) true + check "d3wiojd30h" ((Double.NegativeInfinity > Double.PositiveInfinity)) false + check "d3wiojd30j" ((Double.NegativeInfinity <= Double.NegativeInfinity)) true -module FloatingPointStructured = + check "D2nancompare01" (0 = (compare Double.NaN Double.NaN)) true + check "D2nancompare02" (0 = (compare Double.NaN nan1)) true + check "D2nancompare03" (0 = (compare nan1 Double.NaN)) true + check "D2nancompare04" (0 = (compare nan1 nan1)) true + check "D2nancompare05" (1 = (compare 1. Double.NaN)) true + check "D2nancompare06" (1 = (compare 0. Double.NaN)) true + check "D2nancompare07" (1 = (compare -1. Double.NaN)) true + check "D2nancompare08" (1 = (compare Double.NegativeInfinity Double.NaN)) true + check "D2nancompare09" (1 = (compare Double.PositiveInfinity Double.NaN)) true + check "D2nancompare10" (1 = (compare Double.MaxValue Double.NaN)) true + check "D2nancompare11" (1 = (compare Double.MinValue Double.NaN)) true + check "D2nancompare12" (-1 = (compare Double.NaN 1.)) true + check "D2nancompare13" (-1 = (compare Double.NaN 0.)) true + check "D2nancompare14" (-1 = (compare Double.NaN -1.)) true + check "D2nancompare15" (-1 = (compare Double.NaN Double.NegativeInfinity)) true + check "D2nancompare16" (-1 = (compare Double.NaN Double.PositiveInfinity)) true + check "D2nancompare17" (-1 = (compare Double.NaN Double.MaxValue)) true + check "D2nancompare18" (-1 = (compare Double.NaN Double.MinValue)) true + +module DoubleNaNStructured = type www = W of float - + let nan1 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + let nan2 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + do printf "checking floating point relational operators on structured data\n" // NOTE: SPECIFICATION: The relational operators work differently when applied to // floats embedded in structured data than when applied to raw floats. @@ -2970,10 +3014,29 @@ module FloatingPointStructured = let _ = check "d3wiojd3xx" ((W Double.NegativeInfinity > W Double.PositiveInfinity)) false let _ = check "d3wiojd31z" ((W Double.NegativeInfinity <= W Double.NegativeInfinity)) true - -module FloatingPointStructuredPoly = + let _ = check "D3nancompare01" (0 = (compare (W Double.NaN) (W Double.NaN))) true + let _ = check "D3nancompare02" (0 = (compare (W Double.NaN) (W nan1))) true + let _ = check "D3nancompare03" (0 = (compare (W nan1) (W Double.NaN))) true + let _ = check "D3nancompare04" (0 = (compare (W nan1) (W nan1))) true + let _ = check "D3nancompare05" (1 = (compare (W 1.) (W Double.NaN))) true + let _ = check "D3nancompare06" (1 = (compare (W 0.) (W Double.NaN))) true + let _ = check "D3nancompare07" (1 = (compare (W -1.) (W Double.NaN))) true + let _ = check "D3nancompare08" (1 = (compare (W Double.NegativeInfinity) (W Double.NaN))) true + let _ = check "D3nancompare09" (1 = (compare (W Double.PositiveInfinity) (W Double.NaN))) true + let _ = check "D3nancompare10" (1 = (compare (W Double.MaxValue) (W Double.NaN))) true + let _ = check "D3nancompare11" (1 = (compare (W Double.MinValue) (W Double.NaN))) true + let _ = check "D3nancompare12" (-1 = (compare (W Double.NaN) (W 1.))) true + let _ = check "D3nancompare13" (-1 = (compare (W Double.NaN) (W 0.))) true + let _ = check "D3nancompare14" (-1 = (compare (W Double.NaN) (W -1.))) true + let _ = check "D3nancompare15" (-1 = (compare (W Double.NaN) (W Double.NegativeInfinity))) true + let _ = check "D3nancompare16" (-1 = (compare (W Double.NaN) (W Double.PositiveInfinity))) true + let _ = check "D3nancompare17" (-1 = (compare (W Double.NaN) (W Double.MaxValue))) true + let _ = check "D3nancompare18" (-1 = (compare (W Double.NaN) (W Double.MinValue))) true + +module DoubleNaNStructuredPoly = type 'a www = W of 'a - + let nan1 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) + let nan2 = (let r = ref Double.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0)) do printf "checking floating point relational operators on polymorphic structured data\n" let _ = check "d3wiojd32q" ((W Double.NaN > W Double.NaN)) false @@ -3000,7 +3063,271 @@ module FloatingPointStructuredPoly = let _ = check "d3wiojd32x" ((W Double.NegativeInfinity > W Double.PositiveInfinity)) false let _ = check "d3wiojd32c" ((W Double.NegativeInfinity <= W Double.NegativeInfinity)) true + let _ = check "D4nancompare01" (0 = (compare (W Double.NaN) (W Double.NaN))) true + let _ = check "D4nancompare02" (0 = (compare (W Double.NaN) (W nan1))) true + let _ = check "D4nancompare03" (0 = (compare (W nan1) (W Double.NaN))) true + let _ = check "D4nancompare04" (0 = (compare (W nan1) (W nan1))) true + let _ = check "D4nancompare05" (1 = (compare (W 1.) (W Double.NaN))) true + let _ = check "D4nancompare06" (1 = (compare (W 0.) (W Double.NaN))) true + let _ = check "D4nancompare07" (1 = (compare (W -1.) (W Double.NaN))) true + let _ = check "D4nancompare08" (1 = (compare (W Double.NegativeInfinity) (W Double.NaN))) true + let _ = check "D4nancompare09" (1 = (compare (W Double.PositiveInfinity) (W Double.NaN))) true + let _ = check "D4nancompare10" (1 = (compare (W Double.MaxValue) (W Double.NaN))) true + let _ = check "D4nancompare11" (1 = (compare (W Double.MinValue) (W Double.NaN))) true + let _ = check "D4nancompare12" (-1 = (compare (W Double.NaN) (W 1.))) true + let _ = check "D4nancompare13" (-1 = (compare (W Double.NaN) (W 0.))) true + let _ = check "D4nancompare14" (-1 = (compare (W Double.NaN) (W -1.))) true + let _ = check "D4nancompare15" (-1 = (compare (W Double.NaN) (W Double.NegativeInfinity))) true + let _ = check "D4nancompare16" (-1 = (compare (W Double.NaN) (W Double.PositiveInfinity))) true + let _ = check "D4nancompare17" (-1 = (compare (W Double.NaN) (W Double.MaxValue))) true + let _ = check "D4nancompare18" (-1 = (compare (W Double.NaN) (W Double.MinValue))) true + +(* ----- NaN tests for SINGLE ----- *) + +module SingleNaN = + let nan1 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + let nan2 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + + do printf "checking floating point relational operators\n" + let _ = check "d3wiojd30a" ((Single.NaN > Single.NaN)) false + check "d3wiojd30a" (if (Single.NaN > Single.NaN) then "a" else "b") "b" + check "d3wiojd30b" ((Single.NaN >= Single.NaN)) false + check "d3wiojd30b" (if (Single.NaN >= Single.NaN) then "a" else "b") "b" + check "d3wiojd30c" ((Single.NaN < Single.NaN)) false + check "d3wiojd30c" (if (Single.NaN < Single.NaN) then "a" else "b") "b" + check "d3wiojd30d" ((Single.NaN <= Single.NaN)) false + check "d3wiojd30d" (if (Single.NaN <= Single.NaN) then "a" else "b") "b" + check "d3wiojd30e" ((Single.NaN = Single.NaN)) false + check "d3wiojd30e" (if (Single.NaN = Single.NaN) then "a" else "b") "b" + check "d3wiojd30q" ((Single.NaN <> Single.NaN)) true + check "d3wiojd30w" ((Single.NaN > 1.0f)) false + check "d3wiojd30e" ((Single.NaN >= 1.0f)) false + check "d3wiojd30r" ((Single.NaN < 1.0f)) false + check "d3wiojd30t" ((Single.NaN <= 1.0f)) false + check "d3wiojd30y" ((Single.NaN = 1.0f)) false + check "d3wiojd30u" ((Single.NaN <> 1.0f)) true + check "d3wiojd30i" ((1.0f > Single.NaN)) false + check "d3wiojd30o" ((1.0f >= Single.NaN)) false + check "d3wiojd30p" ((1.0f < Single.NaN)) false + check "d3wiojd30a" ((1.0f <= Single.NaN)) false + check "d3wiojd30s" ((1.0f = Single.NaN)) false + check "d3wiojd30d" ((1.0f <> Single.NaN)) true + check "d3wiojd30a" ((nan1 > Single.NaN)) false + check "d3wiojd30b" ((nan1 >= nan2)) false + check "d3wiojd30c" ((nan1 < nan2)) false + check "d3wiojd30d" ((nan1 <= nan2)) false + check "d3wiojd30e" ((nan1 = nan2)) false + check "d3wiojd30q" ((nan1 <> nan2)) true + check "d3wiojd30w" ((nan1 > 1.0f)) false + check "d3wiojd30e" ((nan1 >= 1.0f)) false + check "d3wiojd30r" ((nan1 < 1.0f)) false + check "d3wiojd30t" ((nan1 <= 1.0f)) false + check "d3wiojd30y" ((nan1 = 1.0f)) false + check "d3wiojd30u" ((nan1 <> 1.0f)) true + check "d3wiojd30i" ((1.0f > nan2)) false + check "d3wiojd30o" ((1.0f >= nan2)) false + check "d3wiojd30p" ((1.0f < nan2)) false + check "d3wiojd30a" ((1.0f <= nan2)) false + check "d3wiojd30s" ((1.0f = nan2)) false + check "d3wiojd30d" ((1.0f <> nan2)) true + check "d3wiojd30f" ((Single.NegativeInfinity = Single.NegativeInfinity)) true + check "d3wiojd30g" ((Single.NegativeInfinity < Single.PositiveInfinity)) true + check "d3wiojd30h" ((Single.NegativeInfinity > Single.PositiveInfinity)) false + check "d3wiojd30j" ((Single.NegativeInfinity <= Single.NegativeInfinity)) true + + check "S1nancompare01" (0 = (compare Single.NaN Single.NaN)) true + check "S1nancompare02" (0 = (compare Single.NaN nan1)) true + check "S1nancompare03" (0 = (compare nan1 Single.NaN)) true + check "S1nancompare04" (0 = (compare nan1 nan1)) true + check "S1nancompare05" (1 = (compare 1.f Single.NaN)) true + check "S1nancompare06" (1 = (compare 0.f Single.NaN)) true + check "S1nancompare07" (1 = (compare -1.f Single.NaN)) true + check "S1nancompare08" (1 = (compare Single.NegativeInfinity Single.NaN)) true + check "S1nancompare09" (1 = (compare Single.PositiveInfinity Single.NaN)) true + check "S1nancompare10" (1 = (compare Single.MaxValue Single.NaN)) true + check "S1nancompare11" (1 = (compare Single.MinValue Single.NaN)) true + check "S1nancompare12" (-1 = (compare Single.NaN 1.f)) true + check "S1nancompare13" (-1 = (compare Single.NaN 0.f)) true + check "S1nancompare14" (-1 = (compare Single.NaN -1.f)) true + check "S1nancompare15" (-1 = (compare Single.NaN Single.NegativeInfinity)) true + check "S1nancompare16" (-1 = (compare Single.NaN Single.PositiveInfinity)) true + check "S1nancompare17" (-1 = (compare Single.NaN Single.MaxValue)) true + check "S1nancompare18" (-1 = (compare Single.NaN Single.MinValue)) true + +module SingleNaNNonStructuralComparison1 = + open NonStructuralComparison + + let nan1 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + let nan2 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + + check "d3wiojd30a" (if (Single.NaN > Single.NaN) then "a" else "b") "b" + check "d3wiojd30b" ((Single.NaN >= Single.NaN)) false + check "d3wiojd30b" (if (Single.NaN >= Single.NaN) then "a" else "b") "b" + check "d3wiojd30c" ((Single.NaN < Single.NaN)) false + check "d3wiojd30c" (if (Single.NaN < Single.NaN) then "a" else "b") "b" + check "d3wiojd30d" ((Single.NaN <= Single.NaN)) false + check "d3wiojd30d" (if (Single.NaN <= Single.NaN) then "a" else "b") "b" + check "d3wiojd30e" ((Single.NaN = Single.NaN)) false + check "d3wiojd30e" (if (Single.NaN = Single.NaN) then "a" else "b") "b" + check "d3wiojd30q" ((Single.NaN <> Single.NaN)) true + check "d3wiojd30w" ((Single.NaN > 1.0f)) false + check "d3wiojd30e" ((Single.NaN >= 1.0f)) false + check "d3wiojd30r" ((Single.NaN < 1.0f)) false + check "d3wiojd30t" ((Single.NaN <= 1.0f)) false + check "d3wiojd30y" ((Single.NaN = 1.0f)) false + check "d3wiojd30u" ((Single.NaN <> 1.0f)) true + check "d3wiojd30i" ((1.0f > Single.NaN)) false + check "d3wiojd30o" ((1.0f >= Single.NaN)) false + check "d3wiojd30p" ((1.0f < Single.NaN)) false + check "d3wiojd30a" ((1.0f <= Single.NaN)) false + check "d3wiojd30s" ((1.0f = Single.NaN)) false + check "d3wiojd30d" ((1.0f <> Single.NaN)) true + check "d3wiojd30a" ((nan1 > Single.NaN)) false + check "d3wiojd30b" ((nan1 >= nan2)) false + check "d3wiojd30c" ((nan1 < nan2)) false + check "d3wiojd30d" ((nan1 <= nan2)) false + check "d3wiojd30e" ((nan1 = nan2)) false + check "d3wiojd30q" ((nan1 <> nan2)) true + check "d3wiojd30w" ((nan1 > 1.0f)) false + check "d3wiojd30e" ((nan1 >= 1.0f)) false + check "d3wiojd30r" ((nan1 < 1.0f)) false + check "d3wiojd30t" ((nan1 <= 1.0f)) false + check "d3wiojd30y" ((nan1 = 1.0f)) false + check "d3wiojd30u" ((nan1 <> 1.0f)) true + check "d3wiojd30i" ((1.0f > nan2)) false + check "d3wiojd30o" ((1.0f >= nan2)) false + check "d3wiojd30p" ((1.0f < nan2)) false + check "d3wiojd30a" ((1.0f <= nan2)) false + check "d3wiojd30s" ((1.0f = nan2)) false + check "d3wiojd30d" ((1.0f <> nan2)) true + check "d3wiojd30f" ((Single.NegativeInfinity = Single.NegativeInfinity)) true + check "d3wiojd30g" ((Single.NegativeInfinity < Single.PositiveInfinity)) true + check "d3wiojd30h" ((Single.NegativeInfinity > Single.PositiveInfinity)) false + check "d3wiojd30j" ((Single.NegativeInfinity <= Single.NegativeInfinity)) true + + check "S2nancompare01" (0 = (compare Single.NaN Single.NaN)) true + check "S2nancompare02" (0 = (compare Single.NaN nan1)) true + check "S2nancompare03" (0 = (compare nan1 Single.NaN)) true + check "S2nancompare04" (0 = (compare nan1 nan1)) true + check "S2nancompare05" (1 = (compare 1.f Single.NaN)) true + check "S2nancompare06" (1 = (compare 0.f Single.NaN)) true + check "S2nancompare07" (1 = (compare -1.f Single.NaN)) true + check "S2nancompare08" (1 = (compare Single.NegativeInfinity Single.NaN)) true + check "S2nancompare09" (1 = (compare Single.PositiveInfinity Single.NaN)) true + check "S2nancompare10" (1 = (compare Single.MaxValue Single.NaN)) true + check "S2nancompare11" (1 = (compare Single.MinValue Single.NaN)) true + check "S2nancompare12" (-1 = (compare Single.NaN 1.f)) true + check "S2nancompare13" (-1 = (compare Single.NaN 0.f)) true + check "S2nancompare14" (-1 = (compare Single.NaN -1.f)) true + check "S2nancompare15" (-1 = (compare Single.NaN Single.NegativeInfinity)) true + check "S2nancompare16" (-1 = (compare Single.NaN Single.PositiveInfinity)) true + check "S2nancompare17" (-1 = (compare Single.NaN Single.MaxValue)) true + check "S2nancompare18" (-1 = (compare Single.NaN Single.MinValue)) true + +module SingleNaNStructured = + type www = W of single + + let nan1 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + let nan2 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + + do printf "checking floating point relational operators on structured data\n" + // NOTE: SPECIFICATION: The relational operators work differently when applied to + // floats embedded in structured data than when applied to raw floats. + + let _ = check "d3wiojd31q" ((W Single.NaN > W Single.NaN)) false + let _ = check "d3wiojd31w" ((W Single.NaN >= W Single.NaN)) false + let _ = check "d3wiojd31e" ((W Single.NaN < W Single.NaN)) false + let _ = check "d3wiojd31r" ((W Single.NaN <= W Single.NaN)) false + let _ = check "d3wiojd31ty" ((W Single.NaN = W Single.NaN)) false + let _ = check "d3wiojd31y" ((W Single.NaN <> W Single.NaN)) true + let _ = check "d3wiojd31dy" (0 = compare (W Single.NaN) (W Single.NaN)) true + let _ = check "d3wiojd31u" ((W Single.NaN > W 1.0f)) false + let _ = check "d3wiojd31i" ((W Single.NaN >= W 1.0f)) false + let _ = check "d3wiojd31o" ((W Single.NaN < W 1.0f)) false + let _ = check "d3wiojd31p" ((W Single.NaN <= W 1.0f)) false + let _ = check "d3wiojd31a" ((W Single.NaN = W 1.0f)) false + let _ = check "d3wiojd31s" ((W Single.NaN <> W 1.0f)) true + let _ = check "d3wiojd31d" ((W 1.0f > W Single.NaN)) false + let _ = check "d3wiojd31f" ((W 1.0f >= W Single.NaN)) false + let _ = check "d3wiojd31g" ((W 1.0f < W Single.NaN)) false + let _ = check "d3wiojd31h" ((W 1.0f <= W Single.NaN)) false + let _ = check "d3wiojd31j" ((W 1.0f = W Single.NaN)) false + let _ = check "d3wiojd31k" ((W 1.0f <> W Single.NaN)) true + let _ = check "d3wiojd31l" ((W Single.NegativeInfinity = W Single.NegativeInfinity)) true + let _ = check "d3wiojd31c" ((W Single.NegativeInfinity < W Single.PositiveInfinity)) true + let _ = check "d3wiojd3xx" ((W Single.NegativeInfinity > W Single.PositiveInfinity)) false + let _ = check "d3wiojd31z" ((W Single.NegativeInfinity <= W Single.NegativeInfinity)) true + + let _ = check "S3nancompare01" (0 = (compare (W Single.NaN) (W Single.NaN))) true + let _ = check "S3nancompare02" (0 = (compare (W Single.NaN) (W nan1))) true + let _ = check "S3nancompare03" (0 = (compare (W nan1) (W Single.NaN))) true + let _ = check "S3nancompare04" (0 = (compare (W nan1) (W nan1))) true + let _ = check "S3nancompare05" (1 = (compare (W 1.f) (W Single.NaN))) true + let _ = check "S3nancompare06" (1 = (compare (W 0.f) (W Single.NaN))) true + let _ = check "S3nancompare07" (1 = (compare (W -1.f) (W Single.NaN))) true + let _ = check "S3nancompare08" (1 = (compare (W Single.NegativeInfinity) (W Single.NaN))) true + let _ = check "S3nancompare09" (1 = (compare (W Single.PositiveInfinity) (W Single.NaN))) true + let _ = check "S3nancompare10" (1 = (compare (W Single.MaxValue) (W Single.NaN))) true + let _ = check "S3nancompare11" (1 = (compare (W Single.MinValue) (W Single.NaN))) true + let _ = check "S3nancompare12" (-1 = (compare (W Single.NaN) (W 1.f))) true + let _ = check "S3nancompare13" (-1 = (compare (W Single.NaN) (W 0.f))) true + let _ = check "S3nancompare14" (-1 = (compare (W Single.NaN) (W -1.f))) true + let _ = check "S3nancompare15" (-1 = (compare (W Single.NaN) (W Single.NegativeInfinity))) true + let _ = check "S3nancompare16" (-1 = (compare (W Single.NaN) (W Single.PositiveInfinity))) true + let _ = check "S3nancompare17" (-1 = (compare (W Single.NaN) (W Single.MaxValue))) true + let _ = check "S3nancompare18" (-1 = (compare (W Single.NaN) (W Single.MinValue))) true + +module SingleNaNStructuredPoly = + type 'a www = W of 'a + let nan1 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + let nan2 = (let r = ref Single.NaN in (if sprintf "Hello" = "Hello" then !r else 0.0f)) + + do printf "checking floating point relational operators on polymorphic structured data\n" + + let _ = check "d3wiojd32q" ((W Single.NaN > W Single.NaN)) false + let _ = check "d3wiojd32w" ((W Single.NaN >= W Single.NaN)) false + let _ = check "d3wiojd32e" ((W Single.NaN < W Single.NaN)) false + let _ = check "d3wiojd32r" ((W Single.NaN <= W Single.NaN)) false + let _ = check "d3wiojd32t" ((W Single.NaN = W Single.NaN)) false + let _ = check "d3wiojd32dt" ((W Single.NaN).Equals(W Single.NaN)) true + let _ = check "d3wiojd32y" ((W Single.NaN <> W Single.NaN)) true + let _ = check "d3wiojd32u" ((W Single.NaN > W 1.0f)) false + let _ = check "d3wiojd32i" ((W Single.NaN >= W 1.0f)) false + let _ = check "d3wiojd32o" ((W Single.NaN < W 1.0f)) false + let _ = check "d3wiojd32p" ((W Single.NaN <= W 1.0f)) false + let _ = check "d3wiojd32a" ((W Single.NaN = W 1.0f)) false + let _ = check "d3wiojd32s" ((W Single.NaN <> W 1.0f)) true + let _ = check "d3wiojd32d" ((W 1.0f > W Single.NaN)) false + let _ = check "d3wiojd32f" ((W 1.0f >= W Single.NaN)) false + let _ = check "d3wiojd32g" ((W 1.0f < W Single.NaN)) false + let _ = check "d3wiojd32h" ((W 1.0f <= W Single.NaN)) false + let _ = check "d3wiojd32j" ((W 1.0f = W Single.NaN)) false + let _ = check "d3wiojd32k" ((W 1.0f <> W Single.NaN)) true + let _ = check "d3wiojd32l" ((W Single.NegativeInfinity = W Single.NegativeInfinity)) true + let _ = check "d3wiojd32z" ((W Single.NegativeInfinity < W Single.PositiveInfinity)) true + let _ = check "d3wiojd32x" ((W Single.NegativeInfinity > W Single.PositiveInfinity)) false + let _ = check "d3wiojd32c" ((W Single.NegativeInfinity <= W Single.NegativeInfinity)) true + + let _ = check "S4nancompare01" (0 = (compare (W Single.NaN) (W Single.NaN))) true + let _ = check "S4nancompare02" (0 = (compare (W Single.NaN) (W nan1))) true + let _ = check "S4nancompare03" (0 = (compare (W nan1) (W Single.NaN))) true + let _ = check "S4nancompare04" (0 = (compare (W nan1) (W nan1))) true + let _ = check "S4nancompare05" (1 = (compare (W 1.f) (W Single.NaN))) true + let _ = check "S4nancompare06" (1 = (compare (W 0.f) (W Single.NaN))) true + let _ = check "S4nancompare07" (1 = (compare (W -1.f) (W Single.NaN))) true + let _ = check "S4nancompare08" (1 = (compare (W Single.NegativeInfinity) (W Single.NaN))) true + let _ = check "S4nancompare09" (1 = (compare (W Single.PositiveInfinity) (W Single.NaN))) true + let _ = check "S4nancompare10" (1 = (compare (W Single.MaxValue) (W Single.NaN))) true + let _ = check "S4nancompare11" (1 = (compare (W Single.MinValue) (W Single.NaN))) true + let _ = check "S4nancompare12" (-1 = (compare (W Single.NaN) (W 1.f))) true + let _ = check "S4nancompare13" (-1 = (compare (W Single.NaN) (W 0.f))) true + let _ = check "S4nancompare14" (-1 = (compare (W Single.NaN) (W -1.f))) true + let _ = check "S4nancompare15" (-1 = (compare (W Single.NaN) (W Single.NegativeInfinity))) true + let _ = check "S4nancompare16" (-1 = (compare (W Single.NaN) (W Single.PositiveInfinity))) true + let _ = check "S4nancompare17" (-1 = (compare (W Single.NaN) (W Single.MaxValue))) true + let _ = check "S4nancompare18" (-1 = (compare (W Single.NaN) (W Single.MinValue))) true + module MoreStructuralEqHashCompareNaNChecks = let test398275413() = let floats = [1.0; 0.0; System.Double.NaN; System.Double.NegativeInfinity; System.Double.PositiveInfinity; nan] in diff --git a/vsintegration/src/Salsa/Salsa.fsproj b/vsintegration/src/Salsa/Salsa.fsproj index a0a9c3db10c..aa6c3202f23 100644 --- a/vsintegration/src/Salsa/Salsa.fsproj +++ b/vsintegration/src/Salsa/Salsa.fsproj @@ -1,4 +1,4 @@ - + @@ -67,7 +67,7 @@ True - $(NunitToolsLibDir)\nunit.util.dll + $(NUnitToolsLibDir)\nunit.util.dll {DED3BBD7-53F4-428A-8C9F-27968E768605} diff --git a/vsintegration/src/unittests/Unittests.fsproj b/vsintegration/src/unittests/Unittests.fsproj index a558740f473..1f4c391cdd0 100644 --- a/vsintegration/src/unittests/Unittests.fsproj +++ b/vsintegration/src/unittests/Unittests.fsproj @@ -1,4 +1,4 @@ - + @@ -106,7 +106,7 @@ True - $(NunitToolsLibDir)\nunit.util.dll + $(NUnitToolsLibDir)\nunit.util.dll True