-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
148 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<LangVersion>preview</LangVersion> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference> | ||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder> | ||
<DisableImplicitLibraryPacksFolder>true</DisableImplicitLibraryPacksFolder> | ||
<PublishTrimmed>true</PublishTrimmed> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<DotnetFscCompilerPath>$(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net8.0/fsc.dll</DotnetFscCompilerPath> | ||
<Fsc_DotNET_DotnetFscCompilerPath>$(MSBuildThisFileDirectory)../../../artifacts/bin/fsc/Release/net8.0/fsc.dll</Fsc_DotNET_DotnetFscCompilerPath> | ||
<FSharpPreferNetFrameworkTools>False</FSharpPreferNetFrameworkTools> | ||
<FSharpPrefer64BitTools>True</FSharpPrefer64BitTools> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)../../../eng/Versions.props" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FSharp.Core" Version="$(FSharpCorePreviewPackageVersionValue)"/> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
open System.Collections.Generic | ||
open NonStructuralComparison | ||
|
||
let failures = HashSet<string>() | ||
|
||
let reportFailure (s: string) = | ||
stderr.Write " NO: " | ||
stderr.WriteLine s | ||
failures.Add s |> ignore | ||
|
||
let test testName x y = | ||
let result = HashIdentity.Structural.Equals(x, y) | ||
if result = false | ||
then | ||
stderr.WriteLine($"\n***** {testName}: Expected: 'true' Result: '{result}' = FAIL\n"); | ||
reportFailure testName | ||
|
||
module BasicTypes = | ||
test "test000" true true | ||
test "test001" 1y 1y | ||
test "test002" 1uy 1uy | ||
test "test003" 1s 1s | ||
test "test004" 1us 1us | ||
test "test005" 1 1 | ||
test "test006" 1u 1u | ||
test "test007" 1L 1L | ||
test "test008" 1UL 1UL | ||
test "test009" (nativeint 1) (nativeint 1) | ||
test "test010" (unativeint 1) (unativeint 1) | ||
test "test011" 'a' 'a' | ||
test "test012" "a" "a" | ||
test "test013" 1m 1m | ||
test "test014" 1.0 1.0 | ||
test "test015" 1.0f 1.0f | ||
|
||
module Arrays = | ||
test "test100" [|1|] [|1|] | ||
test "test101" [|1L|] [|1L|] | ||
test "test102" [|1uy|] [|1uy|] | ||
test "test103" [|box 1|] [|box 1|] | ||
|
||
module Structs = | ||
test "test200" struct (1, 1) struct (1, 1) | ||
test "test201" struct (1, 1, 1) struct (1, 1, 1) | ||
test "test202" struct (1, 1, 1, 1) struct (1, 1, 1, 1) | ||
test "test203" struct (1, 1, 1, 1, 1) struct (1, 1, 1, 1, 1) | ||
test "test204" struct (1, 1, 1, 1, 1, 1) struct (1, 1, 1, 1, 1, 1) | ||
test "test205" struct (1, 1, 1, 1, 1, 1, 1) struct (1, 1, 1, 1, 1, 1, 1) | ||
test "test206" struct (1, 1, 1, 1, 1, 1, 1, 1) struct (1, 1, 1, 1, 1, 1, 1, 1) | ||
|
||
module OptionsAndCo = | ||
open System | ||
|
||
test "test301" (Some 1) (Some 1) | ||
test "test302" (ValueSome 1) (ValueSome 1) | ||
test "test303" (Ok 1) (Ok 1) | ||
test "test304" (Nullable 1) (Nullable 1) | ||
|
||
module Enums = | ||
open System | ||
|
||
type SomeEnum = | ||
| Case0 = 0 | ||
| Case1 = 1 | ||
|
||
test "test401" (enum<SomeEnum>(1)) (enum<SomeEnum>(1)) | ||
test "test402" (enum<DayOfWeek>(1)) (enum<DayOfWeek>(1)) | ||
|
||
[<EntryPoint>] | ||
let main _ = | ||
match failures with | ||
| set when set.Count = 0 -> | ||
stdout.WriteLine "All tests passed" | ||
exit 0 | ||
| _ -> | ||
stdout.WriteLine "Some tests failed" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Write-Host "Publish and Execute: net8.0 - Equality" | ||
|
||
$build_output = dotnet publish -restore -c release -f:net8.0 $(Join-Path $PSScriptRoot Equality.fsproj) | ||
|
||
# Checking that the build succeeded | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
Write-Error "Build failed with exit code ${LASTEXITCODE}" | ||
Write-Error "${build_output}" -ErrorAction Stop | ||
} | ||
|
||
$process = Start-Process ` | ||
-FilePath $(Join-Path $PSScriptRoot bin\release\net8.0\win-x64\publish\Equality.exe) ` | ||
-Wait ` | ||
-NoNewWindow ` | ||
-PassThru ` | ||
-RedirectStandardOutput $(Join-Path $PSScriptRoot output.txt) | ||
|
||
$output = Get-Content $(Join-Path $PSScriptRoot output.txt) | ||
|
||
# Checking that it is actually running. | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
Write-Error "Test failed with exit code ${LASTEXITCODE}" -ErrorAction Stop | ||
} | ||
|
||
# Checking that the output is as expected. | ||
$expected = "All tests passed" | ||
if ($output -ne $expected) | ||
{ | ||
Write-Error "Test failed with unexpected output:`nExpected:`n`t${expected}`nActual`n`t${output}" -ErrorAction Stop | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@echo off | ||
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Trimming\check.ps1"""" | ||
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Equality\check.ps1"""" |