From 619be2c2d27bf9e636d187a6d937ac94b1e805ab Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Thu, 8 Jan 2026 19:19:09 +0100 Subject: [PATCH 1/8] Update fake, paket and tests to dotnet8 --- .config/dotnet-tools.json | 20 +- .gitignore | 1 - FSharpx.Collections.sln | 20 +- build.cmd | 2 +- build.fsx.lock | 728 ------------------ build.sh | 2 +- build.fsx => build/build.fs | 46 +- build/build.fsproj | 12 + build/paket.references | 12 + docs/csharp/csharp.csproj | 2 +- .../csharp/paket.refrences | 0 global.json | 2 +- paket.dependencies | 26 +- paket.lock | 303 +++++++- .../AssemblyInfo.fs | 8 +- src/FSharpx.Collections/AssemblyInfo.fs | 8 +- src/FSharpx.Collections/TaggedCollections.fs | 2 +- ...arpx.Collections.Experimental.Tests.fsproj | 2 +- .../FSharpx.Collections.Tests.fsproj | 2 +- 19 files changed, 382 insertions(+), 816 deletions(-) delete mode 100644 build.fsx.lock rename build.fsx => build/build.fs (92%) create mode 100644 build/build.fsproj create mode 100644 build/paket.references rename paket.references => docs/csharp/paket.refrences (100%) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 18495e4f..f969a509 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,35 +2,33 @@ "version": 1, "isRoot": true, "tools": { - "fake-cli": { - "version": "5.23.0", - "commands": [ - "fake" - ] - }, "paket": { - "version": "7.1.5", + "version": "9.0.2", "commands": [ "paket" - ] + ], + "rollForward": false }, "fsdocs-tool": { "version": "14.0.1", "commands": [ "fsdocs" - ] + ], + "rollForward": false }, "fable": { "version": "3.4.4", "commands": [ "fable" - ] + ], + "rollForward": false }, "fantomas": { "version": "5.0.3", "commands": [ "fantomas" - ] + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.gitignore b/.gitignore index a25ae23d..263652b3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ [Dd]ebug/ [Rr]elease/ x64/ -build/ [Bb]in/ [Oo]bj/ .vs/ diff --git a/FSharpx.Collections.sln b/FSharpx.Collections.sln index 4e9e8f6b..bfd32969 100644 --- a/FSharpx.Collections.sln +++ b/FSharpx.Collections.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31019.35 +# Visual Studio Version 18 +VisualStudioVersion = 18.0.11222.15 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{722621A6-FA45-4129-8B8D-94880DCD7971}" ProjectSection(SolutionItems) = preProject @@ -22,17 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{E8AA1C ProjectSection(SolutionItems) = preProject paket.dependencies = paket.dependencies paket.lock = paket.lock - paket.references = paket.references - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{DF958161-9599-469B-984A-531F0EBB2FD9}" - ProjectSection(SolutionItems) = preProject - .travis.yml = .travis.yml - appveyor.yml = appveyor.yml - build.fsx = build.fsx - build.proj = build.proj - fake.cmd = fake.cmd - fake.sh = fake.sh EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{F0FAE041-7EC2-4ECC-8FA3-DC8B87310757}" @@ -66,6 +55,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "fable", "fable", "{42162C9C EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharpx.Collections.Tests", "tests\fable\FSharpx.Collections.Tests\FSharpx.Collections.Tests.fsproj", "{275B25A0-523E-4CC4-942E-09C9D0582C89}" EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "build", "build\build.fsproj", "{4CA5673B-AF15-4E75-9AC9-29EC9753B720}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -96,6 +87,9 @@ Global {275B25A0-523E-4CC4-942E-09C9D0582C89}.Debug|Any CPU.Build.0 = Debug|Any CPU {275B25A0-523E-4CC4-942E-09C9D0582C89}.Release|Any CPU.ActiveCfg = Release|Any CPU {275B25A0-523E-4CC4-942E-09C9D0582C89}.Release|Any CPU.Build.0 = Release|Any CPU + {4CA5673B-AF15-4E75-9AC9-29EC9753B720}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4CA5673B-AF15-4E75-9AC9-29EC9753B720}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4CA5673B-AF15-4E75-9AC9-29EC9753B720}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/build.cmd b/build.cmd index 903ad7b3..cd6515da 100644 --- a/build.cmd +++ b/build.cmd @@ -3,4 +3,4 @@ cls dotnet tool restore dotnet paket restore -dotnet fake run build.fsx %* +dotnet run --project build\build.fsproj -- %* diff --git a/build.fsx.lock b/build.fsx.lock deleted file mode 100644 index 2b943009..00000000 --- a/build.fsx.lock +++ /dev/null @@ -1,728 +0,0 @@ -STORAGE: NONE -RESTRICTION: == net6.0 -NUGET - remote: https://api.nuget.org/v3/index.json - BlackFox.VsWhere (1.1) - FSharp.Core (>= 4.2.3) - Microsoft.Win32.Registry (>= 4.7) - Chessie (0.6) - FSharp.Core (>= 4.0.1.7-alpha) - NETStandard.Library (>= 1.6) - Fake.Core.CommandLineParsing (5.23) - FParsec (>= 1.1.1) - FSharp.Core (>= 6.0) - Fake.Core.Context (5.23) - FSharp.Core (>= 6.0) - Fake.Core.DependencyManager.Paket (5.23) - FSharp.Core (>= 6.0) - Fake.Core.Environment (5.23) - FSharp.Core (>= 6.0) - Fake.Core.FakeVar (5.23) - Fake.Core.Context (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Core.Process (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.FakeVar (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - System.Collections.Immutable (>= 5.0) - Fake.Core.ReleaseNotes (5.23) - Fake.Core.SemVer (>= 5.23) - Fake.Core.String (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Core.SemVer (5.23) - FSharp.Core (>= 6.0) - Fake.Core.String (5.23) - FSharp.Core (>= 6.0) - Fake.Core.Target (5.23) - Fake.Core.CommandLineParsing (>= 5.23) - Fake.Core.Context (>= 5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.FakeVar (>= 5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - FSharp.Control.Reactive (>= 5.0.2) - FSharp.Core (>= 6.0) - Fake.Core.Tasks (5.23) - Fake.Core.Trace (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Core.Trace (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.FakeVar (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Core.Xml (5.23) - Fake.Core.String (>= 5.23) - FSharp.Core (>= 6.0) - Fake.DotNet.AssemblyInfoFile (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - Fake.DotNet.Cli (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.DotNet.MSBuild (>= 5.23) - Fake.DotNet.NuGet (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - Mono.Posix.NETStandard (>= 1.0) - Newtonsoft.Json (>= 13.0.1) - Fake.DotNet.FSFormatting (5.23) - Fake.Core.Process (>= 5.23) - Fake.DotNet.Cli (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - Fake.DotNet.MSBuild (5.23) - BlackFox.VsWhere (>= 1.1) - Fake.Core.Environment (>= 5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - MSBuild.StructuredLogger (>= 2.1.545) - Fake.DotNet.NuGet (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.SemVer (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Tasks (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.Core.Xml (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - Fake.Net.Http (>= 5.23) - FSharp.Core (>= 6.0) - Newtonsoft.Json (>= 13.0.1) - NuGet.Protocol (>= 5.11) - Fake.DotNet.Paket (5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.DotNet.Cli (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - Fake.DotNet.Testing.Expecto (5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - Fake.Testing.Common (>= 5.23) - FSharp.Core (>= 6.0) - Fake.IO.FileSystem (5.23) - Fake.Core.String (>= 5.23) - FSharp.Core (>= 6.0) - Fake.JavaScript.Yarn (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.Process (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Net.Http (5.23) - Fake.Core.Trace (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Runtime (5.23) - Fake.Core.Context (>= 5.23) - Fake.Core.DependencyManager.Paket (>= 5.23) - Fake.DotNet.Cli (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Compiler.Service (>= 37.0) - FSharp.Core (>= 6.0) - Microsoft.Deployment.DotNet.Releases (>= 1.0.0-preview2.6.21561.1) - Mono.Cecil (>= 0.11.4) - Paket.Core (>= 6.2.1) - System.Runtime.Loader (>= 4.3) - Fake.Testing.Common (5.23) - Fake.Core.Trace (>= 5.23) - FSharp.Core (>= 6.0) - Fake.Tools.Git (5.23) - Fake.Core.Environment (>= 5.23) - Fake.Core.Process (>= 5.23) - Fake.Core.SemVer (>= 5.23) - Fake.Core.String (>= 5.23) - Fake.Core.Trace (>= 5.23) - Fake.IO.FileSystem (>= 5.23) - FSharp.Core (>= 6.0) - FParsec (1.1.1) - FSharp.Core (>= 4.3.4) - FSharp.Compiler.Service (41.0.6) - FSharp.Core (6.0.6) - Microsoft.Build.Framework (>= 17.0) - Microsoft.Build.Tasks.Core (>= 17.0) - Microsoft.Build.Utilities.Core (>= 17.0) - System.Buffers (>= 4.5.1) - System.Collections.Immutable (>= 5.0) - System.Diagnostics.Process (>= 4.3) - System.Diagnostics.TraceSource (>= 4.3) - System.Linq.Expressions (>= 4.3) - System.Linq.Queryable (>= 4.3) - System.Memory (>= 4.5.4) - System.Net.Requests (>= 4.3) - System.Net.Security (>= 4.3.1) - System.Reflection.Emit (>= 4.3) - System.Reflection.Metadata (>= 5.0) - System.Reflection.TypeExtensions (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Runtime.InteropServices (>= 4.3) - System.Runtime.Loader (>= 4.3) - System.Security.Claims (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Principal (>= 4.3) - System.Threading.Tasks.Parallel (>= 4.3) - System.Threading.Thread (>= 4.3) - System.Threading.ThreadPool (>= 4.3) - FSharp.Control.Reactive (5.0.5) - FSharp.Core (>= 4.7.2) - System.Reactive (>= 5.0 < 6.0) - FSharp.Core (6.0.6) - Microsoft.Build (17.3.1) - Microsoft.Build.Framework (>= 17.3.1) - Microsoft.NET.StringTools (>= 17.3.1) - System.Collections.Immutable (>= 6.0) - System.Configuration.ConfigurationManager (>= 6.0) - System.Reflection.Metadata (>= 6.0) - System.Reflection.MetadataLoadContext (>= 6.0) - System.Security.Principal.Windows (>= 5.0) - System.Text.Encoding.CodePages (>= 6.0) - System.Text.Json (>= 6.0) - System.Threading.Tasks.Dataflow (>= 6.0) - Microsoft.Build.Framework (17.3.1) - System.Security.Permissions (>= 6.0) - Microsoft.Build.Tasks.Core (17.3.1) - Microsoft.Build.Framework (>= 17.3.1) - Microsoft.Build.Utilities.Core (>= 17.3.1) - Microsoft.NET.StringTools (>= 17.3.1) - System.CodeDom (>= 6.0) - System.Collections.Immutable (>= 6.0) - System.Reflection.Metadata (>= 6.0) - System.Resources.Extensions (>= 6.0) - System.Security.Cryptography.Pkcs (>= 6.0.1) - System.Security.Cryptography.Xml (>= 6.0) - System.Security.Permissions (>= 6.0) - System.Threading.Tasks.Dataflow (>= 6.0) - Microsoft.Build.Utilities.Core (17.3.1) - Microsoft.Build.Framework (>= 17.3.1) - Microsoft.NET.StringTools (>= 17.3.1) - System.Collections.Immutable (>= 6.0) - System.Configuration.ConfigurationManager (>= 6.0) - Microsoft.Deployment.DotNet.Releases (1.0.0-preview2.6.21561.1) - Newtonsoft.Json (>= 13.0.1) - System.Net.Http (>= 4.3.4) - System.ValueTuple (>= 4.5) - Microsoft.NET.StringTools (17.3.1) - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - Microsoft.NETCore.Platforms (6.0.5) - Microsoft.NETCore.Targets (5.0) - Microsoft.Win32.Primitives (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - Microsoft.Win32.Registry (5.0) - System.Security.AccessControl (>= 5.0) - System.Security.Principal.Windows (>= 5.0) - Microsoft.Win32.SystemEvents (6.0.1) - Mono.Cecil (0.11.4) - Mono.Posix.NETStandard (1.0) - MSBuild.StructuredLogger (2.1.669) - Microsoft.Build (>= 16.10) - Microsoft.Build.Framework (>= 16.10) - Microsoft.Build.Tasks.Core (>= 16.10) - Microsoft.Build.Utilities.Core (>= 16.10) - NETStandard.Library (2.0.3) - Microsoft.NETCore.Platforms (>= 1.1) - Newtonsoft.Json (13.0.1) - NuGet.Common (6.3) - NuGet.Frameworks (>= 6.3) - NuGet.Configuration (6.3) - NuGet.Common (>= 6.3) - System.Security.Cryptography.ProtectedData (>= 4.4) - NuGet.Frameworks (6.3) - NuGet.Packaging (6.3) - Newtonsoft.Json (>= 13.0.1) - NuGet.Configuration (>= 6.3) - NuGet.Versioning (>= 6.3) - System.Security.Cryptography.Cng (>= 5.0) - System.Security.Cryptography.Pkcs (>= 5.0) - NuGet.Protocol (6.3) - NuGet.Packaging (>= 6.3) - NuGet.Versioning (6.3) - Paket.Core (7.0) - Chessie (>= 0.6) - FSharp.Core (>= 6.0.3) - Mono.Cecil (>= 0.11.3) - Newtonsoft.Json (>= 13.0.1) - NuGet.Packaging (>= 5.9.1) - System.Net.Http (>= 4.3.4) - System.Net.Http.WinHttpHandler (>= 5.0) - System.Security.Cryptography.ProtectedData (>= 5.0) - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.native.System (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - runtime.native.System.Net.Http (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - runtime.native.System.Net.Security (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - runtime.native.System.Security.Cryptography.Apple (4.3.1) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) - runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - System.Buffers (4.5.1) - System.CodeDom (6.0) - System.Collections (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Collections.Concurrent (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.Reflection (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Collections.Immutable (6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Configuration.ConfigurationManager (6.0.1) - System.Security.Cryptography.ProtectedData (>= 6.0) - System.Security.Permissions (>= 6.0) - System.Diagnostics.Debug (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Diagnostics.DiagnosticSource (6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Diagnostics.Process (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.Win32.Primitives (>= 4.3) - Microsoft.Win32.Registry (>= 4.3) - runtime.native.System (>= 4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.IO.FileSystem (>= 4.3) - System.IO.FileSystem.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Text.Encoding.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.Thread (>= 4.3) - System.Threading.ThreadPool (>= 4.3) - System.Diagnostics.TraceSource (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System (>= 4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Diagnostics.Tracing (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Drawing.Common (6.0) - Microsoft.Win32.SystemEvents (>= 6.0) - System.Formats.Asn1 (6.0) - System.Globalization (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Globalization.Calendars (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Globalization (>= 4.3) - System.Runtime (>= 4.3) - System.Globalization.Extensions (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - System.Globalization (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.IO (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.IO.FileSystem (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.IO (>= 4.3) - System.IO.FileSystem.Primitives (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.IO.FileSystem.Primitives (4.3) - System.Runtime (>= 4.3) - System.Linq (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Linq.Expressions (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Linq (>= 4.3) - System.ObjectModel (>= 4.3) - System.Reflection (>= 4.3) - System.Reflection.Emit (>= 4.3) - System.Reflection.Emit.ILGeneration (>= 4.3) - System.Reflection.Emit.Lightweight (>= 4.3) - System.Reflection.Extensions (>= 4.3) - System.Reflection.Primitives (>= 4.3) - System.Reflection.TypeExtensions (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Linq.Queryable (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Linq (>= 4.3) - System.Linq.Expressions (>= 4.3) - System.Reflection (>= 4.3) - System.Reflection.Extensions (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Memory (4.5.5) - System.Net.Http (4.3.4) - Microsoft.NETCore.Platforms (>= 1.1.1) - runtime.native.System (>= 4.3) - runtime.native.System.Net.Http (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.DiagnosticSource (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.Globalization.Extensions (>= 4.3) - System.IO (>= 4.3) - System.IO.FileSystem (>= 4.3) - System.Net.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Security.Cryptography.X509Certificates (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Net.Http.WinHttpHandler (6.0.1) - System.Net.Primitives (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime (>= 4.3.1) - System.Runtime.Handles (>= 4.3) - System.Net.Requests (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Net.Http (>= 4.3) - System.Net.Primitives (>= 4.3) - System.Net.WebHeaderCollection (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Net.Security (4.3.2) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.Win32.Primitives (>= 4.3) - runtime.native.System (>= 4.3) - runtime.native.System.Net.Security (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.Collections.Concurrent (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.Globalization.Extensions (>= 4.3) - System.IO (>= 4.3) - System.Net.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Claims (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Security.Cryptography.X509Certificates (>= 4.3) - System.Security.Principal (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.ThreadPool (>= 4.3) - System.Net.WebHeaderCollection (4.3) - System.Collections (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.ObjectModel (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Threading (>= 4.3) - System.Reactive (5.0) - System.Reflection (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.IO (>= 4.3) - System.Reflection.Primitives (>= 4.3) - System.Runtime (>= 4.3) - System.Reflection.Emit (4.7) - System.Reflection.Emit.ILGeneration (4.7) - System.Reflection.Emit.Lightweight (4.7) - System.Reflection.Extensions (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Reflection (>= 4.3) - System.Runtime (>= 4.3) - System.Reflection.Metadata (6.0.1) - System.Collections.Immutable (>= 6.0) - System.Reflection.MetadataLoadContext (6.0) - System.Collections.Immutable (>= 6.0) - System.Reflection.Metadata (>= 6.0) - System.Reflection.Primitives (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Reflection.TypeExtensions (4.7) - System.Resources.Extensions (6.0) - System.Resources.ResourceManager (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Globalization (>= 4.3) - System.Reflection (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime.CompilerServices.Unsafe (6.0) - System.Runtime.Extensions (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime (>= 4.3.1) - System.Runtime.Handles (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Runtime.InteropServices (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Reflection (>= 4.3) - System.Reflection.Primitives (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.Loader (4.3) - System.IO (>= 4.3) - System.Reflection (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Numerics (4.3) - System.Globalization (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Security.AccessControl (6.0) - System.Security.Claims (4.3) - System.Collections (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Security.Principal (>= 4.3) - System.Security.Cryptography.Algorithms (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.IO (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Runtime.Numerics (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Security.Cryptography.Cng (5.0) - System.Formats.Asn1 (>= 5.0) - System.Security.Cryptography.Csp (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - System.IO (>= 4.3) - System.Reflection (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Security.Cryptography.Encoding (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - System.Collections (>= 4.3) - System.Collections.Concurrent (>= 4.3) - System.Linq (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (5.0) - System.Formats.Asn1 (>= 5.0) - System.Security.Cryptography.Pkcs (6.0.1) - System.Formats.Asn1 (>= 6.0) - System.Security.Cryptography.Primitives (4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Security.Cryptography.ProtectedData (6.0) - System.Security.Cryptography.X509Certificates (4.3.2) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System (>= 4.3) - runtime.native.System.Net.Http (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.Globalization.Calendars (>= 4.3) - System.IO (>= 4.3) - System.IO.FileSystem (>= 4.3) - System.IO.FileSystem.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Runtime.Numerics (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Cng (>= 4.3) - System.Security.Cryptography.Csp (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Security.Cryptography.Xml (6.0.1) - System.Security.AccessControl (>= 6.0) - System.Security.Cryptography.Pkcs (>= 6.0.1) - System.Security.Permissions (6.0) - System.Security.AccessControl (>= 6.0) - System.Windows.Extensions (>= 6.0) - System.Security.Principal (4.3) - System.Runtime (>= 4.3) - System.Security.Principal.Windows (5.0) - System.Text.Encoding (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Text.Encoding.CodePages (6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encoding.Extensions (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Text.Encodings.Web (6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Json (6.0.6) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encodings.Web (>= 6.0) - System.Threading (4.3) - System.Runtime (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.Tasks (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Threading.Tasks.Dataflow (6.0) - System.Threading.Tasks.Parallel (4.3) - System.Collections.Concurrent (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.Thread (4.3) - System.Runtime (>= 4.3) - System.Threading.ThreadPool (4.3) - System.Runtime (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.ValueTuple (4.5) - System.Windows.Extensions (6.0) - System.Drawing.Common (>= 6.0) diff --git a/build.sh b/build.sh index 384b5a34..7253b80f 100755 --- a/build.sh +++ b/build.sh @@ -8,4 +8,4 @@ set -o pipefail dotnet tool restore dotnet paket restore -dotnet fake run build.fsx $@ \ No newline at end of file +dotnet run --project build/build.fsx -- $@ \ No newline at end of file diff --git a/build.fsx b/build/build.fs similarity index 92% rename from build.fsx rename to build/build.fs index 941f3e9c..37a41ed7 100644 --- a/build.fsx +++ b/build/build.fs @@ -1,27 +1,3 @@ -#r @"paket: -source https://api.nuget.org/v3/index.json -framework net6.0 -nuget FSharp.Core -nuget Fake.Core.Target -nuget Fake.Core.ReleaseNotes -nuget Fake.IO.FileSystem -nuget Fake.Tools.Git -nuget Fake.Runtime -nuget Fake.DotNet.Paket -nuget Fake.DotNet.AssemblyInfoFile -nuget Fake.DotNet.Cli -nuget Fake.DotNet.MSBuild -nuget Fake.DotNet.Paket -nuget Fake.DotNet.Testing.Expecto -nuget Fake.DotNet.FSFormatting -nuget Fake.JavaScript.Yarn -//" - -#if !FAKE -#load "./.fake/build.fsx/intellisense.fsx" -#r "netstandard" // Temp fix for https://github.com/fsharp/FAKE/issues/1985 -#endif - // -------------------------------------------------------------------------------------- // FAKE build script // -------------------------------------------------------------------------------------- @@ -37,6 +13,12 @@ open Fake.Tools open Fake.JavaScript open Fake.Runtime +let initializeContext() = + let execContext = Context.FakeExecutionContext.Create false "build.fsx" [] + Context.setExecutionContext(Context.RuntimeContext.Fake execContext) + +initializeContext() + // Target configuration let configuration = "Release" @@ -243,7 +225,19 @@ Target.create "All" ignore ==> "CINuGet" ==> "GenerateDocs" ==> "All" +|> ignore "All" ==> "NuGet" ==> "PublishNuget" ==> "ReleaseDocs" ==> "Release" - -Target.runOrDefault "All" +|> ignore + +[] +let main args = + try + match args with + | [| target |] -> Target.runOrDefault target + | _ -> Target.runOrDefault "Run" + + 0 + with e -> + printfn "%A" e + 1 diff --git a/build/build.fsproj b/build/build.fsproj new file mode 100644 index 00000000..8cd457c0 --- /dev/null +++ b/build/build.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net8.0 + + + + + + + \ No newline at end of file diff --git a/build/paket.references b/build/paket.references new file mode 100644 index 00000000..6b2869aa --- /dev/null +++ b/build/paket.references @@ -0,0 +1,12 @@ +group Build +FSharp.Core +Fake.Core.Target +Fake.Core.ReleaseNotes +Fake.Runtime +Fake.DotNet.Cli +Fake.DotNet.MSBuild +Fake.DotNet.Testing.Expecto +Fake.DotNet.Paket +Fake.DotNet.AssemblyInfoFile +Fake.JavaScript.Yarn +Fake.Tools.Git \ No newline at end of file diff --git a/docs/csharp/csharp.csproj b/docs/csharp/csharp.csproj index 79883fbf..d67886e8 100644 --- a/docs/csharp/csharp.csproj +++ b/docs/csharp/csharp.csproj @@ -5,7 +5,7 @@ Properties csharp csharp - net6.0 + net8.0 512 true true diff --git a/paket.references b/docs/csharp/paket.refrences similarity index 100% rename from paket.references rename to docs/csharp/paket.refrences diff --git a/global.json b/global.json index 44752d33..f619e8ff 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.401", + "version": "8.0.416", "rollForward": "minor" } } \ No newline at end of file diff --git a/paket.dependencies b/paket.dependencies index e5967dc8..e17c1f42 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -1,4 +1,4 @@ -framework: netstandard2.0, net6.0 +framework: netstandard2.0, net8.0 source https://api.nuget.org/v3/index.json nuget FSharp.Core >= 4.3.4 lowest_matching:true @@ -17,3 +17,27 @@ nuget Fable.FastCheck nuget Fable.FastCheck.Jest nuget Fable.Jester nuget FSharp.Core + +group Build +framework net8.0 +source https://api.nuget.org/v3/index.json + +nuget FSharp.Core +nuget Fake.Core.Target +nuget Fake.Core.ReleaseNotes +nuget Fake.IO.FileSystem +nuget Fake.Tools.Git +nuget Fake.Runtime +nuget Fake.DotNet.Paket +nuget Fake.DotNet.AssemblyInfoFile +nuget Fake.DotNet.Cli +nuget Fake.DotNet.MSBuild +nuget Fake.DotNet.Testing.Expecto +nuget Fake.DotNet.FSFormatting +nuget Fake.JavaScript.Yarn + +//Pinned for net8 (see https://github.com/fsprojects/FAKE/issues/2722) +nuget Microsoft.Build ~> 17.11.48 +nuget Microsoft.Build.Framework ~> 17.11.48 +nuget Microsoft.Build.Tasks.Core ~> 17.11.48 +nuget Microsoft.Build.Utilities.Core ~> 17.11.48 diff --git a/paket.lock b/paket.lock index 2ff9bcf8..f7268cda 100644 --- a/paket.lock +++ b/paket.lock @@ -1,4 +1,4 @@ -RESTRICTION: || (== net6.0) (== netstandard2.0) +RESTRICTION: || (== net8.0) (== netstandard2.0) NUGET remote: https://api.nuget.org/v3/index.json Expecto (8.13.1) @@ -7,31 +7,292 @@ NUGET Expecto.FsCheck (8.13.1) Expecto (>= 8.13.1) FsCheck (>= 2.14) - FsCheck (2.16.5) + FsCheck (2.16.6) FSharp.Core (>= 4.2.3) FSharp.Core (4.3.4) - Microsoft.CodeCoverage (17.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.NET.Test.Sdk (17.3.1) - Microsoft.CodeCoverage (>= 17.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.TestHost (>= 17.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.ObjectModel (17.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - NuGet.Frameworks (>= 5.11) - System.Reflection.Metadata (>= 1.6) - Microsoft.TestPlatform.TestHost (17.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.ObjectModel (>= 17.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0)) - Newtonsoft.Json (>= 9.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0)) + Microsoft.CodeCoverage (18.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= net8.0)) + Microsoft.NET.Test.Sdk (18.0.1) + Microsoft.CodeCoverage (>= 18.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= net8.0)) + Microsoft.TestPlatform.TestHost (>= 18.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) + Microsoft.TestPlatform.ObjectModel (18.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) + System.Reflection.Metadata (>= 8.0) + Microsoft.TestPlatform.TestHost (18.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) + Microsoft.TestPlatform.ObjectModel (>= 18.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) + Newtonsoft.Json (>= 13.0.3) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) Mono.Cecil (0.11.4) - Newtonsoft.Json (13.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - NuGet.Frameworks (6.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.1)) - System.Collections.Immutable (6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.0)) (&& (== netstandard2.0) (>= netcoreapp2.1)) + Newtonsoft.Json (13.0.4) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) + System.Collections.Immutable (6.0) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Reflection.Metadata (6.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= netcoreapp2.1)) - System.Collections.Immutable (>= 6.0) - System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) + System.Reflection.Metadata (8.0.1) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net8.0)) + System.Runtime.CompilerServices.Unsafe (6.0) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) YoloDev.Expecto.TestSdk (0.8) - Expecto (>= 8.10 < 9.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) - FSharp.Core (>= 4.3.4) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) - System.Collections.Immutable (>= 1.4) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) + Expecto (>= 8.10 < 9.0) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) + FSharp.Core (>= 4.3.4) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) + System.Collections.Immutable (>= 1.4) - restriction: || (== net8.0) (&& (== netstandard2.0) (>= net461)) (&& (== netstandard2.0) (>= netcoreapp2.0)) + +GROUP Build +RESTRICTION: == net8.0 +NUGET + remote: https://api.nuget.org/v3/index.json + BlackFox.VsWhere (1.1) + FSharp.Core (>= 4.2.3) + Microsoft.Win32.Registry (>= 4.7) + Chessie (0.6) + FSharp.Core (>= 4.0.1.7-alpha) + NETStandard.Library (>= 1.6) + Fake.Core.CommandLineParsing (6.1.4) + FParsec (>= 1.1.1) + FSharp.Core (>= 8.0.400) + Fake.Core.Context (6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.DependencyManager.Paket (6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.Environment (6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.FakeVar (6.1.4) + Fake.Core.Context (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.Process (6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.FakeVar (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + System.Collections.Immutable (>= 8.0) + Fake.Core.ReleaseNotes (6.1.4) + Fake.Core.SemVer (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.SemVer (6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.String (6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.Target (6.1.4) + Fake.Core.CommandLineParsing (>= 6.1.4) + Fake.Core.Context (>= 6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.FakeVar (>= 6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + FSharp.Control.Reactive (>= 5.0.2) + FSharp.Core (>= 8.0.400) + Fake.Core.Tasks (6.1.4) + Fake.Core.Trace (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.Trace (6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.FakeVar (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Core.Xml (6.1.4) + Fake.Core.String (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.DotNet.AssemblyInfoFile (6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.DotNet.Cli (6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.DotNet.MSBuild (>= 6.1.4) + Fake.DotNet.NuGet (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Mono.Posix.NETStandard (>= 1.0) + Fake.DotNet.FSFormatting (6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.DotNet.Cli (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.DotNet.MSBuild (6.1.4) + BlackFox.VsWhere (>= 1.1) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + MSBuild.StructuredLogger (>= 2.1.815) + Fake.DotNet.NuGet (6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.SemVer (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Tasks (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.Core.Xml (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + Fake.Net.Http (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Newtonsoft.Json (>= 13.0.3) + NuGet.Protocol (>= 6.12.4) + Fake.DotNet.Paket (6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.DotNet.Cli (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.DotNet.Testing.Expecto (6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.Testing.Common (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.IO.FileSystem (6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.JavaScript.Yarn (6.1.4) + Fake.Core.Process (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Net.Http (6.1.4) + Fake.Core.Trace (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Runtime (6.1.4) + Fake.Core.Context (>= 6.1.4) + Fake.Core.DependencyManager.Paket (>= 6.1.4) + Fake.DotNet.Cli (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Compiler.Service (>= 43.8.400) + FSharp.Core (>= 8.0.400) + Microsoft.Deployment.DotNet.Releases (>= 1.0.1) + Mono.Cecil (>= 0.11.5) + Paket.Core (>= 9.0.2) + Fake.Testing.Common (6.1.4) + Fake.Core.Trace (>= 6.1.4) + FSharp.Core (>= 8.0.400) + Fake.Tools.Git (6.1.4) + Fake.Core.Environment (>= 6.1.4) + Fake.Core.Process (>= 6.1.4) + Fake.Core.SemVer (>= 6.1.4) + Fake.Core.String (>= 6.1.4) + Fake.Core.Trace (>= 6.1.4) + Fake.IO.FileSystem (>= 6.1.4) + FSharp.Core (>= 8.0.400) + FParsec (1.1.1) + FSharp.Core (>= 4.3.4) + FSharp.Compiler.Service (43.10.101) + FSharp.Core (10.0.101) + System.Buffers (>= 4.6) + System.Collections.Immutable (>= 9.0) + System.Diagnostics.DiagnosticSource (>= 9.0) + System.Memory (>= 4.6) + System.Reflection.Emit (>= 4.7) + System.Reflection.Metadata (>= 9.0) + System.Runtime.CompilerServices.Unsafe (>= 6.1) + FSharp.Control.Reactive (6.1.2) + FSharp.Core (>= 6.0.7) + System.Reactive (>= 6.0.1) + FSharp.Core (10.0.101) + Microsoft.Bcl.Cryptography (10.0.1) + System.Formats.Asn1 (>= 10.0.1) + Microsoft.Build (17.11.48) + Microsoft.Build.Framework (>= 17.11.48) + Microsoft.NET.StringTools (>= 17.11.48) + System.Collections.Immutable (>= 8.0) + System.Configuration.ConfigurationManager (>= 8.0) + System.Reflection.Metadata (>= 8.0) + System.Reflection.MetadataLoadContext (>= 8.0) + Microsoft.Build.Framework (17.11.48) + Microsoft.Build.Tasks.Core (17.11.48) + Microsoft.Build.Framework (>= 17.11.48) + Microsoft.Build.Utilities.Core (>= 17.11.48) + Microsoft.NET.StringTools (>= 17.11.48) + System.CodeDom (>= 8.0) + System.Collections.Immutable (>= 8.0) + System.Configuration.ConfigurationManager (>= 8.0) + System.Formats.Asn1 (>= 8.0.1) + System.Resources.Extensions (>= 8.0) + System.Security.Cryptography.Pkcs (>= 8.0) + System.Security.Cryptography.Xml (>= 8.0) + Microsoft.Build.Utilities.Core (17.11.48) + Microsoft.Build.Framework (>= 17.11.48) + Microsoft.NET.StringTools (>= 17.11.48) + System.Collections.Immutable (>= 8.0) + System.Configuration.ConfigurationManager (>= 8.0) + Microsoft.Deployment.DotNet.Releases (1.0.1) + System.Text.Json (>= 8.0.5) + Microsoft.NET.StringTools (18.0.2) + System.Memory (>= 4.6) + System.Runtime.CompilerServices.Unsafe (>= 6.1) + Microsoft.NETCore.Platforms (7.0.4) + Microsoft.Win32.Registry (5.0) + System.Security.AccessControl (>= 5.0) + System.Security.Principal.Windows (>= 5.0) + Mono.Cecil (0.11.6) + Mono.Posix.NETStandard (1.0) + MSBuild.StructuredLogger (2.3.113) + Microsoft.Build.Framework (>= 17.5) + Microsoft.Build.Utilities.Core (>= 17.5) + System.Collections.Immutable (>= 8.0) + NETStandard.Library (2.0.3) + Microsoft.NETCore.Platforms (>= 1.1) + Newtonsoft.Json (13.0.4) + NuGet.Common (7.0.1) + NuGet.Frameworks (>= 7.0.1) + NuGet.Configuration (7.0.1) + NuGet.Common (>= 7.0.1) + System.Security.Cryptography.ProtectedData (>= 9.0.6) + NuGet.Frameworks (7.0.1) + NuGet.Packaging (7.0.1) + Newtonsoft.Json (>= 13.0.3) + NuGet.Configuration (>= 7.0.1) + NuGet.Versioning (>= 7.0.1) + System.Security.Cryptography.Pkcs (>= 9.0.6) + NuGet.Protocol (7.0.1) + NuGet.Packaging (>= 7.0.1) + NuGet.Versioning (7.0.1) + Paket.Core (9.0.2) + Chessie (>= 0.6) + FSharp.Core (>= 8.0.400) + Mono.Cecil (>= 0.11.3 < 0.12) + Newtonsoft.Json (>= 13.0.1) + NuGet.Packaging (>= 5.9.1) + System.Net.Http.WinHttpHandler (>= 5.0) + System.Security.Cryptography.ProtectedData (>= 5.0) + System.Buffers (4.6.1) + System.CodeDom (10.0.1) + System.Collections.Immutable (10.0.1) + System.Configuration.ConfigurationManager (10.0.1) + System.Diagnostics.EventLog (>= 10.0.1) + System.Security.Cryptography.ProtectedData (>= 10.0.1) + System.Diagnostics.DiagnosticSource (10.0.1) + System.Diagnostics.EventLog (10.0.1) + System.Formats.Asn1 (10.0.1) + System.Formats.Nrbf (10.0.1) + System.Reflection.Metadata (>= 10.0.1) + System.IO.Pipelines (10.0.1) + System.Memory (4.6.3) + System.Net.Http.WinHttpHandler (10.0.1) + System.Reactive (6.1) + System.Reflection.Emit (4.7) + System.Reflection.Metadata (10.0.1) + System.Collections.Immutable (>= 10.0.1) + System.Reflection.MetadataLoadContext (10.0.1) + System.Collections.Immutable (>= 10.0.1) + System.Reflection.Metadata (>= 10.0.1) + System.Resources.Extensions (10.0.1) + System.Formats.Nrbf (>= 10.0.1) + System.Runtime.CompilerServices.Unsafe (6.1.2) + System.Security.AccessControl (6.0.1) + System.Security.Cryptography.Pkcs (10.0.1) + Microsoft.Bcl.Cryptography (>= 10.0.1) + System.Formats.Asn1 (>= 10.0.1) + System.Security.Cryptography.ProtectedData (10.0.1) + System.Security.Cryptography.Xml (10.0.1) + Microsoft.Bcl.Cryptography (>= 10.0.1) + System.Security.Cryptography.Pkcs (>= 10.0.1) + System.Security.Principal.Windows (5.0) + System.Text.Encodings.Web (10.0.1) + System.Text.Json (10.0.1) + System.IO.Pipelines (>= 10.0.1) + System.Text.Encodings.Web (>= 10.0.1) GROUP Test.Fable RESTRICTION: == netstandard2.0 diff --git a/src/FSharpx.Collections.Experimental/AssemblyInfo.fs b/src/FSharpx.Collections.Experimental/AssemblyInfo.fs index e8629ca5..aeed0d4d 100644 --- a/src/FSharpx.Collections.Experimental/AssemblyInfo.fs +++ b/src/FSharpx.Collections.Experimental/AssemblyInfo.fs @@ -8,8 +8,8 @@ open System.Runtime.CompilerServices [] [] [] -[] -[] +[] +[] [] do () @@ -19,6 +19,6 @@ module internal AssemblyVersionInformation = let [] AssemblyDescription = "FSharpx.Collections is a collection of datastructures for use with F# and C#." let [] InternalsVisibleTo = "FSharpx.Collections.Tests" let [] InternalsVisibleTo_1 = "FSharpx.Collections.Experimental.Tests" - let [] AssemblyVersion = "3.0.1" - let [] AssemblyFileVersion = "3.0.1" + let [] AssemblyVersion = "3.1.0" + let [] AssemblyFileVersion = "3.1.0" let [] AssemblyConfiguration = "Release" diff --git a/src/FSharpx.Collections/AssemblyInfo.fs b/src/FSharpx.Collections/AssemblyInfo.fs index b4294c8b..bd6e200f 100644 --- a/src/FSharpx.Collections/AssemblyInfo.fs +++ b/src/FSharpx.Collections/AssemblyInfo.fs @@ -8,8 +8,8 @@ open System.Runtime.CompilerServices [] [] [] -[] -[] +[] +[] [] do () @@ -19,6 +19,6 @@ module internal AssemblyVersionInformation = let [] AssemblyDescription = "FSharpx.Collections is a collection of datastructures for use with F# and C#." let [] InternalsVisibleTo = "FSharpx.Collections.Tests" let [] InternalsVisibleTo_1 = "FSharpx.Collections.Experimental.Tests" - let [] AssemblyVersion = "3.0.1" - let [] AssemblyFileVersion = "3.0.1" + let [] AssemblyVersion = "3.1.0" + let [] AssemblyFileVersion = "3.1.0" let [] AssemblyConfiguration = "Release" diff --git a/src/FSharpx.Collections/TaggedCollections.fs b/src/FSharpx.Collections/TaggedCollections.fs index 8e528a9d..e5ef3fed 100644 --- a/src/FSharpx.Collections/TaggedCollections.fs +++ b/src/FSharpx.Collections/TaggedCollections.fs @@ -548,7 +548,7 @@ module SetTree = | [], [] -> 0 | [], _ -> -1 | _, [] -> 1 - | (SetEmpty _ :: t1), (SetEmpty :: t2) -> compareStacks comparer t1 t2 + | (SetEmpty :: t1), (SetEmpty :: t2) -> compareStacks comparer t1 t2 #if ONE | (SetOne(n1k) :: t1), (SetOne(n2k) :: t2) -> let c = comparer.Compare(n1k, n2k) diff --git a/tests/FSharpx.Collections.Experimental.Tests/FSharpx.Collections.Experimental.Tests.fsproj b/tests/FSharpx.Collections.Experimental.Tests/FSharpx.Collections.Experimental.Tests.fsproj index 622dd9b6..2d722e1f 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/FSharpx.Collections.Experimental.Tests.fsproj +++ b/tests/FSharpx.Collections.Experimental.Tests/FSharpx.Collections.Experimental.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false diff --git a/tests/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj b/tests/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj index 7cbcb8bc..44a3f58e 100644 --- a/tests/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj +++ b/tests/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false From b131b5088d4253cad2ac39bdc9fd659b334db877 Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Thu, 8 Jan 2026 19:26:18 +0100 Subject: [PATCH 2/8] Update dotnet vesion in GitHub Actions --- .github/workflows/dotnet.yml | 14 +++++++------- build/build.fs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 19d741fa..c8cbb4bc 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -18,22 +18,22 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest] - dotnet: [6.0.401] + dotnet: [8.0.416] node: ['14'] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: setup git config run: | git config user.name "GitHub Actions Bot" git config user.email "<>" - name: Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v6 with: node-version: ${{ matrix.node }} - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v5 with: dotnet-version: ${{ matrix.dotnet }} - name: Install local tools @@ -41,7 +41,7 @@ jobs: - name: Paket Restore run: dotnet paket restore - name: Build and Test - run: dotnet fake run build.fsx + run: dotnet run --project build\build.fsproj - name: Check secrets presence id: checksecrets @@ -60,12 +60,12 @@ jobs: - name: Publish prerelease NuGet to GitHub if: (steps.checksecrets.outputs.secretspresent != 'NO') && matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' && github.event.inputs.release != 'true' - run: dotnet fake run build.fsx -t PublishCINuGet + run: dotnet run --project build\build.fsproj -- PublishCINuGet env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish NuGet to NuGet.org if: (steps.checksecrets.outputs.secretspresent != 'NO') && matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' && github.event.inputs.release == 'true' - run: dotnet fake run build.fsx -t Release + run: dotnet run --project build\build.fsproj -- Release env: NUGET_KEY: ${{ secrets.NUGETKEY }} diff --git a/build/build.fs b/build/build.fs index 37a41ed7..bdd1cb46 100644 --- a/build/build.fs +++ b/build/build.fs @@ -235,7 +235,7 @@ let main args = try match args with | [| target |] -> Target.runOrDefault target - | _ -> Target.runOrDefault "Run" + | _ -> Target.runOrDefault "All" 0 with e -> From 3f490cf4d6c7128e15e218c722ec093bb2d92893 Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Thu, 8 Jan 2026 19:27:33 +0100 Subject: [PATCH 3/8] Make it *nix friendly --- .github/workflows/dotnet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index c8cbb4bc..164edc83 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -41,7 +41,7 @@ jobs: - name: Paket Restore run: dotnet paket restore - name: Build and Test - run: dotnet run --project build\build.fsproj + run: dotnet run --project build/build.fsproj - name: Check secrets presence id: checksecrets @@ -60,12 +60,12 @@ jobs: - name: Publish prerelease NuGet to GitHub if: (steps.checksecrets.outputs.secretspresent != 'NO') && matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' && github.event.inputs.release != 'true' - run: dotnet run --project build\build.fsproj -- PublishCINuGet + run: dotnet run --project build/build.fsproj -- PublishCINuGet env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish NuGet to NuGet.org if: (steps.checksecrets.outputs.secretspresent != 'NO') && matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' && github.event.inputs.release == 'true' - run: dotnet run --project build\build.fsproj -- Release + run: dotnet run --project build/build.fsproj -- Release env: NUGET_KEY: ${{ secrets.NUGETKEY }} From 859d76fae38b8f2e82f9860fab2bfb6b79efd97a Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Thu, 15 Jan 2026 20:07:54 +0100 Subject: [PATCH 4/8] Replace Fable.Jester with Fable.Mocha --- .config/dotnet-tools.json | 2 +- paket.dependencies | 4 +- paket.lock | 69 +- .../FSharpx.Collections.Tests/Deque.test.fs | 26 +- .../FSharpx.Collections.Tests.fsproj | 1 + .../LazyList.test.fs | 28 +- .../NonEmptyList.test.fs | 26 +- .../PersistentVector.test.fs | 87 +- .../FSharpx.Collections.Tests/Program.fs | 16 + .../FSharpx.Collections.Tests/Queue.test.fs | 42 +- .../paket.references | 6 +- tests/fable/babel.config.js | 8 - tests/fable/package.json | 15 +- tests/fable/yarn.lock | 3879 ++--------------- 14 files changed, 522 insertions(+), 3687 deletions(-) create mode 100644 tests/fable/FSharpx.Collections.Tests/Program.fs delete mode 100644 tests/fable/babel.config.js diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f969a509..37c01dca 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -17,7 +17,7 @@ "rollForward": false }, "fable": { - "version": "3.4.4", + "version": "4.28.0", "commands": [ "fable" ], diff --git a/paket.dependencies b/paket.dependencies index e17c1f42..075e0a2f 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -13,9 +13,7 @@ framework: netstandard2.0 source https://api.nuget.org/v3/index.json nuget Fable.Core -nuget Fable.FastCheck -nuget Fable.FastCheck.Jest -nuget Fable.Jester +nuget Fable.Mocha nuget FSharp.Core group Build diff --git a/paket.lock b/paket.lock index f7268cda..c6d2ebce 100644 --- a/paket.lock +++ b/paket.lock @@ -298,69 +298,8 @@ GROUP Test.Fable RESTRICTION: == netstandard2.0 NUGET remote: https://api.nuget.org/v3/index.json - Fable.AST (4.2) - Fable.Browser.Blob (1.2) + Fable.Core (4.5) + Fable.Mocha (2.17) Fable.Core (>= 3.0) - FSharp.Core (>= 4.7.2) - Fable.Browser.Dom (2.10) - Fable.Browser.Blob (>= 1.2) - Fable.Browser.Event (>= 1.5) - Fable.Browser.WebStorage (>= 1.1) - Fable.Core (>= 3.2.8) - FSharp.Core (>= 4.7.2) - Fable.Browser.Event (1.5) - Fable.Browser.Gamepad (>= 1.1) - Fable.Core (>= 3.0) - FSharp.Core (>= 4.7.2) - Fable.Browser.Gamepad (1.1) - Fable.Core (>= 3.0) - FSharp.Core (>= 4.7.2) - Fable.Browser.WebStorage (1.1) - Fable.Browser.Event (>= 1.5) - Fable.Core (>= 3.0) - FSharp.Core (>= 4.7.2) - Fable.Core (3.7.1) - Fable.Elmish (3.1) - Fable.Core (>= 3.0) - FSharp.Core (>= 4.6.2) - Fable.FastCheck (0.33) - Fable.Core (>= 3.2.8 < 4.0) - Fable.Elmish (>= 3.1 < 4.0) - Fable.Promise (>= 2.2.2 < 3.0) - FSharp.Core (>= 4.7.2) - Fable.FastCheck.Jest (0.33) - Fable.Core (>= 3.2.8 < 4.0) - Fable.FastCheck (>= 0.33) - Fable.Jester (>= 0.33) - Fable.Promise (>= 2.2.2 < 3.0) - FSharp.Core (>= 4.7.2) - Fable.Jester (0.33) - Fable.Browser.Dom (>= 2.4.4 < 3.0) - Fable.Core (>= 3.2.8 < 4.0) - Fable.Node (>= 1.0.2 < 2.0) - Fable.Promise (>= 2.2.2 < 3.0) - Feliz (>= 1.47 < 2.0) - FSharp.Core (>= 4.7.2) - Fable.Node (1.2) - Fable.Core (>= 3.1.2) - FSharp.Core (>= 5.0) - Fable.Promise (2.2.2) - Fable.Core (>= 3.1.5) - FSharp.Core (>= 4.7.2) - Fable.React (9.0.1) - Fable.Core (>= 3.2.7) - Fable.React.Types (>= 18.0) - FSharp.Core (>= 4.7.2) - Fable.React.Types (18.0) - Fable.Browser.Dom (>= 2.4.4) - Fable.Core (>= 3.2.7) - FSharp.Core (>= 4.7.2) - Feliz (1.68) - Fable.Core (>= 3.1.5) - Fable.React (>= 7.4) - Feliz.CompilerPlugins (>= 1.10) - FSharp.Core (>= 4.7.2) - Feliz.CompilerPlugins (1.10) - Fable.AST (>= 3.0) - FSharp.Core (>= 4.7.2) - FSharp.Core (6.0.6) + FSharp.Core (>= 4.7) + FSharp.Core (10.0.102) diff --git a/tests/fable/FSharpx.Collections.Tests/Deque.test.fs b/tests/fable/FSharpx.Collections.Tests/Deque.test.fs index 5141c97b..f2b89c1a 100644 --- a/tests/fable/FSharpx.Collections.Tests/Deque.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/Deque.test.fs @@ -1,21 +1,19 @@ module DequeTests -open Fable.Jester -open Fable.FastCheck -open Fable.FastCheck.Jest +open Fable.Mocha open FSharpx.Collections -Jest.test( - "NonEmptyList works", - async { - let d = Deque.empty +let tests = + testList "DequeTests" [ + test "NonEmptyList works" { + let d = Deque.empty - Jest.expect(Deque.isEmpty d).toEqual(true) + Expect.equal (Deque.isEmpty d) true "should be empty" - let d = d |> Deque.conj "b" |> Deque.conj "a" + let d = d |> Deque.conj "b" |> Deque.conj "a" - Jest.expect(Deque.isEmpty d).toEqual(false) - Jest.expect(Deque.head d).toEqual("b") - Jest.expect(Deque.length d).toEqual(2) - } -) + Expect.equal (Deque.isEmpty d) false "should not be empty anymore" + Expect.equal (Deque.head d) "b" "b should be at top" + Expect.equal (Deque.length d) 2 "Should have length 2" + } + ] diff --git a/tests/fable/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj b/tests/fable/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj index 3ac68e47..7756c01b 100644 --- a/tests/fable/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj +++ b/tests/fable/FSharpx.Collections.Tests/FSharpx.Collections.Tests.fsproj @@ -10,6 +10,7 @@ + diff --git a/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs b/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs index 6c4eb8cc..f06cb6af 100644 --- a/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs @@ -1,24 +1,22 @@ module LazyListTests -open Fable.Jester -open Fable.FastCheck -open Fable.FastCheck.Jest +open Fable.Mocha open FSharpx.Collections -Jest.test( - "LazyList works", - async { - let xs = LazyList.empty +let tests = + testList "LazyListTests" [ + test "LazyList works" { + let xs = LazyList.empty - Jest.expect(LazyList.isEmpty xs).toEqual(true) + Expect.equal (LazyList.isEmpty xs) true "should be empty" - let xs = LazyList.ofList [ 1; 2; 3 ] + let xs = LazyList.ofList [ 1; 2; 3 ] - Jest.expect(LazyList.isEmpty xs).toEqual(false) - Jest.expect(LazyList.tryHead xs).toEqual(1) + Expect.equal (LazyList.isEmpty xs) false "should not be empty" + Expect.equal (LazyList.tryHead xs) (Some 1) "should get first element" - let xs = xs |> LazyList.tail |> LazyList.tail + let xs = xs |> LazyList.tail |> LazyList.tail - Jest.expect(LazyList.tryHead xs).toEqual(3) - } -) + Expect.equal (LazyList.tryHead xs) (Some 3) "should reach third element" + } + ] diff --git a/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs b/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs index dcdc9df7..88d1e8c6 100644 --- a/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs @@ -1,21 +1,19 @@ module NonEmptyListTests -open Fable.Jester -open Fable.FastCheck -open Fable.FastCheck.Jest +open Fable.Mocha open FSharpx.Collections -Jest.test( - "NonEmptyList works", - async { - let xs = NonEmptyList.create "a" [] +let tests = + testList "NonEmptyListTests" [ + test "NonEmptyList works" { + let xs = NonEmptyList.create "a" [] - Jest.expect(NonEmptyList.length xs).toEqual(1) - Jest.expect(NonEmptyList.head xs).toEqual("a") + Expect.equal (NonEmptyList.length xs) 1 "should have single entry" + Expect.equal (NonEmptyList.head xs) "a" "should read head" - let xs = xs |> NonEmptyList.cons "b" |> NonEmptyList.cons "c" + let xs = xs |> NonEmptyList.cons "b" |> NonEmptyList.cons "c" - Jest.expect(NonEmptyList.head xs).toEqual("c") - Jest.expect(NonEmptyList.length xs).toEqual(3) - } -) + Expect.equal (NonEmptyList.head xs) "c" "should update head" + Expect.equal (NonEmptyList.length xs) 3 "should track length" + } + ] diff --git a/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs b/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs index 03e35c47..9d584ec9 100644 --- a/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs @@ -1,51 +1,44 @@ module PersistentVectorTests -open Fable.Jester -open Fable.FastCheck -open Fable.FastCheck.Jest +open Fable.Mocha open FSharpx.Collections -Jest.test( - "PersistentVector.empty works as expected", - fun () -> - let v = PersistentVector.empty - - Jest.expect(PersistentVector.isEmpty v).toEqual(true) - Jest.expect(PersistentVector.length v).toEqual(0) -) - -Jest.test( - "PersistentVector.conj works as expected", - fun () -> - let v = PersistentVector.empty |> PersistentVector.conj "a" - - Jest.expect(PersistentVector.nth 0 v).toEqual("a") - - let v = v |> PersistentVector.conj "b" |> PersistentVector.conj "c" - - Jest.expect(PersistentVector.nth 0 v).toEqual("a") - Jest.expect(PersistentVector.nth 1 v).toEqual("b") - Jest.expect(PersistentVector.nth 2 v).toEqual("c") -) - -Jest.test( - "PersistentVector implements seq as expected", - fun () -> - let v = - PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 - - Jest.expect(Seq.toList v = [ 1; 4; 25 ]).toBe(true) -) - -Jest.test( - "PersistentVector.map works as expected", - fun () -> - let v = - PersistentVector.ofSeq [ 1..4 ] - |> PersistentVector.map(fun x -> x * 2) - - Jest.expect(Seq.toList v = [ 2; 4; 6; 8 ]).toBe(true) -) +let tests = + testList "PersistentVectorTests" [ + test "PersistentVector.empty works as expected" { + let v = PersistentVector.empty + + Expect.equal (PersistentVector.isEmpty v) true "should be empty" + Expect.equal (PersistentVector.length v) 0 "should have zero length" + } + + test "PersistentVector.conj works as expected" { + let v = PersistentVector.empty |> PersistentVector.conj "a" + + Expect.equal (PersistentVector.nth 0 v) "a" "should hold first value" + + let v = v |> PersistentVector.conj "b" |> PersistentVector.conj "c" + + Expect.equal (PersistentVector.nth 0 v) "a" "should preserve first element" + Expect.equal (PersistentVector.nth 1 v) "b" "should add second element" + Expect.equal (PersistentVector.nth 2 v) "c" "should add third element" + } + + test "PersistentVector implements seq as expected" { + let v = + PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 + + Expect.equal (Seq.toList v) [ 1; 4; 25 ] "should convert to list" + } + + test "PersistentVector.map works as expected" { + let v = + PersistentVector.ofSeq [ 1..4 ] + |> PersistentVector.map(fun x -> x * 2) + + Expect.equal (Seq.toList v) [ 2; 4; 6; 8 ] "should map over items" + } + ] diff --git a/tests/fable/FSharpx.Collections.Tests/Program.fs b/tests/fable/FSharpx.Collections.Tests/Program.fs new file mode 100644 index 00000000..71872c82 --- /dev/null +++ b/tests/fable/FSharpx.Collections.Tests/Program.fs @@ -0,0 +1,16 @@ +module Program + +open Fable.Mocha + +let allTests = + testList "All" [ + QueueTests.tests + PersistentVectorTests.tests + NonEmptyListTests.tests + LazyListTests.tests + DequeTests.tests + ] + +[] +let main args = + Mocha.runTests allTests diff --git a/tests/fable/FSharpx.Collections.Tests/Queue.test.fs b/tests/fable/FSharpx.Collections.Tests/Queue.test.fs index d03372da..1c1d07bf 100644 --- a/tests/fable/FSharpx.Collections.Tests/Queue.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/Queue.test.fs @@ -1,38 +1,34 @@ module QueueTests -open Fable.Jester -open Fable.FastCheck -open Fable.FastCheck.Jest +open Fable.Mocha open FSharpx.Collections -Jest.test( - "Queue works", - async { - let q = Queue.empty +let tests = + testList "QueueTests" [ + test "Queue works" { + let q = Queue.empty - Jest.expect(Queue.isEmpty q).toEqual(true) + Expect.equal (Queue.isEmpty q) true "should start empty" - let q = Queue.conj "a" q + let q = Queue.conj "a" q - Jest.expect(Queue.isEmpty q).toEqual(false) - Jest.expect(Queue.tryHead q).toEqual(Some "a") + Expect.equal (Queue.isEmpty q) false "should no longer be empty" + Expect.equal (Queue.tryHead q) (Some "a") "should read first element" - let q = Queue.conj "b" q + let q = Queue.conj "b" q - Jest.expect(Queue.tryHead q).toEqual(Some "a") + Expect.equal (Queue.tryHead q) (Some "a") "should preserve head" - let q = Queue.conj "c" q + let q = Queue.conj "c" q - Jest - .expect(Queue.tryTail q) - .toEqual(Queue.empty |> Queue.conj "b" |> Queue.conj "c") + Expect.equal (Queue.tryTail q) (Queue.empty |> Queue.conj "b" |> Queue.conj "c" |> Some) "should drop head" - let popped, q = Queue.uncons q + let popped, q = Queue.uncons q - Jest.expect(popped).toEqual("a") + Expect.equal popped "a" "should pop in order" - let popped, q = Queue.uncons q + let popped, _ = Queue.uncons q - Jest.expect(popped).toEqual("b") - } -) + Expect.equal popped "b" "should pop second" + } + ] diff --git a/tests/fable/FSharpx.Collections.Tests/paket.references b/tests/fable/FSharpx.Collections.Tests/paket.references index 9b0e5001..c2522385 100644 --- a/tests/fable/FSharpx.Collections.Tests/paket.references +++ b/tests/fable/FSharpx.Collections.Tests/paket.references @@ -1,6 +1,4 @@ group Test.Fable - Fable.Core - Fable.FastCheck - Fable.FastCheck.Jest - Fable.Jester FSharp.Core + Fable.Core + Fable.Mocha diff --git a/tests/fable/babel.config.js b/tests/fable/babel.config.js deleted file mode 100644 index 721f39f9..00000000 --- a/tests/fable/babel.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - presets: [ - [ '@babel/preset-env', { targets: { node: 'current' } } ] - ], - plugins: [ - "@babel/plugin-transform-runtime", - ], -}; diff --git a/tests/fable/package.json b/tests/fable/package.json index bc230f41..69743846 100644 --- a/tests/fable/package.json +++ b/tests/fable/package.json @@ -3,22 +3,13 @@ "version": "0.1.0", "license": "MIT", "author": "fsprojects", + "type": "module", "scripts": { "pretest": "dotnet fable ./FSharpx.Collections.Tests --sourceMaps --outDir ./dist", - "test": "jest" + "test": "mocha dist" }, - "dependencies": {}, "private": true, - "jest": { - "roots": [ - "./dist" - ] - }, "devDependencies": { - "@babel/core": "^7.15.8", - "@babel/plugin-transform-runtime": "^7.15.8", - "@babel/preset-env": "^7.15.8", - "babel-jest": "^27.3.1", - "jest": "^27.2" + "mocha": "^11.7.5" } } diff --git a/tests/fable/yarn.lock b/tests/fable/yarn.lock index 7b0ebc12..62a79985 100644 --- a/tests/fable/yarn.lock +++ b/tests/fable/yarn.lock @@ -2,3235 +2,382 @@ # yarn lockfile v1 -"@babel/code-frame@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" - integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== - dependencies: - "@babel/highlight" "^7.10.4" - -"@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5", "@babel/code-frame@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.15.8.tgz#45990c47adadb00c03677baa89221f7cc23d2503" - integrity sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg== - dependencies: - "@babel/highlight" "^7.14.5" - -"@babel/compat-data@^7.13.11", "@babel/compat-data@^7.15.0": - version "7.15.0" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176" - integrity sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA== - -"@babel/core@^7.1.0", "@babel/core@^7.7.5": - version "7.12.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.3.tgz#1b436884e1e3bff6fb1328dc02b208759de92ad8" - integrity sha512-0qXcZYKZp3/6N2jKYVxZv0aNCsxTSVCiK72DTiTYZAu7sjg73W0/aynWjMbiGd87EQL4WyA8reiJVh92AVla9g== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.1" - "@babel/helper-module-transforms" "^7.12.1" - "@babel/helpers" "^7.12.1" - "@babel/parser" "^7.12.3" - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.12.1" - "@babel/types" "^7.12.1" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.1" - json5 "^2.1.2" - lodash "^4.17.19" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/core@^7.15.8", "@babel/core@^7.7.2": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.15.8.tgz#195b9f2bffe995d2c6c159e72fe525b4114e8c10" - integrity sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og== - dependencies: - "@babel/code-frame" "^7.15.8" - "@babel/generator" "^7.15.8" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-module-transforms" "^7.15.8" - "@babel/helpers" "^7.15.4" - "@babel/parser" "^7.15.8" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.6" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.1.2" - semver "^6.3.0" - source-map "^0.5.0" - -"@babel/generator@^7.12.1", "@babel/generator@^7.12.5": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.5.tgz#a2c50de5c8b6d708ab95be5e6053936c1884a4de" - integrity sha512-m16TQQJ8hPt7E+OS/XVQg/7U184MLXtvuGbCdA7na61vha+ImkyyNM/9DDA0unYCVZn3ZOhng+qz48/KBOT96A== - dependencies: - "@babel/types" "^7.12.5" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/generator@^7.15.4", "@babel/generator@^7.15.8", "@babel/generator@^7.7.2": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.8.tgz#fa56be6b596952ceb231048cf84ee499a19c0cd1" - integrity sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g== - dependencies: - "@babel/types" "^7.15.6" - jsesc "^2.5.1" - source-map "^0.5.0" - -"@babel/helper-annotate-as-pure@^7.14.5", "@babel/helper-annotate-as-pure@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.15.4.tgz#3d0e43b00c5e49fdb6c57e421601a7a658d5f835" - integrity sha512-QwrtdNvUNsPCj2lfNQacsGSQvGX8ee1ttrBrcozUP2Sv/jylewBP/8QFe6ZkBsC8T/GYWonNAWJV4aRR9AL2DA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-builder-binary-assignment-operator-visitor@^7.14.5": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.15.4.tgz#21ad815f609b84ee0e3058676c33cf6d1670525f" - integrity sha512-P8o7JP2Mzi0SdC6eWr1zF+AEYvrsZa7GSY1lTayjF5XJhVH0kjLYUZPvTMflP7tBgZoe9gIhTa60QwFpqh/E0Q== - dependencies: - "@babel/helper-explode-assignable-expression" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz#cf6d94f30fbefc139123e27dd6b02f65aeedb7b9" - integrity sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ== - dependencies: - "@babel/compat-data" "^7.15.0" - "@babel/helper-validator-option" "^7.14.5" - browserslist "^4.16.6" - semver "^6.3.0" - -"@babel/helper-create-class-features-plugin@^7.14.5", "@babel/helper-create-class-features-plugin@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.15.4.tgz#7f977c17bd12a5fba363cb19bea090394bf37d2e" - integrity sha512-7ZmzFi+DwJx6A7mHRwbuucEYpyBwmh2Ca0RvI6z2+WLZYCqV0JOaLb+u0zbtmDicebgKBZgqbYfLaKNqSgv5Pw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-member-expression-to-functions" "^7.15.4" - "@babel/helper-optimise-call-expression" "^7.15.4" - "@babel/helper-replace-supers" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - -"@babel/helper-create-regexp-features-plugin@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.14.5.tgz#c7d5ac5e9cf621c26057722fb7a8a4c5889358c4" - integrity sha512-TLawwqpOErY2HhWbGJ2nZT5wSkR192QpN+nBg1THfBfftrlvOh+WbhrxXCH4q4xJ9Gl16BGPR/48JA+Ryiho/A== - dependencies: - "@babel/helper-annotate-as-pure" "^7.14.5" - regexpu-core "^4.7.1" - -"@babel/helper-define-polyfill-provider@^0.2.2": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.3.tgz#0525edec5094653a282688d34d846e4c75e9c0b6" - integrity sha512-RH3QDAfRMzj7+0Nqu5oqgO5q9mFtQEVvCRsi8qCEfzLR9p2BHfn5FzhSB2oj1fF7I2+DcTORkYaQ6aTR9Cofew== - dependencies: - "@babel/helper-compilation-targets" "^7.13.0" - "@babel/helper-module-imports" "^7.12.13" - "@babel/helper-plugin-utils" "^7.13.0" - "@babel/traverse" "^7.13.0" - debug "^4.1.1" - lodash.debounce "^4.0.8" - resolve "^1.14.2" - semver "^6.1.2" - -"@babel/helper-explode-assignable-expression@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.15.4.tgz#f9aec9d219f271eaf92b9f561598ca6b2682600c" - integrity sha512-J14f/vq8+hdC2KoWLIQSsGrC9EFBKE4NFts8pfMpymfApds+fPqR30AOUWc4tyr56h9l/GA1Sxv2q3dLZWbQ/g== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-function-name@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a" - integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ== - dependencies: - "@babel/helper-get-function-arity" "^7.10.4" - "@babel/template" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/helper-function-name@^7.14.5", "@babel/helper-function-name@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.15.4.tgz#845744dafc4381a4a5fb6afa6c3d36f98a787ebc" - integrity sha512-Z91cOMM4DseLIGOnog+Z8OI6YseR9bua+HpvLAQ2XayUGU+neTtX+97caALaLdyu53I/fjhbeCnWnRH1O3jFOw== - dependencies: - "@babel/helper-get-function-arity" "^7.15.4" - "@babel/template" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-get-function-arity@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2" - integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A== - dependencies: - "@babel/types" "^7.10.4" - -"@babel/helper-get-function-arity@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.15.4.tgz#098818934a137fce78b536a3e015864be1e2879b" - integrity sha512-1/AlxSF92CmGZzHnC515hm4SirTxtpDnLEJ0UyEMgTMZN+6bxXKg04dKhiRx5Enel+SUA1G1t5Ed/yQia0efrA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-hoist-variables@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.15.4.tgz#09993a3259c0e918f99d104261dfdfc033f178df" - integrity sha512-VTy085egb3jUGVK9ycIxQiPbquesq0HUQ+tPO0uv5mPEBZipk+5FkRKiWq5apuyTE9FUrjENB0rCf8y+n+UuhA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-member-expression-to-functions@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.12.1.tgz#fba0f2fcff3fba00e6ecb664bb5e6e26e2d6165c" - integrity sha512-k0CIe3tXUKTRSoEx1LQEPFU9vRQfqHtl+kf8eNnDqb4AUJEy5pz6aIiog+YWtVm2jpggjS1laH68bPsR+KWWPQ== - dependencies: - "@babel/types" "^7.12.1" - -"@babel/helper-member-expression-to-functions@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.4.tgz#bfd34dc9bba9824a4658b0317ec2fd571a51e6ef" - integrity sha512-cokOMkxC/BTyNP1AlY25HuBWM32iCEsLPI4BHDpJCHHm1FU2E7dKWWIXJgQgSFiu4lp8q3bL1BIKwqkSUviqtA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-module-imports@^7.12.1": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.12.5.tgz#1bfc0229f794988f76ed0a4d4e90860850b54dfb" - integrity sha512-SR713Ogqg6++uexFRORf/+nPXMmWIn80TALu0uaFb+iQIUoR7bOC7zBWyzBs5b3tBBJXuyD0cRu1F15GyzjOWA== - dependencies: - "@babel/types" "^7.12.5" - -"@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.14.5", "@babel/helper-module-imports@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.15.4.tgz#e18007d230632dea19b47853b984476e7b4e103f" - integrity sha512-jeAHZbzUwdW/xHgHQ3QmWR4Jg6j15q4w/gCfwZvtqOxoo5DKtLHk8Bsf4c5RZRC7NmLEs+ohkdq8jFefuvIxAA== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-module-transforms@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.12.1.tgz#7954fec71f5b32c48e4b303b437c34453fd7247c" - integrity sha512-QQzehgFAZ2bbISiCpmVGfiGux8YVFXQ0abBic2Envhej22DVXV9nCFaS5hIQbkyo1AdGb+gNME2TSh3hYJVV/w== - dependencies: - "@babel/helper-module-imports" "^7.12.1" - "@babel/helper-replace-supers" "^7.12.1" - "@babel/helper-simple-access" "^7.12.1" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/helper-validator-identifier" "^7.10.4" - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.12.1" - "@babel/types" "^7.12.1" - lodash "^4.17.19" - -"@babel/helper-module-transforms@^7.14.5", "@babel/helper-module-transforms@^7.15.4", "@babel/helper-module-transforms@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz#d8c0e75a87a52e374a8f25f855174786a09498b2" - integrity sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg== - dependencies: - "@babel/helper-module-imports" "^7.15.4" - "@babel/helper-replace-supers" "^7.15.4" - "@babel/helper-simple-access" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - "@babel/helper-validator-identifier" "^7.15.7" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.6" - -"@babel/helper-optimise-call-expression@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673" - integrity sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg== - dependencies: - "@babel/types" "^7.10.4" - -"@babel/helper-optimise-call-expression@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.15.4.tgz#f310a5121a3b9cc52d9ab19122bd729822dee171" - integrity sha512-E/z9rfbAOt1vDW1DR7k4SzhzotVV5+qMciWV6LaG1g4jeFrkDlJedjtV4h0i4Q/ITnUu+Pk08M7fczsB9GXBDw== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" - integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== - -"@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.8.3": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz#5ac822ce97eec46741ab70a517971e443a70c5a9" - integrity sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ== - -"@babel/helper-remap-async-to-generator@^7.14.5", "@babel/helper-remap-async-to-generator@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.15.4.tgz#2637c0731e4c90fbf58ac58b50b2b5a192fc970f" - integrity sha512-v53MxgvMK/HCwckJ1bZrq6dNKlmwlyRNYM6ypaRTdXWGOE2c1/SCa6dL/HimhPulGhZKw9W0QhREM583F/t0vQ== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-wrap-function" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-replace-supers@^7.12.1": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.12.5.tgz#f009a17543bbbbce16b06206ae73b63d3fca68d9" - integrity sha512-5YILoed0ZyIpF4gKcpZitEnXEJ9UoDRki1Ey6xz46rxOzfNMAhVIJMoune1hmPVxh40LRv1+oafz7UsWX+vyWA== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.12.1" - "@babel/helper-optimise-call-expression" "^7.10.4" - "@babel/traverse" "^7.12.5" - "@babel/types" "^7.12.5" - -"@babel/helper-replace-supers@^7.14.5", "@babel/helper-replace-supers@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.15.4.tgz#52a8ab26ba918c7f6dee28628b07071ac7b7347a" - integrity sha512-/ztT6khaXF37MS47fufrKvIsiQkx1LBRvSJNzRqmbyeZnTwU9qBxXYLaaT/6KaxfKhjs2Wy8kG8ZdsFUuWBjzw== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.15.4" - "@babel/helper-optimise-call-expression" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helper-simple-access@^7.12.1": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.12.1.tgz#32427e5aa61547d38eb1e6eaf5fd1426fdad9136" - integrity sha512-OxBp7pMrjVewSSC8fXDFrHrBcJATOOFssZwv16F3/6Xtc138GHybBfPbm9kfiqQHKhYQrlamWILwlDCeyMFEaA== - dependencies: - "@babel/types" "^7.12.1" - -"@babel/helper-simple-access@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.15.4.tgz#ac368905abf1de8e9781434b635d8f8674bcc13b" - integrity sha512-UzazrDoIVOZZcTeHHEPYrr1MvTR/K+wgLg6MY6e1CJyaRhbibftF6fR2KU2sFRtI/nERUZR9fBd6aKgBlIBaPg== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-skip-transparent-expression-wrappers@^7.14.5", "@babel/helper-skip-transparent-expression-wrappers@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.15.4.tgz#707dbdba1f4ad0fa34f9114fc8197aec7d5da2eb" - integrity sha512-BMRLsdh+D1/aap19TycS4eD1qELGrCBJwzaY9IE8LrpJtJb+H7rQkPIdsfgnMtLBA6DJls7X9z93Z4U8h7xw0A== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-split-export-declaration@^7.11.0": - version "7.11.0" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.11.0.tgz#f8a491244acf6a676158ac42072911ba83ad099f" - integrity sha512-74Vejvp6mHkGE+m+k5vHY93FX2cAtrw1zXrZXRlG4l410Nm9PxfEiVTn1PjDPV5SnmieiueY4AFg2xqhNFuuZg== - dependencies: - "@babel/types" "^7.11.0" - -"@babel/helper-split-export-declaration@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.15.4.tgz#aecab92dcdbef6a10aa3b62ab204b085f776e257" - integrity sha512-HsFqhLDZ08DxCpBdEVtKmywj6PQbwnF6HHybur0MAnkAKnlS6uHkwnmRIkElB2Owpfb4xL4NwDmDLFubueDXsw== - dependencies: - "@babel/types" "^7.15.4" - -"@babel/helper-validator-identifier@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" - integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== - -"@babel/helper-validator-identifier@^7.14.5", "@babel/helper-validator-identifier@^7.14.9", "@babel/helper-validator-identifier@^7.15.7": - version "7.15.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz#220df993bfe904a4a6b02ab4f3385a5ebf6e2389" - integrity sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w== - -"@babel/helper-validator-option@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" - integrity sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow== - -"@babel/helper-wrap-function@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.15.4.tgz#6f754b2446cfaf3d612523e6ab8d79c27c3a3de7" - integrity sha512-Y2o+H/hRV5W8QhIfTpRIBwl57y8PrZt6JM3V8FOo5qarjshHItyH5lXlpMfBfmBefOqSCpKZs/6Dxqp0E/U+uw== - dependencies: - "@babel/helper-function-name" "^7.15.4" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/helpers@^7.12.1": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.12.5.tgz#1a1ba4a768d9b58310eda516c449913fe647116e" - integrity sha512-lgKGMQlKqA8meJqKsW6rUnc4MdUk35Ln0ATDqdM1a/UpARODdI4j5Y5lVfUScnSNkJcdCRAaWkspykNoFg9sJA== - dependencies: - "@babel/template" "^7.10.4" - "@babel/traverse" "^7.12.5" - "@babel/types" "^7.12.5" - -"@babel/helpers@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.15.4.tgz#5f40f02050a3027121a3cf48d497c05c555eaf43" - integrity sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ== - dependencies: - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/highlight@^7.10.4": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" - integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== - dependencies: - "@babel/helper-validator-identifier" "^7.10.4" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/highlight@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.14.5.tgz#6861a52f03966405001f6aa534a01a24d99e8cd9" - integrity sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg== - dependencies: - "@babel/helper-validator-identifier" "^7.14.5" - chalk "^2.0.0" - js-tokens "^4.0.0" - -"@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.12.3", "@babel/parser@^7.12.5": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.5.tgz#b4af32ddd473c0bfa643bd7ff0728b8e71b81ea0" - integrity sha512-FVM6RZQ0mn2KCf1VUED7KepYeUWoVShczewOCfm3nzoBybaih51h+sYVVGthW9M6lPByEPTQf+xm27PBdlpwmQ== - -"@babel/parser@^7.15.4", "@babel/parser@^7.15.8", "@babel/parser@^7.7.2": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.8.tgz#7bacdcbe71bdc3ff936d510c15dcea7cf0b99016" - integrity sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA== - -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.15.4.tgz#dbdeabb1e80f622d9f0b583efb2999605e0a567e" - integrity sha512-eBnpsl9tlhPhpI10kU06JHnrYXwg3+V6CaP2idsCXNef0aeslpqyITXQ74Vfk5uHgY7IG7XP0yIH8b42KSzHog== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.15.4" - "@babel/plugin-proposal-optional-chaining" "^7.14.5" - -"@babel/plugin-proposal-async-generator-functions@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.15.8.tgz#a3100f785fab4357987c4223ab1b02b599048403" - integrity sha512-2Z5F2R2ibINTc63mY7FLqGfEbmofrHU9FitJW1Q7aPaKFhiPvSq6QEt/BoWN5oME3GVyjcRuNNSRbb9LC0CSWA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-remap-async-to-generator" "^7.15.4" - "@babel/plugin-syntax-async-generators" "^7.8.4" - -"@babel/plugin-proposal-class-properties@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.14.5.tgz#40d1ee140c5b1e31a350f4f5eed945096559b42e" - integrity sha512-q/PLpv5Ko4dVc1LYMpCY7RVAAO4uk55qPwrIuJ5QJ8c6cVuAmhu7I/49JOppXL6gXf7ZHzpRVEUZdYoPLM04Gg== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-proposal-class-static-block@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.15.4.tgz#3e7ca6128453c089e8b477a99f970c63fc1cb8d7" - integrity sha512-M682XWrrLNk3chXCjoPUQWOyYsB93B9z3mRyjtqqYJWDf2mfCdIYgDrA11cgNVhAQieaq6F2fn2f3wI0U4aTjA== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - -"@babel/plugin-proposal-dynamic-import@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.14.5.tgz#0c6617df461c0c1f8fff3b47cd59772360101d2c" - integrity sha512-ExjiNYc3HDN5PXJx+bwC50GIx/KKanX2HiggnIUAYedbARdImiCU4RhhHfdf0Kd7JNXGpsBBBCOm+bBVy3Gb0g== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - -"@babel/plugin-proposal-export-namespace-from@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.14.5.tgz#dbad244310ce6ccd083072167d8cea83a52faf76" - integrity sha512-g5POA32bXPMmSBu5Dx/iZGLGnKmKPc5AiY7qfZgurzrCYgIztDlHFbznSNCoQuv57YQLnQfaDi7dxCtLDIdXdA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - -"@babel/plugin-proposal-json-strings@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.14.5.tgz#38de60db362e83a3d8c944ac858ddf9f0c2239eb" - integrity sha512-NSq2fczJYKVRIsUJyNxrVUMhB27zb7N7pOFGQOhBKJrChbGcgEAqyZrmZswkPk18VMurEeJAaICbfm57vUeTbQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-json-strings" "^7.8.3" - -"@babel/plugin-proposal-logical-assignment-operators@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.14.5.tgz#6e6229c2a99b02ab2915f82571e0cc646a40c738" - integrity sha512-YGn2AvZAo9TwyhlLvCCWxD90Xq8xJ4aSgaX3G5D/8DW94L8aaT+dS5cSP+Z06+rCJERGSr9GxMBZ601xoc2taw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - -"@babel/plugin-proposal-nullish-coalescing-operator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.14.5.tgz#ee38589ce00e2cc59b299ec3ea406fcd3a0fdaf6" - integrity sha512-gun/SOnMqjSb98Nkaq2rTKMwervfdAoz6NphdY0vTfuzMfryj+tDGb2n6UkDKwez+Y8PZDhE3D143v6Gepp4Hg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - -"@babel/plugin-proposal-numeric-separator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.14.5.tgz#83631bf33d9a51df184c2102a069ac0c58c05f18" - integrity sha512-yiclALKe0vyZRZE0pS6RXgjUOt87GWv6FYa5zqj15PvhOGFO69R5DusPlgK/1K5dVnCtegTiWu9UaBSrLLJJBg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - -"@babel/plugin-proposal-object-rest-spread@^7.15.6": - version "7.15.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.15.6.tgz#ef68050c8703d07b25af402cb96cf7f34a68ed11" - integrity sha512-qtOHo7A1Vt+O23qEAX+GdBpqaIuD3i9VRrWgCJeq7WO6H2d14EK3q11urj5Te2MAeK97nMiIdRpwd/ST4JFbNg== - dependencies: - "@babel/compat-data" "^7.15.0" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.15.4" - -"@babel/plugin-proposal-optional-catch-binding@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.14.5.tgz#939dd6eddeff3a67fdf7b3f044b5347262598c3c" - integrity sha512-3Oyiixm0ur7bzO5ybNcZFlmVsygSIQgdOa7cTfOYCMY+wEPAYhZAJxi3mixKFCTCKUhQXuCTtQ1MzrpL3WT8ZQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - -"@babel/plugin-proposal-optional-chaining@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.14.5.tgz#fa83651e60a360e3f13797eef00b8d519695b603" - integrity sha512-ycz+VOzo2UbWNI1rQXxIuMOzrDdHGrI23fRiz/Si2R4kv2XZQ1BK8ccdHwehMKBlcH/joGW/tzrUmo67gbJHlQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.14.5" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - -"@babel/plugin-proposal-private-methods@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.14.5.tgz#37446495996b2945f30f5be5b60d5e2aa4f5792d" - integrity sha512-838DkdUA1u+QTCplatfq4B7+1lnDa/+QMI89x5WZHBcnNv+47N8QEj2k9I2MUU9xIv8XJ4XvPCviM/Dj7Uwt9g== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-proposal-private-property-in-object@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.15.4.tgz#55c5e3b4d0261fd44fe637e3f624cfb0f484e3e5" - integrity sha512-X0UTixkLf0PCCffxgu5/1RQyGGbgZuKoI+vXP4iSbJSYwPb7hu06omsFGBvQ9lJEvwgrxHdS8B5nbfcd8GyUNA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-create-class-features-plugin" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - -"@babel/plugin-proposal-unicode-property-regex@^7.14.5", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.14.5.tgz#0f95ee0e757a5d647f378daa0eca7e93faa8bbe8" - integrity sha512-6axIeOU5LnY471KenAB9vI8I5j7NQ2d652hIYwVyRfgaZT5UpiqFKCuVXCDMSrU+3VFafnu2c5m3lrWIlr6A5Q== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-async-generators@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" - integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-bigint@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" - integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-class-properties@^7.12.13": - version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" - integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== - dependencies: - "@babel/helper-plugin-utils" "^7.12.13" - -"@babel/plugin-syntax-class-properties@^7.8.3": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.1.tgz#bcb297c5366e79bebadef509549cd93b04f19978" - integrity sha512-U40A76x5gTwmESz+qiqssqmeEsKvcSyvtgktrm0uzcARAmM9I1jR221f6Oq+GmHrcD+LvZDag1UTOTe2fL3TeA== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-class-static-block@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" - integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-dynamic-import@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" - integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-export-namespace-from@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz#028964a9ba80dbc094c915c487ad7c4e7a66465a" - integrity sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.3" - -"@babel/plugin-syntax-import-meta@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" - integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-json-strings@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" - integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-logical-assignment-operators@^7.10.4", "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" - integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" - integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-numeric-separator@^7.10.4", "@babel/plugin-syntax-numeric-separator@^7.8.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" - integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-object-rest-spread@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" - integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-catch-binding@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" - integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-optional-chaining@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" - integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== - dependencies: - "@babel/helper-plugin-utils" "^7.8.0" - -"@babel/plugin-syntax-private-property-in-object@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" - integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-top-level-await@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" - integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-syntax-top-level-await@^7.8.3": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz#dd6c0b357ac1bb142d98537450a319625d13d2a0" - integrity sha512-i7ooMZFS+a/Om0crxZodrTzNEPJHZrlMVGMTEpFAj6rYY/bKCddB0Dk/YxfPuYXOopuhKk/e1jV6h+WUU9XN3A== - dependencies: - "@babel/helper-plugin-utils" "^7.10.4" - -"@babel/plugin-syntax-typescript@^7.7.2": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.14.5.tgz#b82c6ce471b165b5ce420cf92914d6fb46225716" - integrity sha512-u6OXzDaIXjEstBRRoBCQ/uKQKlbuaeE5in0RvWdA4pN6AhqxTIwUsnHPU1CFZA/amYObMsuWhYfRl3Ch90HD0Q== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-arrow-functions@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.14.5.tgz#f7187d9588a768dd080bf4c9ffe117ea62f7862a" - integrity sha512-KOnO0l4+tD5IfOdi4x8C1XmEIRWUjNRV8wc6K2vz/3e8yAOoZZvsRXRRIF/yo/MAOFb4QjtAw9xSxMXbSMRy8A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-async-to-generator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.14.5.tgz#72c789084d8f2094acb945633943ef8443d39e67" - integrity sha512-szkbzQ0mNk0rpu76fzDdqSyPu0MuvpXgC+6rz5rpMb5OIRxdmHfQxrktL8CYolL2d8luMCZTR0DpIMIdL27IjA== - dependencies: - "@babel/helper-module-imports" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-remap-async-to-generator" "^7.14.5" - -"@babel/plugin-transform-block-scoped-functions@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.14.5.tgz#e48641d999d4bc157a67ef336aeb54bc44fd3ad4" - integrity sha512-dtqWqdWZ5NqBX3KzsVCWfQI3A53Ft5pWFCT2eCVUftWZgjc5DpDponbIF1+c+7cSGk2wN0YK7HGL/ezfRbpKBQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-block-scoping@^7.15.3": - version "7.15.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.15.3.tgz#94c81a6e2fc230bcce6ef537ac96a1e4d2b3afaf" - integrity sha512-nBAzfZwZb4DkaGtOes1Up1nOAp9TDRRFw4XBzBBSG9QK7KVFmYzgj9o9sbPv7TX5ofL4Auq4wZnxCoPnI/lz2Q== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-classes@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.15.4.tgz#50aee17aaf7f332ae44e3bce4c2e10534d5d3bf1" - integrity sha512-Yjvhex8GzBmmPQUvpXRPWQ9WnxXgAFuZSrqOK/eJlOGIXwvv8H3UEdUigl1gb/bnjTrln+e8bkZUYCBt/xYlBg== - dependencies: - "@babel/helper-annotate-as-pure" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-optimise-call-expression" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-replace-supers" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - globals "^11.1.0" - -"@babel/plugin-transform-computed-properties@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.14.5.tgz#1b9d78987420d11223d41195461cc43b974b204f" - integrity sha512-pWM+E4283UxaVzLb8UBXv4EIxMovU4zxT1OPnpHJcmnvyY9QbPPTKZfEj31EUvG3/EQRbYAGaYEUZ4yWOBC2xg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-destructuring@^7.14.7": - version "7.14.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.14.7.tgz#0ad58ed37e23e22084d109f185260835e5557576" - integrity sha512-0mDE99nK+kVh3xlc5vKwB6wnP9ecuSj+zQCa/n0voENtP/zymdT4HH6QEb65wjjcbqr1Jb/7z9Qp7TF5FtwYGw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-dotall-regex@^7.14.5", "@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.14.5.tgz#2f6bf76e46bdf8043b4e7e16cf24532629ba0c7a" - integrity sha512-loGlnBdj02MDsFaHhAIJzh7euK89lBrGIdM9EAtHFo6xKygCUGuuWe07o1oZVk287amtW1n0808sQM99aZt3gw== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-duplicate-keys@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.14.5.tgz#365a4844881bdf1501e3a9f0270e7f0f91177954" - integrity sha512-iJjbI53huKbPDAsJ8EmVmvCKeeq21bAze4fu9GBQtSLqfvzj2oRuHVx4ZkDwEhg1htQ+5OBZh/Ab0XDf5iBZ7A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-exponentiation-operator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.14.5.tgz#5154b8dd6a3dfe6d90923d61724bd3deeb90b493" - integrity sha512-jFazJhMBc9D27o9jDnIE5ZErI0R0m7PbKXVq77FFvqFbzvTMuv8jaAwLZ5PviOLSFttqKIW0/wxNSDbjLk0tYA== - dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-for-of@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.15.4.tgz#25c62cce2718cfb29715f416e75d5263fb36a8c2" - integrity sha512-DRTY9fA751AFBDh2oxydvVm4SYevs5ILTWLs6xKXps4Re/KG5nfUkr+TdHCrRWB8C69TlzVgA9b3RmGWmgN9LA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-function-name@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.14.5.tgz#e81c65ecb900746d7f31802f6bed1f52d915d6f2" - integrity sha512-vbO6kv0fIzZ1GpmGQuvbwwm+O4Cbm2NrPzwlup9+/3fdkuzo1YqOZcXw26+YUJB84Ja7j9yURWposEHLYwxUfQ== - dependencies: - "@babel/helper-function-name" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.14.5.tgz#41d06c7ff5d4d09e3cf4587bd3ecf3930c730f78" - integrity sha512-ql33+epql2F49bi8aHXxvLURHkxJbSmMKl9J5yHqg4PLtdE6Uc48CH1GS6TQvZ86eoB/ApZXwm7jlA+B3kra7A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-member-expression-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.14.5.tgz#b39cd5212a2bf235a617d320ec2b48bcc091b8a7" - integrity sha512-WkNXxH1VXVTKarWFqmso83xl+2V3Eo28YY5utIkbsmXoItO8Q3aZxN4BTS2k0hz9dGUloHK26mJMyQEYfkn/+Q== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-modules-amd@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.14.5.tgz#4fd9ce7e3411cb8b83848480b7041d83004858f7" - integrity sha512-3lpOU8Vxmp3roC4vzFpSdEpGUWSMsHFreTWOMMLzel2gNGfHE5UWIh/LN6ghHs2xurUp4jRFYMUIZhuFbody1g== - dependencies: - "@babel/helper-module-transforms" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - babel-plugin-dynamic-import-node "^2.3.3" - -"@babel/plugin-transform-modules-commonjs@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.15.4.tgz#8201101240eabb5a76c08ef61b2954f767b6b4c1" - integrity sha512-qg4DPhwG8hKp4BbVDvX1s8cohM8a6Bvptu4l6Iingq5rW+yRUAhe/YRup/YcW2zCOlrysEWVhftIcKzrEZv3sA== - dependencies: - "@babel/helper-module-transforms" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-simple-access" "^7.15.4" - babel-plugin-dynamic-import-node "^2.3.3" - -"@babel/plugin-transform-modules-systemjs@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.15.4.tgz#b42890c7349a78c827719f1d2d0cd38c7d268132" - integrity sha512-fJUnlQrl/mezMneR72CKCgtOoahqGJNVKpompKwzv3BrEXdlPspTcyxrZ1XmDTIr9PpULrgEQo3qNKp6dW7ssw== - dependencies: - "@babel/helper-hoist-variables" "^7.15.4" - "@babel/helper-module-transforms" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-validator-identifier" "^7.14.9" - babel-plugin-dynamic-import-node "^2.3.3" - -"@babel/plugin-transform-modules-umd@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.14.5.tgz#fb662dfee697cce274a7cda525190a79096aa6e0" - integrity sha512-RfPGoagSngC06LsGUYyM9QWSXZ8MysEjDJTAea1lqRjNECE3y0qIJF/qbvJxc4oA4s99HumIMdXOrd+TdKaAAA== - dependencies: - "@babel/helper-module-transforms" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-named-capturing-groups-regex@^7.14.9": - version "7.14.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.14.9.tgz#c68f5c5d12d2ebaba3762e57c2c4f6347a46e7b2" - integrity sha512-l666wCVYO75mlAtGFfyFwnWmIXQm3kSH0C3IRnJqWcZbWkoihyAdDhFm2ZWaxWTqvBvhVFfJjMRQ0ez4oN1yYA== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - -"@babel/plugin-transform-new-target@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.14.5.tgz#31bdae8b925dc84076ebfcd2a9940143aed7dbf8" - integrity sha512-Nx054zovz6IIRWEB49RDRuXGI4Gy0GMgqG0cII9L3MxqgXz/+rgII+RU58qpo4g7tNEx1jG7rRVH4ihZoP4esQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-object-super@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.14.5.tgz#d0b5faeac9e98597a161a9cf78c527ed934cdc45" - integrity sha512-MKfOBWzK0pZIrav9z/hkRqIk/2bTv9qvxHzPQc12RcVkMOzpIKnFCNYJip00ssKWYkd8Sf5g0Wr7pqJ+cmtuFg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-replace-supers" "^7.14.5" - -"@babel/plugin-transform-parameters@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.15.4.tgz#5f2285cc3160bf48c8502432716b48504d29ed62" - integrity sha512-9WB/GUTO6lvJU3XQsSr6J/WKvBC2hcs4Pew8YxZagi6GkTdniyqp8On5kqdK8MN0LMeu0mGbhPN+O049NV/9FQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-property-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.14.5.tgz#0ddbaa1f83db3606f1cdf4846fa1dfb473458b34" - integrity sha512-r1uilDthkgXW8Z1vJz2dKYLV1tuw2xsbrp3MrZmD99Wh9vsfKoob+JTgri5VUb/JqyKRXotlOtwgu4stIYCmnw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-regenerator@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.14.5.tgz#9676fd5707ed28f522727c5b3c0aa8544440b04f" - integrity sha512-NVIY1W3ITDP5xQl50NgTKlZ0GrotKtLna08/uGY6ErQt6VEQZXla86x/CTddm5gZdcr+5GSsvMeTmWA5Ii6pkg== - dependencies: - regenerator-transform "^0.14.2" - -"@babel/plugin-transform-reserved-words@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.14.5.tgz#c44589b661cfdbef8d4300dcc7469dffa92f8304" - integrity sha512-cv4F2rv1nD4qdexOGsRQXJrOcyb5CrgjUH9PKrrtyhSDBNWGxd0UIitjyJiWagS+EbUGjG++22mGH1Pub8D6Vg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-runtime@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.15.8.tgz#9d15b1e94e1c7f6344f65a8d573597d93c6cd886" - integrity sha512-+6zsde91jMzzvkzuEA3k63zCw+tm/GvuuabkpisgbDMTPQsIMHllE3XczJFFtEHLjjhKQFZmGQVRdELetlWpVw== - dependencies: - "@babel/helper-module-imports" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - babel-plugin-polyfill-corejs2 "^0.2.2" - babel-plugin-polyfill-corejs3 "^0.2.5" - babel-plugin-polyfill-regenerator "^0.2.2" - semver "^6.3.0" - -"@babel/plugin-transform-shorthand-properties@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.14.5.tgz#97f13855f1409338d8cadcbaca670ad79e091a58" - integrity sha512-xLucks6T1VmGsTB+GWK5Pl9Jl5+nRXD1uoFdA5TSO6xtiNjtXTjKkmPdFXVLGlK5A2/or/wQMKfmQ2Y0XJfn5g== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-spread@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.15.8.tgz#79d5aa27f68d700449b2da07691dfa32d2f6d468" - integrity sha512-/daZ8s2tNaRekl9YJa9X4bzjpeRZLt122cpgFnQPLGUe61PH8zMEBmYqKkW5xF5JUEh5buEGXJoQpqBmIbpmEQ== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-skip-transparent-expression-wrappers" "^7.15.4" - -"@babel/plugin-transform-sticky-regex@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.14.5.tgz#5b617542675e8b7761294381f3c28c633f40aeb9" - integrity sha512-Z7F7GyvEMzIIbwnziAZmnSNpdijdr4dWt+FJNBnBLz5mwDFkqIXU9wmBcWWad3QeJF5hMTkRe4dAq2sUZiG+8A== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-template-literals@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.14.5.tgz#a5f2bc233937d8453885dc736bdd8d9ffabf3d93" - integrity sha512-22btZeURqiepOfuy/VkFr+zStqlujWaarpMErvay7goJS6BWwdd6BY9zQyDLDa4x2S3VugxFb162IZ4m/S/+Gg== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-typeof-symbol@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.14.5.tgz#39af2739e989a2bd291bf6b53f16981423d457d4" - integrity sha512-lXzLD30ffCWseTbMQzrvDWqljvZlHkXU+CnseMhkMNqU1sASnCsz3tSzAaH3vCUXb9PHeUb90ZT1BdFTm1xxJw== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-unicode-escapes@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.14.5.tgz#9d4bd2a681e3c5d7acf4f57fa9e51175d91d0c6b" - integrity sha512-crTo4jATEOjxj7bt9lbYXcBAM3LZaUrbP2uUdxb6WIorLmjNKSpHfIybgY4B8SRpbf8tEVIWH3Vtm7ayCrKocA== - dependencies: - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/plugin-transform-unicode-regex@^7.14.5": - version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.14.5.tgz#4cd09b6c8425dd81255c7ceb3fb1836e7414382e" - integrity sha512-UygduJpC5kHeCiRw/xDVzC+wj8VaYSoKl5JNVmbP7MadpNinAm3SvZCxZ42H37KZBKztz46YC73i9yV34d0Tzw== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.14.5" - "@babel/helper-plugin-utils" "^7.14.5" - -"@babel/preset-env@^7.15.8": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.15.8.tgz#f527ce5bcb121cd199f6b502bf23e420b3ff8dba" - integrity sha512-rCC0wH8husJgY4FPbHsiYyiLxSY8oMDJH7Rl6RQMknbN9oDDHhM9RDFvnGM2MgkbUJzSQB4gtuwygY5mCqGSsA== - dependencies: - "@babel/compat-data" "^7.15.0" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-plugin-utils" "^7.14.5" - "@babel/helper-validator-option" "^7.14.5" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.15.4" - "@babel/plugin-proposal-async-generator-functions" "^7.15.8" - "@babel/plugin-proposal-class-properties" "^7.14.5" - "@babel/plugin-proposal-class-static-block" "^7.15.4" - "@babel/plugin-proposal-dynamic-import" "^7.14.5" - "@babel/plugin-proposal-export-namespace-from" "^7.14.5" - "@babel/plugin-proposal-json-strings" "^7.14.5" - "@babel/plugin-proposal-logical-assignment-operators" "^7.14.5" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.14.5" - "@babel/plugin-proposal-numeric-separator" "^7.14.5" - "@babel/plugin-proposal-object-rest-spread" "^7.15.6" - "@babel/plugin-proposal-optional-catch-binding" "^7.14.5" - "@babel/plugin-proposal-optional-chaining" "^7.14.5" - "@babel/plugin-proposal-private-methods" "^7.14.5" - "@babel/plugin-proposal-private-property-in-object" "^7.15.4" - "@babel/plugin-proposal-unicode-property-regex" "^7.14.5" - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-class-properties" "^7.12.13" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - "@babel/plugin-syntax-top-level-await" "^7.14.5" - "@babel/plugin-transform-arrow-functions" "^7.14.5" - "@babel/plugin-transform-async-to-generator" "^7.14.5" - "@babel/plugin-transform-block-scoped-functions" "^7.14.5" - "@babel/plugin-transform-block-scoping" "^7.15.3" - "@babel/plugin-transform-classes" "^7.15.4" - "@babel/plugin-transform-computed-properties" "^7.14.5" - "@babel/plugin-transform-destructuring" "^7.14.7" - "@babel/plugin-transform-dotall-regex" "^7.14.5" - "@babel/plugin-transform-duplicate-keys" "^7.14.5" - "@babel/plugin-transform-exponentiation-operator" "^7.14.5" - "@babel/plugin-transform-for-of" "^7.15.4" - "@babel/plugin-transform-function-name" "^7.14.5" - "@babel/plugin-transform-literals" "^7.14.5" - "@babel/plugin-transform-member-expression-literals" "^7.14.5" - "@babel/plugin-transform-modules-amd" "^7.14.5" - "@babel/plugin-transform-modules-commonjs" "^7.15.4" - "@babel/plugin-transform-modules-systemjs" "^7.15.4" - "@babel/plugin-transform-modules-umd" "^7.14.5" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.14.9" - "@babel/plugin-transform-new-target" "^7.14.5" - "@babel/plugin-transform-object-super" "^7.14.5" - "@babel/plugin-transform-parameters" "^7.15.4" - "@babel/plugin-transform-property-literals" "^7.14.5" - "@babel/plugin-transform-regenerator" "^7.14.5" - "@babel/plugin-transform-reserved-words" "^7.14.5" - "@babel/plugin-transform-shorthand-properties" "^7.14.5" - "@babel/plugin-transform-spread" "^7.15.8" - "@babel/plugin-transform-sticky-regex" "^7.14.5" - "@babel/plugin-transform-template-literals" "^7.14.5" - "@babel/plugin-transform-typeof-symbol" "^7.14.5" - "@babel/plugin-transform-unicode-escapes" "^7.14.5" - "@babel/plugin-transform-unicode-regex" "^7.14.5" - "@babel/preset-modules" "^0.1.4" - "@babel/types" "^7.15.6" - babel-plugin-polyfill-corejs2 "^0.2.2" - babel-plugin-polyfill-corejs3 "^0.2.5" - babel-plugin-polyfill-regenerator "^0.2.2" - core-js-compat "^3.16.0" - semver "^6.3.0" - -"@babel/preset-modules@^0.1.4": - version "0.1.4" - resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.4.tgz#362f2b68c662842970fdb5e254ffc8fc1c2e415e" - integrity sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/types" "^7.4.4" - esutils "^2.0.2" - -"@babel/runtime@^7.8.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.15.4.tgz#fd17d16bfdf878e6dd02d19753a39fa8a8d9c84a" - integrity sha512-99catp6bHCaxr4sJ/DbTGgHS4+Rs2RVd2g7iOap6SLGPDknRK9ztKNsE/Fg6QhSeh1FGE5f6gHGQmvvn3I3xhw== - dependencies: - regenerator-runtime "^0.13.4" - -"@babel/template@^7.10.4", "@babel/template@^7.3.3": - version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" - integrity sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/parser" "^7.10.4" - "@babel/types" "^7.10.4" - -"@babel/template@^7.15.4": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194" - integrity sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg== - dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/parser" "^7.15.4" - "@babel/types" "^7.15.4" - -"@babel/traverse@^7.1.0", "@babel/traverse@^7.12.1", "@babel/traverse@^7.12.5": - version "7.12.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.12.5.tgz#78a0c68c8e8a35e4cacfd31db8bb303d5606f095" - integrity sha512-xa15FbQnias7z9a62LwYAA5SZZPkHIXpd42C6uW68o8uTuua96FHZy1y61Va5P/i83FAAcMpW8+A/QayntzuqA== - dependencies: - "@babel/code-frame" "^7.10.4" - "@babel/generator" "^7.12.5" - "@babel/helper-function-name" "^7.10.4" - "@babel/helper-split-export-declaration" "^7.11.0" - "@babel/parser" "^7.12.5" - "@babel/types" "^7.12.5" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.19" - -"@babel/traverse@^7.13.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.7.2": - version "7.15.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" - integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== - dependencies: - "@babel/code-frame" "^7.14.5" - "@babel/generator" "^7.15.4" - "@babel/helper-function-name" "^7.15.4" - "@babel/helper-hoist-variables" "^7.15.4" - "@babel/helper-split-export-declaration" "^7.15.4" - "@babel/parser" "^7.15.4" - "@babel/types" "^7.15.4" - debug "^4.1.0" - globals "^11.1.0" - -"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.11.0", "@babel/types@^7.12.1", "@babel/types@^7.12.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.12.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.12.6.tgz#ae0e55ef1cce1fbc881cd26f8234eb3e657edc96" - integrity sha512-hwyjw6GvjBLiyy3W0YQf0Z5Zf4NpYejUnKFcfcUhZCSffoBBp30w6wP2Wn6pk31jMYZvcOrB/1b7cGXvEoKogA== - dependencies: - "@babel/helper-validator-identifier" "^7.10.4" - lodash "^4.17.19" - to-fast-properties "^2.0.0" - -"@babel/types@^7.15.4", "@babel/types@^7.15.6", "@babel/types@^7.4.4": - version "7.15.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f" - integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig== - dependencies: - "@babel/helper-validator-identifier" "^7.14.9" - to-fast-properties "^2.0.0" - -"@bcoe/v8-coverage@^0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" - integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== - -"@istanbuljs/load-nyc-config@^1.0.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" - integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== - dependencies: - camelcase "^5.3.1" - find-up "^4.1.0" - get-package-type "^0.1.0" - js-yaml "^3.13.1" - resolve-from "^5.0.0" - -"@istanbuljs/schema@^0.1.2": - version "0.1.2" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" - integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== - -"@jest/console@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.3.1.tgz#e8ea3a475d3f8162f23d69efbfaa9cbe486bee93" - integrity sha512-RkFNWmv0iui+qsOr/29q9dyfKTTT5DCuP31kUwg7rmOKPT/ozLeGLKJKVIiOfbiKyleUZKIrHwhmiZWVe8IMdw== - dependencies: - "@jest/types" "^27.2.5" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^27.3.1" - jest-util "^27.3.1" - slash "^3.0.0" - -"@jest/core@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.3.1.tgz#04992ef1b58b17c459afb87ab56d81e63d386925" - integrity sha512-DMNE90RR5QKx0EA+wqe3/TNEwiRpOkhshKNxtLxd4rt3IZpCt+RSL+FoJsGeblRZmqdK4upHA/mKKGPPRAifhg== - dependencies: - "@jest/console" "^27.3.1" - "@jest/reporters" "^27.3.1" - "@jest/test-result" "^27.3.1" - "@jest/transform" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - emittery "^0.8.1" - exit "^0.1.2" - graceful-fs "^4.2.4" - jest-changed-files "^27.3.0" - jest-config "^27.3.1" - jest-haste-map "^27.3.1" - jest-message-util "^27.3.1" - jest-regex-util "^27.0.6" - jest-resolve "^27.3.1" - jest-resolve-dependencies "^27.3.1" - jest-runner "^27.3.1" - jest-runtime "^27.3.1" - jest-snapshot "^27.3.1" - jest-util "^27.3.1" - jest-validate "^27.3.1" - jest-watcher "^27.3.1" - micromatch "^4.0.4" - rimraf "^3.0.0" - slash "^3.0.0" - strip-ansi "^6.0.0" - -"@jest/environment@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.3.1.tgz#2182defbce8d385fd51c5e7c7050f510bd4c86b1" - integrity sha512-BCKCj4mOVLme6Tanoyc9k0ultp3pnmuyHw73UHRPeeZxirsU/7E3HC4le/VDb/SMzE1JcPnto+XBKFOcoiJzVw== - dependencies: - "@jest/fake-timers" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - jest-mock "^27.3.0" - -"@jest/fake-timers@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.3.1.tgz#1fad860ee9b13034762cdb94266e95609dfce641" - integrity sha512-M3ZFgwwlqJtWZ+QkBG5NmC23A9w+A6ZxNsO5nJxJsKYt4yguBd3i8TpjQz5NfCX91nEve1KqD9RA2Q+Q1uWqoA== - dependencies: - "@jest/types" "^27.2.5" - "@sinonjs/fake-timers" "^8.0.1" - "@types/node" "*" - jest-message-util "^27.3.1" - jest-mock "^27.3.0" - jest-util "^27.3.1" - -"@jest/globals@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.3.1.tgz#ce1dfb03d379237a9da6c1b99ecfaca1922a5f9e" - integrity sha512-Q651FWiWQAIFiN+zS51xqhdZ8g9b88nGCobC87argAxA7nMfNQq0Q0i9zTfQYgLa6qFXk2cGANEqfK051CZ8Pg== - dependencies: - "@jest/environment" "^27.3.1" - "@jest/types" "^27.2.5" - expect "^27.3.1" - -"@jest/reporters@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.3.1.tgz#28b5c1f5789481e23788048fa822ed15486430b9" - integrity sha512-m2YxPmL9Qn1emFVgZGEiMwDntDxRRQ2D58tiDQlwYTg5GvbFOKseYCcHtn0WsI8CG4vzPglo3nqbOiT8ySBT/w== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^27.3.1" - "@jest/test-result" "^27.3.1" - "@jest/transform" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.2.4" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^4.0.3" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.2" - jest-haste-map "^27.3.1" - jest-resolve "^27.3.1" - jest-util "^27.3.1" - jest-worker "^27.3.1" - slash "^3.0.0" - source-map "^0.6.0" - string-length "^4.0.1" - terminal-link "^2.0.0" - v8-to-istanbul "^8.1.0" - -"@jest/source-map@^27.0.6": - version "27.0.6" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-27.0.6.tgz#be9e9b93565d49b0548b86e232092491fb60551f" - integrity sha512-Fek4mi5KQrqmlY07T23JRi0e7Z9bXTOOD86V/uS0EIW4PClvPDqZOyFlLpNJheS6QI0FNX1CgmPjtJ4EA/2M+g== - dependencies: - callsites "^3.0.0" - graceful-fs "^4.2.4" - source-map "^0.6.0" - -"@jest/test-result@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.3.1.tgz#89adee8b771877c69b3b8d59f52f29dccc300194" - integrity sha512-mLn6Thm+w2yl0opM8J/QnPTqrfS4FoXsXF2WIWJb2O/GBSyResL71BRuMYbYRsGt7ELwS5JGcEcGb52BNrumgg== - dependencies: - "@jest/console" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - -"@jest/test-sequencer@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.3.1.tgz#4b3bde2dbb05ee74afdae608cf0768e3354683b1" - integrity sha512-siySLo07IMEdSjA4fqEnxfIX8lB/lWYsBPwNFtkOvsFQvmBrL3yj3k3uFNZv/JDyApTakRpxbKLJ3CT8UGVCrA== - dependencies: - "@jest/test-result" "^27.3.1" - graceful-fs "^4.2.4" - jest-haste-map "^27.3.1" - jest-runtime "^27.3.1" - -"@jest/transform@^27.3.1": - version "27.3.1" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.3.1.tgz#ff80eafbeabe811e9025e4b6f452126718455220" - integrity sha512-3fSvQ02kuvjOI1C1ssqMVBKJpZf6nwoCiSu00zAKh5nrp3SptNtZy/8s5deayHnqxhjD9CWDJ+yqQwuQ0ZafXQ== - dependencies: - "@babel/core" "^7.1.0" - "@jest/types" "^27.2.5" - babel-plugin-istanbul "^6.0.0" - chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" - graceful-fs "^4.2.4" - jest-haste-map "^27.3.1" - jest-regex-util "^27.0.6" - jest-util "^27.3.1" - micromatch "^4.0.4" - pirates "^4.0.1" - slash "^3.0.0" - source-map "^0.6.1" - write-file-atomic "^3.0.0" - -"@jest/types@^27.2.5": - version "27.2.5" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.2.5.tgz#420765c052605e75686982d24b061b4cbba22132" - integrity sha512-nmuM4VuDtCZcY+eTpw+0nvstwReMsjPoj7ZR80/BbixulhLaiX+fbv8oeLW8WZlJMcsGQsTmMKT/iTZu1Uy/lQ== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.0" - "@types/istanbul-reports" "^3.0.0" - "@types/node" "*" - "@types/yargs" "^16.0.0" - chalk "^4.0.0" - -"@sinonjs/commons@^1.7.0": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217" - integrity sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw== - dependencies: - type-detect "4.0.8" - -"@sinonjs/fake-timers@^8.0.1": - version "8.0.1" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-8.0.1.tgz#1c1c9a91419f804e59ae8df316a07dd1c3a76b94" - integrity sha512-AU7kwFxreVd6OAXcAFlKSmZquiRUU0FvYm44k1Y1QbK7Co4m0aqfGMhjykIeQp/H6rcl+nFmj0zfdUcGVs9Dew== - dependencies: - "@sinonjs/commons" "^1.7.0" - -"@tootallnate/once@1": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" - integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== - -"@types/babel__core@^7.0.0": - version "7.1.12" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.12.tgz#4d8e9e51eb265552a7e4f1ff2219ab6133bdfb2d" - integrity sha512-wMTHiiTiBAAPebqaPiPDLFA4LYPKr6Ph0Xq/6rq1Ur3v66HXyG+clfR9CNETkD7MQS8ZHvpQOtA53DLws5WAEQ== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__core@^7.1.14": - version "7.1.16" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.16.tgz#bc12c74b7d65e82d29876b5d0baf5c625ac58702" - integrity sha512-EAEHtisTMM+KaKwfWdC3oyllIqswlznXCIVCt7/oRNrh+DhgT4UEBNC/jlADNjvw7UnfbcdkGQcPVZ1xYiLcrQ== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - "@types/babel__generator" "*" - "@types/babel__template" "*" - "@types/babel__traverse" "*" - -"@types/babel__generator@*": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.2.tgz#f3d71178e187858f7c45e30380f8f1b7415a12d8" - integrity sha512-MdSJnBjl+bdwkLskZ3NGFp9YcXGx5ggLpQQPqtgakVhsWK0hTtNYhjpZLlWQTviGTvF8at+Bvli3jV7faPdgeQ== - dependencies: - "@babel/types" "^7.0.0" - -"@types/babel__template@*": - version "7.0.3" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.0.3.tgz#b8aaeba0a45caca7b56a5de9459872dde3727214" - integrity sha512-uCoznIPDmnickEi6D0v11SBpW0OuVqHJCa7syXqQHy5uktSCreIlt0iglsCnmvz8yCb38hGcWeseA8cWJSwv5Q== - dependencies: - "@babel/parser" "^7.1.0" - "@babel/types" "^7.0.0" - -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": - version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.15.tgz#db9e4238931eb69ef8aab0ad6523d4d4caa39d03" - integrity sha512-Pzh9O3sTK8V6I1olsXpCfj2k/ygO2q1X0vhhnDrEQyYLHZesWz+zMZMVcwXLCYf0U36EtmyYaFGPfXlTtDHe3A== - dependencies: - "@babel/types" "^7.3.0" - -"@types/graceful-fs@^4.1.2": - version "4.1.4" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.4.tgz#4ff9f641a7c6d1a3508ff88bc3141b152772e753" - integrity sha512-mWA/4zFQhfvOA8zWkXobwJvBD7vzcxgrOQ0J5CH1votGqdq9m7+FwtGaqyCZqC3NyyBkc9z4m+iry4LlqcMWJg== - dependencies: - "@types/node" "*" - -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": - version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762" - integrity sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw== - -"@types/istanbul-lib-report@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#c14c24f18ea8190c118ee7562b7ff99a36552686" - integrity sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg== - dependencies: - "@types/istanbul-lib-coverage" "*" - -"@types/istanbul-reports@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.0.tgz#508b13aa344fa4976234e75dddcc34925737d821" - integrity sha512-nwKNbvnwJ2/mndE9ItP/zc2TCzw6uuodnF4EHYWD+gCQDVBuRQL5UzbZD0/ezy1iKsFU2ZQiDqg4M9dN4+wZgA== - dependencies: - "@types/istanbul-lib-report" "*" - -"@types/node@*": - version "14.14.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.7.tgz#8ea1e8f8eae2430cf440564b98c6dfce1ec5945d" - integrity sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg== - -"@types/prettier@^2.1.5": - version "2.4.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.4.1.tgz#e1303048d5389563e130f5bdd89d37a99acb75eb" - integrity sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw== - -"@types/stack-utils@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.0.tgz#7036640b4e21cc2f259ae826ce843d277dad8cff" - integrity sha512-RJJrrySY7A8havqpGObOB4W92QXKJo63/jFLLgpvOtsGUqbQZ9Sbgl35KMm1DjC6j7AvmmU2bIno+3IyEaemaw== - -"@types/yargs-parser@*": - version "15.0.0" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-15.0.0.tgz#cb3f9f741869e20cce330ffbeb9271590483882d" - integrity sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw== - -"@types/yargs@^16.0.0": - version "16.0.4" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-16.0.4.tgz#26aad98dd2c2a38e421086ea9ad42b9e51642977" - integrity sha512-T8Yc9wt/5LbJyCaLiHPReJa0kApcIgJ7Bn735GjItUfh08Z1pJvu8QZqb9s+mMvKV6WUQRV7K2R46YbjMXTTJw== - dependencies: - "@types/yargs-parser" "*" - -abab@^2.0.3, abab@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" - integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== - -acorn-globals@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" - integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== - dependencies: - acorn "^7.1.1" - acorn-walk "^7.1.1" - -acorn-walk@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - -acorn@^7.1.1: - version "7.4.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" - integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== - -acorn@^8.2.4: - version "8.5.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.5.0.tgz#4512ccb99b3698c752591e9bb4472e38ad43cee2" - integrity sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q== - -agent-base@6: - version "6.0.2" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77" - integrity sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ== - dependencies: - debug "4" - -ansi-escapes@^4.2.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61" - integrity sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA== - dependencies: - type-fest "^0.11.0" +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== ansi-regex@^5.0.0, ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" +ansi-regex@^6.0.1: + version "6.2.2" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.2.2.tgz#60216eea464d864597ce2832000738a0589650c1" + integrity sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg== ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: - color-convert "^2.0.1" - -ansi-styles@^5.0.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" - integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== - -anymatch@^3.0.3: - version "3.1.1" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" - integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== - dependencies: - normalize-path "^3.0.0" - picomatch "^2.0.4" - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - -babel-jest@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.3.1.tgz#0636a3404c68e07001e434ac4956d82da8a80022" - integrity sha512-SjIF8hh/ir0peae2D6S6ZKRhUy7q/DnpH7k/V6fT4Bgs/LXXUztOpX4G2tCgq8mLo5HA9mN6NmlFMeYtKmIsTQ== - dependencies: - "@jest/transform" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/babel__core" "^7.1.14" - babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^27.2.0" - chalk "^4.0.0" - graceful-fs "^4.2.4" - slash "^3.0.0" - -babel-plugin-dynamic-import-node@^2.3.3: - version "2.3.3" - resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" - integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ== - dependencies: - object.assign "^4.1.0" - -babel-plugin-istanbul@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz#e159ccdc9af95e0b570c75b4573b7c34d671d765" - integrity sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@istanbuljs/load-nyc-config" "^1.0.0" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-instrument "^4.0.0" - test-exclude "^6.0.0" - -babel-plugin-jest-hoist@^27.2.0: - version "27.2.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.2.0.tgz#79f37d43f7e5c4fdc4b2ca3e10cc6cf545626277" - integrity sha512-TOux9khNKdi64mW+0OIhcmbAn75tTlzKhxmiNXevQaPbrBYK7YKjP1jl6NHTJ6XR5UgUrJbCnWlKVnJn29dfjw== - dependencies: - "@babel/template" "^7.3.3" - "@babel/types" "^7.3.3" - "@types/babel__core" "^7.0.0" - "@types/babel__traverse" "^7.0.6" - -babel-plugin-polyfill-corejs2@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.2.2.tgz#e9124785e6fd94f94b618a7954e5693053bf5327" - integrity sha512-kISrENsJ0z5dNPq5eRvcctITNHYXWOA4DUZRFYCz3jYCcvTb/A546LIddmoGNMVYg2U38OyFeNosQwI9ENTqIQ== - dependencies: - "@babel/compat-data" "^7.13.11" - "@babel/helper-define-polyfill-provider" "^0.2.2" - semver "^6.1.1" - -babel-plugin-polyfill-corejs3@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.2.5.tgz#2779846a16a1652244ae268b1e906ada107faf92" - integrity sha512-ninF5MQNwAX9Z7c9ED+H2pGt1mXdP4TqzlHKyPIYmJIYz0N+++uwdM7RnJukklhzJ54Q84vA4ZJkgs7lu5vqcw== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.2.2" - core-js-compat "^3.16.2" - -babel-plugin-polyfill-regenerator@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.2.2.tgz#b310c8d642acada348c1fa3b3e6ce0e851bee077" - integrity sha512-Goy5ghsc21HgPDFtzRkSirpZVW35meGoTmTOb2bxqdl60ghub4xOidgNTHaZfQ2FaxQsKmwvXtOAkcIS4SMBWg== - dependencies: - "@babel/helper-define-polyfill-provider" "^0.2.2" - -babel-preset-current-node-syntax@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.0.tgz#cf5feef29551253471cfa82fc8e0f5063df07a77" - integrity sha512-mGkvkpocWJes1CmMKtgGUwCeeq0pOhALyymozzDWYomHTbDLwueDYG6p4TK1YOeYHCzBzYPsWkgTto10JubI1Q== - dependencies: - "@babel/plugin-syntax-async-generators" "^7.8.4" - "@babel/plugin-syntax-bigint" "^7.8.3" - "@babel/plugin-syntax-class-properties" "^7.8.3" - "@babel/plugin-syntax-import-meta" "^7.8.3" - "@babel/plugin-syntax-json-strings" "^7.8.3" - "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - "@babel/plugin-syntax-numeric-separator" "^7.8.3" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - "@babel/plugin-syntax-top-level-await" "^7.8.3" - -babel-preset-jest@^27.2.0: - version "27.2.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-27.2.0.tgz#556bbbf340608fed5670ab0ea0c8ef2449fba885" - integrity sha512-z7MgQ3peBwN5L5aCqBKnF6iqdlvZvFUQynEhu0J+X9nHLU72jO3iY331lcYrg+AssJ8q7xsv5/3AICzVmJ/wvg== - dependencies: - babel-plugin-jest-hoist "^27.2.0" - babel-preset-current-node-syntax "^1.0.0" - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -braces@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== - dependencies: - fill-range "^7.0.1" - -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== - -browserslist@^4.16.6, browserslist@^4.17.3: - version "4.17.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.4.tgz#72e2508af2a403aec0a49847ef31bd823c57ead4" - integrity sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ== - dependencies: - caniuse-lite "^1.0.30001265" - electron-to-chromium "^1.3.867" - escalade "^3.1.1" - node-releases "^2.0.0" - picocolors "^1.0.0" - -bser@2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" - integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== - dependencies: - node-int64 "^0.4.0" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - -call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" - integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - -call-bind@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.0.tgz#24127054bb3f9bdcb4b1fb82418186072f77b8ce" - integrity sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w== - dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.0" - -callsites@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" - integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== - -camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== - -camelcase@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" - integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== - -caniuse-lite@^1.0.30001265: - version "1.0.30001270" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001270.tgz#cc9c37a4ec5c1a8d616fc7bace902bb053b0cdea" - integrity sha512-TcIC7AyNWXhcOmv2KftOl1ShFAaHQYcB/EPL/hEyMrcS7ZX0/DvV1aoy6BzV0+16wTpoAyTMGDNAJfSqS/rz7A== - -chalk@^2.0.0: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -chalk@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" - integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -char-regex@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" - integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== - -ci-info@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.2.0.tgz#2876cb948a498797b5236f0095bc057d0dca38b6" - integrity sha512-dVqRX7fLUm8J6FgHJ418XuIgDLZDkYcDFTeL6TA2gt5WlIZUQrrH6EZrNClwT/H0FateUsZkGIOPRrLbP+PR9A== - -cjs-module-lexer@^1.0.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.2.tgz#9f84ba3244a512f3a54e5277e8eef4c489864e40" - integrity sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA== - -cliui@^7.0.2: - version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" - integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== - dependencies: - string-width "^4.2.0" - strip-ansi "^6.0.0" - wrap-ansi "^7.0.0" - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - -collect-v8-coverage@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" - integrity sha512-iBPtljfCNcTKNAto0KEtDfZ3qzjJvqE3aTGZsbhjSBlorqpXJlaWWtPO35D+ZImoC3KWejX64o+yPGxhWSTzfg== - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" - integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== - dependencies: - safe-buffer "~5.1.1" - -core-js-compat@^3.16.0, core-js-compat@^3.16.2: - version "3.18.3" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.18.3.tgz#e0e7e87abc55efb547e7fa19169e45fa9df27a67" - integrity sha512-4zP6/y0a2RTHN5bRGT7PTq9lVt3WzvffTNjqnTKsXhkAYNDTkdCLOIfAdOLcQ/7TDdyRj3c+NeHe1NmF1eDScw== - dependencies: - browserslist "^4.17.3" - semver "7.0.0" - -cross-spawn@^7.0.3: - version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" - integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - -cssom@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - -data-urls@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" - integrity sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== - dependencies: - abab "^2.0.3" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - -debug@4, debug@^4.1.0, debug@^4.1.1: - version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -decimal.js@^10.2.1: - version "10.3.1" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783" - integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== - -dedent@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" - integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw= - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= - -deepmerge@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" - integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== - -define-properties@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== - dependencies: - object-keys "^1.0.12" - -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -detect-newline@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" - integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== - -diff-sequences@^27.0.6: - version "27.0.6" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.0.6.tgz#3305cb2e55a033924054695cc66019fd7f8e5723" - integrity sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ== - -domexception@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" - integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== - dependencies: - webidl-conversions "^5.0.0" - -dunder-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" - integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== - dependencies: - call-bind-apply-helpers "^1.0.1" - es-errors "^1.3.0" - gopd "^1.2.0" - -electron-to-chromium@^1.3.867: - version "1.3.873" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.873.tgz#c238c9199e4951952fe815a65c1beab5db4826b8" - integrity sha512-TiHlCgl2uP26Z0c67u442c0a2MZCWZNCRnPTQDPhVJ4h9G6z2zU0lApD9H0K9R5yFL5SfdaiVsVD2izOY24xBQ== - -emittery@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" - integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== - -emoji-regex@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" - integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== - -es-define-property@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" - integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - -es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" - integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== - dependencies: - es-errors "^1.3.0" - -es-set-tostringtag@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" - integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== - dependencies: - es-errors "^1.3.0" - get-intrinsic "^1.2.6" - has-tostringtag "^1.0.2" - hasown "^2.0.2" - -escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -escape-string-regexp@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" - integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== - -escodegen@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" - integrity sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionator "^0.8.1" - optionalDependencies: - source-map "~0.6.1" - -esprima@^4.0.0, esprima@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -estraverse@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.2.0.tgz#307df42547e6cc7324d3cf03c155d5cdb8c53880" - integrity sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -execa@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" - integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.0" - human-signals "^2.1.0" - is-stream "^2.0.0" - merge-stream "^2.0.0" - npm-run-path "^4.0.1" - onetime "^5.1.2" - signal-exit "^3.0.3" - strip-final-newline "^2.0.0" - -exit@^0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" - integrity sha1-BjJjj42HfMghB9MKD/8aF8uhzQw= - -expect@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-27.3.1.tgz#d0f170b1f5c8a2009bab0beffd4bb94f043e38e7" - integrity sha512-MrNXV2sL9iDRebWPGOGFdPQRl2eDQNu/uhxIMShjjx74T6kC6jFIkmQ6OqXDtevjGUkyB2IT56RzDBqXf/QPCg== - dependencies: - "@jest/types" "^27.2.5" - ansi-styles "^5.0.0" - jest-get-type "^27.3.1" - jest-matcher-utils "^27.3.1" - jest-message-util "^27.3.1" - jest-regex-util "^27.0.6" - -fast-json-stable-stringify@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" - integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== - -fast-levenshtein@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -fb-watchman@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" - integrity sha512-DkPJKQeY6kKwmuMretBhr7G6Vodr7bFwDYTXIkfG1gjvNpaxBTQV3PbXg6bR1c1UP4jPOX0jHUbbHANL9vRjVg== - dependencies: - bser "2.1.1" - -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== - dependencies: - to-regex-range "^5.0.1" - -find-up@^4.0.0, find-up@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" - integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== - dependencies: - locate-path "^5.0.0" - path-exists "^4.0.0" - -form-data@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.4.tgz#938273171d3f999286a4557528ce022dc2c98df1" - integrity sha512-f0cRzm6dkyVYV3nPoooP8XlccPQukegwhAnpoLcXy+X+A8KfpGOoXwDr9FLZd3wzgLaBGQBE3lY93Zm/i1JvIQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - es-set-tostringtag "^2.1.0" - hasown "^2.0.2" - mime-types "^2.1.35" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -fsevents@^2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -function-bind@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" - integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== - -gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: - version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" - integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== - -get-caller-file@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" - integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== - -get-intrinsic@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.1.tgz#94a9768fcbdd0595a1c9273aacf4c89d075631be" - integrity sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg== - dependencies: - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - -get-intrinsic@^1.2.6: - version "1.3.0" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" - integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== - dependencies: - call-bind-apply-helpers "^1.0.2" - es-define-property "^1.0.1" - es-errors "^1.3.0" - es-object-atoms "^1.1.1" - function-bind "^1.1.2" - get-proto "^1.0.1" - gopd "^1.2.0" - has-symbols "^1.1.0" - hasown "^2.0.2" - math-intrinsics "^1.1.0" - -get-package-type@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" - integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== - -get-proto@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" - integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== - dependencies: - dunder-proto "^1.0.1" - es-object-atoms "^1.0.0" - -get-stream@^6.0.0: - version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" - integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== - -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - -gopd@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" - integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== - -graceful-fs@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" - integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= - -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - -has-symbols@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" - integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== - -has-symbols@^1.0.3, has-symbols@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" - integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== - -has-tostringtag@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" - integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== - dependencies: - has-symbols "^1.0.3" - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -hasown@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" - integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== - dependencies: - function-bind "^1.1.2" - -html-encoding-sniffer@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" - integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== - dependencies: - whatwg-encoding "^1.0.5" - -html-escaper@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" - integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== - -http-proxy-agent@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz#8a8c8ef7f5932ccf953c296ca8291b95aa74aa3a" - integrity sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg== - dependencies: - "@tootallnate/once" "1" - agent-base "6" - debug "4" - -https-proxy-agent@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2" - integrity sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA== - dependencies: - agent-base "6" - debug "4" - -human-signals@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" - integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== - -iconv-lite@0.4.24: - version "0.4.24" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" - integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== - dependencies: - safer-buffer ">= 2.1.2 < 3" - -import-local@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" - integrity sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA== - dependencies: - pkg-dir "^4.2.0" - resolve-cwd "^3.0.0" - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-core-module@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.1.0.tgz#a4cc031d9b1aca63eecbd18a650e13cb4eeab946" - integrity sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA== - dependencies: - has "^1.0.3" - -is-core-module@^2.2.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" - integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== - dependencies: - has "^1.0.3" - -is-fullwidth-code-point@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" - integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== - -is-generator-fn@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" - integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== - -is-number@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" - integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== - -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - -is-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" - integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== - -is-typedarray@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= - -isexe@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" - integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= - -istanbul-lib-coverage@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" - integrity sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg== - -istanbul-lib-instrument@^4.0.0, istanbul-lib-instrument@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz#873c6fff897450118222774696a3f28902d77c1d" - integrity sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ== - dependencies: - "@babel/core" "^7.7.5" - "@istanbuljs/schema" "^0.1.2" - istanbul-lib-coverage "^3.0.0" - semver "^6.3.0" - -istanbul-lib-report@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" - integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== - dependencies: - istanbul-lib-coverage "^3.0.0" - make-dir "^3.0.0" - supports-color "^7.1.0" - -istanbul-lib-source-maps@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" - integrity sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg== - dependencies: - debug "^4.1.1" - istanbul-lib-coverage "^3.0.0" - source-map "^0.6.1" - -istanbul-reports@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.2.tgz#d593210e5000683750cb09fc0644e4b6e27fd53b" - integrity sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw== - dependencies: - html-escaper "^2.0.0" - istanbul-lib-report "^3.0.0" - -jest-changed-files@^27.3.0: - version "27.3.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.3.0.tgz#22a02cc2b34583fc66e443171dc271c0529d263c" - integrity sha512-9DJs9garMHv4RhylUMZgbdCJ3+jHSkpL9aaVKp13xtXAD80qLTLrqcDZL1PHA9dYA0bCI86Nv2BhkLpLhrBcPg== - dependencies: - "@jest/types" "^27.2.5" - execa "^5.0.0" - throat "^6.0.1" - -jest-circus@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.3.1.tgz#1679e74387cbbf0c6a8b42de963250a6469e0797" - integrity sha512-v1dsM9II6gvXokgqq6Yh2jHCpfg7ZqV4jWY66u7npz24JnhP3NHxI0sKT7+ZMQ7IrOWHYAaeEllOySbDbWsiXw== - dependencies: - "@jest/environment" "^27.3.1" - "@jest/test-result" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^0.7.0" - expect "^27.3.1" - is-generator-fn "^2.0.0" - jest-each "^27.3.1" - jest-matcher-utils "^27.3.1" - jest-message-util "^27.3.1" - jest-runtime "^27.3.1" - jest-snapshot "^27.3.1" - jest-util "^27.3.1" - pretty-format "^27.3.1" - slash "^3.0.0" - stack-utils "^2.0.3" - throat "^6.0.1" - -jest-cli@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.3.1.tgz#b576f9d146ba6643ce0a162d782b40152b6b1d16" - integrity sha512-WHnCqpfK+6EvT62me6WVs8NhtbjAS4/6vZJnk7/2+oOr50cwAzG4Wxt6RXX0hu6m1169ZGMlhYYUNeKBXCph/Q== - dependencies: - "@jest/core" "^27.3.1" - "@jest/test-result" "^27.3.1" - "@jest/types" "^27.2.5" - chalk "^4.0.0" - exit "^0.1.2" - graceful-fs "^4.2.4" - import-local "^3.0.2" - jest-config "^27.3.1" - jest-util "^27.3.1" - jest-validate "^27.3.1" - prompts "^2.0.1" - yargs "^16.2.0" - -jest-config@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.3.1.tgz#cb3b7f6aaa8c0a7daad4f2b9573899ca7e09bbad" - integrity sha512-KY8xOIbIACZ/vdYCKSopL44I0xboxC751IX+DXL2+Wx6DKNycyEfV3rryC3BPm5Uq/BBqDoMrKuqLEUNJmMKKg== - dependencies: - "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^27.3.1" - "@jest/types" "^27.2.5" - babel-jest "^27.3.1" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.1" - graceful-fs "^4.2.4" - jest-circus "^27.3.1" - jest-environment-jsdom "^27.3.1" - jest-environment-node "^27.3.1" - jest-get-type "^27.3.1" - jest-jasmine2 "^27.3.1" - jest-regex-util "^27.0.6" - jest-resolve "^27.3.1" - jest-runner "^27.3.1" - jest-util "^27.3.1" - jest-validate "^27.3.1" - micromatch "^4.0.4" - pretty-format "^27.3.1" - -jest-diff@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.3.1.tgz#d2775fea15411f5f5aeda2a5e02c2f36440f6d55" - integrity sha512-PCeuAH4AWUo2O5+ksW4pL9v5xJAcIKPUPfIhZBcG1RKv/0+dvaWTQK1Nrau8d67dp65fOqbeMdoil+6PedyEPQ== - dependencies: - chalk "^4.0.0" - diff-sequences "^27.0.6" - jest-get-type "^27.3.1" - pretty-format "^27.3.1" - -jest-docblock@^27.0.6: - version "27.0.6" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.0.6.tgz#cc78266acf7fe693ca462cbbda0ea4e639e4e5f3" - integrity sha512-Fid6dPcjwepTFraz0YxIMCi7dejjJ/KL9FBjPYhBp4Sv1Y9PdhImlKZqYU555BlN4TQKaTc+F2Av1z+anVyGkA== - dependencies: - detect-newline "^3.0.0" - -jest-each@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.3.1.tgz#14c56bb4f18dd18dc6bdd853919b5f16a17761ff" - integrity sha512-E4SwfzKJWYcvOYCjOxhZcxwL+AY0uFMvdCOwvzgutJiaiodFjkxQQDxHm8FQBeTqDnSmKsQWn7ldMRzTn2zJaQ== - dependencies: - "@jest/types" "^27.2.5" - chalk "^4.0.0" - jest-get-type "^27.3.1" - jest-util "^27.3.1" - pretty-format "^27.3.1" - -jest-environment-jsdom@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.3.1.tgz#63ac36d68f7a9303494df783494856222b57f73e" - integrity sha512-3MOy8qMzIkQlfb3W1TfrD7uZHj+xx8Olix5vMENkj5djPmRqndMaXtpnaZkxmxM+Qc3lo+yVzJjzuXbCcZjAlg== - dependencies: - "@jest/environment" "^27.3.1" - "@jest/fake-timers" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - jest-mock "^27.3.0" - jest-util "^27.3.1" - jsdom "^16.6.0" - -jest-environment-node@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.3.1.tgz#af7d0eed04edafb740311b303f3fe7c8c27014bb" - integrity sha512-T89F/FgkE8waqrTSA7/ydMkcc52uYPgZZ6q8OaZgyiZkJb5QNNCF6oPZjH9IfPFfcc9uBWh1574N0kY0pSvTXw== - dependencies: - "@jest/environment" "^27.3.1" - "@jest/fake-timers" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - jest-mock "^27.3.0" - jest-util "^27.3.1" - -jest-get-type@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.3.1.tgz#a8a2b0a12b50169773099eee60a0e6dd11423eff" - integrity sha512-+Ilqi8hgHSAdhlQ3s12CAVNd8H96ZkQBfYoXmArzZnOfAtVAJEiPDBirjByEblvG/4LPJmkL+nBqPO3A1YJAEg== - -jest-haste-map@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.3.1.tgz#7656fbd64bf48bda904e759fc9d93e2c807353ee" - integrity sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg== - dependencies: - "@jest/types" "^27.2.5" - "@types/graceful-fs" "^4.1.2" - "@types/node" "*" - anymatch "^3.0.3" - fb-watchman "^2.0.0" - graceful-fs "^4.2.4" - jest-regex-util "^27.0.6" - jest-serializer "^27.0.6" - jest-util "^27.3.1" - jest-worker "^27.3.1" - micromatch "^4.0.4" - walker "^1.0.7" - optionalDependencies: - fsevents "^2.3.2" - -jest-jasmine2@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.3.1.tgz#df6d3d07c7dafc344feb43a0072a6f09458d32b0" - integrity sha512-WK11ZUetDQaC09w4/j7o4FZDUIp+4iYWH/Lik34Pv7ukL+DuXFGdnmmi7dT58J2ZYKFB5r13GyE0z3NPeyJmsg== - dependencies: - "@babel/traverse" "^7.1.0" - "@jest/environment" "^27.3.1" - "@jest/source-map" "^27.0.6" - "@jest/test-result" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - expect "^27.3.1" - is-generator-fn "^2.0.0" - jest-each "^27.3.1" - jest-matcher-utils "^27.3.1" - jest-message-util "^27.3.1" - jest-runtime "^27.3.1" - jest-snapshot "^27.3.1" - jest-util "^27.3.1" - pretty-format "^27.3.1" - throat "^6.0.1" - -jest-leak-detector@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.3.1.tgz#7fb632c2992ef707a1e73286e1e704f9cc1772b2" - integrity sha512-78QstU9tXbaHzwlRlKmTpjP9k4Pvre5l0r8Spo4SbFFVy/4Abg9I6ZjHwjg2QyKEAMg020XcjP+UgLZIY50yEg== - dependencies: - jest-get-type "^27.3.1" - pretty-format "^27.3.1" - -jest-matcher-utils@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.3.1.tgz#257ad61e54a6d4044e080d85dbdc4a08811e9c1c" - integrity sha512-hX8N7zXS4k+8bC1Aj0OWpGb7D3gIXxYvPNK1inP5xvE4ztbz3rc4AkI6jGVaerepBnfWB17FL5lWFJT3s7qo8w== - dependencies: - chalk "^4.0.0" - jest-diff "^27.3.1" - jest-get-type "^27.3.1" - pretty-format "^27.3.1" - -jest-message-util@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.3.1.tgz#f7c25688ad3410ab10bcb862bcfe3152345c6436" - integrity sha512-bh3JEmxsTZ/9rTm0jQrPElbY2+y48Rw2t47uMfByNyUVR+OfPh4anuyKsGqsNkXk/TI4JbLRZx+7p7Hdt6q1yg== - dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^27.2.5" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.4" - micromatch "^4.0.4" - pretty-format "^27.3.1" - slash "^3.0.0" - stack-utils "^2.0.3" - -jest-mock@^27.3.0: - version "27.3.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.3.0.tgz#ddf0ec3cc3e68c8ccd489bef4d1f525571a1b867" - integrity sha512-ziZiLk0elZOQjD08bLkegBzv5hCABu/c8Ytx45nJKkysQwGaonvmTxwjLqEA4qGdasq9o2I8/HtdGMNnVsMTGw== - dependencies: - "@jest/types" "^27.2.5" - "@types/node" "*" - -jest-pnp-resolver@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" - integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== - -jest-regex-util@^27.0.6: - version "27.0.6" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-27.0.6.tgz#02e112082935ae949ce5d13b2675db3d8c87d9c5" - integrity sha512-SUhPzBsGa1IKm8hx2F4NfTGGp+r7BXJ4CulsZ1k2kI+mGLG+lxGrs76veN2LF/aUdGosJBzKgXmNCw+BzFqBDQ== - -jest-resolve-dependencies@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.3.1.tgz#85b99bdbdfa46e2c81c6228fc4c91076f624f6e2" - integrity sha512-X7iLzY8pCiYOnvYo2YrK3P9oSE8/3N2f4pUZMJ8IUcZnT81vlSonya1KTO9ZfKGuC+svE6FHK/XOb8SsoRUV1A== - dependencies: - "@jest/types" "^27.2.5" - jest-regex-util "^27.0.6" - jest-snapshot "^27.3.1" - -jest-resolve@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.3.1.tgz#0e5542172a1aa0270be6f66a65888647bdd74a3e" - integrity sha512-Dfzt25CFSPo3Y3GCbxynRBZzxq9AdyNN+x/v2IqYx6KVT5Z6me2Z/PsSGFSv3cOSUZqJ9pHxilao/I/m9FouLw== - dependencies: - "@jest/types" "^27.2.5" - chalk "^4.0.0" - graceful-fs "^4.2.4" - jest-haste-map "^27.3.1" - jest-pnp-resolver "^1.2.2" - jest-util "^27.3.1" - jest-validate "^27.3.1" - resolve "^1.20.0" - resolve.exports "^1.1.0" - slash "^3.0.0" - -jest-runner@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.3.1.tgz#1d594dcbf3bd8600a7e839e790384559eaf96e3e" - integrity sha512-r4W6kBn6sPr3TBwQNmqE94mPlYVn7fLBseeJfo4E2uCTmAyDFm2O5DYAQAFP7Q3YfiA/bMwg8TVsciP7k0xOww== - dependencies: - "@jest/console" "^27.3.1" - "@jest/environment" "^27.3.1" - "@jest/test-result" "^27.3.1" - "@jest/transform" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.8.1" - exit "^0.1.2" - graceful-fs "^4.2.4" - jest-docblock "^27.0.6" - jest-environment-jsdom "^27.3.1" - jest-environment-node "^27.3.1" - jest-haste-map "^27.3.1" - jest-leak-detector "^27.3.1" - jest-message-util "^27.3.1" - jest-resolve "^27.3.1" - jest-runtime "^27.3.1" - jest-util "^27.3.1" - jest-worker "^27.3.1" - source-map-support "^0.5.6" - throat "^6.0.1" - -jest-runtime@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.3.1.tgz#80fa32eb85fe5af575865ddf379874777ee993d7" - integrity sha512-qtO6VxPbS8umqhEDpjA4pqTkKQ1Hy4ZSi9mDVeE9Za7LKBo2LdW2jmT+Iod3XFaJqINikZQsn2wEi0j9wPRbLg== - dependencies: - "@jest/console" "^27.3.1" - "@jest/environment" "^27.3.1" - "@jest/globals" "^27.3.1" - "@jest/source-map" "^27.0.6" - "@jest/test-result" "^27.3.1" - "@jest/transform" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/yargs" "^16.0.0" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - execa "^5.0.0" - exit "^0.1.2" - glob "^7.1.3" - graceful-fs "^4.2.4" - jest-haste-map "^27.3.1" - jest-message-util "^27.3.1" - jest-mock "^27.3.0" - jest-regex-util "^27.0.6" - jest-resolve "^27.3.1" - jest-snapshot "^27.3.1" - jest-util "^27.3.1" - jest-validate "^27.3.1" - slash "^3.0.0" - strip-bom "^4.0.0" - yargs "^16.2.0" - -jest-serializer@^27.0.6: - version "27.0.6" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-27.0.6.tgz#93a6c74e0132b81a2d54623251c46c498bb5bec1" - integrity sha512-PtGdVK9EGC7dsaziskfqaAPib6wTViY3G8E5wz9tLVPhHyiDNTZn/xjZ4khAw+09QkoOVpn7vF5nPSN6dtBexA== - dependencies: - "@types/node" "*" - graceful-fs "^4.2.4" - -jest-snapshot@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.3.1.tgz#1da5c0712a252d70917d46c037054f5918c49ee4" - integrity sha512-APZyBvSgQgOT0XumwfFu7X3G5elj6TGhCBLbBdn3R1IzYustPGPE38F51dBWMQ8hRXa9je0vAdeVDtqHLvB6lg== - dependencies: - "@babel/core" "^7.7.2" - "@babel/generator" "^7.7.2" - "@babel/parser" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" - "@babel/types" "^7.0.0" - "@jest/transform" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/babel__traverse" "^7.0.4" - "@types/prettier" "^2.1.5" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^27.3.1" - graceful-fs "^4.2.4" - jest-diff "^27.3.1" - jest-get-type "^27.3.1" - jest-haste-map "^27.3.1" - jest-matcher-utils "^27.3.1" - jest-message-util "^27.3.1" - jest-resolve "^27.3.1" - jest-util "^27.3.1" - natural-compare "^1.4.0" - pretty-format "^27.3.1" - semver "^7.3.2" - -jest-util@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.3.1.tgz#a58cdc7b6c8a560caac9ed6bdfc4e4ff23f80429" - integrity sha512-8fg+ifEH3GDryLQf/eKZck1DEs2YuVPBCMOaHQxVVLmQwl/CDhWzrvChTX4efLZxGrw+AA0mSXv78cyytBt/uw== - dependencies: - "@jest/types" "^27.2.5" - "@types/node" "*" - chalk "^4.0.0" - ci-info "^3.2.0" - graceful-fs "^4.2.4" - picomatch "^2.2.3" - -jest-validate@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.3.1.tgz#3a395d61a19cd13ae9054af8cdaf299116ef8a24" - integrity sha512-3H0XCHDFLA9uDII67Bwi1Vy7AqwA5HqEEjyy934lgVhtJ3eisw6ShOF1MDmRPspyikef5MyExvIm0/TuLzZ86Q== - dependencies: - "@jest/types" "^27.2.5" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^27.3.1" - leven "^3.1.0" - pretty-format "^27.3.1" - -jest-watcher@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.3.1.tgz#ba5e0bc6aa843612b54ddb7f009d1cbff7e05f3e" - integrity sha512-9/xbV6chABsGHWh9yPaAGYVVKurWoP3ZMCv6h+O1v9/+pkOroigs6WzZ0e9gLP/njokUwM7yQhr01LKJVMkaZA== - dependencies: - "@jest/test-result" "^27.3.1" - "@jest/types" "^27.2.5" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - jest-util "^27.3.1" - string-length "^4.0.1" - -jest-worker@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.3.1.tgz#0def7feae5b8042be38479799aeb7b5facac24b2" - integrity sha512-ks3WCzsiZaOPJl/oMsDjaf0TRiSv7ctNgs0FqRr2nARsovz6AWWy4oLElwcquGSz692DzgZQrCLScPNs5YlC4g== - dependencies: - "@types/node" "*" - merge-stream "^2.0.0" - supports-color "^8.0.0" - -jest@^27.2: - version "27.3.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-27.3.1.tgz#b5bab64e8f56b6f7e275ba1836898b0d9f1e5c8a" - integrity sha512-U2AX0AgQGd5EzMsiZpYt8HyZ+nSVIh5ujQ9CPp9EQZJMjXIiSZpJNweZl0swatKRoqHWgGKM3zaSwm4Zaz87ng== - dependencies: - "@jest/core" "^27.3.1" - import-local "^3.0.2" - jest-cli "^27.3.1" + color-convert "^2.0.1" -js-tokens@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" - integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== +ansi-styles@^6.1.0: + version "6.2.3" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.3.tgz#c044d5dcc521a076413472597a1acb1f103c4041" + integrity sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg== -js-yaml@^3.13.1: - version "3.14.2" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.2.tgz#77485ce1dd7f33c061fd1b16ecea23b55fcb04b0" - integrity sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -jsdom@^16.6.0: - version "16.7.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" - integrity sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw== +brace-expansion@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" + integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== dependencies: - abab "^2.0.5" - acorn "^8.2.4" - acorn-globals "^6.0.0" - cssom "^0.4.4" - cssstyle "^2.3.0" - data-urls "^2.0.0" - decimal.js "^10.2.1" - domexception "^2.0.1" - escodegen "^2.0.0" - form-data "^3.0.0" - html-encoding-sniffer "^2.0.1" - http-proxy-agent "^4.0.1" - https-proxy-agent "^5.0.0" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.0" - parse5 "6.0.1" - saxes "^5.0.1" - symbol-tree "^3.2.4" - tough-cookie "^4.0.0" - w3c-hr-time "^1.0.2" - w3c-xmlserializer "^2.0.0" - webidl-conversions "^6.1.0" - whatwg-encoding "^1.0.5" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.5.0" - ws "^7.4.6" - xml-name-validator "^3.0.0" - -jsesc@^2.5.1: - version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" - integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== - -jsesc@~0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" - integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= - -json5@^2.1.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - -kleur@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" - integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== + balanced-match "^1.0.0" -leven@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" - integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +browser-stdout@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + +camelcase@^6.0.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= +chalk@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" + ansi-styles "^4.1.0" + supports-color "^7.1.0" -locate-path@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" - integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== +chokidar@^4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-4.0.3.tgz#7be37a4c03c9aee1ecfe862a4a23b2c70c205d30" + integrity sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA== dependencies: - p-locate "^4.1.0" + readdirp "^4.0.1" -lodash.debounce@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" - integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" -lodash.sortby@^4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" - integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" -lodash@^4.17.19, lodash@^4.7.0: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== +cross-spawn@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: - yallist "^4.0.0" + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" -make-dir@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" - integrity sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw== +debug@^4.3.5: + version "4.4.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.3.tgz#c6ae432d9bd9662582fce08709b038c58e9e3d6a" + integrity sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA== dependencies: - semver "^6.0.0" + ms "^2.1.3" -makeerror@1.0.x: - version "1.0.11" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.11.tgz#e01a5c9109f2af79660e4e8b9587790184f5a96c" - integrity sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw= - dependencies: - tmpl "1.0.x" +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -math-intrinsics@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" - integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== +diff@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-7.0.0.tgz#3fb34d387cd76d803f6eebea67b921dab0182a9a" + integrity sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw== -merge-stream@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" - integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -micromatch@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.4.tgz#896d519dfe9db25fce94ceb7a500919bf881ebf9" - integrity sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg== - dependencies: - braces "^3.0.1" - picomatch "^2.2.3" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.35: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: - brace-expansion "^1.1.7" + locate-path "^6.0.0" + path-exists "^4.0.0" -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +flat@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" + integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== + +foreground-child@^3.1.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.1.tgz#32e8e9ed1b68a3497befb9ac2b6adf92a638576f" + integrity sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw== + dependencies: + cross-spawn "^7.0.6" + signal-exit "^4.0.1" -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -node-int64@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" - integrity sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs= +glob@^10.4.5: + version "10.5.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c" + integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" -node-modules-regexp@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" - integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -node-releases@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.0.tgz#67dc74903100a7deb044037b8a2e5f453bb05400" - integrity sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA== +he@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" + integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -normalize-path@^3.0.0: +is-fullwidth-code-point@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" - integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -npm-run-path@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" - integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== - dependencies: - path-key "^3.0.0" +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -nwsapi@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" - integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== -object-keys@^1.0.12, object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== +is-unicode-supported@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" + integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== -object.assign@^4.1.0: - version "4.1.2" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" - integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== - dependencies: - call-bind "^1.0.0" - define-properties "^1.1.3" - has-symbols "^1.0.1" - object-keys "^1.1.1" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= -onetime@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== dependencies: - mimic-fn "^2.1.0" + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" -optionator@^0.8.1: - version "0.8.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== +js-yaml@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b" + integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA== dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" - -p-limit@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" - integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + argparse "^2.0.1" + +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: - p-try "^2.0.0" + p-locate "^5.0.0" -p-locate@^4.1.0: +log-symbols@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" - integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" + integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== + dependencies: + chalk "^4.1.0" + is-unicode-supported "^0.1.0" + +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + +minimatch@^9.0.4, minimatch@^9.0.5: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + +mocha@^11.7.5: + version "11.7.5" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.5.tgz#58f5bbfa5e0211ce7e5ee6128107cefc2515a627" + integrity sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig== + dependencies: + browser-stdout "^1.3.1" + chokidar "^4.0.1" + debug "^4.3.5" + diff "^7.0.0" + escape-string-regexp "^4.0.0" + find-up "^5.0.0" + glob "^10.4.5" + he "^1.2.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + log-symbols "^4.1.0" + minimatch "^9.0.5" + ms "^2.1.3" + picocolors "^1.1.1" + serialize-javascript "^6.0.2" + strip-json-comments "^3.1.1" + supports-color "^8.1.1" + workerpool "^9.2.0" + yargs "^17.7.2" + yargs-parser "^21.1.1" + yargs-unparser "^2.0.0" + +ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + +p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: - p-limit "^2.2.0" + yocto-queue "^0.1.0" -p-try@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" - integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" -parse5@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-key@^3.0.0, path-key@^3.1.0: +path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-parse@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -picomatch@^2.0.4: - version "2.2.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== - -picomatch@^2.2.3: - version "2.3.0" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" - integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== - -pirates@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" - integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== - dependencies: - node-modules-regexp "^1.0.0" - -pkg-dir@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" - integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== - dependencies: - find-up "^4.0.0" - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= - -pretty-format@^27.3.1: - version "27.3.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.3.1.tgz#7e9486365ccdd4a502061fa761d3ab9ca1b78df5" - integrity sha512-DR/c+pvFc52nLimLROYjnXPtolawm+uWDxr4FjuLDLUn+ktWnSN851KoHwHzzqq6rfCOjkzN8FLgDrSub6UDuA== - dependencies: - "@jest/types" "^27.2.5" - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^17.0.1" - -prompts@^2.0.1: - version "2.4.0" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.0.tgz#4aa5de0723a231d1ee9121c40fdf663df73f61d7" - integrity sha512-awZAKrk3vN6CroQukBL+R9051a4R3zCZBlJm/HBfrSZ8iTpYix3VX1vU4mveiLpiwmOJT4wokTF9m6HUk4KqWQ== +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== dependencies: - kleur "^3.0.3" - sisteransi "^1.0.5" + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" -psl@^1.1.33: - version "1.8.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" - integrity sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ== +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== - -querystringify@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" - integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== - -react-is@^17.0.1: - version "17.0.1" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.1.tgz#5b3531bd76a645a4c9fb6e693ed36419e3301339" - integrity sha512-NAnt2iGDXohE5LI7uBnLnqvLQMtzhkiAOLXTmv+qnF9Ky7xAPcX8Up/xWIhxvLVGJvuLiNc4xQLtuqDRzb4fSA== - -regenerate-unicode-properties@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz#54d09c7115e1f53dc2314a974b32c1c344efe326" - integrity sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA== - dependencies: - regenerate "^1.4.2" - -regenerate@^1.4.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" - integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== - -regenerator-runtime@^0.13.4: - version "0.13.9" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" - integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== - -regenerator-transform@^0.14.2: - version "0.14.5" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4" - integrity sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw== +randombytes@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: - "@babel/runtime" "^7.8.4" + safe-buffer "^5.1.0" -regexpu-core@^4.7.1: - version "4.8.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.8.0.tgz#e5605ba361b67b1718478501327502f4479a98f0" - integrity sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg== - dependencies: - regenerate "^1.4.2" - regenerate-unicode-properties "^9.0.0" - regjsgen "^0.5.2" - regjsparser "^0.7.0" - unicode-match-property-ecmascript "^2.0.0" - unicode-match-property-value-ecmascript "^2.0.0" - -regjsgen@^0.5.2: - version "0.5.2" - resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.5.2.tgz#92ff295fb1deecbf6ecdab2543d207e91aa33733" - integrity sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A== - -regjsparser@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.7.0.tgz#a6b667b54c885e18b52554cb4960ef71187e9968" - integrity sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ== - dependencies: - jsesc "~0.5.0" +readdirp@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-4.1.2.tgz#eb85801435fbf2a7ee58f19e0921b068fc69948d" + integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg== require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -requires-port@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" - integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== - -resolve-cwd@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" - integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== - dependencies: - resolve-from "^5.0.0" - -resolve-from@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" - integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== - -resolve.exports@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" - integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== - -resolve@^1.14.2, resolve@^1.20.0: - version "1.20.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" - integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== - dependencies: - is-core-module "^2.2.0" - path-parse "^1.0.6" - -resolve@^1.3.2: - version "1.19.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" - integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== - dependencies: - is-core-module "^2.1.0" - path-parse "^1.0.6" - -rimraf@^3.0.0: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - -safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -"safer-buffer@>= 2.1.2 < 3": - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -saxes@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" - integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== - dependencies: - xmlchars "^2.2.0" +safe-buffer@^5.1.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -semver@7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" - integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== - -semver@^5.4.1: - version "5.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.3.2: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== +serialize-javascript@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" + integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== dependencies: - lru-cache "^6.0.0" + randombytes "^2.1.0" shebang-command@^2.0.0: version "2.0.0" @@ -3244,68 +391,19 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -signal-exit@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" - integrity sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA== - -signal-exit@^3.0.3: - version "3.0.5" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.5.tgz#9e3e8cc0c75a99472b44321033a7702e7738252f" - integrity sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ== - -sisteransi@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" - integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== - -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -source-map-support@^0.5.6: - version "0.5.19" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.5.0: - version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" - integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= - -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -source-map@^0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -stack-utils@^2.0.3: - version "2.0.5" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.5.tgz#d25265fca995154659dbbfba3b49254778d2fdd5" - integrity sha512-xrQcmYhOsn/1kX+Vraq+7j4oE2j/6BFscZ0etmYg81xuM8Gq0022Pxb8+IqgOFUIaxHs0KaSb7T1+OegiNrNFA== - dependencies: - escape-string-regexp "^2.0.0" +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== -string-length@^4.0.1: - version "4.0.1" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.1.tgz#4a973bf31ef77c4edbceadd6af2611996985f8a1" - integrity sha512-PKyXUd0LK0ePjSOnWn34V2uD6acUWev9uy0Ft05k0E8xRW+SKcA0F7eMr7h5xlzfn+4O3N+55rduYyet3Jk+jw== +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: - char-regex "^1.0.2" - strip-ansi "^6.0.0" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" @@ -3316,6 +414,31 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" @@ -3323,243 +446,39 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" -strip-bom@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" - integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== - -strip-final-newline@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" - integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== +strip-ansi@^7.0.1: + version "7.1.2" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.2.tgz#132875abde678c7ea8d691533f2e7e22bb744dba" + integrity sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA== dependencies: - has-flag "^3.0.0" + ansi-regex "^6.0.1" + +strip-json-comments@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" -supports-color@^8.0.0: +supports-color@^8.1.1: version "8.1.1" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz#f663df252af5f37c5d49bbd7eeefa9e0b9e59e47" - integrity sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - -test-exclude@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" - integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== - dependencies: - "@istanbuljs/schema" "^0.1.2" - glob "^7.1.4" - minimatch "^3.0.4" - -throat@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.1.tgz#d514fedad95740c12c2d7fc70ea863eb51ade375" - integrity sha512-8hmiGIJMDlwjg7dlJ4yKGLK8EsYqKgPWbG3b4wjJddKNwc7N7Dpn08Df4szr/sZdMVeOstrdYSsqzX6BYbcB+w== - -tmpl@1.0.x: - version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" - integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== - -to-fast-properties@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" - integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= - -to-regex-range@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" - integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== - dependencies: - is-number "^7.0.0" - -tough-cookie@^4.0.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" - integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - -tr46@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.0.2.tgz#03273586def1595ae08fedb38d7733cee91d2479" - integrity sha512-3n1qG+/5kg+jrbTzwAykB5yRYtQCTqOGKq5U5PE3b0a1/mzo6snDhjGS0zJVJunO0NrT3Dg1MLy5TjWP/UJppg== - dependencies: - punycode "^2.1.1" - -tr46@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" - integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== - dependencies: - punycode "^2.1.1" - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= - dependencies: - prelude-ls "~1.1.2" - -type-detect@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" - integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== - -type-fest@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1" - integrity sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ== - -typedarray-to-buffer@^3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" - integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== - dependencies: - is-typedarray "^1.0.0" - -unicode-canonical-property-names-ecmascript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" - integrity sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ== - -unicode-match-property-ecmascript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz#54fd16e0ecb167cf04cf1f756bdcc92eba7976c3" - integrity sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q== - dependencies: - unicode-canonical-property-names-ecmascript "^2.0.0" - unicode-property-aliases-ecmascript "^2.0.0" - -unicode-match-property-value-ecmascript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz#1a01aa57247c14c568b89775a54938788189a714" - integrity sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw== - -unicode-property-aliases-ecmascript@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz#0a36cb9a585c4f6abd51ad1deddb285c165297c8" - integrity sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ== - -universalify@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" - integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== - -url-parse@^1.5.3: - version "1.5.10" - resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" - integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== - dependencies: - querystringify "^2.1.1" - requires-port "^1.0.0" - -v8-to-istanbul@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.1.0.tgz#0aeb763894f1a0a1676adf8a8b7612a38902446c" - integrity sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - -w3c-hr-time@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== - dependencies: - browser-process-hrtime "^1.0.0" - -w3c-xmlserializer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz#3e7104a05b75146cc60f564380b7f683acf1020a" - integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== - dependencies: - xml-name-validator "^3.0.0" - -walker@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" - integrity sha1-L3+bj9ENZ3JisYqITijRlhjgKPs= - dependencies: - makeerror "1.0.x" - -webidl-conversions@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - -webidl-conversions@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" - integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== - -whatwg-encoding@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== - dependencies: - iconv-lite "0.4.24" - -whatwg-mimetype@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== - -whatwg-url@^8.0.0: - version "8.4.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.4.0.tgz#50fb9615b05469591d2b2bd6dfaed2942ed72837" - integrity sha512-vwTUFf6V4zhcPkWp/4CQPr1TW9Ml6SF4lVyaIMBdJw5i6qUUJ1QWM4Z6YYVkfka0OUIzVo/0aNtGVGk256IKWw== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^2.0.2" - webidl-conversions "^6.1.0" - -whatwg-url@^8.5.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77" - integrity sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg== - dependencies: - lodash "^4.7.0" - tr46 "^2.1.0" - webidl-conversions "^6.1.0" - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -3567,12 +486,12 @@ which@^2.0.1: dependencies: isexe "^2.0.0" -word-wrap@~1.2.3: - version "1.2.4" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.4.tgz#cb4b50ec9aca570abd1f52f33cd45b6c61739a9f" - integrity sha512-2V81OA4ugVo5pRo46hAoD2ivUJx8jXmWXfUkY4KFNw0hEptvN0QfH3K4nHiwzGeKl5rFKedV48QVoqYavy4YpA== +workerpool@^9.2.0: + version "9.3.4" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-9.3.4.tgz#f6c92395b2141afd78e2a889e80cb338fe9fca41" + integrity sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg== -wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -3581,60 +500,58 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -write-file-atomic@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" - integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: - imurmurhash "^0.1.4" - is-typedarray "^1.0.0" - signal-exit "^3.0.2" - typedarray-to-buffer "^3.1.5" - -ws@^7.4.6: - version "7.5.5" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" - integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== - -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - -yargs-parser@^20.2.2: - version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" - integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== - -yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== +yargs-parser@^21.1.1: + version "21.1.1" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== + +yargs-unparser@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@^17.7.2: + version "17.7.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== dependencies: - cliui "^7.0.2" + cliui "^8.0.1" escalade "^3.1.1" get-caller-file "^2.0.5" require-directory "^2.1.1" - string-width "^4.2.0" + string-width "^4.2.3" y18n "^5.0.5" - yargs-parser "^20.2.2" + yargs-parser "^21.1.1" + +yocto-queue@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== From d23b8b55b9b4691c45fc8780cccd2d858c2af441 Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Thu, 15 Jan 2026 20:16:31 +0100 Subject: [PATCH 5/8] Fix expecto tests location --- build/build.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.fs b/build/build.fs index bdd1cb46..f659ac63 100644 --- a/build/build.fs +++ b/build/build.fs @@ -81,7 +81,7 @@ Target.create "Build" (fun _ -> // Run the unit tests using test runner Target.create "RunTests" (fun _ -> - !! "tests/**/bin/Release/net6.0/*Tests.dll" + !! "tests/**/bin/Release/net8.0/*Tests.dll" |> Expecto.run(fun x -> { x with Parallel = true From fa889bc843a50c9789eea030fb77dcbe7128e150 Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Thu, 15 Jan 2026 23:09:11 +0100 Subject: [PATCH 6/8] Remove tests that use BinaryFormatter --- .../RandomAccessListTest.fs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs b/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs index a820e3b7..b2b90515 100644 --- a/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs +++ b/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs @@ -1614,16 +1614,6 @@ module RandomAccessListTest = } ] - let mkSerializationProperty<'a when 'a: equality> name = - testPropertyWithConfig config10k (sprintf "RandomAccessList serialization and deserialization work with %ss" name) (fun (l: 'a list) -> - let ral1 = RandomAccessList.ofSeq l - let f = BinaryFormatter() - use memStream = new MemoryStream() - f.Serialize(memStream, ral1) - memStream.Position <- 0L - let ral2 = f.Deserialize memStream :?> 'a RandomAccessList - Seq.equalsWith (=) ral1 ral2) - [] let propertyTestRandomAccessList = let consThruList l q = @@ -1859,8 +1849,4 @@ module RandomAccessListTest = (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) - mkSerializationProperty "32-bit integer" - mkSerializationProperty "string" - mkSerializationProperty "GUID" - mkSerializationProperty "big integer" ] From 7fb4cb9f457b362a48f66521c9b13e1c82843709 Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Fri, 16 Jan 2026 08:35:38 +0100 Subject: [PATCH 7/8] Format code and update Fantomas --- .config/dotnet-tools.json | 2 +- build/build.fs | 42 +- .../AltBinaryRandomAccessList.fs | 15 +- .../BankersDeque.fs | 9 +- .../BankersQueue.fs | 9 +- .../BatchedDeque.fs | 9 +- .../BatchedQueue.fs | 9 +- .../BinaryRandomAccessList.fs | 15 +- .../BinaryRoseTree.fs | 59 +- .../BinaryTreeZipper.fs | 38 +- .../BootstrappedQueue.fs | 27 +- .../BottomUpMergeSort.fs | 17 +- .../ChampHashMap.fs | 9 +- src/FSharpx.Collections.Experimental/DList.fs | 34 +- src/FSharpx.Collections.Experimental/Deque.fs | 9 +- .../EagerRoseTree.fs | 49 +- .../FlatList.fs | 10 +- .../HoodMelvilleQueue.fs | 69 +- .../IndexedRoseTree.fs | 49 +- .../ListZipper.fs | 3 +- .../PhysicistQueue.fs | 9 +- .../RealTimeDeque.fs | 19 +- .../RealTimeQueue.fs | 18 +- .../RingBuffer.fs | 7 +- .../RoseTree.fs | 49 +- .../SkewBinaryRandomAccessList.fs | 15 +- src/FSharpx.Collections/ByteString.fs | 6 +- src/FSharpx.Collections/CircularBuffer.fs | 28 +- src/FSharpx.Collections/Collections.fs | 244 +- src/FSharpx.Collections/DList.fs | 39 +- src/FSharpx.Collections/Deque.fs | 9 +- src/FSharpx.Collections/LazyList.fs | 11 +- src/FSharpx.Collections/NonEmptyList.fs | 30 +- src/FSharpx.Collections/PersistentHashMap.fs | 961 ++- src/FSharpx.Collections/PersistentVector.fs | 42 +- src/FSharpx.Collections/PriorityQueue.fs | 3 +- src/FSharpx.Collections/Queue.fs | 9 +- src/FSharpx.Collections/RandomAccessList.fs | 5 +- src/FSharpx.Collections/ResizeArray.fs | 20 +- src/FSharpx.Collections/TaggedCollections.fs | 10 +- .../AltBinaryRandomAccessListTest.fs | 2934 +++---- .../BKTreeTest.fs | 185 +- .../BankersDequeTest.fs | 7352 ++++++++-------- .../BatchedDequeTest.fs | 4215 +++++----- .../BinaryRandomAccessListTest.fs | 1624 ++-- .../BinaryRoseTreeTest.fs | 80 +- .../BinaryTreeZipperTest.fs | 154 +- .../BinomialHeapTest.fs | 724 +- .../BlockResizeArrayTest.fs | 492 +- .../BootstrappedQueueTest.fs | 200 +- .../BottomUpMergeSortTest.fs | 82 +- .../ChampHashMapTest.fs | 283 +- .../DListTest.fs | 140 +- .../DequeTest.fs | 3916 ++++----- .../EagerRoseTreeTest.fs | 261 +- .../EditDistanceTest.fs | 46 +- .../FileSystemZipperTest.fs | 197 +- .../FlatListTest.fs | 752 +- .../FsCheckProperties.fs | 33 +- .../HeapGen.fs | 354 +- .../HeapPriorityQueueTest.fs | 150 +- .../IQueueTest.fs | 1408 ++-- .../ImplicitQueueTest.fs | 170 +- .../IndexedRoseTreeTest.fs | 171 +- .../IntMapTest.fs | 1495 ++-- .../LeftistHeapTest.fs | 754 +- .../ListZipperTest.fs | 82 +- .../PairingHeapTest.fs | 723 +- .../QueueGen.fs | 335 +- .../RealTimeDequeTest.fs | 7384 ++++++++--------- .../RealTimeQueueTest.fs | 170 +- .../RingBufferTest.fs | 158 +- .../RoseTreeTest.fs | 222 +- .../SkewBinaryRandomAccessListTest.fs | 2524 +++--- .../SkewBinomialHeapTest.fs | 1020 ++- .../TimeSeriesTest.fs | 495 +- tests/FSharpx.Collections.Tests/ArrayTests.fs | 85 +- .../ByteStringTest.fs | 398 +- .../CircularBufferTests.fs | 567 +- tests/FSharpx.Collections.Tests/DListTest.fs | 601 +- tests/FSharpx.Collections.Tests/DequeTest.fs | 2067 ++--- .../DictionaryExtensionsTests.fs | 21 +- .../FsCheckProperties.fs | 33 +- tests/FSharpx.Collections.Tests/HeapTest.fs | 832 +- .../LazyListTests.fs | 814 +- .../ListExtensionsTest.fs | 151 +- .../MapExtensionsTest.fs | 64 +- tests/FSharpx.Collections.Tests/MapTests.fs | 73 +- .../NameValueCollectionTests.fs | 159 +- .../NonEmptyListTests.fs | 294 +- .../PersistentHashMapTest.fs | 607 +- .../PersistentVectorTest.fs | 1105 +-- .../PriorityQueueTest.fs | 202 +- tests/FSharpx.Collections.Tests/QueueTest.fs | 493 +- .../RandomAccessListTest.fs | 3595 ++++---- .../ResizeArrayTests.fs | 552 +- tests/FSharpx.Collections.Tests/SeqTests.fs | 429 +- .../TransientHashMapTest.fs | 425 +- .../FSharpx.Collections.Tests/Deque.test.fs | 20 +- .../LazyList.test.fs | 22 +- .../NonEmptyList.test.fs | 20 +- .../PersistentVector.test.fs | 58 +- .../FSharpx.Collections.Tests/Program.fs | 14 +- .../FSharpx.Collections.Tests/Queue.test.fs | 34 +- 104 files changed, 28532 insertions(+), 28505 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 37c01dca..6c257046 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -24,7 +24,7 @@ "rollForward": false }, "fantomas": { - "version": "5.0.3", + "version": "7.0.5", "commands": [ "fantomas" ], diff --git a/build/build.fs b/build/build.fs index f659ac63..56e599a3 100644 --- a/build/build.fs +++ b/build/build.fs @@ -35,22 +35,21 @@ let (|Fsproj|Csproj|Vbproj|)(projFileName: string) = // Generate assembly info files with the right version & up-to-date information Target.create "AssemblyInfo" (fun _ -> - let getAssemblyInfoAttributes projectName = [ - AssemblyInfo.Title(projectName) - AssemblyInfo.Product "FSharpx.Collections" - AssemblyInfo.Description "FSharpx.Collections is a collection of datastructures for use with F# and C#." - AssemblyInfo.InternalsVisibleTo "FSharpx.Collections.Tests" - AssemblyInfo.InternalsVisibleTo "FSharpx.Collections.Experimental.Tests" - AssemblyInfo.Version release.AssemblyVersion - AssemblyInfo.FileVersion release.AssemblyVersion - AssemblyInfo.Configuration configuration - ] + let getAssemblyInfoAttributes projectName = + [ AssemblyInfo.Title(projectName) + AssemblyInfo.Product "FSharpx.Collections" + AssemblyInfo.Description "FSharpx.Collections is a collection of datastructures for use with F# and C#." + AssemblyInfo.InternalsVisibleTo "FSharpx.Collections.Tests" + AssemblyInfo.InternalsVisibleTo "FSharpx.Collections.Experimental.Tests" + AssemblyInfo.Version release.AssemblyVersion + AssemblyInfo.FileVersion release.AssemblyVersion + AssemblyInfo.Configuration configuration ] let getProjectDetails(projectPath: string) = let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath) (projectPath, projectName, System.IO.Path.GetDirectoryName(projectPath), (getAssemblyInfoAttributes projectName)) - !! "src/**/*.??proj" + !!"src/**/*.??proj" |> Seq.map getProjectDetails |> Seq.iter(fun (projFileName, _, folderName, attributes) -> match projFileName with @@ -74,26 +73,23 @@ Target.create "Build" (fun _ -> "FSharpx.Collections.sln" |> DotNet.build(fun p -> { p with - Configuration = buildConfiguration - })) + Configuration = buildConfiguration })) // -------------------------------------------------------------------------------------- // Run the unit tests using test runner Target.create "RunTests" (fun _ -> - !! "tests/**/bin/Release/net8.0/*Tests.dll" + !!"tests/**/bin/Release/net8.0/*Tests.dll" |> Expecto.run(fun x -> { x with Parallel = true - ParallelWorkers = System.Environment.ProcessorCount - })) + ParallelWorkers = System.Environment.ProcessorCount })) Target.create "RunTestsFable" (fun _ -> let setParams = (fun (o: Yarn.YarnParams) -> { o with - WorkingDirectory = "tests/fable" - }) + WorkingDirectory = "tests/fable" }) Yarn.installPureLock setParams Yarn.exec "test" setParams) @@ -108,8 +104,7 @@ let nuGet out suffix = ToolType = ToolType.CreateLocalTool() OutputPath = out Version = release.NugetVersion + (suffix |> Option.defaultValue "") - ReleaseNotes = releaseNotes - }) + ReleaseNotes = releaseNotes }) Target.create "NuGet" (fun _ -> nuGet "bin" None) @@ -124,7 +119,7 @@ let ensureOk(pr: ProcessResult) = Target.create "PublishCINuGet" (fun _ -> let token = Environment.environVarOrFail "GITHUB_TOKEN" - !! "temp/*.nupkg" + !!"temp/*.nupkg" |> Seq.iter(fun file -> DotNet.exec id "nuget" (sprintf "push %s -s https://nuget.pkg.github.com/fsprojects/index.json -k %s" file token) |> ensureOk // @@ -134,8 +129,7 @@ Target.create "PublishNuget" (fun _ -> Paket.push(fun p -> { p with ToolType = ToolType.CreateLocalTool() - WorkingDir = "bin" - })) + WorkingDir = "bin" })) // -------------------------------------------------------------------------------------- // Generate the documentation @@ -177,7 +171,7 @@ Target.create "Release" (fun _ -> // Fantomas code formatting and style checking let sourceFiles = - !! "**/*.fs" ++ "**/*.fsx" + !!"**/*.fs" ++ "**/*.fsx" -- "**/fable_modules/**/**.fs" -- "packages/**/*.*" -- "paket-files/**/*.*" diff --git a/src/FSharpx.Collections.Experimental/AltBinaryRandomAccessList.fs b/src/FSharpx.Collections.Experimental/AltBinaryRandomAccessList.fs index 74c04d9e..509c6b2e 100644 --- a/src/FSharpx.Collections.Experimental/AltBinaryRandomAccessList.fs +++ b/src/FSharpx.Collections.Experimental/AltBinaryRandomAccessList.fs @@ -77,13 +77,14 @@ type AltBinRndAccList<'T> = | Some(x) -> Some(x :> _) member this.GetEnumerator() = - let e = seq { - match AltBinRndAccList.tryUncons this with - | None -> () - | Some(x, xs) -> - yield x - yield! xs - } + let e = + seq { + match AltBinRndAccList.tryUncons this with + | None -> () + | Some(x, xs) -> + yield x + yield! xs + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/BankersDeque.fs b/src/FSharpx.Collections.Experimental/BankersDeque.fs index e110bec8..ab8aa1f3 100644 --- a/src/FSharpx.Collections.Experimental/BankersDeque.fs +++ b/src/FSharpx.Collections.Experimental/BankersDeque.fs @@ -458,10 +458,11 @@ type BankersDeque<'T>(c: int, frontLength: int, front: LazyList<'T>, rBackLength member this.Count = this.Length member this.GetEnumerator() = - let e = seq { - yield! front - yield! (LazyList.rev this.rBack) - } + let e = + seq { + yield! front + yield! (LazyList.rev this.rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/BankersQueue.fs b/src/FSharpx.Collections.Experimental/BankersQueue.fs index dc280faa..ca873316 100644 --- a/src/FSharpx.Collections.Experimental/BankersQueue.fs +++ b/src/FSharpx.Collections.Experimental/BankersQueue.fs @@ -140,10 +140,11 @@ type BankersQueue<'T>(frontLength: int, front: LazyList<'T>, backLength: int, ba member this.Count = this.Length member this.GetEnumerator() = - let e = seq { - yield! front - yield! (LazyList.rev back) - } + let e = + seq { + yield! front + yield! (LazyList.rev back) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/BatchedDeque.fs b/src/FSharpx.Collections.Experimental/BatchedDeque.fs index cb1e2d2b..c6c87876 100644 --- a/src/FSharpx.Collections.Experimental/BatchedDeque.fs +++ b/src/FSharpx.Collections.Experimental/BatchedDeque.fs @@ -400,10 +400,11 @@ type BatchedDeque<'T>(front, rBack) = member this.Count = this.Length member this.GetEnumerator() = - let e = seq { - yield! front - yield! (List.rev rBack) - } + let e = + seq { + yield! front + yield! (List.rev rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/BatchedQueue.fs b/src/FSharpx.Collections.Experimental/BatchedQueue.fs index d29e7690..1cc4ca19 100644 --- a/src/FSharpx.Collections.Experimental/BatchedQueue.fs +++ b/src/FSharpx.Collections.Experimental/BatchedQueue.fs @@ -126,10 +126,11 @@ type BatchedQueue<'T>(front: list<'T>, rBack: list<'T>) = member this.Count = this.Length member this.GetEnumerator() = - let e = seq { - yield! front - yield! (List.rev rBack) - } + let e = + seq { + yield! front + yield! (List.rev rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/BinaryRandomAccessList.fs b/src/FSharpx.Collections.Experimental/BinaryRandomAccessList.fs index 2d20a39c..d98acb98 100644 --- a/src/FSharpx.Collections.Experimental/BinaryRandomAccessList.fs +++ b/src/FSharpx.Collections.Experimental/BinaryRandomAccessList.fs @@ -300,13 +300,14 @@ type BinaryRandomAccessList<'T>(randomAccessList) = | Some(ts) -> Some(ts :> _) member this.GetEnumerator() = - let e = seq { - match this.TryUncons with - | None -> () - | Some(x, ts) -> - yield x - yield! ts - } + let e = + seq { + match this.TryUncons with + | None -> () + | Some(x, ts) -> + yield x + yield! ts + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/BinaryRoseTree.fs b/src/FSharpx.Collections.Experimental/BinaryRoseTree.fs index 413e3479..fe57bfda 100644 --- a/src/FSharpx.Collections.Experimental/BinaryRoseTree.fs +++ b/src/FSharpx.Collections.Experimental/BinaryRoseTree.fs @@ -36,15 +36,16 @@ type BinaryRoseTree<'T> = //{ Root: 'T; Children: 'T BinaryRoseTree Vector } interface IEnumerable<'T> with member x.GetEnumerator() = - (let rec loop x = seq { - match x with - | Node(a, Nil, Nil) -> yield a - | Node(a, children, siblings) -> - yield a - yield! loop children - yield! loop siblings - | Nil -> () - } + (let rec loop x = + seq { + match x with + | Node(a, Nil, Nil) -> yield a + | Node(a, children, siblings) -> + yield a + yield! loop children + yield! loop siblings + | Nil -> () + } loop x) .GetEnumerator() @@ -109,22 +110,24 @@ module BinaryRoseTree = let map f (tree: _ BinaryRoseTree) = (map2 (fun x (l: BinaryRoseTree<_>) (r: BinaryRoseTree<_>) -> Node(f x, l, r)) Nil tree) - let rec preOrder(x: _ BinaryRoseTree) = seq { - match x with - | Node(a, Nil, Nil) -> yield a - | Node(a, children, siblings) -> - yield a - yield! preOrder children - yield! preOrder siblings - | Nil -> () - } - - let rec postOrder(x: _ BinaryRoseTree) = seq { - match x with - | Node(a, Nil, Nil) -> yield a - | Node(a, children, siblings) -> - yield! postOrder children - yield a - yield! postOrder siblings - | Nil -> () - } + let rec preOrder(x: _ BinaryRoseTree) = + seq { + match x with + | Node(a, Nil, Nil) -> yield a + | Node(a, children, siblings) -> + yield a + yield! preOrder children + yield! preOrder siblings + | Nil -> () + } + + let rec postOrder(x: _ BinaryRoseTree) = + seq { + match x with + | Node(a, Nil, Nil) -> yield a + | Node(a, children, siblings) -> + yield! postOrder children + yield a + yield! postOrder siblings + | Nil -> () + } diff --git a/src/FSharpx.Collections.Experimental/BinaryTreeZipper.fs b/src/FSharpx.Collections.Experimental/BinaryTreeZipper.fs index aabaadb4..4c344818 100644 --- a/src/FSharpx.Collections.Experimental/BinaryTreeZipper.fs +++ b/src/FSharpx.Collections.Experimental/BinaryTreeZipper.fs @@ -10,10 +10,9 @@ type TreeDirection = | Right /// The zipper data structure for binary trees -type BinaryTreeZipper<'T> = { - Focus: BinaryTree<'T> - Path: (TreeDirection * 'T * BinaryTree<'T>) list -} +type BinaryTreeZipper<'T> = + { Focus: BinaryTree<'T> + Path: (TreeDirection * 'T * BinaryTree<'T>) list } /// TreeZipper /// original implementation taken from http://blog.xquant.net/?p=156 @@ -27,14 +26,12 @@ module BinaryTreeZipper = /// Moves the zipper one level up let up z = match z.Path with - | (Left, v, other) :: ep -> { - Focus = Branch(v, z.Focus, other) - Path = ep - } - | (Right, v, other) :: ep -> { - Focus = Branch(v, other, z.Focus) - Path = ep - } + | (Left, v, other) :: ep -> + { Focus = Branch(v, z.Focus, other) + Path = ep } + | (Right, v, other) :: ep -> + { Focus = Branch(v, other, z.Focus) + Path = ep } | [] -> failwith "can't go up" // because ep only goes down and is empty /// Moves the zipper to the top @@ -46,19 +43,17 @@ module BinaryTreeZipper = /// Moves the zipper to the left let left z = match z.Focus with - | (Branch(v, explored, other)) -> { - Focus = explored - Path = (Left, v, other) :: z.Path - } + | (Branch(v, explored, other)) -> + { Focus = explored + Path = (Left, v, other) :: z.Path } | Leaf -> failwith "can't go down on leaf" /// Moves the zipper to the right let right z = match z.Focus with - | (Branch(v, other, explored)) -> { - Focus = explored - Path = (Right, v, other) :: z.Path - } + | (Branch(v, other, explored)) -> + { Focus = explored + Path = (Right, v, other) :: z.Path } | Leaf -> failwith "can't go down on leaf" /// Modifies the current focus inside the zipper @@ -66,7 +61,8 @@ module BinaryTreeZipper = { zipper with Focus = newFocus } /// Creates a zipper from a tree - let zipper t = { Focus = t; Path = [] } + let zipper t = + { Focus = t; Path = [] } type TreeZipperDirection = | Up diff --git a/src/FSharpx.Collections.Experimental/BootstrappedQueue.fs b/src/FSharpx.Collections.Experimental/BootstrappedQueue.fs index 663b64c5..def73604 100644 --- a/src/FSharpx.Collections.Experimental/BootstrappedQueue.fs +++ b/src/FSharpx.Collections.Experimental/BootstrappedQueue.fs @@ -3,21 +3,18 @@ open FSharpx.Collections type NonEmptyBootstrappedQueue<'T> = - { - FrontAndSuspensionsLength: int - Front: list<'T> - Suspensions: BootstrappedQueue>> - RBackLength: int - RBack: list<'T> - } - - static member create lenfm f m lenr r = { - FrontAndSuspensionsLength = lenfm - Front = f - Suspensions = m - RBackLength = lenr - RBack = r - } + { FrontAndSuspensionsLength: int + Front: list<'T> + Suspensions: BootstrappedQueue>> + RBackLength: int + RBack: list<'T> } + + static member create lenfm f m lenr r = + { FrontAndSuspensionsLength = lenfm + Front = f + Suspensions = m + RBackLength = lenr + RBack = r } and BootstrappedQueue<'T> = | Empty diff --git a/src/FSharpx.Collections.Experimental/BottomUpMergeSort.fs b/src/FSharpx.Collections.Experimental/BottomUpMergeSort.fs index bb13872e..4691e09f 100644 --- a/src/FSharpx.Collections.Experimental/BottomUpMergeSort.fs +++ b/src/FSharpx.Collections.Experimental/BottomUpMergeSort.fs @@ -6,10 +6,9 @@ namespace FSharpx.Collections.Experimental [] module BottomUpMergeSort = - type Sortable<'T> = { - Size: int - Segments: Lazy>> - } + type Sortable<'T> = + { Size: int + Segments: Lazy>> } let rec merge xs ys = match xs, ys with @@ -22,7 +21,8 @@ module BottomUpMergeSort = let isEmpty x = x.Size = 0 - let singleton x = { Size = 1; Segments = lazy [ [ x ] ] } + let singleton x = + { Size = 1; Segments = lazy [ [ x ] ] } let rec addSeg seg segs size = if size % 2 = 0 then @@ -30,10 +30,9 @@ module BottomUpMergeSort = else addSeg (merge seg (List.head segs)) (List.tail segs) (size / 2) - let add x y = { - Size = y.Size + 1 - Segments = lazy addSeg [ x ] (y.Segments.Force()) y.Size - } + let add x y = + { Size = y.Size + 1 + Segments = lazy addSeg [ x ] (y.Segments.Force()) y.Size } let rec mergeAll xs ys = match xs, ys with diff --git a/src/FSharpx.Collections.Experimental/ChampHashMap.fs b/src/FSharpx.Collections.Experimental/ChampHashMap.fs index e302d030..71eaf6c7 100644 --- a/src/FSharpx.Collections.Experimental/ChampHashMap.fs +++ b/src/FSharpx.Collections.Experimental/ChampHashMap.fs @@ -272,10 +272,11 @@ module internal Node = let rec toSeq = function | EmptyNode -> Seq.empty - | BitmapNode(_, _, items, nodes) -> seq { - yield! items - yield! Seq.collect toSeq nodes - } + | BitmapNode(_, _, items, nodes) -> + seq { + yield! items + yield! Seq.collect toSeq nodes + } | CollisionNode(items, _) -> Array.toSeq items //Returns the number of entries in the node and all of its sub-nodes diff --git a/src/FSharpx.Collections.Experimental/DList.fs b/src/FSharpx.Collections.Experimental/DList.fs index 2240a736..3a031955 100644 --- a/src/FSharpx.Collections.Experimental/DList.fs +++ b/src/FSharpx.Collections.Experimental/DList.fs @@ -83,26 +83,28 @@ type DList<'T> = interface IEnumerable<'T> with member x.GetEnumerator() = - let enumerable = seq { - match x with - | Nil -> () - | Unit x -> yield x - | Join(x, y, _) -> - yield! x :> seq<'T> - yield! y :> seq<'T> - } + let enumerable = + seq { + match x with + | Nil -> () + | Unit x -> yield x + | Join(x, y, _) -> + yield! x :> seq<'T> + yield! y :> seq<'T> + } enumerable.GetEnumerator() member x.GetEnumerator() = - let enumerable = seq { - match x with - | Nil -> () - | Unit x -> yield x - | Join(x, y, _) -> - yield! x :> seq<'T> - yield! y :> seq<'T> - } + let enumerable = + seq { + match x with + | Nil -> () + | Unit x -> yield x + | Join(x, y, _) -> + yield! x :> seq<'T> + yield! y :> seq<'T> + } enumerable.GetEnumerator() :> IEnumerator diff --git a/src/FSharpx.Collections.Experimental/Deque.fs b/src/FSharpx.Collections.Experimental/Deque.fs index e7d42a85..2ff075b0 100644 --- a/src/FSharpx.Collections.Experimental/Deque.fs +++ b/src/FSharpx.Collections.Experimental/Deque.fs @@ -399,10 +399,11 @@ type Deque<'T>(front, rBack) = member this.Count = this.Length member this.GetEnumerator() = - let e = seq { - yield! front - yield! (List.rev rBack) - } + let e = + seq { + yield! front + yield! (List.rev rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/EagerRoseTree.fs b/src/FSharpx.Collections.Experimental/EagerRoseTree.fs index 9022e25e..13f65855 100644 --- a/src/FSharpx.Collections.Experimental/EagerRoseTree.fs +++ b/src/FSharpx.Collections.Experimental/EagerRoseTree.fs @@ -11,10 +11,8 @@ open System.Runtime.CompilerServices // Ported from http://hackage.haskell.org/packages/archive/containers/latest/doc/html/src/Data-Tree.html [] type EagerRoseTree<'T> = - { - Root: 'T - Children: EagerRoseForest<'T> - } + { Root: 'T + Children: EagerRoseForest<'T> } override x.Equals y = match y with @@ -37,23 +35,22 @@ and EagerRoseForest<'T> = EagerRoseTree<'T> list module EagerRoseTree = open FSharpx - let inline create root children = { Root = root; Children = children } + let inline create root children = + { Root = root; Children = children } let inline singleton x = create x List.empty - let rec map f (x: _ EagerRoseTree) = { - EagerRoseTree.Root = f x.Root - Children = List.map (map f) x.Children - } + let rec map f (x: _ EagerRoseTree) = + { EagerRoseTree.Root = f x.Root + Children = List.map (map f) x.Children } - let rec ap x f = { - EagerRoseTree.Root = f.Root x.Root - Children = + let rec ap x f = + { EagerRoseTree.Root = f.Root x.Root + Children = let a = List.map (map f.Root) x.Children let b = List.map (fun c -> ap x c) f.Children - List.append a b - } + List.append a b } let inline lift2 f a b = singleton f |> ap a |> ap b @@ -61,24 +58,24 @@ module EagerRoseTree = let rec bind f x = let a = f x.Root - { - EagerRoseTree.Root = a.Root - Children = List.append a.Children (List.map (bind f) x.Children) - } + { EagerRoseTree.Root = a.Root + Children = List.append a.Children (List.map (bind f) x.Children) } [] [] - let rec dfsPre(x: _ EagerRoseTree) = seq { - yield x.Root - yield! Seq.collect dfsPre x.Children - } + let rec dfsPre(x: _ EagerRoseTree) = + seq { + yield x.Root + yield! Seq.collect dfsPre x.Children + } [] [] - let rec dfsPost(x: _ EagerRoseTree) = seq { - yield! Seq.collect dfsPost x.Children - yield x.Root - } + let rec dfsPost(x: _ EagerRoseTree) = + seq { + yield! Seq.collect dfsPost x.Children + yield x.Root + } let rec unfold f seed = let root, bs = f seed diff --git a/src/FSharpx.Collections.Experimental/FlatList.fs b/src/FSharpx.Collections.Experimental/FlatList.fs index 051f4e23..706511df 100644 --- a/src/FSharpx.Collections.Experimental/FlatList.fs +++ b/src/FSharpx.Collections.Experimental/FlatList.fs @@ -30,12 +30,10 @@ type FlatList<'T> = val internal array: 'T[] internal new(arr: 'T[]) = - { - array = - (match arr with - | null -> null - | arr -> if arr.Length = 0 then null else arr) - } + { array = + (match arr with + | null -> null + | arr -> if arr.Length = 0 then null else arr) } member x.Item with get (n: int) = x.array.[n] diff --git a/src/FSharpx.Collections.Experimental/HoodMelvilleQueue.fs b/src/FSharpx.Collections.Experimental/HoodMelvilleQueue.fs index bfeb2329..7359fa48 100644 --- a/src/FSharpx.Collections.Experimental/HoodMelvilleQueue.fs +++ b/src/FSharpx.Collections.Experimental/HoodMelvilleQueue.fs @@ -146,56 +146,55 @@ type HoodMelvilleQueue<'T>(frontLength: int, front: list<'T>, state: RotationSta ) | _ -> None - with - interface IQueue<'T> with + interface IQueue<'T> with - member this.Count() = - this.Length + member this.Count() = + this.Length - member this.Head = this.Head + member this.Head = this.Head - member this.TryGetHead = this.TryGetHead + member this.TryGetHead = this.TryGetHead - member this.IsEmpty = this.IsEmpty + member this.IsEmpty = this.IsEmpty - member this.Length() = - this.Length + member this.Length() = + this.Length - member this.Snoc x = - this.Snoc x :> _ + member this.Snoc x = + this.Snoc x :> _ - member this.Tail = this.Tail :> _ + member this.Tail = this.Tail :> _ - member this.TryGetTail = - match this.TryGetTail with - | None -> None - | Some(q) -> Some(q :> _) + member this.TryGetTail = + match this.TryGetTail with + | None -> None + | Some(q) -> Some(q :> _) - member this.Uncons = - let x, xs = this.Uncons - x, xs :> _ + member this.Uncons = + let x, xs = this.Uncons + x, xs :> _ - member this.TryUncons = - match this.TryUncons with - | None -> None - | Some(x, q) -> Some(x, q :> _) + member this.TryUncons = + match this.TryUncons with + | None -> None + | Some(x, q) -> Some(x, q :> _) - interface IReadOnlyCollection<'T> with - member this.Count = this.Length + interface IReadOnlyCollection<'T> with + member this.Count = this.Length - member this.GetEnumerator() = - let e = - let q = HoodMelvilleQueue.readyQ this + member this.GetEnumerator() = + let e = + let q = HoodMelvilleQueue.readyQ this - seq { - yield! q.front - yield! (List.rev q.rBack) - } + seq { + yield! q.front + yield! (List.rev q.rBack) + } - e.GetEnumerator() + e.GetEnumerator() - member this.GetEnumerator() = - (this :> _ seq).GetEnumerator() :> IEnumerator + member this.GetEnumerator() = + (this :> _ seq).GetEnumerator() :> IEnumerator [] module HoodMelvilleQueue = diff --git a/src/FSharpx.Collections.Experimental/IndexedRoseTree.fs b/src/FSharpx.Collections.Experimental/IndexedRoseTree.fs index 7a45224b..d6459fdf 100644 --- a/src/FSharpx.Collections.Experimental/IndexedRoseTree.fs +++ b/src/FSharpx.Collections.Experimental/IndexedRoseTree.fs @@ -12,10 +12,8 @@ open System.Runtime.CompilerServices // Ported from http://hackage.haskell.org/packages/archive/containers/latest/doc/html/src/Data-Tree.html [] type IndexedRoseTree<'T> = - { - Root: 'T - Children: PersistentVector> - } + { Root: 'T + Children: PersistentVector> } override x.Equals y = match y with @@ -33,23 +31,22 @@ type IndexedRoseTree<'T> = [] module IndexedRoseTree = - let inline create root children = { Root = root; Children = children } + let inline create root children = + { Root = root; Children = children } let inline singleton x = create x PersistentVector.empty - let rec map f (x: _ IndexedRoseTree) = { - IndexedRoseTree.Root = f x.Root - Children = PersistentVector.map (map f) x.Children - } + let rec map f (x: _ IndexedRoseTree) = + { IndexedRoseTree.Root = f x.Root + Children = PersistentVector.map (map f) x.Children } - let rec ap x f = { - IndexedRoseTree.Root = f.Root x.Root - Children = + let rec ap x f = + { IndexedRoseTree.Root = f.Root x.Root + Children = let a = PersistentVector.map (map f.Root) x.Children let b = PersistentVector.map (fun c -> ap x c) f.Children - PersistentVector.append a b - } + PersistentVector.append a b } let inline lift2 f a b = singleton f |> ap a |> ap b @@ -57,20 +54,20 @@ module IndexedRoseTree = let rec bind f x = let a = f x.Root - { - IndexedRoseTree.Root = a.Root - Children = PersistentVector.append a.Children (PersistentVector.map (bind f) x.Children) - } + { IndexedRoseTree.Root = a.Root + Children = PersistentVector.append a.Children (PersistentVector.map (bind f) x.Children) } - let rec preOrder(x: _ IndexedRoseTree) = seq { - yield x.Root - yield! Seq.collect preOrder x.Children - } + let rec preOrder(x: _ IndexedRoseTree) = + seq { + yield x.Root + yield! Seq.collect preOrder x.Children + } - let rec postOrder(x: _ IndexedRoseTree) = seq { - yield! Seq.collect postOrder x.Children - yield x.Root - } + let rec postOrder(x: _ IndexedRoseTree) = + seq { + yield! Seq.collect postOrder x.Children + yield x.Root + } let rec unfold f seed = let root, bs = f seed diff --git a/src/FSharpx.Collections.Experimental/ListZipper.fs b/src/FSharpx.Collections.Experimental/ListZipper.fs index 2b5baafa..7dd0ec7d 100644 --- a/src/FSharpx.Collections.Experimental/ListZipper.fs +++ b/src/FSharpx.Collections.Experimental/ListZipper.fs @@ -36,7 +36,8 @@ module ListZipper = | _ -> back zipper |> front /// Creates a list zipper - let zipper list = { Focus = list; Path = [] } + let zipper list = + { Focus = list; Path = [] } /// Returns the whole list from the zipper let getList zipper = diff --git a/src/FSharpx.Collections.Experimental/PhysicistQueue.fs b/src/FSharpx.Collections.Experimental/PhysicistQueue.fs index 336033e4..15d520ec 100644 --- a/src/FSharpx.Collections.Experimental/PhysicistQueue.fs +++ b/src/FSharpx.Collections.Experimental/PhysicistQueue.fs @@ -170,10 +170,11 @@ type PhysicistQueue<'T>(prefix: list<'T>, frontLength: int, front: Lazy member this.Count = this.Length member this.GetEnumerator() = - let e = seq { - yield! front.Value - yield! (List.rev rBack) - } + let e = + seq { + yield! front.Value + yield! (List.rev rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/RealTimeDeque.fs b/src/FSharpx.Collections.Experimental/RealTimeDeque.fs index 0b36c7f3..36e70058 100644 --- a/src/FSharpx.Collections.Experimental/RealTimeDeque.fs +++ b/src/FSharpx.Collections.Experimental/RealTimeDeque.fs @@ -13,15 +13,7 @@ open System.Collections open System.Collections.Generic type RealTimeDeque<'T> - ( - c: int, - frontLength: int, - front: LazyList<'T>, - streamFront: LazyList<'T>, - rBackLength: int, - rBack: LazyList<'T>, - streamRBack: LazyList<'T> - ) = + (c: int, frontLength: int, front: LazyList<'T>, streamFront: LazyList<'T>, rBackLength: int, rBack: LazyList<'T>, streamRBack: LazyList<'T>) = member private this.c = c @@ -577,10 +569,11 @@ type RealTimeDeque<'T> with get i = this.Lookup i member this.GetEnumerator() = - let e = seq { - yield! front - yield! (LazyList.rev this.rBack) - } + let e = + seq { + yield! front + yield! (LazyList.rev this.rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections.Experimental/RealTimeQueue.fs b/src/FSharpx.Collections.Experimental/RealTimeQueue.fs index 6f2f0929..a732057d 100644 --- a/src/FSharpx.Collections.Experimental/RealTimeQueue.fs +++ b/src/FSharpx.Collections.Experimental/RealTimeQueue.fs @@ -2,11 +2,10 @@ open FSharpx.Collections -type RealTimeQueue<'T> = { - F: LazyList<'T> - R: list<'T> - S: LazyList<'T> -} +type RealTimeQueue<'T> = + { F: LazyList<'T> + R: list<'T> + S: LazyList<'T> } /// RealTime queue from Chris Okasaki's "Purely functional data structures" /// original implementation taken from http://lepensemoi.free.fr/index.php/2010/01/07/real-time-queue @@ -14,11 +13,10 @@ type RealTimeQueue<'T> = { module RealTimeQueue = ///O(1). Returns queue of no elements. - let empty<'T> : RealTimeQueue<'T> = { - F = LazyList.empty - R = [] - S = LazyList.empty - } + let empty<'T> : RealTimeQueue<'T> = + { F = LazyList.empty + R = [] + S = LazyList.empty } ///O(1). Returns true if the queue has no elements let isEmpty queue = diff --git a/src/FSharpx.Collections.Experimental/RingBuffer.fs b/src/FSharpx.Collections.Experimental/RingBuffer.fs index 7a6581d0..d78ca3fa 100644 --- a/src/FSharpx.Collections.Experimental/RingBuffer.fs +++ b/src/FSharpx.Collections.Experimental/RingBuffer.fs @@ -22,10 +22,9 @@ type RingBuffer<'T>(position: int, values: seq<'T>) = member private x.IndexOffset(i, offset) = (i + offset) % x.Buffer.Length - member x.ToArray() = [| - for i in 0 .. x.Buffer.Length - 1 do - yield x.Buffer.[x.IndexOffset(x.Position, i)] - |] + member x.ToArray() = + [| for i in 0 .. x.Buffer.Length - 1 do + yield x.Buffer.[x.IndexOffset(x.Position, i)] |] member x.Insert(op, offset, items) = if offset >= 0 && offset < x.Buffer.Length then diff --git a/src/FSharpx.Collections.Experimental/RoseTree.fs b/src/FSharpx.Collections.Experimental/RoseTree.fs index a57bab53..3447e66f 100644 --- a/src/FSharpx.Collections.Experimental/RoseTree.fs +++ b/src/FSharpx.Collections.Experimental/RoseTree.fs @@ -8,10 +8,8 @@ open System.Runtime.CompilerServices // Ported from https://hackage.haskell.org/package/containers-0.6.6/docs/Data-Tree.html [] type RoseTree<[] 'T> = - { - Root: 'T - Children: LazyList> - } + { Root: 'T + Children: LazyList> } override x.Equals y = match y with @@ -36,23 +34,22 @@ module L = LazyList module RoseTree = open FSharpx - let inline create root children = { Root = root; Children = children } + let inline create root children = + { Root = root; Children = children } let inline singleton x = create x L.empty - let rec map f (x: _ RoseTree) = { - RoseTree.Root = f x.Root - Children = L.map (map f) x.Children - } + let rec map f (x: _ RoseTree) = + { RoseTree.Root = f x.Root + Children = L.map (map f) x.Children } - let rec ap x f = { - RoseTree.Root = f.Root x.Root - Children = + let rec ap x f = + { RoseTree.Root = f.Root x.Root + Children = let a = L.map (map f.Root) x.Children let b = L.map (fun c -> ap x c) f.Children - L.append a b - } + L.append a b } let inline lift2 f a b = singleton f |> ap a |> ap b @@ -60,24 +57,24 @@ module RoseTree = let rec bind f x = let a = f x.Root - { - RoseTree.Root = a.Root - Children = L.append a.Children (L.map (bind f) x.Children) - } + { RoseTree.Root = a.Root + Children = L.append a.Children (L.map (bind f) x.Children) } [] [] - let rec dfsPre(x: _ RoseTree) = seq { - yield x.Root - yield! Seq.collect dfsPre x.Children - } + let rec dfsPre(x: _ RoseTree) = + seq { + yield x.Root + yield! Seq.collect dfsPre x.Children + } [] [] - let rec dfsPost(x: _ RoseTree) = seq { - yield! Seq.collect dfsPost x.Children - yield x.Root - } + let rec dfsPost(x: _ RoseTree) = + seq { + yield! Seq.collect dfsPost x.Children + yield x.Root + } let rec unfold f seed = let root, bs = f seed diff --git a/src/FSharpx.Collections.Experimental/SkewBinaryRandomAccessList.fs b/src/FSharpx.Collections.Experimental/SkewBinaryRandomAccessList.fs index 6698d256..f3591980 100644 --- a/src/FSharpx.Collections.Experimental/SkewBinaryRandomAccessList.fs +++ b/src/FSharpx.Collections.Experimental/SkewBinaryRandomAccessList.fs @@ -285,13 +285,14 @@ type SkewBinaryRandomAccessList<'T>(randomAccessList) = | Some(ts) -> Some(ts :> _) member this.GetEnumerator() = - let e = seq { - match this.TryUncons with - | None -> () - | Some(x, ts) -> - yield x - yield! ts - } + let e = + seq { + match this.TryUncons with + | None -> () + | Some(x, ts) -> + yield x + yield! ts + } e.GetEnumerator() diff --git a/src/FSharpx.Collections/ByteString.fs b/src/FSharpx.Collections/ByteString.fs index adec9ac6..e7fa8892 100644 --- a/src/FSharpx.Collections/ByteString.fs +++ b/src/FSharpx.Collections/ByteString.fs @@ -52,8 +52,7 @@ type ByteString(array: byte[], offset: int, count: int) = member self.MoveNext() = false member self.Reset() = () interface System.IDisposable with - member self.Dispose() = () - } + member self.Dispose() = () } else let segment = x.Array let minIndex = x.Offset @@ -87,8 +86,7 @@ type ByteString(array: byte[], offset: int, count: int) = member self.Reset() = currentIndex <- minIndex - 1 interface System.IDisposable with - member self.Dispose() = () - } + member self.Dispose() = () } member this.Item with get pos = this.Array.[this.Offset + pos] diff --git a/src/FSharpx.Collections/CircularBuffer.fs b/src/FSharpx.Collections/CircularBuffer.fs index d8468962..ea44f8db 100644 --- a/src/FSharpx.Collections/CircularBuffer.fs +++ b/src/FSharpx.Collections/CircularBuffer.fs @@ -17,15 +17,16 @@ type CircularBuffer<'T>(bufferSize: int) = let mutable tail = 0 let mutable length = 0 - let rec nextBuffer offset count = seq { - let overflow = count + offset - bufferSize + let rec nextBuffer offset count = + seq { + let overflow = count + offset - bufferSize - if overflow > 0 then - yield (offset, bufferSize - offset) - yield! nextBuffer 0 overflow - else - yield (offset, count) - } + if overflow > 0 then + yield (offset, bufferSize - offset) + yield! nextBuffer 0 overflow + else + yield (offset, count) + } member this.Count = length @@ -83,12 +84,13 @@ type CircularBuffer<'T>(bufferSize: int) = this.Enqueue([| value |], 0, 1) member this.GetEnumerator() = - let rec loop() = seq { - if length > 0 then - yield this.Dequeue(1).[0] + let rec loop() = + seq { + if length > 0 then + yield this.Dequeue(1).[0] - yield! loop() - } + yield! loop() + } loop().GetEnumerator() diff --git a/src/FSharpx.Collections/Collections.fs b/src/FSharpx.Collections/Collections.fs index 6b3b2805..1dff6f9f 100644 --- a/src/FSharpx.Collections/Collections.fs +++ b/src/FSharpx.Collections/Collections.fs @@ -11,10 +11,11 @@ open System.Runtime.CompilerServices module Seq = /// Prepends `x` to the seq `xs` - let cons x xs = seq { - yield x - yield! xs - } + let cons x xs = + seq { + yield x + yield! xs + } /// Returns the head and tail of the seq. If the seq is empty, returns `None`. let unCons s = @@ -40,11 +41,12 @@ module Seq = let inline findExactlyOne (predicate: 'a -> bool) (source: seq<'a>) : 'a = source |> Seq.filter predicate |> Seq.exactlyOne - let inline lift2 f l1 l2 = seq { - for i in l1 do - for j in l2 do - yield f i j - } + let inline lift2 f l1 l2 = + seq { + for i in l1 do + for j in l2 do + yield f i j + } /// Will iterate the current sequence until the given predicate is satisfied let iterBreak (f: 'T -> bool) (seq: seq<_>) = @@ -57,7 +59,7 @@ module Seq = /// The same as Seq.average except will return None if the seq is empty let inline tryAverage(seq: seq<(^a)>) : ^a option = use e = seq.GetEnumerator() - let mutable acc = LanguagePrimitives.GenericZero<( ^a)> + let mutable acc = LanguagePrimitives.GenericZero<(^a)> let mutable count = 0 while e.MoveNext() do @@ -67,7 +69,7 @@ module Seq = if count = 0 then None else - Some(LanguagePrimitives.DivideByInt<( ^a)> acc count) + Some(LanguagePrimitives.DivideByInt<(^a)> acc count) /// The same as Seq.tryHead but also returning the tail alongside the head (in a tuple) let tryHeadTail<'T>(sequence: seq<'T>) : Option<'T * seq<'T>> = @@ -102,21 +104,23 @@ module Seq = #if !FABLE_COMPILER /// Converts a streamReader into a seq yielding on each line - let ofStreamReader(streamReader: System.IO.StreamReader) = seq { - use sr = streamReader + let ofStreamReader(streamReader: System.IO.StreamReader) = + seq { + use sr = streamReader - while not(sr.EndOfStream) do - yield sr.ReadLine() - } + while not(sr.EndOfStream) do + yield sr.ReadLine() + } #endif #if !FABLE_COMPILER /// Converts a Stream into a sequence of bytes - let ofStreamByByte(stream: System.IO.Stream) = seq { - while stream.Length <> stream.Position do - let x = stream.ReadByte() - if (int x) < 0 then () else yield x - } + let ofStreamByByte(stream: System.IO.Stream) = + seq { + while stream.Length <> stream.Position do + let x = stream.ReadByte() + if (int x) < 0 then () else yield x + } #endif #if !FABLE_COMPILER @@ -134,58 +138,63 @@ module Seq = /// Creates a infinite sequences of the given values let asCircular values = - let rec next() = seq { - for element in values do - yield element + let rec next() = + seq { + for element in values do + yield element - yield! next() - } + yield! next() + } next() /// Creates a infinite sequences of the given values, executing the given function everytime the given seq is exhausted let asCircularOnLoop f values = - let rec next() = seq { - for element in values do - yield element + let rec next() = + seq { + for element in values do + yield element - f() - yield! next() - } + f() + yield! next() + } next() /// Creates a infinite sequences of the given values returning None everytime the given seq is exhausted let asCircularWithBreak values = - let rec next() = seq { - for element in values do - yield Some(element) + let rec next() = + seq { + for element in values do + yield Some(element) - yield None - yield! next() - } + yield None + yield! next() + } next() - let tail(source: seq<_>) = seq { - use e = source.GetEnumerator() + let tail(source: seq<_>) = + seq { + use e = source.GetEnumerator() - if e.MoveNext() then - while e.MoveNext() do - yield e.Current - else - invalidArg "source" "source sequence cannot be empty" - } + if e.MoveNext() then + while e.MoveNext() do + yield e.Current + else + invalidArg "source" "source sequence cannot be empty" + } - let tailNoFail(source: seq<_>) = seq { - use e = source.GetEnumerator() + let tailNoFail(source: seq<_>) = + seq { + use e = source.GetEnumerator() - if e.MoveNext() then - while e.MoveNext() do - yield e.Current - else - () - } + if e.MoveNext() then + while e.MoveNext() do + yield e.Current + else + () + } /// The same as Seq.nth except returns None if the sequence is empty or does not have enough elements let tryNth index (source: seq<_>) = @@ -214,35 +223,38 @@ module Seq = #endif /// Creates an infinite sequence of the given value - let repeat a = seq { - while true do - yield a - } + let repeat a = + seq { + while true do + yield a + } /// Contracts a seq selecting every n values - let rec contract n (source: seq<_>) = seq { - let values = source |> skipNoFail(n - 1) + let rec contract n (source: seq<_>) = + seq { + let values = source |> skipNoFail(n - 1) - match values |> tryNth 0 with - | Some(v) -> - yield v - yield! contract n (tailNoFail values) - | None -> () - } + match values |> tryNth 0 with + | Some(v) -> + yield v + yield! contract n (tailNoFail values) + | None -> () + } /// Creates a new collection whose elements are the results of applying the given function to the corresponding pairs of elements from the two sequences. /// Unlike Seq.map2, if one input sequence is shorter than the other then the remaining elements of the longer sequence are not ignored, they are yielded at the end of the resulting sequence. - let rec combine f (a: seq<_>) (b: seq<_>) = seq { - use e = a.GetEnumerator() - use e' = b.GetEnumerator() - let mutable eNext = e.MoveNext() - let mutable eNext' = e'.MoveNext() - - while eNext || eNext' do - yield f e.Current e'.Current - eNext <- e.MoveNext() - eNext' <- e'.MoveNext() - } + let rec combine f (a: seq<_>) (b: seq<_>) = + seq { + use e = a.GetEnumerator() + use e' = b.GetEnumerator() + let mutable eNext = e.MoveNext() + let mutable eNext' = e'.MoveNext() + + while eNext || eNext' do + yield f e.Current e'.Current + eNext <- e.MoveNext() + eNext' <- e'.MoveNext() + } /// Replicates each element in the seq n-times let grow n = @@ -252,22 +264,24 @@ module Seq = let page page pageSize (source: seq<_>) = source |> skipNoFail(page * pageSize) |> Seq.truncate pageSize - let prependToAll sep list = seq { - for element in list do - yield sep - yield element - } + let prependToAll sep list = + seq { + for element in list do + yield sep + yield element + } - let intersperse (sep: 'a) (list: 'a seq) : 'a seq = seq { - let mutable notFirst = false + let intersperse (sep: 'a) (list: 'a seq) : 'a seq = + seq { + let mutable notFirst = false - for element in list do - if notFirst then - yield sep + for element in list do + if notFirst then + yield sep - yield element - notFirst <- true - } + yield element + notFirst <- true + } /// The catOptions function takes a list of Options and returns a seq of all the Some values. let inline catOptions(xs: seq>) = @@ -421,11 +435,10 @@ module List = let inline findExactlyOne (predicate: 'a -> bool) (source: 'a list) : 'a = source |> List.filter predicate |> List.exactlyOne - let inline lift2 f (l1: _ list) (l2: _ list) = [ - for i in l1 do - for j in l2 do - yield f i j - ] + let inline lift2 f (l1: _ list) (l2: _ list) = + [ for i in l1 do + for j in l2 do + yield f i j ] let span pred l = @@ -513,18 +526,17 @@ module List = | _ -> [] /// Merges to sequences using the given function to transform the elements for comparision - let rec mergeBy f (a: _ list) (b: _ list) = [ - match a, b with - | h :: t, h' :: t' when f(h) < f(h') -> - yield h - yield! mergeBy f t b - | h :: t, h' :: t' -> - yield h' - yield! mergeBy f a t' - | h :: t, [] -> yield! a - | [], h :: t -> yield! b - | [], [] -> () - ] + let rec mergeBy f (a: _ list) (b: _ list) = + [ match a, b with + | h :: t, h' :: t' when f(h) < f(h') -> + yield h + yield! mergeBy f t b + | h :: t, h' :: t' -> + yield h' + yield! mergeBy f a t' + | h :: t, [] -> yield! a + | [], h :: t -> yield! b + | [], [] -> () ] /// Merges two sequences by the default comparer for 'T let merge a b = @@ -830,8 +842,7 @@ module NameValueCollection = enum.Reset() member e.Dispose() = () - member e.Current = box(wrapElem enum.Current) - } + member e.Current = box(wrapElem enum.Current) } { new IDictionary with member d.Count = x.Count @@ -906,8 +917,7 @@ module NameValueCollection = value <- d.[key] true else - false - } + false } [] [] @@ -961,8 +971,7 @@ module NameValueCollection = false member d.TryGetValue(key: string, value: byref) = - a.TryGetValue(key, &value) - } + a.TryGetValue(key, &value) } [] [] @@ -981,8 +990,7 @@ module NameValueCollection = values.GetEnumerator() member x.GetEnumerator() = - values.GetEnumerator() :> IEnumerator - } + values.GetEnumerator() :> IEnumerator } { new IEnumerator> with member x.Current = wrapElem e.Current @@ -992,8 +1000,7 @@ module NameValueCollection = member x.Reset() = e.Reset() member x.Dispose() = () - member x.Current = box(wrapElem e.Current) - } + member x.Current = box(wrapElem e.Current) } { new ILookup with member x.Count = this.Count @@ -1011,6 +1018,5 @@ module NameValueCollection = getEnumerator() member x.GetEnumerator() = - getEnumerator() :> IEnumerator - } + getEnumerator() :> IEnumerator } #endif diff --git a/src/FSharpx.Collections/DList.fs b/src/FSharpx.Collections/DList.fs index 3e3506cc..42f73e57 100644 --- a/src/FSharpx.Collections/DList.fs +++ b/src/FSharpx.Collections/DList.fs @@ -84,7 +84,7 @@ type DList<'T>(length: int, data: DListData<'T>) = | _ -> Join(left, right) static member appendLists((left: DList<'T>), (right: DList<'T>)) = - DList((left.Length + right.Length), (DList<'T>.append (left.dc, right.dc))) + DList((left.Length + right.Length), (DList<'T>.append(left.dc, right.dc))) static member head data = match data with @@ -113,14 +113,14 @@ type DList<'T>(length: int, data: DListData<'T>) = | _ -> false member this.Conj(x: 'T) = - DList((length + 1), DList<'T>.append (data, Unit x)) + DList((length + 1), DList<'T>.append(data, Unit x)) member this.Tail = let rec step (xs: DListData<'T>) (acc: DListData<'T>) = match xs with | Nil -> acc | Unit _ -> acc - | Join(x, y) -> step x (DList<'T>.append (y, acc)) + | Join(x, y) -> step x (DList<'T>.append(y, acc)) if this.IsEmpty then failwith "DList.tail: empty DList" @@ -132,7 +132,7 @@ type DList<'T>(length: int, data: DListData<'T>) = match xs with | Nil -> acc | Unit _ -> acc - | Join(x, y) -> step x (DList<'T>.append (y, acc)) + | Join(x, y) -> step x (DList<'T>.append(y, acc)) if this.IsEmpty then None @@ -148,20 +148,21 @@ type DList<'T>(length: int, data: DListData<'T>) = member this.toSeq() = //adaptation of right-hand side of Norman Ramsey's "fold" - let rec walk rights l = seq { - match l with - | Nil -> - match rights with - | [] -> () - | t :: ts -> yield! walk ts t - | Unit x -> - yield x - - match rights with - | [] -> () - | t :: ts -> yield! walk ts t - | Join(x, y) -> yield! walk (y :: rights) x - } + let rec walk rights l = + seq { + match l with + | Nil -> + match rights with + | [] -> () + | t :: ts -> yield! walk ts t + | Unit x -> + yield x + + match rights with + | [] -> () + | t :: ts -> yield! walk ts t + | Join(x, y) -> yield! walk (y :: rights) x + } (walk [] data).GetEnumerator() @@ -197,7 +198,7 @@ module DList = | None -> Nil let append left right = - DList<'T>.appendLists (left, right) + DList<'T>.appendLists(left, right) let cons hd (l: DList<'T>) = match l.Length with diff --git a/src/FSharpx.Collections/Deque.fs b/src/FSharpx.Collections/Deque.fs index 61ff0c1f..2a056164 100644 --- a/src/FSharpx.Collections/Deque.fs +++ b/src/FSharpx.Collections/Deque.fs @@ -154,10 +154,11 @@ type Deque<'T>(front, rBack) = interface IEnumerable<'T> with member this.GetEnumerator() = - let e = seq { - yield! front - yield! (List.rev rBack) - } + let e = + seq { + yield! front + yield! (List.rev rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections/LazyList.fs b/src/FSharpx.Collections/LazyList.fs index 3f16ff86..ab0c935f 100644 --- a/src/FSharpx.Collections/LazyList.fs +++ b/src/FSharpx.Collections/LazyList.fs @@ -14,9 +14,7 @@ exception UndefinedException [] type LazyList<'T> = - { - status: Lazy> - } + { status: Lazy> } member x.Value = x.status.Value @@ -96,10 +94,13 @@ and [] LazyListCell<'T> = [] module LazyList = - let lzy f = { status = Lazy<_>.Create f } + let lzy f = + { status = Lazy<_>.Create f } + let force(x: LazyList<'T>) = x.Value - let notlazy v = { status = Lazy<_>.CreateFromValue v } + let notlazy v = + { status = Lazy<_>.CreateFromValue v } let getCell(x: LazyList<'T>) = force x let empty<'T> : LazyList<'T> = notlazy CellEmpty diff --git a/src/FSharpx.Collections/NonEmptyList.fs b/src/FSharpx.Collections/NonEmptyList.fs index 410ae264..4540ee7c 100644 --- a/src/FSharpx.Collections/NonEmptyList.fs +++ b/src/FSharpx.Collections/NonEmptyList.fs @@ -7,9 +7,7 @@ open System.Runtime.CompilerServices type NonEmptyList<'T> = private - { - List: 'T list - } + { List: 'T list } member this.Head = this.List.Head member this.Tail = this.List.Tail @@ -30,11 +28,13 @@ type NonEmptyList<'T> = [] module NonEmptyList = [] - let create head tail = { List = head :: tail } + let create head tail = + { List = head :: tail } #if !FABLE_COMPILER [] - let createParamsArray(head, [] tail) = { List = head :: List.ofArray tail } + let createParamsArray(head, [] tail) = + { List = head :: List.ofArray tail } #endif [] @@ -84,18 +84,22 @@ module NonEmptyList = { List = List.ofSeq e } [] - let map f list = { List = List.map f list.List } + let map f list = + { List = List.map f list.List } [] - let cons head tail = { List = head :: tail.List } + let cons head tail = + { List = head :: tail.List } #if !FABLE_COMPILER [] #endif - let appendList list1 list2 = { List = list1.List @ list2 } + let appendList list1 list2 = + { List = list1.List @ list2 } [] - let append list1 list2 = { List = list1.List @ list2.List } + let append list1 list2 = + { List = list1.List @ list2.List } [] let reduce reduction list = @@ -107,13 +111,13 @@ module NonEmptyList = [] [] - let rev list = { List = List.rev list.List } + let rev list = + { List = List.rev list.List } [] let collect (mapping: 'a -> NonEmptyList<'b>) (list: NonEmptyList<'a>) = list.List |> List.collect(fun x -> (mapping x).List) |> ofList [] - let zip list1 list2 = { - List = List.zip list1.List list2.List - } + let zip list1 list2 = + { List = List.zip list1.List list2.List } diff --git a/src/FSharpx.Collections/PersistentHashMap.fs b/src/FSharpx.Collections/PersistentHashMap.fs index 37cac099..a41d598f 100644 --- a/src/FSharpx.Collections/PersistentHashMap.fs +++ b/src/FSharpx.Collections/PersistentHashMap.fs @@ -68,22 +68,23 @@ module private NodeHelpers = System.Array.Copy(array, 2 * (i + 1), newArray, 2 * i, newArray.Length - 2 * i) newArray - let inline createNodeSeq(array: obj[]) = seq { - let mutable j = 0 + let inline createNodeSeq(array: obj[]) = + seq { + let mutable j = 0 - while j < array.Length do - let isNode = array.[j + 1] :? INode + while j < array.Length do + let isNode = array.[j + 1] :? INode - if isNode then - let node = array.[j + 1] :?> INode + if isNode then + let node = array.[j + 1] :?> INode - if node <> Unchecked.defaultof then - yield! node.nodeSeq() - else if array.[j] <> null then - yield array.[j], array.[j + 1] + if node <> Unchecked.defaultof then + yield! node.nodeSeq() + else if array.[j] <> null then + yield array.[j], array.[j + 1] - j <- j + 2 - } + j <- j + 2 + } open BitCount open NodeHelpers @@ -98,9 +99,7 @@ type private NodeCreation = let addedLeaf = Box(null) - (BitmapIndexedNode() :> INode) - .assoc(thread, shift, key1hash, key1, val1, addedLeaf) - .assoc(thread, shift, key2hash, key2, val2, addedLeaf) + (BitmapIndexedNode() :> INode).assoc(thread, shift, key1hash, key1, val1, addedLeaf).assoc(thread, shift, key2hash, key2, val2, addedLeaf) static member createNode(shift, key1, val1, key2hash, key2, val2) = let key1hash = hash(key1) @@ -111,292 +110,283 @@ type private NodeCreation = let addedLeaf = Box(null) - (BitmapIndexedNode() :> INode) - .assoc(shift, key1hash, key1, val1, addedLeaf) - .assoc(shift, key2hash, key2, val2, addedLeaf) + (BitmapIndexedNode() :> INode).assoc(shift, key1hash, key1, val1, addedLeaf).assoc(shift, key2hash, key2, val2, addedLeaf) and private HashCollisionNode(thread, hashCollisionKey, count', array': obj[]) = let thread = thread member val array = array' with get, set member val count = count' with get, set - with - member this.findIndex key = - let mutable i = 0 + member this.findIndex key = + let mutable i = 0 - while (i < 2 * this.count) && (key <> this.array.[i]) do - i <- i + 2 + while (i < 2 * this.count) && (key <> this.array.[i]) do + i <- i + 2 - if i < 2 * this.count then i else -1 + if i < 2 * this.count then i else -1 - member this.ensureEditable(thread1, count1, array1) = - if !thread1 = !thread then - this.array <- array1 - this.count <- count1 - this - else - HashCollisionNode(thread1, hashCollisionKey, count1, array1) + member this.ensureEditable(thread1, count1, array1) = + if !thread1 = !thread then + this.array <- array1 + this.count <- count1 + this + else + HashCollisionNode(thread1, hashCollisionKey, count1, array1) - member this.ensureEditable(thread1) = - if !thread1 = !thread then - this - else - let newArray = Array.create (2 * (this.count + 1)) null // make room for next assoc - System.Array.Copy(this.array, 0, newArray, 0, 2 * this.count) - HashCollisionNode(thread1, hashCollisionKey, this.count, newArray) + member this.ensureEditable(thread1) = + if !thread1 = !thread then + this + else + let newArray = Array.create (2 * (this.count + 1)) null // make room for next assoc + System.Array.Copy(this.array, 0, newArray, 0, 2 * this.count) + HashCollisionNode(thread1, hashCollisionKey, this.count, newArray) - member this.editAndSet(thread1, i, a) = - let editable = this.ensureEditable(thread1) - editable.array.[i] <- a - editable + member this.editAndSet(thread1, i, a) = + let editable = this.ensureEditable(thread1) + editable.array.[i] <- a + editable - member this.editAndSet(thread1, i, a, j, b) = - let editable = this.ensureEditable(thread1) - editable.array.[i] <- a - editable.array.[j] <- b - editable + member this.editAndSet(thread1, i, a, j, b) = + let editable = this.ensureEditable(thread1) + editable.array.[i] <- a + editable.array.[j] <- b + editable - interface INode with + interface INode with - member this.assoc(shift, hashKey, key, value, addedLeaf) : INode = - if hashKey = hashCollisionKey then - let idx = this.findIndex(key) + member this.assoc(shift, hashKey, key, value, addedLeaf) : INode = + if hashKey = hashCollisionKey then + let idx = this.findIndex(key) - if idx <> -1 then - if this.array.[idx + 1] = value then - this :> INode - else - HashCollisionNode(ref null, hashKey, this.count, cloneAndSet(this.array, idx + 1, value)) :> INode + if idx <> -1 then + if this.array.[idx + 1] = value then + this :> INode else - let newArray = Array.create (2 * (this.count + 1)) null - System.Array.Copy(this.array, 0, newArray, 0, 2 * this.count) - newArray.[2 * this.count] <- key - newArray.[2 * this.count + 1] <- value - addedLeaf.Value <- addedLeaf :> obj - HashCollisionNode(thread, hashKey, this.count + 1, newArray) :> INode + HashCollisionNode(ref null, hashKey, this.count, cloneAndSet(this.array, idx + 1, value)) :> INode else - (BitmapIndexedNode(ref null, bitpos(hashCollisionKey, shift), [| null; this |]) :> INode) - .assoc(shift, hashKey, key, value, addedLeaf) + let newArray = Array.create (2 * (this.count + 1)) null + System.Array.Copy(this.array, 0, newArray, 0, 2 * this.count) + newArray.[2 * this.count] <- key + newArray.[2 * this.count + 1] <- value + addedLeaf.Value <- addedLeaf :> obj + HashCollisionNode(thread, hashKey, this.count + 1, newArray) :> INode + else + (BitmapIndexedNode(ref null, bitpos(hashCollisionKey, shift), [| null; this |]) :> INode).assoc(shift, hashKey, key, value, addedLeaf) - member this.assoc(thread1, shift, hashKey, key, value, addedLeaf) : INode = - if hashCollisionKey = hashKey then - let idx = this.findIndex(key) + member this.assoc(thread1, shift, hashKey, key, value, addedLeaf) : INode = + if hashCollisionKey = hashKey then + let idx = this.findIndex(key) - if idx <> -1 then - if this.array.[idx + 1] = value then - this :> INode - else - this.editAndSet(thread1, idx + 1, value) :> INode - else if this.array.Length > 2 * this.count then - addedLeaf.Value <- addedLeaf :> obj + if idx <> -1 then + if this.array.[idx + 1] = value then + this :> INode + else + this.editAndSet(thread1, idx + 1, value) :> INode + else if this.array.Length > 2 * this.count then + addedLeaf.Value <- addedLeaf :> obj - let editable = - this.editAndSet(thread1, 2 * this.count, key, 2 * this.count + 1, value) + let editable = + this.editAndSet(thread1, 2 * this.count, key, 2 * this.count + 1, value) - editable.count <- editable.count + 1 - editable :> INode - else - let newArray = Array.create (this.array.Length + 2) null - System.Array.Copy(this.array, 0, newArray, 0, this.array.Length) - newArray.[this.array.Length] <- key - newArray.[this.array.Length + 1] <- value - addedLeaf.Value <- addedLeaf :> obj - this.ensureEditable(thread1, this.count + 1, newArray) :> INode + editable.count <- editable.count + 1 + editable :> INode else - // nest it in a bitmap node - (BitmapIndexedNode(thread1, bitpos(hashCollisionKey, shift), [| null; this; null; null |]) :> INode) - .assoc(thread1, shift, hashKey, key, value, addedLeaf) + let newArray = Array.create (this.array.Length + 2) null + System.Array.Copy(this.array, 0, newArray, 0, this.array.Length) + newArray.[this.array.Length] <- key + newArray.[this.array.Length + 1] <- value + addedLeaf.Value <- addedLeaf :> obj + this.ensureEditable(thread1, this.count + 1, newArray) :> INode + else + // nest it in a bitmap node + (BitmapIndexedNode(thread1, bitpos(hashCollisionKey, shift), [| null; this; null; null |]) :> INode) + .assoc(thread1, shift, hashKey, key, value, addedLeaf) - member this.find(shift, hash, key) = - let idx = this.findIndex(key) + member this.find(shift, hash, key) = + let idx = this.findIndex(key) - if idx < 0 then null - else if key = this.array.[idx] then this.array.[idx + 1] - else null + if idx < 0 then null + else if key = this.array.[idx] then this.array.[idx + 1] + else null - member this.tryFind(shift, hash, key) = - let idx = this.findIndex(key) + member this.tryFind(shift, hash, key) = + let idx = this.findIndex(key) - if idx < 0 then - None - else if key = this.array.[idx] then - Some this.array.[idx + 1] - else - None + if idx < 0 then + None + else if key = this.array.[idx] then + Some this.array.[idx + 1] + else + None - member this.without(shift, hashKey, key) = - let idx = this.findIndex(key) + member this.without(shift, hashKey, key) = + let idx = this.findIndex(key) - if idx = -1 then - this :> INode - else if this.count = 1 then - Unchecked.defaultof - else - HashCollisionNode(ref null, hashKey, this.count - 1, removePair(this.array, idx / 2)) :> INode + if idx = -1 then + this :> INode + else if this.count = 1 then + Unchecked.defaultof + else + HashCollisionNode(ref null, hashKey, this.count - 1, removePair(this.array, idx / 2)) :> INode - member this.nodeSeq() = - createNodeSeq this.array + member this.nodeSeq() = + createNodeSeq this.array - member this.without(thread, shift, hashKey, key, removedLeaf) = - let idx = this.findIndex(key) + member this.without(thread, shift, hashKey, key, removedLeaf) = + let idx = this.findIndex(key) - if idx = -1 then - this :> INode - else - removedLeaf.Value <- removedLeaf :> obj + if idx = -1 then + this :> INode + else + removedLeaf.Value <- removedLeaf :> obj - if this.count = 1 then - Unchecked.defaultof - else - let editable = this.ensureEditable(thread) - editable.array.[idx] <- editable.array.[2 * this.count - 2] - editable.array.[idx + 1] <- editable.array.[2 * this.count - 1] - editable.array.[2 * this.count - 2] <- null - editable.array.[2 * this.count - 1] <- null - editable.count <- editable.count - 1 - editable :> INode + if this.count = 1 then + Unchecked.defaultof + else + let editable = this.ensureEditable(thread) + editable.array.[idx] <- editable.array.[2 * this.count - 2] + editable.array.[idx + 1] <- editable.array.[2 * this.count - 1] + editable.array.[2 * this.count - 2] <- null + editable.array.[2 * this.count - 1] <- null + editable.count <- editable.count - 1 + editable :> INode and private ArrayNode(thread, count', array': INode[]) = member val array = array' with get, set member val count = count' with get, set - with - member this.pack(thred, idx) = - let newArray = Array.create (2 * (this.count - 1)) null - let mutable j = 1 - let mutable bitmap = 0 + member this.pack(thred, idx) = + let newArray = Array.create (2 * (this.count - 1)) null + let mutable j = 1 + let mutable bitmap = 0 - for i in 0 .. idx - 1 do - if this.array.[i] <> Unchecked.defaultof then - newArray.[j] <- this.array.[i] :> obj - bitmap <- bitmap ||| (1 <<< i) - j <- j + 2 + for i in 0 .. idx - 1 do + if this.array.[i] <> Unchecked.defaultof then + newArray.[j] <- this.array.[i] :> obj + bitmap <- bitmap ||| (1 <<< i) + j <- j + 2 - for i in idx + 1 .. this.array.Length - 1 do - if this.array.[i] <> Unchecked.defaultof then - newArray.[j] <- this.array.[i] :> obj - bitmap <- bitmap ||| (1 <<< i) - j <- j + 2 + for i in idx + 1 .. this.array.Length - 1 do + if this.array.[i] <> Unchecked.defaultof then + newArray.[j] <- this.array.[i] :> obj + bitmap <- bitmap ||| (1 <<< i) + j <- j + 2 - BitmapIndexedNode(thread, bitmap, newArray) + BitmapIndexedNode(thread, bitmap, newArray) - member this.ensureEditable(thread1) = - if !thread1 = !thread then - this - else - ArrayNode(thread1, this.count, Array.copy this.array) + member this.ensureEditable(thread1) = + if !thread1 = !thread then + this + else + ArrayNode(thread1, this.count, Array.copy this.array) - member this.editAndSet(thread1, i, n) = - let editable = this.ensureEditable(thread1) - editable.array.[i] <- n - editable + member this.editAndSet(thread1, i, n) = + let editable = this.ensureEditable(thread1) + editable.array.[i] <- n + editable - interface INode with + interface INode with - member this.assoc(shift, hashKey, key, value, addedLeaf) : INode = - let idx = mask(hashKey, shift) - let node = this.array.[idx] + member this.assoc(shift, hashKey, key, value, addedLeaf) : INode = + let idx = mask(hashKey, shift) + let node = this.array.[idx] - if node = Unchecked.defaultof then - ArrayNode( - ref null, - this.count + 1, - cloneAndSetNodes(this.array, idx, (BitmapIndexedNode() :> INode).assoc(shift + 5, hashKey, key, value, addedLeaf)) - ) - :> INode + if node = Unchecked.defaultof then + ArrayNode( + ref null, + this.count + 1, + cloneAndSetNodes(this.array, idx, (BitmapIndexedNode() :> INode).assoc(shift + 5, hashKey, key, value, addedLeaf)) + ) + :> INode + else + let n = node.assoc(shift + 5, hashKey, key, value, addedLeaf) + + if n = node then + this :> INode else - let n = node.assoc(shift + 5, hashKey, key, value, addedLeaf) + ArrayNode(ref null, this.count, cloneAndSetNodes(this.array, idx, n)) :> INode - if n = node then - this :> INode - else - ArrayNode(ref null, this.count, cloneAndSetNodes(this.array, idx, n)) :> INode + member this.assoc(thread1, shift, hashKey, key, value, addedLeaf) : INode = + let idx = mask(hashKey, shift) + let node = this.array.[idx] - member this.assoc(thread1, shift, hashKey, key, value, addedLeaf) : INode = - let idx = mask(hashKey, shift) - let node = this.array.[idx] + if node = Unchecked.defaultof then + let editable = + this.editAndSet(thread1, idx, (BitmapIndexedNode() :> INode).assoc(thread1, shift + 5, hashKey, key, value, addedLeaf)) - if node = Unchecked.defaultof then - let editable = - this.editAndSet( - thread1, - idx, - (BitmapIndexedNode() :> INode) - .assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) - ) + editable.count <- editable.count + 1 + editable :> INode + else + let n = node.assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) - editable.count <- editable.count + 1 - editable :> INode + if n = node then + this :> INode else - let n = node.assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) + this.editAndSet(thread1, idx, n) :> INode - if n = node then - this :> INode - else - this.editAndSet(thread1, idx, n) :> INode + member this.find(shift, hash, key) = + let idx = mask(hash, shift) + let node = this.array.[idx] - member this.find(shift, hash, key) = - let idx = mask(hash, shift) - let node = this.array.[idx] + if node = Unchecked.defaultof then + null + else + node.find(shift + 5, hash, key) - if node = Unchecked.defaultof then - null - else - node.find(shift + 5, hash, key) + member this.tryFind(shift, hash, key) = + let idx = mask(hash, shift) + let node = this.array.[idx] - member this.tryFind(shift, hash, key) = - let idx = mask(hash, shift) - let node = this.array.[idx] + if node = Unchecked.defaultof then + None + else + node.tryFind(shift + 5, hash, key) - if node = Unchecked.defaultof then - None - else - node.tryFind(shift + 5, hash, key) + member this.without(shift, hashKey, key) = + let idx = mask(hashKey, shift) + let node = this.array.[idx] - member this.without(shift, hashKey, key) = - let idx = mask(hashKey, shift) - let node = this.array.[idx] + if node = Unchecked.defaultof then + this :> INode + else + let n = node.without(shift + 5, hashKey, key) - if node = Unchecked.defaultof then + if n = node then this :> INode + else if n = Unchecked.defaultof then + if this.count <= 8 then // shrink + this.pack(ref null, idx) :> INode + else + ArrayNode(ref null, this.count - 1, cloneAndSetNodes(this.array, idx, n)) :> INode else - let n = node.without(shift + 5, hashKey, key) + ArrayNode(ref null, this.count, cloneAndSetNodes(this.array, idx, n)) :> INode - if n = node then - this :> INode - else if n = Unchecked.defaultof then - if this.count <= 8 then // shrink - this.pack(ref null, idx) :> INode - else - ArrayNode(ref null, this.count - 1, cloneAndSetNodes(this.array, idx, n)) :> INode - else - ArrayNode(ref null, this.count, cloneAndSetNodes(this.array, idx, n)) :> INode + member this.without(thread1, shift, hashKey, key, removedLeaf) = + let idx = mask(hashKey, shift) + let node = this.array.[idx] - member this.without(thread1, shift, hashKey, key, removedLeaf) = - let idx = mask(hashKey, shift) - let node = this.array.[idx] + if node = Unchecked.defaultof then + this :> INode + else + let n = node.without(thread1, shift + 5, hashKey, key, removedLeaf) - if node = Unchecked.defaultof then + if n = node then this :> INode - else - let n = node.without(thread1, shift + 5, hashKey, key, removedLeaf) - - if n = node then - this :> INode - else if n = Unchecked.defaultof then - if this.count <= 8 then // shrink - this.pack(thread1, idx) :> INode - else - let editable = this.editAndSet(thread1, idx, n) - editable.count <- editable.count - 1 - editable :> INode + else if n = Unchecked.defaultof then + if this.count <= 8 then // shrink + this.pack(thread1, idx) :> INode else - this.editAndSet(thread1, idx, n) :> INode + let editable = this.editAndSet(thread1, idx, n) + editable.count <- editable.count - 1 + editable :> INode + else + this.editAndSet(thread1, idx, n) :> INode - member this.nodeSeq() = seq { + member this.nodeSeq() = + seq { let mutable j = 0 while j < this.array.Length do @@ -412,286 +402,278 @@ and private BitmapIndexedNode(thread, bitmap', array': obj[]) = member val bitmap = bitmap' with get, set new() = BitmapIndexedNode(ref null, 0, Array.create 0 null) - with - member this.ensureEditable(thread1) = - if !thread = !thread1 then - this - else - let n = NumberOfSetBits(this.bitmap) - let newArray = Array.create (if n >= 0 then 2 * (n + 1) else 4) null // make room for next assoc - System.Array.Copy(this.array, 0, newArray, 0, 2 * n) - BitmapIndexedNode(thread1, this.bitmap, newArray) - member this.editAndSet(thread1, i, a) = - let editable = this.ensureEditable(thread1) - editable.array.[i] <- a - editable - - member this.editAndSet(thread1, i, a, j, b) = + member this.ensureEditable(thread1) = + if !thread = !thread1 then + this + else + let n = NumberOfSetBits(this.bitmap) + let newArray = Array.create (if n >= 0 then 2 * (n + 1) else 4) null // make room for next assoc + System.Array.Copy(this.array, 0, newArray, 0, 2 * n) + BitmapIndexedNode(thread1, this.bitmap, newArray) + + member this.editAndSet(thread1, i, a) = + let editable = this.ensureEditable(thread1) + editable.array.[i] <- a + editable + + member this.editAndSet(thread1, i, a, j, b) = + let editable = this.ensureEditable(thread1) + editable.array.[i] <- a + editable.array.[j] <- b + editable + + member this.editAndRemovePair(thread1, bit, i) = + if this.bitmap = bit then + Unchecked.defaultof + else let editable = this.ensureEditable(thread1) - editable.array.[i] <- a - editable.array.[j] <- b + editable.bitmap <- editable.bitmap ^^^ bit + System.Array.Copy(editable.array, 2 * (i + 1), editable.array, 2 * i, editable.array.Length - 2 * (i + 1)) + editable.array.[editable.array.Length - 2] <- null + editable.array.[editable.array.Length - 1] <- null editable - member this.editAndRemovePair(thread1, bit, i) = - if this.bitmap = bit then - Unchecked.defaultof - else - let editable = this.ensureEditable(thread1) - editable.bitmap <- editable.bitmap ^^^ bit - System.Array.Copy(editable.array, 2 * (i + 1), editable.array, 2 * i, editable.array.Length - 2 * (i + 1)) - editable.array.[editable.array.Length - 2] <- null - editable.array.[editable.array.Length - 1] <- null - editable - - interface INode with - - member this.find(shift, hash, key) = - let bit = bitpos(hash, shift) + interface INode with - if this.bitmap &&& bit = 0 then - null - else - let idx' = index(this.bitmap, bit) * 2 - let keyOrNull = this.array.[idx'] - let valOrNode = this.array.[idx' + 1] - - if keyOrNull = null then - (valOrNode :?> INode).find(shift + 5, hash, key) - else if key = keyOrNull then - valOrNode - else - null + member this.find(shift, hash, key) = + let bit = bitpos(hash, shift) - member this.tryFind(shift, hash, key) = - let bit = bitpos(hash, shift) + if this.bitmap &&& bit = 0 then + null + else + let idx' = index(this.bitmap, bit) * 2 + let keyOrNull = this.array.[idx'] + let valOrNode = this.array.[idx' + 1] - if this.bitmap &&& bit = 0 then - None + if keyOrNull = null then + (valOrNode :?> INode).find(shift + 5, hash, key) + else if key = keyOrNull then + valOrNode else - let idx = index(this.bitmap, bit) - let keyOrNull = this.array.[2 * idx] - let valOrNode = this.array.[2 * idx + 1] - - if keyOrNull = null then - (valOrNode :?> INode).tryFind(shift + 5, hash, key) - else if key = keyOrNull then - Some valOrNode - else - None + null - member this.assoc(shift, hashKey, key, value, addedLeaf) = - let bit = bitpos(hashKey, shift) - let idx' = index(this.bitmap, bit) * 2 + member this.tryFind(shift, hash, key) = + let bit = bitpos(hash, shift) - if (this.bitmap &&& bit) <> 0 then - let keyOrNull = this.array.[idx'] - let valOrNode = this.array.[idx' + 1] - - if keyOrNull = null then - let n = (valOrNode :?> INode).assoc(shift + 5, hashKey, key, value, addedLeaf) - - if n = (valOrNode :?> INode) then - this :> INode - else - BitmapIndexedNode(ref null, this.bitmap, cloneAndSet(this.array, idx' + 1, n)) :> INode - else if key = keyOrNull then - if value = valOrNode then - this :> INode - else - BitmapIndexedNode(ref null, this.bitmap, cloneAndSet(this.array, idx' + 1, value)) :> INode - else - addedLeaf.Value <- addedLeaf - - BitmapIndexedNode( - ref null, - this.bitmap, - cloneAndSet2( - this.array, - idx', - null, - idx' + 1, - NodeCreation.createNode(shift + 5, keyOrNull, valOrNode, hashKey, key, value) :> obj - ) - ) - :> INode + if this.bitmap &&& bit = 0 then + None + else + let idx = index(this.bitmap, bit) + let keyOrNull = this.array.[2 * idx] + let valOrNode = this.array.[2 * idx + 1] + + if keyOrNull = null then + (valOrNode :?> INode).tryFind(shift + 5, hash, key) + else if key = keyOrNull then + Some valOrNode else - let n = NumberOfSetBits(this.bitmap) - - if n >= 16 then - let nodes = Array.create 32 Unchecked.defaultof - let jdx = mask(hashKey, shift) - nodes.[jdx] <- (BitmapIndexedNode() :> INode).assoc(shift + 5, hashKey, key, value, addedLeaf) - let mutable j = 0 - - for i in 0..31 do - if ((this.bitmap >>> i) &&& 1) <> 0 then - if this.array.[j] = null then - nodes.[i] <- this.array.[j + 1] :?> INode - else - nodes.[i] <- - (BitmapIndexedNode() :> INode) - .assoc(shift + 5, hash(this.array.[j]), this.array.[j], this.array.[j + 1], addedLeaf) - - j <- j + 2 - - ArrayNode(ref null, n + 1, nodes) :> INode - else - let newArray = Array.create (2 * (n + 1)) null - System.Array.Copy(this.array, 0, newArray, 0, idx') - newArray.[idx'] <- key - addedLeaf.Value <- addedLeaf - newArray.[idx' + 1] <- value - System.Array.Copy(this.array, idx', newArray, idx' + 2, 2 * n - idx') - BitmapIndexedNode(ref null, this.bitmap ||| bit, newArray) :> INode + None - member this.nodeSeq() = - createNodeSeq this.array + member this.assoc(shift, hashKey, key, value, addedLeaf) = + let bit = bitpos(hashKey, shift) + let idx' = index(this.bitmap, bit) * 2 + if (this.bitmap &&& bit) <> 0 then + let keyOrNull = this.array.[idx'] + let valOrNode = this.array.[idx' + 1] - member this.assoc(thread1, shift, hashKey, key, value, addedLeaf) = - let bit = bitpos(hashKey, shift) - let idx' = index(this.bitmap, bit) * 2 + if keyOrNull = null then + let n = (valOrNode :?> INode).assoc(shift + 5, hashKey, key, value, addedLeaf) - if (this.bitmap &&& bit) <> 0 then - let keyOrNull = this.array.[idx'] - let valOrNode = this.array.[idx' + 1] - - if keyOrNull = null then - let n = - (valOrNode :?> INode).assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) - - if n = (valOrNode :?> INode) then - this :> INode - else - this.editAndSet(thread1, idx' + 1, n) :> INode - else if key = keyOrNull then - if value = valOrNode then - this :> INode - else - this.editAndSet(thread1, idx' + 1, value) :> INode + if n = (valOrNode :?> INode) then + this :> INode + else + BitmapIndexedNode(ref null, this.bitmap, cloneAndSet(this.array, idx' + 1, n)) :> INode + else if key = keyOrNull then + if value = valOrNode then + this :> INode else - addedLeaf.Value <- addedLeaf :> obj + BitmapIndexedNode(ref null, this.bitmap, cloneAndSet(this.array, idx' + 1, value)) :> INode + else + addedLeaf.Value <- addedLeaf - this.editAndSet( - thread1, + BitmapIndexedNode( + ref null, + this.bitmap, + cloneAndSet2( + this.array, idx', null, idx' + 1, - NodeCreation.createNode(thread1, shift + 5, keyOrNull, valOrNode, hashKey, key, value) + NodeCreation.createNode(shift + 5, keyOrNull, valOrNode, hashKey, key, value) :> obj ) - :> INode - else - let n = NumberOfSetBits(this.bitmap) * 2 - let n' = n * 2 - - if n' < this.array.Length then - addedLeaf.Value <- addedLeaf :> obj - let editable = this.ensureEditable(thread1) - System.Array.Copy(editable.array, idx', editable.array, idx' + 2, n' - idx') - editable.array.[idx'] <- key - editable.array.[idx' + 1] <- value - editable.bitmap <- editable.bitmap ||| bit - editable :> INode - else if n >= 16 then - let nodes = Array.create 32 Unchecked.defaultof - let jdx = mask(hashKey, shift) + ) + :> INode + else + let n = NumberOfSetBits(this.bitmap) - nodes.[jdx] <- - (BitmapIndexedNode() :> INode) - .assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) + if n >= 16 then + let nodes = Array.create 32 Unchecked.defaultof + let jdx = mask(hashKey, shift) + nodes.[jdx] <- (BitmapIndexedNode() :> INode).assoc(shift + 5, hashKey, key, value, addedLeaf) + let mutable j = 0 - let mutable j = 0 + for i in 0..31 do + if ((this.bitmap >>> i) &&& 1) <> 0 then + if this.array.[j] = null then + nodes.[i] <- this.array.[j + 1] :?> INode + else + nodes.[i] <- + (BitmapIndexedNode() :> INode) + .assoc(shift + 5, hash(this.array.[j]), this.array.[j], this.array.[j + 1], addedLeaf) - for i in 0..31 do - if ((this.bitmap >>> i) &&& 1) <> 0 then - if this.array.[j] = null then - nodes.[i] <- this.array.[j + 1] :?> INode - else - nodes.[i] <- - (BitmapIndexedNode() :> INode) - .assoc(thread1, shift + 5, hash(this.array.[j]), this.array.[j], this.array.[j + 1], addedLeaf) + j <- j + 2 - j <- j + 2 + ArrayNode(ref null, n + 1, nodes) :> INode + else + let newArray = Array.create (2 * (n + 1)) null + System.Array.Copy(this.array, 0, newArray, 0, idx') + newArray.[idx'] <- key + addedLeaf.Value <- addedLeaf + newArray.[idx' + 1] <- value + System.Array.Copy(this.array, idx', newArray, idx' + 2, 2 * n - idx') + BitmapIndexedNode(ref null, this.bitmap ||| bit, newArray) :> INode - ArrayNode(thread1, n + 1, nodes) :> INode - else - let newArray = Array.create (n' + 8) null - System.Array.Copy(this.array, 0, newArray, 0, idx') - newArray.[idx'] <- key - addedLeaf.Value <- addedLeaf :> obj - newArray.[idx' + 1] <- value - System.Array.Copy(this.array, idx', newArray, idx' + 2, n' - idx') - let editable = this.ensureEditable(thread1) - editable.array <- newArray - editable.bitmap <- this.bitmap ||| bit - editable :> INode + member this.nodeSeq() = + createNodeSeq this.array - member this.without(shift, hashKey, key) = - let bit = bitpos(hashKey, shift) + member this.assoc(thread1, shift, hashKey, key, value, addedLeaf) = + let bit = bitpos(hashKey, shift) + let idx' = index(this.bitmap, bit) * 2 - if (this.bitmap &&& bit) = 0 then - this :> INode - else - let idx = index(this.bitmap, bit) - let keyOrNull = this.array.[2 * idx] - let valOrNode = this.array.[2 * idx + 1] - - if keyOrNull = null then - let n = (valOrNode :?> INode).without(shift + 5, hashKey, key) - - if n = (valOrNode :?> INode) then - this :> INode - else if n <> Unchecked.defaultof then - BitmapIndexedNode(ref null, this.bitmap, cloneAndSet(this.array, 2 * idx + 1, n)) :> INode - else if this.bitmap = bit then - Unchecked.defaultof - else - BitmapIndexedNode(ref null, this.bitmap ^^^ bit, removePair(this.array, idx)) :> INode - else if key = keyOrNull then - // TODO: collapse - BitmapIndexedNode(ref null, this.bitmap ^^^ bit, removePair(this.array, idx)) :> INode + if (this.bitmap &&& bit) <> 0 then + let keyOrNull = this.array.[idx'] + let valOrNode = this.array.[idx' + 1] + + if keyOrNull = null then + let n = + (valOrNode :?> INode).assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) + + if n = (valOrNode :?> INode) then + this :> INode else + this.editAndSet(thread1, idx' + 1, n) :> INode + else if key = keyOrNull then + if value = valOrNode then this :> INode + else + this.editAndSet(thread1, idx' + 1, value) :> INode + else + addedLeaf.Value <- addedLeaf :> obj + + this.editAndSet( + thread1, + idx', + null, + idx' + 1, + NodeCreation.createNode(thread1, shift + 5, keyOrNull, valOrNode, hashKey, key, value) + ) + :> INode + else + let n = NumberOfSetBits(this.bitmap) * 2 + let n' = n * 2 + + if n' < this.array.Length then + addedLeaf.Value <- addedLeaf :> obj + let editable = this.ensureEditable(thread1) + System.Array.Copy(editable.array, idx', editable.array, idx' + 2, n' - idx') + editable.array.[idx'] <- key + editable.array.[idx' + 1] <- value + editable.bitmap <- editable.bitmap ||| bit + editable :> INode + else if n >= 16 then + let nodes = Array.create 32 Unchecked.defaultof + let jdx = mask(hashKey, shift) - member this.without(thread1, shift, hashKey, key, removedLeaf) = - let bit = bitpos(hashKey, shift) + nodes.[jdx] <- (BitmapIndexedNode() :> INode).assoc(thread1, shift + 5, hashKey, key, value, addedLeaf) - if (this.bitmap &&& bit) = 0 then - this :> INode + let mutable j = 0 + + for i in 0..31 do + if ((this.bitmap >>> i) &&& 1) <> 0 then + if this.array.[j] = null then + nodes.[i] <- this.array.[j + 1] :?> INode + else + nodes.[i] <- + (BitmapIndexedNode() :> INode) + .assoc(thread1, shift + 5, hash(this.array.[j]), this.array.[j], this.array.[j + 1], addedLeaf) + + j <- j + 2 + + ArrayNode(thread1, n + 1, nodes) :> INode else - let idx = index(this.bitmap, bit) - - let keyOrNull = this.array.[2 * idx] - let valOrNode = this.array.[2 * idx + 1] - - if keyOrNull = null then - let n = (valOrNode :?> INode).without(thread1, shift + 5, hashKey, key, removedLeaf) - - if n = (valOrNode :?> INode) then - this :> INode - else if n <> Unchecked.defaultof then - this.editAndSet(thread1, 2 * idx + 1, n) :> INode - else if this.bitmap = bit then - Unchecked.defaultof - else - this.editAndRemovePair(thread1, bit, idx) :> INode - else if key = keyOrNull then - removedLeaf.Value <- removedLeaf :> obj - // TODO: collapse - this.editAndRemovePair(thread1, bit, idx) :> INode + let newArray = Array.create (n' + 8) null + System.Array.Copy(this.array, 0, newArray, 0, idx') + newArray.[idx'] <- key + addedLeaf.Value <- addedLeaf :> obj + newArray.[idx' + 1] <- value + System.Array.Copy(this.array, idx', newArray, idx' + 2, n' - idx') + let editable = this.ensureEditable(thread1) + editable.array <- newArray + editable.bitmap <- this.bitmap ||| bit + editable :> INode + + + member this.without(shift, hashKey, key) = + let bit = bitpos(hashKey, shift) + + if (this.bitmap &&& bit) = 0 then + this :> INode + else + let idx = index(this.bitmap, bit) + let keyOrNull = this.array.[2 * idx] + let valOrNode = this.array.[2 * idx + 1] + + if keyOrNull = null then + let n = (valOrNode :?> INode).without(shift + 5, hashKey, key) + + if n = (valOrNode :?> INode) then + this :> INode + else if n <> Unchecked.defaultof then + BitmapIndexedNode(ref null, this.bitmap, cloneAndSet(this.array, 2 * idx + 1, n)) :> INode + else if this.bitmap = bit then + Unchecked.defaultof else + BitmapIndexedNode(ref null, this.bitmap ^^^ bit, removePair(this.array, idx)) :> INode + else if key = keyOrNull then + // TODO: collapse + BitmapIndexedNode(ref null, this.bitmap ^^^ bit, removePair(this.array, idx)) :> INode + else + this :> INode + + member this.without(thread1, shift, hashKey, key, removedLeaf) = + let bit = bitpos(hashKey, shift) + + if (this.bitmap &&& bit) = 0 then + this :> INode + else + let idx = index(this.bitmap, bit) + + let keyOrNull = this.array.[2 * idx] + let valOrNode = this.array.[2 * idx + 1] + + if keyOrNull = null then + let n = (valOrNode :?> INode).without(thread1, shift + 5, hashKey, key, removedLeaf) + + if n = (valOrNode :?> INode) then this :> INode + else if n <> Unchecked.defaultof then + this.editAndSet(thread1, 2 * idx + 1, n) :> INode + else if this.bitmap = bit then + Unchecked.defaultof + else + this.editAndRemovePair(thread1, bit, idx) :> INode + else if key = keyOrNull then + removedLeaf.Value <- removedLeaf :> obj + // TODO: collapse + this.editAndRemovePair(thread1, bit, idx) :> INode + else + this :> INode type internal TransientHashMap<[] 'T, 'S when 'T: equality and 'S: equality> - ( - thread, - count', - root': INode, - hasNull', - nullValue': 'S - ) = + (thread, count', root': INode, hasNull', nullValue': 'S) = let leafFlag = Box(null) member val hasNull = hasNull' with get, set @@ -803,12 +785,10 @@ and PersistentHashMap<[] 'T, 'S when 'T: equality and 'S: member this.Count: int = this.count internal new(count', root': INode, hasNull', nullValue': 'S) = - { - count = count' - root = root' - hasNull = hasNull' - nullValue = nullValue' - } + { count = count' + root = root' + hasNull = hasNull' + nullValue = nullValue' } member this.ContainsKey(key: 'T) = if key = Unchecked.defaultof<'T> then this.hasNull @@ -816,7 +796,7 @@ and PersistentHashMap<[] 'T, 'S when 'T: equality and 'S: else this.root.find(0, hash(key), key) <> null static member ofSeq(items: ('T * 'S) seq) = - let mutable ret = TransientHashMap<'T, 'S>.Empty () + let mutable ret = TransientHashMap<'T, 'S>.Empty() for (key, value) in items do ret <- ret.Add(key, value) @@ -881,15 +861,16 @@ and PersistentHashMap<[] 'T, 'S when 'T: equality and 'S: | Some value -> value :?> 'S | _ -> failwithf "Key %A is not found in the map." key - member this.Iterator<'T, 'S>() : ('T * 'S) seq = seq { - if this.hasNull then - yield Unchecked.defaultof<'T>, this.nullValue + member this.Iterator<'T, 'S>() : ('T * 'S) seq = + seq { + if this.hasNull then + yield Unchecked.defaultof<'T>, this.nullValue - if this.root <> Unchecked.defaultof then - yield! - this.root.nodeSeq() - |> Seq.map(fun (key, value) -> key :?> 'T, value :?> 'S) - } + if this.root <> Unchecked.defaultof then + yield! + this.root.nodeSeq() + |> Seq.map(fun (key, value) -> key :?> 'T, value :?> 'S) + } interface System.Collections.Generic.IEnumerable<'T * 'S> with member this.GetEnumerator() = @@ -941,7 +922,7 @@ module PersistentHashMap = ///O(n). Returns a HashMap whose elements are the results of applying the supplied function to each of the elements of a supplied HashMap. let map (f: 'S -> 'S1) (map: PersistentHashMap<'T, 'S>) : PersistentHashMap<'T, 'S1> = - let mutable ret = TransientHashMap<'T, 'S1>.Empty () + let mutable ret = TransientHashMap<'T, 'S1>.Empty() for (key, value) in map do ret <- ret.Add(key, f value) diff --git a/src/FSharpx.Collections/PersistentVector.fs b/src/FSharpx.Collections/PersistentVector.fs index d5a0de79..656b5be8 100644 --- a/src/FSharpx.Collections/PersistentVector.fs +++ b/src/FSharpx.Collections/PersistentVector.fs @@ -9,23 +9,23 @@ open System.Threading type Node(thread, array: obj[]) = let thread = thread new() = Node(ref null, Array.create Literals.blockSize null) - with - static member InCurrentThread() = - Node(ref Thread.CurrentThread, Array.create Literals.blockSize null) - member this.Array = array - member this.Thread = thread + static member InCurrentThread() = + Node(ref Thread.CurrentThread, Array.create Literals.blockSize null) - member this.SetThread t = - thread := t + member this.Array = array + member this.Thread = thread + + member this.SetThread t = + thread := t #else type Node(array: obj[]) = new() = Node(Array.create Literals.blockSize null) - with - static member InCurrentThread() = - Node(Array.create Literals.blockSize null) - member this.Array = array + static member InCurrentThread() = + Node(Array.create Literals.blockSize null) + + member this.Array = array #endif type internal TransientVector<'T>(count, shift: int, root: Node, tail: obj[]) = @@ -376,10 +376,9 @@ and PersistentVector<'T>(count, shift: int, root: Node, tail: obj[]) = if count = 0 then failwith "Can't initial empty vector" else if count = 1 then - PersistentVector<'T>.Empty () - else + PersistentVector<'T>.Empty() + else if - if count - tailOff > 1 then #if !FABLE_COMPILER @@ -432,14 +431,15 @@ and PersistentVector<'T>(count, shift: int, root: Node, tail: obj[]) = let mutable i = count - 1 let mutable array = this.ArrayFor i - let items = seq { - while i > - 1 do - if (i + 1) % Literals.blockSize = 0 then - array <- this.ArrayFor i + let items = + seq { + while i > -1 do + if (i + 1) % Literals.blockSize = 0 then + array <- this.ArrayFor i - yield array.[i &&& Literals.blockIndexMask] :?> 'T - i <- i - 1 - } + yield array.[i &&& Literals.blockIndexMask] :?> 'T + i <- i - 1 + } let mutable ret = TransientVector() diff --git a/src/FSharpx.Collections/PriorityQueue.fs b/src/FSharpx.Collections/PriorityQueue.fs index ddd66bac..1c9046d2 100644 --- a/src/FSharpx.Collections/PriorityQueue.fs +++ b/src/FSharpx.Collections/PriorityQueue.fs @@ -239,9 +239,8 @@ type Heap<'T when 'T: comparison>(isDescending: bool, length: int, data: HeapDat member this.GetEnumerator() = (this :> _ seq).GetEnumerator() :> IEnumerator - interface IPriorityQueue<'T> + interface IPriorityQueue<'T> with - with member this.IsEmpty = this.IsEmpty member this.Insert element = diff --git a/src/FSharpx.Collections/Queue.fs b/src/FSharpx.Collections/Queue.fs index 2ed0477d..c4a5b218 100644 --- a/src/FSharpx.Collections/Queue.fs +++ b/src/FSharpx.Collections/Queue.fs @@ -89,10 +89,11 @@ type Queue<'T>(front: list<'T>, rBack: list<'T>) = interface System.Collections.Generic.IEnumerable<'T> with override this.GetEnumerator() : System.Collections.Generic.IEnumerator<'T> = - let e = seq { - yield! front - yield! (List.rev rBack) - } + let e = + seq { + yield! front + yield! (List.rev rBack) + } e.GetEnumerator() diff --git a/src/FSharpx.Collections/RandomAccessList.fs b/src/FSharpx.Collections/RandomAccessList.fs index 94fbe18c..7aafe906 100644 --- a/src/FSharpx.Collections/RandomAccessList.fs +++ b/src/FSharpx.Collections/RandomAccessList.fs @@ -355,10 +355,9 @@ and [] RandomAccessList<'T>(count, shift: int, root: NodeR, tail: if count = 0 then failwith "Can't tail empty randomAccessList" else if count = 1 then - RandomAccessList<'T>.Empty () - else + RandomAccessList<'T>.Empty() + else if - if count - tailOff > 1 then let mutable newroot = diff --git a/src/FSharpx.Collections/ResizeArray.fs b/src/FSharpx.Collections/ResizeArray.fs index 7c1e3ae0..7f77076a 100644 --- a/src/FSharpx.Collections/ResizeArray.fs +++ b/src/FSharpx.Collections/ResizeArray.fs @@ -130,7 +130,7 @@ module ResizeArray = res let mapi f (arr: ResizeArray<_>) = - let f = FSharpFunc<_, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _>.Adapt(f) let len = length arr let res = new ResizeArray<_>(len) @@ -140,7 +140,7 @@ module ResizeArray = res let iteri f (arr: ResizeArray<_>) = - let f = FSharpFunc<_, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _>.Adapt(f) for i = 0 to arr.Count - 1 do f.Invoke(i, arr.[i]) @@ -192,7 +192,7 @@ module ResizeArray = loop 0 let iter2 f (arr1: ResizeArray<'T>) (arr2: ResizeArray<'b>) = - let f = FSharpFunc<_, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _>.Adapt(f) let len1 = length arr1 if len1 <> length arr2 then @@ -202,7 +202,7 @@ module ResizeArray = f.Invoke(arr1.[i], arr2.[i]) let map2 f (arr1: ResizeArray<'T>) (arr2: ResizeArray<'T2>) = - let f = FSharpFunc<_, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _>.Adapt(f) let len1 = length arr1 if len1 <> length arr2 then @@ -349,7 +349,7 @@ module ResizeArray = foldBackSub f arr 0 (arrn - 2) arr.[arrn - 1] let fold2 f (acc: 'T) (arr1: ResizeArray<'T1>) (arr2: ResizeArray<'T2>) = - let f = FSharpFunc<_, _, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _, _>.Adapt(f) let mutable res = acc let len = length arr1 @@ -362,7 +362,7 @@ module ResizeArray = res let foldBack2 f (arr1: ResizeArray<'T1>) (arr2: ResizeArray<'T2>) (acc: 'State) = - let f = FSharpFunc<_, _, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _, _>.Adapt(f) let mutable res = acc let len = length arr1 @@ -389,7 +389,7 @@ module ResizeArray = length(arr: ResizeArray<_>) = 0 let iteri2 f (arr1: ResizeArray<'T>) (arr2: ResizeArray<'T2>) = - let f = FSharpFunc<_, _, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _, _>.Adapt(f) let len1 = length arr1 if len1 <> length arr2 then @@ -399,7 +399,7 @@ module ResizeArray = f.Invoke(i, arr1.[i], arr2.[i]) let mapi2 (f: int -> 'T -> 'T2 -> 'c) (arr1: ResizeArray<'T>) (arr2: ResizeArray<'T2>) = - let f = FSharpFunc<_, _, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _, _>.Adapt(f) let len1 = length arr1 if len1 <> length arr2 then @@ -408,7 +408,7 @@ module ResizeArray = init len1 (fun i -> f.Invoke(i, arr1.[i], arr2.[i])) let scanBackSub f (arr: ResizeArray<'T>) start fin acc = - let f = FSharpFunc<_, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _>.Adapt(f) let mutable state = acc let res = create (2 + fin - start) acc @@ -419,7 +419,7 @@ module ResizeArray = res let scanSub f acc (arr: ResizeArray<'T>) start fin = - let f = FSharpFunc<_, _, _>.Adapt (f) + let f = FSharpFunc<_, _, _>.Adapt(f) let mutable state = acc let res = create (fin - start + 2) acc diff --git a/src/FSharpx.Collections/TaggedCollections.fs b/src/FSharpx.Collections/TaggedCollections.fs index e5ef3fed..919b1e6e 100644 --- a/src/FSharpx.Collections/TaggedCollections.fs +++ b/src/FSharpx.Collections/TaggedCollections.fs @@ -536,8 +536,7 @@ module SetTree = member __.Reset() = i <- SetIterator s interface System.IDisposable with - member __.Dispose() = () - } + member __.Dispose() = () } //-------------------------------------------------------------------------- // Set comparison. This can be expensive. @@ -688,10 +687,10 @@ type Set<'T, 'ComparerTag> when 'ComparerTag :> IComparer<'T>(comparer: ICompare SetTree.forAll f tree static member (-)((a: Set<'T, 'ComparerTag>), (b: Set<'T, 'ComparerTag>)) = - Set<_, _>.Difference (a, b) + Set<_, _>.Difference(a, b) static member (+)((a: Set<'T, 'ComparerTag>), (b: Set<'T, 'ComparerTag>)) = - Set<_, _>.Union (a, b) + Set<_, _>.Union(a, b) static member Intersection((a: Set<'T, 'ComparerTag>), (b: Set<'T, 'ComparerTag>)) : Set<'T, 'ComparerTag> = match b.Tree with @@ -1237,8 +1236,7 @@ module MapTree = member self.Reset() = i <- MapIterator(s) interface System.IDisposable with - member self.Dispose() = () - } + member self.Dispose() = () } [] diff --git a/tests/FSharpx.Collections.Experimental.Tests/AltBinaryRandomAccessListTest.fs b/tests/FSharpx.Collections.Experimental.Tests/AltBinaryRandomAccessListTest.fs index 9cc5f4fc..58a1a9a7 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/AltBinaryRandomAccessListTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/AltBinaryRandomAccessListTest.fs @@ -96,1470 +96,1470 @@ module AltBinaryRandomAccessListTest = [] let testAltBinaryRandomAccessList = - testList "Experimental AltBinaryRandomAccessList" [ - test "AltBinaryRandomAccessList.empty list should be AltBinaryRandomAccessList.empty" { - AltBinaryRandomAccessList.isEmpty AltBinaryRandomAccessList.empty - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.cons works" { - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.isEmpty - |> Expect.isFalse "" - } - - test "AltBinaryRandomAccessList.uncons 1 element" { - let x, _ = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.uncons - - (x = 1) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.uncons 2 elements" { - let x, _ = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.uncons - - (x = 2) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.uncons 3 elements" { - let x, _ = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.cons 3 - |> AltBinaryRandomAccessList.uncons - - (x = 3) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUncons 1 element" { - let x = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.tryUncons - - (fst(x.Value) = 1) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUncons 2 elements" { - let x = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.tryUncons - - (fst(x.Value) = 2) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUncons 3 elements" { - let x = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.cons 3 - |> AltBinaryRandomAccessList.tryUncons - - (fst(x.Value) = 3) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUncons AltBinaryRandomAccessList.empty" { - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.tryUncons - |> Expect.isNone "" - } - - test "AltBinaryRandomAccessList.head should return" { - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.head - |> Expect.equal "" 2 - } - - test "AltBinaryRandomAccessList.tryGetHead should return" { - let x = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.tryGetHead - - x.Value |> Expect.equal "" 2 - } - - test "AltBinaryRandomAccessList.tryGetHead on AltBinaryRandomAccessList.empty should return None" { - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.tryGetHead - |> Expect.isNone "" - } - - test "AltBinaryRandomAccessList.tryGetTail on AltBinaryRandomAccessList.empty should return None" { - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.tryGetTail - |> Expect.isNone "" - } - - test "AltBinaryRandomAccessList.tryGetTail on len 1 should return Some AltBinaryRandomAccessList.empty" { - let x = - (AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.tryGetTail) - .Value - - x |> AltBinaryRandomAccessList.isEmpty |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tail on len 2 should return" { - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.tail - |> AltBinaryRandomAccessList.head - |> Expect.equal "" 1 - } - - test "AltBinaryRandomAccessList.tryGetTail on len 2 should return" { - let a = - AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons 1 - |> AltBinaryRandomAccessList.cons 2 - |> AltBinaryRandomAccessList.tryGetTail - - ((AltBinaryRandomAccessList.head a.Value) = 1) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 1" { len1 |> AltBinaryRandomAccessList.lookup 0 |> Expect.equal "" "a" } - - test "AltBinaryRandomAccessList.rev AltBinaryRandomAccessList.empty" { - AltBinaryRandomAccessList.isEmpty(AltBinaryRandomAccessList.empty |> AltBinaryRandomAccessList.rev) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.rev elements length 5" { - let a = - match (len5 |> AltBinaryRandomAccessList.rev) with - | One("a", Zero(One((("b", "c"), ("d", "e")), Nil))) -> true - | _ -> false - - a |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.append 2 AltBinaryRandomAccessList.empty lists" { - AltBinaryRandomAccessList.isEmpty(AltBinaryRandomAccessList.append AltBinaryRandomAccessList.empty AltBinaryRandomAccessList.empty) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.append left AltBinaryRandomAccessList.empty right 5" { - let a = - match (AltBinaryRandomAccessList.append AltBinaryRandomAccessList.empty len5) with - | One("e", Zero(One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - a |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.append left 6 right AltBinaryRandomAccessList.empty" { - let a = - match (AltBinaryRandomAccessList.append len6 AltBinaryRandomAccessList.empty) with - | Zero(One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - a |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.append left 6 right3" { - let a = - match - (AltBinaryRandomAccessList.append - len6 - (AltBinaryRandomAccessList.empty - |> AltBinaryRandomAccessList.cons "3" - |> AltBinaryRandomAccessList.cons "2" - |> AltBinaryRandomAccessList.cons "1")) - with - | One("f", Zero(Zero(One(((("e", "d"), ("c", "b")), (("a", "1"), ("2", "3"))), Nil)))) -> true - | _ -> false - - a |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 2" { - (((len2 |> AltBinaryRandomAccessList.lookup 0) = "b") - && ((len2 |> AltBinaryRandomAccessList.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 3" { - (((len3 |> AltBinaryRandomAccessList.lookup 0) = "c") - && ((len3 |> AltBinaryRandomAccessList.lookup 1) = "b") - && ((len3 |> AltBinaryRandomAccessList.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 4" { - (((len4 |> AltBinaryRandomAccessList.lookup 0) = "d") - && ((len4 |> AltBinaryRandomAccessList.lookup 1) = "c") - && ((len4 |> AltBinaryRandomAccessList.lookup 2) = "b") - && ((len4 |> AltBinaryRandomAccessList.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 5" { - (((len5 |> AltBinaryRandomAccessList.lookup 0) = "e") - && ((len5 |> AltBinaryRandomAccessList.lookup 1) = "d") - && ((len5 |> AltBinaryRandomAccessList.lookup 2) = "c") - && ((len5 |> AltBinaryRandomAccessList.lookup 3) = "b") - && ((len5 |> AltBinaryRandomAccessList.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 6" { - (((len6 |> AltBinaryRandomAccessList.lookup 0) = "f") - && ((len6 |> AltBinaryRandomAccessList.lookup 1) = "e") - && ((len6 |> AltBinaryRandomAccessList.lookup 2) = "d") - && ((len6 |> AltBinaryRandomAccessList.lookup 3) = "c") - && ((len6 |> AltBinaryRandomAccessList.lookup 4) = "b") - && ((len6 |> AltBinaryRandomAccessList.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 7" { - (((len7 |> AltBinaryRandomAccessList.lookup 0) = "g") - && ((len7 |> AltBinaryRandomAccessList.lookup 1) = "f") - && ((len7 |> AltBinaryRandomAccessList.lookup 2) = "e") - && ((len7 |> AltBinaryRandomAccessList.lookup 3) = "d") - && ((len7 |> AltBinaryRandomAccessList.lookup 4) = "c") - && ((len7 |> AltBinaryRandomAccessList.lookup 5) = "b") - && ((len7 |> AltBinaryRandomAccessList.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 8" { - (((len8 |> AltBinaryRandomAccessList.lookup 0) = "h") - && ((len8 |> AltBinaryRandomAccessList.lookup 1) = "g") - && ((len8 |> AltBinaryRandomAccessList.lookup 2) = "f") - && ((len8 |> AltBinaryRandomAccessList.lookup 3) = "e") - && ((len8 |> AltBinaryRandomAccessList.lookup 4) = "d") - && ((len8 |> AltBinaryRandomAccessList.lookup 5) = "c") - && ((len8 |> AltBinaryRandomAccessList.lookup 6) = "b") - && ((len8 |> AltBinaryRandomAccessList.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 9" { - (((len9 |> AltBinaryRandomAccessList.lookup 0) = "i") - && ((len9 |> AltBinaryRandomAccessList.lookup 1) = "h") - && ((len9 |> AltBinaryRandomAccessList.lookup 2) = "g") - && ((len9 |> AltBinaryRandomAccessList.lookup 3) = "f") - && ((len9 |> AltBinaryRandomAccessList.lookup 4) = "e") - && ((len9 |> AltBinaryRandomAccessList.lookup 5) = "d") - && ((len9 |> AltBinaryRandomAccessList.lookup 6) = "c") - && ((len9 |> AltBinaryRandomAccessList.lookup 7) = "b") - && ((len9 |> AltBinaryRandomAccessList.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.lookup length 10" { - (((lena |> AltBinaryRandomAccessList.lookup 0) = "j") - && ((lena |> AltBinaryRandomAccessList.lookup 1) = "i") - && ((lena |> AltBinaryRandomAccessList.lookup 2) = "h") - && ((lena |> AltBinaryRandomAccessList.lookup 3) = "g") - && ((lena |> AltBinaryRandomAccessList.lookup 4) = "f") - && ((lena |> AltBinaryRandomAccessList.lookup 5) = "e") - && ((lena |> AltBinaryRandomAccessList.lookup 6) = "d") - && ((lena |> AltBinaryRandomAccessList.lookup 7) = "c") - && ((lena |> AltBinaryRandomAccessList.lookup 8) = "b") - && ((lena |> AltBinaryRandomAccessList.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 1" { - let a = len1 |> AltBinaryRandomAccessList.tryLookup 0 - (a.Value = "a") |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 2" { - let b = len2 |> AltBinaryRandomAccessList.tryLookup 0 - let a = len2 |> AltBinaryRandomAccessList.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 3" { - let c = len3 |> AltBinaryRandomAccessList.tryLookup 0 - let b = len3 |> AltBinaryRandomAccessList.tryLookup 1 - let a = len3 |> AltBinaryRandomAccessList.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 4" { - let d = len4 |> AltBinaryRandomAccessList.tryLookup 0 - let c = len4 |> AltBinaryRandomAccessList.tryLookup 1 - let b = len4 |> AltBinaryRandomAccessList.tryLookup 2 - let a = len4 |> AltBinaryRandomAccessList.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 5" { - let e = len5 |> AltBinaryRandomAccessList.tryLookup 0 - let d = len5 |> AltBinaryRandomAccessList.tryLookup 1 - let c = len5 |> AltBinaryRandomAccessList.tryLookup 2 - let b = len5 |> AltBinaryRandomAccessList.tryLookup 3 - let a = len5 |> AltBinaryRandomAccessList.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 6" { - let f = len6 |> AltBinaryRandomAccessList.tryLookup 0 - let e = len6 |> AltBinaryRandomAccessList.tryLookup 1 - let d = len6 |> AltBinaryRandomAccessList.tryLookup 2 - let c = len6 |> AltBinaryRandomAccessList.tryLookup 3 - let b = len6 |> AltBinaryRandomAccessList.tryLookup 4 - let a = len6 |> AltBinaryRandomAccessList.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 7" { - let g = len7 |> AltBinaryRandomAccessList.tryLookup 0 - let f = len7 |> AltBinaryRandomAccessList.tryLookup 1 - let e = len7 |> AltBinaryRandomAccessList.tryLookup 2 - let d = len7 |> AltBinaryRandomAccessList.tryLookup 3 - let c = len7 |> AltBinaryRandomAccessList.tryLookup 4 - let b = len7 |> AltBinaryRandomAccessList.tryLookup 5 - let a = len7 |> AltBinaryRandomAccessList.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 8" { - let h = len8 |> AltBinaryRandomAccessList.tryLookup 0 - let g = len8 |> AltBinaryRandomAccessList.tryLookup 1 - let f = len8 |> AltBinaryRandomAccessList.tryLookup 2 - let e = len8 |> AltBinaryRandomAccessList.tryLookup 3 - let d = len8 |> AltBinaryRandomAccessList.tryLookup 4 - let c = len8 |> AltBinaryRandomAccessList.tryLookup 5 - let b = len8 |> AltBinaryRandomAccessList.tryLookup 6 - let a = len8 |> AltBinaryRandomAccessList.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 9" { - let i = len9 |> AltBinaryRandomAccessList.tryLookup 0 - let h = len9 |> AltBinaryRandomAccessList.tryLookup 1 - let g = len9 |> AltBinaryRandomAccessList.tryLookup 2 - let f = len9 |> AltBinaryRandomAccessList.tryLookup 3 - let e = len9 |> AltBinaryRandomAccessList.tryLookup 4 - let d = len9 |> AltBinaryRandomAccessList.tryLookup 5 - let c = len9 |> AltBinaryRandomAccessList.tryLookup 6 - let b = len9 |> AltBinaryRandomAccessList.tryLookup 7 - let a = len9 |> AltBinaryRandomAccessList.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup length 10" { - let j = lena |> AltBinaryRandomAccessList.tryLookup 0 - let i = lena |> AltBinaryRandomAccessList.tryLookup 1 - let h = lena |> AltBinaryRandomAccessList.tryLookup 2 - let g = lena |> AltBinaryRandomAccessList.tryLookup 3 - let f = lena |> AltBinaryRandomAccessList.tryLookup 4 - let e = lena |> AltBinaryRandomAccessList.tryLookup 5 - let d = lena |> AltBinaryRandomAccessList.tryLookup 6 - let c = lena |> AltBinaryRandomAccessList.tryLookup 7 - let b = lena |> AltBinaryRandomAccessList.tryLookup 8 - let a = lena |> AltBinaryRandomAccessList.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryLookup not found" { lena |> AltBinaryRandomAccessList.tryLookup 10 |> Expect.isNone "" } - - test "AltBinaryRandomAccessList.update length 1" { - len1 - |> AltBinaryRandomAccessList.update 0 "aa" - |> AltBinaryRandomAccessList.lookup 0 - |> Expect.equal "" "aa" - } - - test "AltBinaryRandomAccessList.update length 2" { - (((len2 - |> AltBinaryRandomAccessList.update 0 "bb" - |> AltBinaryRandomAccessList.lookup 0) = "bb") - && ((len2 - |> AltBinaryRandomAccessList.update 1 "aa" - |> AltBinaryRandomAccessList.lookup 1) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 3" { - (((len3 - |> AltBinaryRandomAccessList.update 0 "cc" - |> AltBinaryRandomAccessList.lookup 0) = "cc") - && ((len3 - |> AltBinaryRandomAccessList.update 1 "bb" - |> AltBinaryRandomAccessList.lookup 1) = "bb") - && ((len3 - |> AltBinaryRandomAccessList.update 2 "aa" - |> AltBinaryRandomAccessList.lookup 2) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 4" { - (((len4 - |> AltBinaryRandomAccessList.update 0 "dd" - |> AltBinaryRandomAccessList.lookup 0) = "dd") - && ((len4 - |> AltBinaryRandomAccessList.update 1 "cc" - |> AltBinaryRandomAccessList.lookup 1) = "cc") - && ((len4 - |> AltBinaryRandomAccessList.update 2 "bb" - |> AltBinaryRandomAccessList.lookup 2) = "bb") - && ((len4 - |> AltBinaryRandomAccessList.update 3 "aa" - |> AltBinaryRandomAccessList.lookup 3) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 5" { - (((len5 - |> AltBinaryRandomAccessList.update 0 "ee" - |> AltBinaryRandomAccessList.lookup 0) = "ee") - && ((len5 - |> AltBinaryRandomAccessList.update 1 "dd" - |> AltBinaryRandomAccessList.lookup 1) = "dd") - && ((len5 - |> AltBinaryRandomAccessList.update 2 "cc" - |> AltBinaryRandomAccessList.lookup 2) = "cc") - && ((len5 - |> AltBinaryRandomAccessList.update 3 "bb" - |> AltBinaryRandomAccessList.lookup 3) = "bb") - && ((len5 - |> AltBinaryRandomAccessList.update 4 "aa" - |> AltBinaryRandomAccessList.lookup 4) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 6" { - (((len6 - |> AltBinaryRandomAccessList.update 0 "ff" - |> AltBinaryRandomAccessList.lookup 0) = "ff") - && ((len6 - |> AltBinaryRandomAccessList.update 1 "ee" - |> AltBinaryRandomAccessList.lookup 1) = "ee") - && ((len6 - |> AltBinaryRandomAccessList.update 2 "dd" - |> AltBinaryRandomAccessList.lookup 2) = "dd") - && ((len6 - |> AltBinaryRandomAccessList.update 3 "cc" - |> AltBinaryRandomAccessList.lookup 3) = "cc") - && ((len6 - |> AltBinaryRandomAccessList.update 4 "bb" - |> AltBinaryRandomAccessList.lookup 4) = "bb") - && ((len6 - |> AltBinaryRandomAccessList.update 5 "aa" - |> AltBinaryRandomAccessList.lookup 5) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 7" { - (((len7 - |> AltBinaryRandomAccessList.update 0 "gg" - |> AltBinaryRandomAccessList.lookup 0) = "gg") - && ((len7 - |> AltBinaryRandomAccessList.update 1 "ff" - |> AltBinaryRandomAccessList.lookup 1) = "ff") - && ((len7 - |> AltBinaryRandomAccessList.update 2 "ee" - |> AltBinaryRandomAccessList.lookup 2) = "ee") - && ((len7 - |> AltBinaryRandomAccessList.update 3 "dd" - |> AltBinaryRandomAccessList.lookup 3) = "dd") - && ((len7 - |> AltBinaryRandomAccessList.update 4 "cc" - |> AltBinaryRandomAccessList.lookup 4) = "cc") - && ((len7 - |> AltBinaryRandomAccessList.update 5 "bb" - |> AltBinaryRandomAccessList.lookup 5) = "bb") - && ((len7 - |> AltBinaryRandomAccessList.update 6 "aa" - |> AltBinaryRandomAccessList.lookup 6) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 8" { - (((len8 - |> AltBinaryRandomAccessList.update 0 "hh" - |> AltBinaryRandomAccessList.lookup 0) = "hh") - && ((len8 - |> AltBinaryRandomAccessList.update 1 "gg" - |> AltBinaryRandomAccessList.lookup 1) = "gg") - && ((len8 - |> AltBinaryRandomAccessList.update 2 "ff" - |> AltBinaryRandomAccessList.lookup 2) = "ff") - && ((len8 - |> AltBinaryRandomAccessList.update 3 "ee" - |> AltBinaryRandomAccessList.lookup 3) = "ee") - && ((len8 - |> AltBinaryRandomAccessList.update 4 "dd" - |> AltBinaryRandomAccessList.lookup 4) = "dd") - && ((len8 - |> AltBinaryRandomAccessList.update 5 "cc" - |> AltBinaryRandomAccessList.lookup 5) = "cc") - && ((len8 - |> AltBinaryRandomAccessList.update 6 "bb" - |> AltBinaryRandomAccessList.lookup 6) = "bb") - && ((len8 - |> AltBinaryRandomAccessList.update 7 "aa" - |> AltBinaryRandomAccessList.lookup 7) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 9" { - (((len9 - |> AltBinaryRandomAccessList.update 0 "ii" - |> AltBinaryRandomAccessList.lookup 0) = "ii") - && ((len9 - |> AltBinaryRandomAccessList.update 1 "hh" - |> AltBinaryRandomAccessList.lookup 1) = "hh") - && ((len9 - |> AltBinaryRandomAccessList.update 2 "gg" - |> AltBinaryRandomAccessList.lookup 2) = "gg") - && ((len9 - |> AltBinaryRandomAccessList.update 3 "ff" - |> AltBinaryRandomAccessList.lookup 3) = "ff") - && ((len9 - |> AltBinaryRandomAccessList.update 4 "ee" - |> AltBinaryRandomAccessList.lookup 4) = "ee") - && ((len9 - |> AltBinaryRandomAccessList.update 5 "dd" - |> AltBinaryRandomAccessList.lookup 5) = "dd") - && ((len9 - |> AltBinaryRandomAccessList.update 6 "cc" - |> AltBinaryRandomAccessList.lookup 6) = "cc") - && ((len9 - |> AltBinaryRandomAccessList.update 7 "bb" - |> AltBinaryRandomAccessList.lookup 7) = "bb") - && ((len9 - |> AltBinaryRandomAccessList.update 8 "aa" - |> AltBinaryRandomAccessList.lookup 8) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.update length 10" { - (((lena - |> AltBinaryRandomAccessList.update 0 "jj" - |> AltBinaryRandomAccessList.lookup 0) = "jj") - && ((lena - |> AltBinaryRandomAccessList.update 1 "ii" - |> AltBinaryRandomAccessList.lookup 1) = "ii") - && ((lena - |> AltBinaryRandomAccessList.update 2 "hh" - |> AltBinaryRandomAccessList.lookup 2) = "hh") - && ((lena - |> AltBinaryRandomAccessList.update 3 "gg" - |> AltBinaryRandomAccessList.lookup 3) = "gg") - && ((lena - |> AltBinaryRandomAccessList.update 4 "ff" - |> AltBinaryRandomAccessList.lookup 4) = "ff") - && ((lena - |> AltBinaryRandomAccessList.update 5 "ee" - |> AltBinaryRandomAccessList.lookup 5) = "ee") - && ((lena - |> AltBinaryRandomAccessList.update 6 "dd" - |> AltBinaryRandomAccessList.lookup 6) = "dd") - && ((lena - |> AltBinaryRandomAccessList.update 7 "cc" - |> AltBinaryRandomAccessList.lookup 7) = "cc") - && ((lena - |> AltBinaryRandomAccessList.update 8 "bb" - |> AltBinaryRandomAccessList.lookup 8) = "bb") - && ((lena - |> AltBinaryRandomAccessList.update 9 "aa" - |> AltBinaryRandomAccessList.lookup 9) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 1" { - let a = len1 |> AltBinaryRandomAccessList.tryUpdate 0 "aa" - - ((a.Value |> AltBinaryRandomAccessList.lookup 0) = "aa") - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 2" { - let b = len2 |> AltBinaryRandomAccessList.tryUpdate 0 "bb" - let a = len2 |> AltBinaryRandomAccessList.tryUpdate 1 "aa" - - (((b.Value |> AltBinaryRandomAccessList.lookup 0) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 1) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 3" { - let c = len3 |> AltBinaryRandomAccessList.tryUpdate 0 "cc" - let b = len3 |> AltBinaryRandomAccessList.tryUpdate 1 "bb" - let a = len3 |> AltBinaryRandomAccessList.tryUpdate 2 "aa" - - (((c.Value |> AltBinaryRandomAccessList.lookup 0) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 1) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 2) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 4" { - let d = len4 |> AltBinaryRandomAccessList.tryUpdate 0 "dd" - let c = len4 |> AltBinaryRandomAccessList.tryUpdate 1 "cc" - let b = len4 |> AltBinaryRandomAccessList.tryUpdate 2 "bb" - let a = len4 |> AltBinaryRandomAccessList.tryUpdate 3 "aa" - - (((d.Value |> AltBinaryRandomAccessList.lookup 0) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 1) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 2) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 3) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 5" { - let e = len5 |> AltBinaryRandomAccessList.tryUpdate 0 "ee" - let d = len5 |> AltBinaryRandomAccessList.tryUpdate 1 "dd" - let c = len5 |> AltBinaryRandomAccessList.tryUpdate 2 "cc" - let b = len5 |> AltBinaryRandomAccessList.tryUpdate 3 "bb" - let a = len5 |> AltBinaryRandomAccessList.tryUpdate 4 "aa" - - (((e.Value |> AltBinaryRandomAccessList.lookup 0) = "ee") - && ((d.Value |> AltBinaryRandomAccessList.lookup 1) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 2) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 3) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 4) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 6" { - let f = len6 |> AltBinaryRandomAccessList.tryUpdate 0 "ff" - let e = len6 |> AltBinaryRandomAccessList.tryUpdate 1 "ee" - let d = len6 |> AltBinaryRandomAccessList.tryUpdate 2 "dd" - let c = len6 |> AltBinaryRandomAccessList.tryUpdate 3 "cc" - let b = len6 |> AltBinaryRandomAccessList.tryUpdate 4 "bb" - let a = len6 |> AltBinaryRandomAccessList.tryUpdate 5 "aa" - - (((f.Value |> AltBinaryRandomAccessList.lookup 0) = "ff") - && ((e.Value |> AltBinaryRandomAccessList.lookup 1) = "ee") - && ((d.Value |> AltBinaryRandomAccessList.lookup 2) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 3) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 4) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 5) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 7" { - let g = len7 |> AltBinaryRandomAccessList.tryUpdate 0 "gg" - let f = len7 |> AltBinaryRandomAccessList.tryUpdate 1 "ff" - let e = len7 |> AltBinaryRandomAccessList.tryUpdate 2 "ee" - let d = len7 |> AltBinaryRandomAccessList.tryUpdate 3 "dd" - let c = len7 |> AltBinaryRandomAccessList.tryUpdate 4 "cc" - let b = len7 |> AltBinaryRandomAccessList.tryUpdate 5 "bb" - let a = len7 |> AltBinaryRandomAccessList.tryUpdate 6 "aa" - - (((g.Value |> AltBinaryRandomAccessList.lookup 0) = "gg") - && ((f.Value |> AltBinaryRandomAccessList.lookup 1) = "ff") - && ((e.Value |> AltBinaryRandomAccessList.lookup 2) = "ee") - && ((d.Value |> AltBinaryRandomAccessList.lookup 3) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 4) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 5) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 6) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 8" { - let h = len8 |> AltBinaryRandomAccessList.tryUpdate 0 "hh" - let g = len8 |> AltBinaryRandomAccessList.tryUpdate 1 "gg" - let f = len8 |> AltBinaryRandomAccessList.tryUpdate 2 "ff" - let e = len8 |> AltBinaryRandomAccessList.tryUpdate 3 "ee" - let d = len8 |> AltBinaryRandomAccessList.tryUpdate 4 "dd" - let c = len8 |> AltBinaryRandomAccessList.tryUpdate 5 "cc" - let b = len8 |> AltBinaryRandomAccessList.tryUpdate 6 "bb" - let a = len8 |> AltBinaryRandomAccessList.tryUpdate 7 "aa" - - (((h.Value |> AltBinaryRandomAccessList.lookup 0) = "hh") - && ((g.Value |> AltBinaryRandomAccessList.lookup 1) = "gg") - && ((f.Value |> AltBinaryRandomAccessList.lookup 2) = "ff") - && ((e.Value |> AltBinaryRandomAccessList.lookup 3) = "ee") - && ((d.Value |> AltBinaryRandomAccessList.lookup 4) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 5) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 6) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 7) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 9" { - let i = len9 |> AltBinaryRandomAccessList.tryUpdate 0 "ii" - let h = len9 |> AltBinaryRandomAccessList.tryUpdate 1 "hh" - let g = len9 |> AltBinaryRandomAccessList.tryUpdate 2 "gg" - let f = len9 |> AltBinaryRandomAccessList.tryUpdate 3 "ff" - let e = len9 |> AltBinaryRandomAccessList.tryUpdate 4 "ee" - let d = len9 |> AltBinaryRandomAccessList.tryUpdate 5 "dd" - let c = len9 |> AltBinaryRandomAccessList.tryUpdate 6 "cc" - let b = len9 |> AltBinaryRandomAccessList.tryUpdate 7 "bb" - let a = len9 |> AltBinaryRandomAccessList.tryUpdate 8 "aa" - - (((i.Value |> AltBinaryRandomAccessList.lookup 0) = "ii") - && ((h.Value |> AltBinaryRandomAccessList.lookup 1) = "hh") - && ((g.Value |> AltBinaryRandomAccessList.lookup 2) = "gg") - && ((f.Value |> AltBinaryRandomAccessList.lookup 3) = "ff") - && ((e.Value |> AltBinaryRandomAccessList.lookup 4) = "ee") - && ((d.Value |> AltBinaryRandomAccessList.lookup 5) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 6) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 7) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 8) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryUpdate length 10" { - let j = lena |> AltBinaryRandomAccessList.tryUpdate 0 "jj" - let i = lena |> AltBinaryRandomAccessList.tryUpdate 1 "ii" - let h = lena |> AltBinaryRandomAccessList.tryUpdate 2 "hh" - let g = lena |> AltBinaryRandomAccessList.tryUpdate 3 "gg" - let f = lena |> AltBinaryRandomAccessList.tryUpdate 4 "ff" - let e = lena |> AltBinaryRandomAccessList.tryUpdate 5 "ee" - let d = lena |> AltBinaryRandomAccessList.tryUpdate 6 "dd" - let c = lena |> AltBinaryRandomAccessList.tryUpdate 7 "cc" - let b = lena |> AltBinaryRandomAccessList.tryUpdate 8 "bb" - let a = lena |> AltBinaryRandomAccessList.tryUpdate 9 "aa" - - (((j.Value |> AltBinaryRandomAccessList.lookup 0) = "jj") - && ((i.Value |> AltBinaryRandomAccessList.lookup 1) = "ii") - && ((h.Value |> AltBinaryRandomAccessList.lookup 2) = "hh") - && ((g.Value |> AltBinaryRandomAccessList.lookup 3) = "gg") - && ((f.Value |> AltBinaryRandomAccessList.lookup 4) = "ff") - && ((e.Value |> AltBinaryRandomAccessList.lookup 5) = "ee") - && ((d.Value |> AltBinaryRandomAccessList.lookup 6) = "dd") - && ((c.Value |> AltBinaryRandomAccessList.lookup 7) = "cc") - && ((b.Value |> AltBinaryRandomAccessList.lookup 8) = "bb") - && ((a.Value |> AltBinaryRandomAccessList.lookup 9) = "aa")) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 1" { - AltBinaryRandomAccessList.isEmpty(len1 |> AltBinaryRandomAccessList.remove 0) - |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 2" { - let a = - match (len2 |> AltBinaryRandomAccessList.remove 0) with - | One(("a"), Nil) -> true - | _ -> false - - let b = - match (len2 |> AltBinaryRandomAccessList.remove 1) with - | One(("b"), Nil) -> true - | _ -> false - - (a && b) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 3" { - let a = - match (len3 |> AltBinaryRandomAccessList.remove 0) with - | Zero(One(("b", "a"), Nil)) -> true - | _ -> false - - let b = - match (len3 |> AltBinaryRandomAccessList.remove 1) with - | Zero(One(("c", "a"), Nil)) -> true - | _ -> false - - let c = - match (len3 |> AltBinaryRandomAccessList.remove 2) with - | Zero(One(("c", "b"), Nil)) -> true - | _ -> false - - (a && b && c) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 4" { - let a = - match (len4 |> AltBinaryRandomAccessList.remove 0) with - | One("c", One(("b", "a"), Nil)) -> true - | _ -> false - - let b = - match (len4 |> AltBinaryRandomAccessList.remove 1) with - | One("d", One(("b", "a"), Nil)) -> true - | _ -> false - - let c = - match (len4 |> AltBinaryRandomAccessList.remove 2) with - | One("d", One(("c", "a"), Nil)) -> true - | _ -> false - - let d = - match (len4 |> AltBinaryRandomAccessList.remove 3) with - | One("d", One(("c", "b"), Nil)) -> true - | _ -> false - - (a && b && c && d) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 5" { - let a = - match (len5 |> AltBinaryRandomAccessList.remove 0) with - | Zero(Zero(One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let b = - match (len5 |> AltBinaryRandomAccessList.remove 1) with - | Zero(Zero(One((("e", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let c = - match (len5 |> AltBinaryRandomAccessList.remove 2) with - | Zero(Zero(One((("e", "d"), ("b", "a")), Nil))) -> true - | _ -> false - - let d = - match (len5 |> AltBinaryRandomAccessList.remove 3) with - | Zero(Zero(One((("e", "d"), ("c", "a")), Nil))) -> true - | _ -> false - - let e = - match (len5 |> AltBinaryRandomAccessList.remove 4) with - | Zero(Zero(One((("e", "d"), ("c", "b")), Nil))) -> true - | _ -> false - - (a && b && c && d && e) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 6" { - let a = - match (len6 |> AltBinaryRandomAccessList.remove 0) with - | One("e", Zero(One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let b = - match (len6 |> AltBinaryRandomAccessList.remove 1) with - | One("f", Zero(One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let c = - match (len6 |> AltBinaryRandomAccessList.remove 2) with - | One("f", Zero(One((("e", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let d = - match (len6 |> AltBinaryRandomAccessList.remove 3) with - | One("f", Zero(One((("e", "d"), ("b", "a")), Nil))) -> true - | _ -> false - - let e = - match (len6 |> AltBinaryRandomAccessList.remove 4) with - | One("f", Zero(One((("e", "d"), ("c", "a")), Nil))) -> true - | _ -> false - - let f = - match (len6 |> AltBinaryRandomAccessList.remove 5) with - | One("f", Zero(One((("e", "d"), ("c", "b")), Nil))) -> true - | _ -> false - - (a && b && c && d && e && f) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 7" { - let a = - match (len7 |> AltBinaryRandomAccessList.remove 0) with - | Zero(One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let b = - match (len7 |> AltBinaryRandomAccessList.remove 1) with - | Zero(One(("g", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let c = - match (len7 |> AltBinaryRandomAccessList.remove 2) with - | Zero(One(("g", "f"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let d = - match (len7 |> AltBinaryRandomAccessList.remove 3) with - | Zero(One(("g", "f"), One((("e", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let e = - match (len7 |> AltBinaryRandomAccessList.remove 4) with - | Zero(One(("g", "f"), One((("e", "d"), ("b", "a")), Nil))) -> true - | _ -> false - - let f = - match (len7 |> AltBinaryRandomAccessList.remove 5) with - | Zero(One(("g", "f"), One((("e", "d"), ("c", "a")), Nil))) -> true - | _ -> false - - let g = - match (len7 |> AltBinaryRandomAccessList.remove 6) with - | Zero(One(("g", "f"), One((("e", "d"), ("c", "b")), Nil))) -> true - | _ -> false - - (a && b && c && d && e && f && g) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 8" { - let a = - match (len8 |> AltBinaryRandomAccessList.remove 0) with - | One("g", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let b = - match (len8 |> AltBinaryRandomAccessList.remove 1) with - | One("h", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let c = - match (len8 |> AltBinaryRandomAccessList.remove 2) with - | One("h", One(("g", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let d = - match (len8 |> AltBinaryRandomAccessList.remove 3) with - | One("h", One(("g", "f"), One((("d", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let e = - match (len8 |> AltBinaryRandomAccessList.remove 4) with - | One("h", One(("g", "f"), One((("e", "c"), ("b", "a")), Nil))) -> true - | _ -> false - - let f = - match (len8 |> AltBinaryRandomAccessList.remove 5) with - | One("h", One(("g", "f"), One((("e", "d"), ("b", "a")), Nil))) -> true - | _ -> false - - let g = - match (len8 |> AltBinaryRandomAccessList.remove 6) with - | One("h", One(("g", "f"), One((("e", "d"), ("c", "a")), Nil))) -> true - | _ -> false - - let h = - match (len8 |> AltBinaryRandomAccessList.remove 7) with - | One("h", One(("g", "f"), One((("e", "d"), ("c", "b")), Nil))) -> true - | _ -> false - - (a && b && c && d && e && f && g && h) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 9" { - let a = - match (len9 |> AltBinaryRandomAccessList.remove 0) with - | Zero(Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let b = - match (len9 |> AltBinaryRandomAccessList.remove 1) with - | Zero(Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let c = - match (len9 |> AltBinaryRandomAccessList.remove 2) with - | Zero(Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let d = - match (len9 |> AltBinaryRandomAccessList.remove 3) with - | Zero(Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let e = - match (len9 |> AltBinaryRandomAccessList.remove 4) with - | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let f = - match (len9 |> AltBinaryRandomAccessList.remove 5) with - | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let g = - match (len9 |> AltBinaryRandomAccessList.remove 6) with - | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let h = - match (len9 |> AltBinaryRandomAccessList.remove 7) with - | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil)))) -> true - | _ -> false - - let i = - match (len9 |> AltBinaryRandomAccessList.remove 8) with - | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil)))) -> true - | _ -> false - - (a && b && c && d && e && f && g && h && i) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.remove elements length 10" { - let a = - match (lena |> AltBinaryRandomAccessList.remove 0) with - | One("i", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let b = - match (lena |> AltBinaryRandomAccessList.remove 1) with - | One("j", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let c = - match (lena |> AltBinaryRandomAccessList.remove 2) with - | One("j", Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let d = - match (lena |> AltBinaryRandomAccessList.remove 3) with - | One("j", Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let e = - match (lena |> AltBinaryRandomAccessList.remove 4) with - | One("j", Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let f = - match (lena |> AltBinaryRandomAccessList.remove 5) with - | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let g = - match (lena |> AltBinaryRandomAccessList.remove 6) with - | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let h = - match (lena |> AltBinaryRandomAccessList.remove 7) with - | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil)))) -> true - | _ -> false - - let i = - match (lena |> AltBinaryRandomAccessList.remove 8) with - | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil)))) -> true - | _ -> false - - let j = - match (lena |> AltBinaryRandomAccessList.remove 9) with - | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil)))) -> true - | _ -> false - - (a && b && c && d && e && f && g && h && i && j) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 1" { - let a = AltBinaryRandomAccessList.tryRemove 0 len1 - (AltBinaryRandomAccessList.isEmpty a.Value) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 2" { - let a = - match (len2 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(One(("a"), Nil)) -> true - | _ -> false - - let b = - match (len2 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(One(("b"), Nil)) -> true - | _ -> false - - (a && b) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 3" { - let a = - match (len3 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(Zero(One(("b", "a"), Nil))) -> true - | _ -> false - - let b = - match (len3 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(Zero(One(("c", "a"), Nil))) -> true - | _ -> false - - let c = - match (len3 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(Zero(One(("c", "b"), Nil))) -> true - | _ -> false - - (a && b && c) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 4" { - let a = - match (len4 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(One("c", One(("b", "a"), Nil))) -> true - | _ -> false - - let b = - match (len4 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(One("d", One(("b", "a"), Nil))) -> true - | _ -> false - - let c = - match (len4 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(One("d", One(("c", "a"), Nil))) -> true - | _ -> false - - let d = - match (len4 |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(One("d", One(("c", "b"), Nil))) -> true - | _ -> false - - (a && b && c && d) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 5" { - let a = - match (len5 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(Zero(Zero(One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let b = - match (len5 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(Zero(Zero(One((("e", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let c = - match (len5 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(Zero(Zero(One((("e", "d"), ("b", "a")), Nil)))) -> true - | _ -> false - - let d = - match (len5 |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(Zero(Zero(One((("e", "d"), ("c", "a")), Nil)))) -> true - | _ -> false - - let e = - match (len5 |> AltBinaryRandomAccessList.tryRemove 4) with - | Some(Zero(Zero(One((("e", "d"), ("c", "b")), Nil)))) -> true - | _ -> false - - (a && b && c && d && e) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 6" { - let a = - match (len6 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(One("e", Zero(One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let b = - match (len6 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(One("f", Zero(One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let c = - match (len6 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(One("f", Zero(One((("e", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let d = - match (len6 |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(One("f", Zero(One((("e", "d"), ("b", "a")), Nil)))) -> true - | _ -> false - - let e = - match (len6 |> AltBinaryRandomAccessList.tryRemove 4) with - | Some(One("f", Zero(One((("e", "d"), ("c", "a")), Nil)))) -> true - | _ -> false - - let f = - match (len6 |> AltBinaryRandomAccessList.tryRemove 5) with - | Some(One("f", Zero(One((("e", "d"), ("c", "b")), Nil)))) -> true - | _ -> false - - (a && b && c && d && e && f) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 7" { - let a = - match (len7 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(Zero(One(("f", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let b = - match (len7 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(Zero(One(("g", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let c = - match (len7 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(Zero(One(("g", "f"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let d = - match (len7 |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(Zero(One(("g", "f"), One((("e", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let e = - match (len7 |> AltBinaryRandomAccessList.tryRemove 4) with - | Some(Zero(One(("g", "f"), One((("e", "d"), ("b", "a")), Nil)))) -> true - | _ -> false - - let f = - match (len7 |> AltBinaryRandomAccessList.tryRemove 5) with - | Some(Zero(One(("g", "f"), One((("e", "d"), ("c", "a")), Nil)))) -> true - | _ -> false - - let g = - match (len7 |> AltBinaryRandomAccessList.tryRemove 6) with - | Some(Zero(One(("g", "f"), One((("e", "d"), ("c", "b")), Nil)))) -> true - | _ -> false - - (a && b && c && d && e && f && g) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 8" { - let a = - match (len8 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(One("g", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let b = - match (len8 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(One("h", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let c = - match (len8 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(One("h", One(("g", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let d = - match (len8 |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(One("h", One(("g", "f"), One((("d", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let e = - match (len8 |> AltBinaryRandomAccessList.tryRemove 4) with - | Some(One("h", One(("g", "f"), One((("e", "c"), ("b", "a")), Nil)))) -> true - | _ -> false - - let f = - match (len8 |> AltBinaryRandomAccessList.tryRemove 5) with - | Some(One("h", One(("g", "f"), One((("e", "d"), ("b", "a")), Nil)))) -> true - | _ -> false - - let g = - match (len8 |> AltBinaryRandomAccessList.tryRemove 6) with - | Some(One("h", One(("g", "f"), One((("e", "d"), ("c", "a")), Nil)))) -> true - | _ -> false - - let h = - match (len8 |> AltBinaryRandomAccessList.tryRemove 7) with - | Some(One("h", One(("g", "f"), One((("e", "d"), ("c", "b")), Nil)))) -> true - | _ -> false - - (a && b && c && d && e && f && g && h) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 9" { - let a = - match (len9 |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(Zero(Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let b = - match (len9 |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(Zero(Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let c = - match (len9 |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let d = - match (len9 |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let e = - match (len9 |> AltBinaryRandomAccessList.tryRemove 4) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let f = - match (len9 |> AltBinaryRandomAccessList.tryRemove 5) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let g = - match (len9 |> AltBinaryRandomAccessList.tryRemove 6) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let h = - match (len9 |> AltBinaryRandomAccessList.tryRemove 7) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil))))) -> true - | _ -> false - - let i = - match (len9 |> AltBinaryRandomAccessList.tryRemove 8) with - | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil))))) -> true - | _ -> false - - (a && b && c && d && e && f && g && h && i) |> Expect.isTrue "" - } - - test "AltBinaryRandomAccessList.tryRemove elements length 10" { - let a = - match (lena |> AltBinaryRandomAccessList.tryRemove 0) with - | Some(One("i", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let b = - match (lena |> AltBinaryRandomAccessList.tryRemove 1) with - | Some(One("j", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let c = - match (lena |> AltBinaryRandomAccessList.tryRemove 2) with - | Some(One("j", Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let d = - match (lena |> AltBinaryRandomAccessList.tryRemove 3) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let e = - match (lena |> AltBinaryRandomAccessList.tryRemove 4) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let f = - match (lena |> AltBinaryRandomAccessList.tryRemove 5) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let g = - match (lena |> AltBinaryRandomAccessList.tryRemove 6) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let h = - match (lena |> AltBinaryRandomAccessList.tryRemove 7) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil))))) -> true - | _ -> false - - let i = - match (lena |> AltBinaryRandomAccessList.tryRemove 8) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil))))) -> true - | _ -> false - - let j = - match (lena |> AltBinaryRandomAccessList.tryRemove 9) with - | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil))))) -> true - | _ -> false - - (a && b && c && d && e && f && g && h && i && j) |> Expect.isTrue "" - } - - test "length of AltBinaryRandomAccessList.empty is 0" { - ((AltBinaryRandomAccessList.length AltBinaryRandomAccessList.empty) = 0) - |> Expect.isTrue "" - } - - test "length of 1 - 10 good" { - (((AltBinaryRandomAccessList.length len1) = 1) - && ((AltBinaryRandomAccessList.length len2) = 2) - && ((AltBinaryRandomAccessList.length len3) = 3) - && ((AltBinaryRandomAccessList.length len4) = 4) - && ((AltBinaryRandomAccessList.length len5) = 5) - && ((AltBinaryRandomAccessList.length len6) = 6) - && ((AltBinaryRandomAccessList.length len7) = 7) - && ((AltBinaryRandomAccessList.length len8) = 8) - && ((AltBinaryRandomAccessList.length len9) = 9) - && ((AltBinaryRandomAccessList.length lena) = 10)) - |> Expect.isTrue "" - } - - test "ofSeq" { - let x = - AltBinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] - - (((x |> AltBinaryRandomAccessList.lookup 0) = "a") - && ((x |> AltBinaryRandomAccessList.lookup 1) = "b") - && ((x |> AltBinaryRandomAccessList.lookup 2) = "c") - && ((x |> AltBinaryRandomAccessList.lookup 3) = "d") - && ((x |> AltBinaryRandomAccessList.lookup 4) = "e") - && ((x |> AltBinaryRandomAccessList.lookup 5) = "f") - && ((x |> AltBinaryRandomAccessList.lookup 6) = "g") - && ((x |> AltBinaryRandomAccessList.lookup 7) = "h") - && ((x |> AltBinaryRandomAccessList.lookup 8) = "i") - && ((x |> AltBinaryRandomAccessList.lookup 9) = "j")) - |> Expect.isTrue "" - } - - test "IRandomAccessList AltBinaryRandomAccessList.cons works" { - ((lena :> IRandomAccessList).Cons "zz").Head - |> Expect.equal "" "zz" - } - ] + testList + "Experimental AltBinaryRandomAccessList" + [ test "AltBinaryRandomAccessList.empty list should be AltBinaryRandomAccessList.empty" { + AltBinaryRandomAccessList.isEmpty AltBinaryRandomAccessList.empty + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.cons works" { + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.isEmpty + |> Expect.isFalse "" + } + + test "AltBinaryRandomAccessList.uncons 1 element" { + let x, _ = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.uncons + + (x = 1) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.uncons 2 elements" { + let x, _ = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.uncons + + (x = 2) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.uncons 3 elements" { + let x, _ = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.cons 3 + |> AltBinaryRandomAccessList.uncons + + (x = 3) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUncons 1 element" { + let x = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.tryUncons + + (fst(x.Value) = 1) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUncons 2 elements" { + let x = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.tryUncons + + (fst(x.Value) = 2) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUncons 3 elements" { + let x = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.cons 3 + |> AltBinaryRandomAccessList.tryUncons + + (fst(x.Value) = 3) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUncons AltBinaryRandomAccessList.empty" { + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.tryUncons + |> Expect.isNone "" + } + + test "AltBinaryRandomAccessList.head should return" { + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.head + |> Expect.equal "" 2 + } + + test "AltBinaryRandomAccessList.tryGetHead should return" { + let x = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.tryGetHead + + x.Value |> Expect.equal "" 2 + } + + test "AltBinaryRandomAccessList.tryGetHead on AltBinaryRandomAccessList.empty should return None" { + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.tryGetHead + |> Expect.isNone "" + } + + test "AltBinaryRandomAccessList.tryGetTail on AltBinaryRandomAccessList.empty should return None" { + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.tryGetTail + |> Expect.isNone "" + } + + test "AltBinaryRandomAccessList.tryGetTail on len 1 should return Some AltBinaryRandomAccessList.empty" { + let x = + (AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.tryGetTail) + .Value + + x |> AltBinaryRandomAccessList.isEmpty |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tail on len 2 should return" { + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.tail + |> AltBinaryRandomAccessList.head + |> Expect.equal "" 1 + } + + test "AltBinaryRandomAccessList.tryGetTail on len 2 should return" { + let a = + AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons 1 + |> AltBinaryRandomAccessList.cons 2 + |> AltBinaryRandomAccessList.tryGetTail + + ((AltBinaryRandomAccessList.head a.Value) = 1) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 1" { len1 |> AltBinaryRandomAccessList.lookup 0 |> Expect.equal "" "a" } + + test "AltBinaryRandomAccessList.rev AltBinaryRandomAccessList.empty" { + AltBinaryRandomAccessList.isEmpty(AltBinaryRandomAccessList.empty |> AltBinaryRandomAccessList.rev) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.rev elements length 5" { + let a = + match (len5 |> AltBinaryRandomAccessList.rev) with + | One("a", Zero(One((("b", "c"), ("d", "e")), Nil))) -> true + | _ -> false + + a |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.append 2 AltBinaryRandomAccessList.empty lists" { + AltBinaryRandomAccessList.isEmpty(AltBinaryRandomAccessList.append AltBinaryRandomAccessList.empty AltBinaryRandomAccessList.empty) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.append left AltBinaryRandomAccessList.empty right 5" { + let a = + match (AltBinaryRandomAccessList.append AltBinaryRandomAccessList.empty len5) with + | One("e", Zero(One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + a |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.append left 6 right AltBinaryRandomAccessList.empty" { + let a = + match (AltBinaryRandomAccessList.append len6 AltBinaryRandomAccessList.empty) with + | Zero(One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + a |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.append left 6 right3" { + let a = + match + (AltBinaryRandomAccessList.append + len6 + (AltBinaryRandomAccessList.empty + |> AltBinaryRandomAccessList.cons "3" + |> AltBinaryRandomAccessList.cons "2" + |> AltBinaryRandomAccessList.cons "1")) + with + | One("f", Zero(Zero(One(((("e", "d"), ("c", "b")), (("a", "1"), ("2", "3"))), Nil)))) -> true + | _ -> false + + a |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 2" { + (((len2 |> AltBinaryRandomAccessList.lookup 0) = "b") + && ((len2 |> AltBinaryRandomAccessList.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 3" { + (((len3 |> AltBinaryRandomAccessList.lookup 0) = "c") + && ((len3 |> AltBinaryRandomAccessList.lookup 1) = "b") + && ((len3 |> AltBinaryRandomAccessList.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 4" { + (((len4 |> AltBinaryRandomAccessList.lookup 0) = "d") + && ((len4 |> AltBinaryRandomAccessList.lookup 1) = "c") + && ((len4 |> AltBinaryRandomAccessList.lookup 2) = "b") + && ((len4 |> AltBinaryRandomAccessList.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 5" { + (((len5 |> AltBinaryRandomAccessList.lookup 0) = "e") + && ((len5 |> AltBinaryRandomAccessList.lookup 1) = "d") + && ((len5 |> AltBinaryRandomAccessList.lookup 2) = "c") + && ((len5 |> AltBinaryRandomAccessList.lookup 3) = "b") + && ((len5 |> AltBinaryRandomAccessList.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 6" { + (((len6 |> AltBinaryRandomAccessList.lookup 0) = "f") + && ((len6 |> AltBinaryRandomAccessList.lookup 1) = "e") + && ((len6 |> AltBinaryRandomAccessList.lookup 2) = "d") + && ((len6 |> AltBinaryRandomAccessList.lookup 3) = "c") + && ((len6 |> AltBinaryRandomAccessList.lookup 4) = "b") + && ((len6 |> AltBinaryRandomAccessList.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 7" { + (((len7 |> AltBinaryRandomAccessList.lookup 0) = "g") + && ((len7 |> AltBinaryRandomAccessList.lookup 1) = "f") + && ((len7 |> AltBinaryRandomAccessList.lookup 2) = "e") + && ((len7 |> AltBinaryRandomAccessList.lookup 3) = "d") + && ((len7 |> AltBinaryRandomAccessList.lookup 4) = "c") + && ((len7 |> AltBinaryRandomAccessList.lookup 5) = "b") + && ((len7 |> AltBinaryRandomAccessList.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 8" { + (((len8 |> AltBinaryRandomAccessList.lookup 0) = "h") + && ((len8 |> AltBinaryRandomAccessList.lookup 1) = "g") + && ((len8 |> AltBinaryRandomAccessList.lookup 2) = "f") + && ((len8 |> AltBinaryRandomAccessList.lookup 3) = "e") + && ((len8 |> AltBinaryRandomAccessList.lookup 4) = "d") + && ((len8 |> AltBinaryRandomAccessList.lookup 5) = "c") + && ((len8 |> AltBinaryRandomAccessList.lookup 6) = "b") + && ((len8 |> AltBinaryRandomAccessList.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 9" { + (((len9 |> AltBinaryRandomAccessList.lookup 0) = "i") + && ((len9 |> AltBinaryRandomAccessList.lookup 1) = "h") + && ((len9 |> AltBinaryRandomAccessList.lookup 2) = "g") + && ((len9 |> AltBinaryRandomAccessList.lookup 3) = "f") + && ((len9 |> AltBinaryRandomAccessList.lookup 4) = "e") + && ((len9 |> AltBinaryRandomAccessList.lookup 5) = "d") + && ((len9 |> AltBinaryRandomAccessList.lookup 6) = "c") + && ((len9 |> AltBinaryRandomAccessList.lookup 7) = "b") + && ((len9 |> AltBinaryRandomAccessList.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.lookup length 10" { + (((lena |> AltBinaryRandomAccessList.lookup 0) = "j") + && ((lena |> AltBinaryRandomAccessList.lookup 1) = "i") + && ((lena |> AltBinaryRandomAccessList.lookup 2) = "h") + && ((lena |> AltBinaryRandomAccessList.lookup 3) = "g") + && ((lena |> AltBinaryRandomAccessList.lookup 4) = "f") + && ((lena |> AltBinaryRandomAccessList.lookup 5) = "e") + && ((lena |> AltBinaryRandomAccessList.lookup 6) = "d") + && ((lena |> AltBinaryRandomAccessList.lookup 7) = "c") + && ((lena |> AltBinaryRandomAccessList.lookup 8) = "b") + && ((lena |> AltBinaryRandomAccessList.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 1" { + let a = len1 |> AltBinaryRandomAccessList.tryLookup 0 + (a.Value = "a") |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 2" { + let b = len2 |> AltBinaryRandomAccessList.tryLookup 0 + let a = len2 |> AltBinaryRandomAccessList.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 3" { + let c = len3 |> AltBinaryRandomAccessList.tryLookup 0 + let b = len3 |> AltBinaryRandomAccessList.tryLookup 1 + let a = len3 |> AltBinaryRandomAccessList.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 4" { + let d = len4 |> AltBinaryRandomAccessList.tryLookup 0 + let c = len4 |> AltBinaryRandomAccessList.tryLookup 1 + let b = len4 |> AltBinaryRandomAccessList.tryLookup 2 + let a = len4 |> AltBinaryRandomAccessList.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 5" { + let e = len5 |> AltBinaryRandomAccessList.tryLookup 0 + let d = len5 |> AltBinaryRandomAccessList.tryLookup 1 + let c = len5 |> AltBinaryRandomAccessList.tryLookup 2 + let b = len5 |> AltBinaryRandomAccessList.tryLookup 3 + let a = len5 |> AltBinaryRandomAccessList.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 6" { + let f = len6 |> AltBinaryRandomAccessList.tryLookup 0 + let e = len6 |> AltBinaryRandomAccessList.tryLookup 1 + let d = len6 |> AltBinaryRandomAccessList.tryLookup 2 + let c = len6 |> AltBinaryRandomAccessList.tryLookup 3 + let b = len6 |> AltBinaryRandomAccessList.tryLookup 4 + let a = len6 |> AltBinaryRandomAccessList.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 7" { + let g = len7 |> AltBinaryRandomAccessList.tryLookup 0 + let f = len7 |> AltBinaryRandomAccessList.tryLookup 1 + let e = len7 |> AltBinaryRandomAccessList.tryLookup 2 + let d = len7 |> AltBinaryRandomAccessList.tryLookup 3 + let c = len7 |> AltBinaryRandomAccessList.tryLookup 4 + let b = len7 |> AltBinaryRandomAccessList.tryLookup 5 + let a = len7 |> AltBinaryRandomAccessList.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 8" { + let h = len8 |> AltBinaryRandomAccessList.tryLookup 0 + let g = len8 |> AltBinaryRandomAccessList.tryLookup 1 + let f = len8 |> AltBinaryRandomAccessList.tryLookup 2 + let e = len8 |> AltBinaryRandomAccessList.tryLookup 3 + let d = len8 |> AltBinaryRandomAccessList.tryLookup 4 + let c = len8 |> AltBinaryRandomAccessList.tryLookup 5 + let b = len8 |> AltBinaryRandomAccessList.tryLookup 6 + let a = len8 |> AltBinaryRandomAccessList.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 9" { + let i = len9 |> AltBinaryRandomAccessList.tryLookup 0 + let h = len9 |> AltBinaryRandomAccessList.tryLookup 1 + let g = len9 |> AltBinaryRandomAccessList.tryLookup 2 + let f = len9 |> AltBinaryRandomAccessList.tryLookup 3 + let e = len9 |> AltBinaryRandomAccessList.tryLookup 4 + let d = len9 |> AltBinaryRandomAccessList.tryLookup 5 + let c = len9 |> AltBinaryRandomAccessList.tryLookup 6 + let b = len9 |> AltBinaryRandomAccessList.tryLookup 7 + let a = len9 |> AltBinaryRandomAccessList.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup length 10" { + let j = lena |> AltBinaryRandomAccessList.tryLookup 0 + let i = lena |> AltBinaryRandomAccessList.tryLookup 1 + let h = lena |> AltBinaryRandomAccessList.tryLookup 2 + let g = lena |> AltBinaryRandomAccessList.tryLookup 3 + let f = lena |> AltBinaryRandomAccessList.tryLookup 4 + let e = lena |> AltBinaryRandomAccessList.tryLookup 5 + let d = lena |> AltBinaryRandomAccessList.tryLookup 6 + let c = lena |> AltBinaryRandomAccessList.tryLookup 7 + let b = lena |> AltBinaryRandomAccessList.tryLookup 8 + let a = lena |> AltBinaryRandomAccessList.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryLookup not found" { lena |> AltBinaryRandomAccessList.tryLookup 10 |> Expect.isNone "" } + + test "AltBinaryRandomAccessList.update length 1" { + len1 + |> AltBinaryRandomAccessList.update 0 "aa" + |> AltBinaryRandomAccessList.lookup 0 + |> Expect.equal "" "aa" + } + + test "AltBinaryRandomAccessList.update length 2" { + (((len2 + |> AltBinaryRandomAccessList.update 0 "bb" + |> AltBinaryRandomAccessList.lookup 0) = "bb") + && ((len2 + |> AltBinaryRandomAccessList.update 1 "aa" + |> AltBinaryRandomAccessList.lookup 1) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 3" { + (((len3 + |> AltBinaryRandomAccessList.update 0 "cc" + |> AltBinaryRandomAccessList.lookup 0) = "cc") + && ((len3 + |> AltBinaryRandomAccessList.update 1 "bb" + |> AltBinaryRandomAccessList.lookup 1) = "bb") + && ((len3 + |> AltBinaryRandomAccessList.update 2 "aa" + |> AltBinaryRandomAccessList.lookup 2) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 4" { + (((len4 + |> AltBinaryRandomAccessList.update 0 "dd" + |> AltBinaryRandomAccessList.lookup 0) = "dd") + && ((len4 + |> AltBinaryRandomAccessList.update 1 "cc" + |> AltBinaryRandomAccessList.lookup 1) = "cc") + && ((len4 + |> AltBinaryRandomAccessList.update 2 "bb" + |> AltBinaryRandomAccessList.lookup 2) = "bb") + && ((len4 + |> AltBinaryRandomAccessList.update 3 "aa" + |> AltBinaryRandomAccessList.lookup 3) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 5" { + (((len5 + |> AltBinaryRandomAccessList.update 0 "ee" + |> AltBinaryRandomAccessList.lookup 0) = "ee") + && ((len5 + |> AltBinaryRandomAccessList.update 1 "dd" + |> AltBinaryRandomAccessList.lookup 1) = "dd") + && ((len5 + |> AltBinaryRandomAccessList.update 2 "cc" + |> AltBinaryRandomAccessList.lookup 2) = "cc") + && ((len5 + |> AltBinaryRandomAccessList.update 3 "bb" + |> AltBinaryRandomAccessList.lookup 3) = "bb") + && ((len5 + |> AltBinaryRandomAccessList.update 4 "aa" + |> AltBinaryRandomAccessList.lookup 4) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 6" { + (((len6 + |> AltBinaryRandomAccessList.update 0 "ff" + |> AltBinaryRandomAccessList.lookup 0) = "ff") + && ((len6 + |> AltBinaryRandomAccessList.update 1 "ee" + |> AltBinaryRandomAccessList.lookup 1) = "ee") + && ((len6 + |> AltBinaryRandomAccessList.update 2 "dd" + |> AltBinaryRandomAccessList.lookup 2) = "dd") + && ((len6 + |> AltBinaryRandomAccessList.update 3 "cc" + |> AltBinaryRandomAccessList.lookup 3) = "cc") + && ((len6 + |> AltBinaryRandomAccessList.update 4 "bb" + |> AltBinaryRandomAccessList.lookup 4) = "bb") + && ((len6 + |> AltBinaryRandomAccessList.update 5 "aa" + |> AltBinaryRandomAccessList.lookup 5) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 7" { + (((len7 + |> AltBinaryRandomAccessList.update 0 "gg" + |> AltBinaryRandomAccessList.lookup 0) = "gg") + && ((len7 + |> AltBinaryRandomAccessList.update 1 "ff" + |> AltBinaryRandomAccessList.lookup 1) = "ff") + && ((len7 + |> AltBinaryRandomAccessList.update 2 "ee" + |> AltBinaryRandomAccessList.lookup 2) = "ee") + && ((len7 + |> AltBinaryRandomAccessList.update 3 "dd" + |> AltBinaryRandomAccessList.lookup 3) = "dd") + && ((len7 + |> AltBinaryRandomAccessList.update 4 "cc" + |> AltBinaryRandomAccessList.lookup 4) = "cc") + && ((len7 + |> AltBinaryRandomAccessList.update 5 "bb" + |> AltBinaryRandomAccessList.lookup 5) = "bb") + && ((len7 + |> AltBinaryRandomAccessList.update 6 "aa" + |> AltBinaryRandomAccessList.lookup 6) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 8" { + (((len8 + |> AltBinaryRandomAccessList.update 0 "hh" + |> AltBinaryRandomAccessList.lookup 0) = "hh") + && ((len8 + |> AltBinaryRandomAccessList.update 1 "gg" + |> AltBinaryRandomAccessList.lookup 1) = "gg") + && ((len8 + |> AltBinaryRandomAccessList.update 2 "ff" + |> AltBinaryRandomAccessList.lookup 2) = "ff") + && ((len8 + |> AltBinaryRandomAccessList.update 3 "ee" + |> AltBinaryRandomAccessList.lookup 3) = "ee") + && ((len8 + |> AltBinaryRandomAccessList.update 4 "dd" + |> AltBinaryRandomAccessList.lookup 4) = "dd") + && ((len8 + |> AltBinaryRandomAccessList.update 5 "cc" + |> AltBinaryRandomAccessList.lookup 5) = "cc") + && ((len8 + |> AltBinaryRandomAccessList.update 6 "bb" + |> AltBinaryRandomAccessList.lookup 6) = "bb") + && ((len8 + |> AltBinaryRandomAccessList.update 7 "aa" + |> AltBinaryRandomAccessList.lookup 7) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 9" { + (((len9 + |> AltBinaryRandomAccessList.update 0 "ii" + |> AltBinaryRandomAccessList.lookup 0) = "ii") + && ((len9 + |> AltBinaryRandomAccessList.update 1 "hh" + |> AltBinaryRandomAccessList.lookup 1) = "hh") + && ((len9 + |> AltBinaryRandomAccessList.update 2 "gg" + |> AltBinaryRandomAccessList.lookup 2) = "gg") + && ((len9 + |> AltBinaryRandomAccessList.update 3 "ff" + |> AltBinaryRandomAccessList.lookup 3) = "ff") + && ((len9 + |> AltBinaryRandomAccessList.update 4 "ee" + |> AltBinaryRandomAccessList.lookup 4) = "ee") + && ((len9 + |> AltBinaryRandomAccessList.update 5 "dd" + |> AltBinaryRandomAccessList.lookup 5) = "dd") + && ((len9 + |> AltBinaryRandomAccessList.update 6 "cc" + |> AltBinaryRandomAccessList.lookup 6) = "cc") + && ((len9 + |> AltBinaryRandomAccessList.update 7 "bb" + |> AltBinaryRandomAccessList.lookup 7) = "bb") + && ((len9 + |> AltBinaryRandomAccessList.update 8 "aa" + |> AltBinaryRandomAccessList.lookup 8) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.update length 10" { + (((lena + |> AltBinaryRandomAccessList.update 0 "jj" + |> AltBinaryRandomAccessList.lookup 0) = "jj") + && ((lena + |> AltBinaryRandomAccessList.update 1 "ii" + |> AltBinaryRandomAccessList.lookup 1) = "ii") + && ((lena + |> AltBinaryRandomAccessList.update 2 "hh" + |> AltBinaryRandomAccessList.lookup 2) = "hh") + && ((lena + |> AltBinaryRandomAccessList.update 3 "gg" + |> AltBinaryRandomAccessList.lookup 3) = "gg") + && ((lena + |> AltBinaryRandomAccessList.update 4 "ff" + |> AltBinaryRandomAccessList.lookup 4) = "ff") + && ((lena + |> AltBinaryRandomAccessList.update 5 "ee" + |> AltBinaryRandomAccessList.lookup 5) = "ee") + && ((lena + |> AltBinaryRandomAccessList.update 6 "dd" + |> AltBinaryRandomAccessList.lookup 6) = "dd") + && ((lena + |> AltBinaryRandomAccessList.update 7 "cc" + |> AltBinaryRandomAccessList.lookup 7) = "cc") + && ((lena + |> AltBinaryRandomAccessList.update 8 "bb" + |> AltBinaryRandomAccessList.lookup 8) = "bb") + && ((lena + |> AltBinaryRandomAccessList.update 9 "aa" + |> AltBinaryRandomAccessList.lookup 9) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 1" { + let a = len1 |> AltBinaryRandomAccessList.tryUpdate 0 "aa" + + ((a.Value |> AltBinaryRandomAccessList.lookup 0) = "aa") + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 2" { + let b = len2 |> AltBinaryRandomAccessList.tryUpdate 0 "bb" + let a = len2 |> AltBinaryRandomAccessList.tryUpdate 1 "aa" + + (((b.Value |> AltBinaryRandomAccessList.lookup 0) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 1) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 3" { + let c = len3 |> AltBinaryRandomAccessList.tryUpdate 0 "cc" + let b = len3 |> AltBinaryRandomAccessList.tryUpdate 1 "bb" + let a = len3 |> AltBinaryRandomAccessList.tryUpdate 2 "aa" + + (((c.Value |> AltBinaryRandomAccessList.lookup 0) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 1) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 2) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 4" { + let d = len4 |> AltBinaryRandomAccessList.tryUpdate 0 "dd" + let c = len4 |> AltBinaryRandomAccessList.tryUpdate 1 "cc" + let b = len4 |> AltBinaryRandomAccessList.tryUpdate 2 "bb" + let a = len4 |> AltBinaryRandomAccessList.tryUpdate 3 "aa" + + (((d.Value |> AltBinaryRandomAccessList.lookup 0) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 1) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 2) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 3) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 5" { + let e = len5 |> AltBinaryRandomAccessList.tryUpdate 0 "ee" + let d = len5 |> AltBinaryRandomAccessList.tryUpdate 1 "dd" + let c = len5 |> AltBinaryRandomAccessList.tryUpdate 2 "cc" + let b = len5 |> AltBinaryRandomAccessList.tryUpdate 3 "bb" + let a = len5 |> AltBinaryRandomAccessList.tryUpdate 4 "aa" + + (((e.Value |> AltBinaryRandomAccessList.lookup 0) = "ee") + && ((d.Value |> AltBinaryRandomAccessList.lookup 1) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 2) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 3) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 4) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 6" { + let f = len6 |> AltBinaryRandomAccessList.tryUpdate 0 "ff" + let e = len6 |> AltBinaryRandomAccessList.tryUpdate 1 "ee" + let d = len6 |> AltBinaryRandomAccessList.tryUpdate 2 "dd" + let c = len6 |> AltBinaryRandomAccessList.tryUpdate 3 "cc" + let b = len6 |> AltBinaryRandomAccessList.tryUpdate 4 "bb" + let a = len6 |> AltBinaryRandomAccessList.tryUpdate 5 "aa" + + (((f.Value |> AltBinaryRandomAccessList.lookup 0) = "ff") + && ((e.Value |> AltBinaryRandomAccessList.lookup 1) = "ee") + && ((d.Value |> AltBinaryRandomAccessList.lookup 2) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 3) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 4) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 5) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 7" { + let g = len7 |> AltBinaryRandomAccessList.tryUpdate 0 "gg" + let f = len7 |> AltBinaryRandomAccessList.tryUpdate 1 "ff" + let e = len7 |> AltBinaryRandomAccessList.tryUpdate 2 "ee" + let d = len7 |> AltBinaryRandomAccessList.tryUpdate 3 "dd" + let c = len7 |> AltBinaryRandomAccessList.tryUpdate 4 "cc" + let b = len7 |> AltBinaryRandomAccessList.tryUpdate 5 "bb" + let a = len7 |> AltBinaryRandomAccessList.tryUpdate 6 "aa" + + (((g.Value |> AltBinaryRandomAccessList.lookup 0) = "gg") + && ((f.Value |> AltBinaryRandomAccessList.lookup 1) = "ff") + && ((e.Value |> AltBinaryRandomAccessList.lookup 2) = "ee") + && ((d.Value |> AltBinaryRandomAccessList.lookup 3) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 4) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 5) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 6) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 8" { + let h = len8 |> AltBinaryRandomAccessList.tryUpdate 0 "hh" + let g = len8 |> AltBinaryRandomAccessList.tryUpdate 1 "gg" + let f = len8 |> AltBinaryRandomAccessList.tryUpdate 2 "ff" + let e = len8 |> AltBinaryRandomAccessList.tryUpdate 3 "ee" + let d = len8 |> AltBinaryRandomAccessList.tryUpdate 4 "dd" + let c = len8 |> AltBinaryRandomAccessList.tryUpdate 5 "cc" + let b = len8 |> AltBinaryRandomAccessList.tryUpdate 6 "bb" + let a = len8 |> AltBinaryRandomAccessList.tryUpdate 7 "aa" + + (((h.Value |> AltBinaryRandomAccessList.lookup 0) = "hh") + && ((g.Value |> AltBinaryRandomAccessList.lookup 1) = "gg") + && ((f.Value |> AltBinaryRandomAccessList.lookup 2) = "ff") + && ((e.Value |> AltBinaryRandomAccessList.lookup 3) = "ee") + && ((d.Value |> AltBinaryRandomAccessList.lookup 4) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 5) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 6) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 7) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 9" { + let i = len9 |> AltBinaryRandomAccessList.tryUpdate 0 "ii" + let h = len9 |> AltBinaryRandomAccessList.tryUpdate 1 "hh" + let g = len9 |> AltBinaryRandomAccessList.tryUpdate 2 "gg" + let f = len9 |> AltBinaryRandomAccessList.tryUpdate 3 "ff" + let e = len9 |> AltBinaryRandomAccessList.tryUpdate 4 "ee" + let d = len9 |> AltBinaryRandomAccessList.tryUpdate 5 "dd" + let c = len9 |> AltBinaryRandomAccessList.tryUpdate 6 "cc" + let b = len9 |> AltBinaryRandomAccessList.tryUpdate 7 "bb" + let a = len9 |> AltBinaryRandomAccessList.tryUpdate 8 "aa" + + (((i.Value |> AltBinaryRandomAccessList.lookup 0) = "ii") + && ((h.Value |> AltBinaryRandomAccessList.lookup 1) = "hh") + && ((g.Value |> AltBinaryRandomAccessList.lookup 2) = "gg") + && ((f.Value |> AltBinaryRandomAccessList.lookup 3) = "ff") + && ((e.Value |> AltBinaryRandomAccessList.lookup 4) = "ee") + && ((d.Value |> AltBinaryRandomAccessList.lookup 5) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 6) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 7) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 8) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryUpdate length 10" { + let j = lena |> AltBinaryRandomAccessList.tryUpdate 0 "jj" + let i = lena |> AltBinaryRandomAccessList.tryUpdate 1 "ii" + let h = lena |> AltBinaryRandomAccessList.tryUpdate 2 "hh" + let g = lena |> AltBinaryRandomAccessList.tryUpdate 3 "gg" + let f = lena |> AltBinaryRandomAccessList.tryUpdate 4 "ff" + let e = lena |> AltBinaryRandomAccessList.tryUpdate 5 "ee" + let d = lena |> AltBinaryRandomAccessList.tryUpdate 6 "dd" + let c = lena |> AltBinaryRandomAccessList.tryUpdate 7 "cc" + let b = lena |> AltBinaryRandomAccessList.tryUpdate 8 "bb" + let a = lena |> AltBinaryRandomAccessList.tryUpdate 9 "aa" + + (((j.Value |> AltBinaryRandomAccessList.lookup 0) = "jj") + && ((i.Value |> AltBinaryRandomAccessList.lookup 1) = "ii") + && ((h.Value |> AltBinaryRandomAccessList.lookup 2) = "hh") + && ((g.Value |> AltBinaryRandomAccessList.lookup 3) = "gg") + && ((f.Value |> AltBinaryRandomAccessList.lookup 4) = "ff") + && ((e.Value |> AltBinaryRandomAccessList.lookup 5) = "ee") + && ((d.Value |> AltBinaryRandomAccessList.lookup 6) = "dd") + && ((c.Value |> AltBinaryRandomAccessList.lookup 7) = "cc") + && ((b.Value |> AltBinaryRandomAccessList.lookup 8) = "bb") + && ((a.Value |> AltBinaryRandomAccessList.lookup 9) = "aa")) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 1" { + AltBinaryRandomAccessList.isEmpty(len1 |> AltBinaryRandomAccessList.remove 0) + |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 2" { + let a = + match (len2 |> AltBinaryRandomAccessList.remove 0) with + | One(("a"), Nil) -> true + | _ -> false + + let b = + match (len2 |> AltBinaryRandomAccessList.remove 1) with + | One(("b"), Nil) -> true + | _ -> false + + (a && b) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 3" { + let a = + match (len3 |> AltBinaryRandomAccessList.remove 0) with + | Zero(One(("b", "a"), Nil)) -> true + | _ -> false + + let b = + match (len3 |> AltBinaryRandomAccessList.remove 1) with + | Zero(One(("c", "a"), Nil)) -> true + | _ -> false + + let c = + match (len3 |> AltBinaryRandomAccessList.remove 2) with + | Zero(One(("c", "b"), Nil)) -> true + | _ -> false + + (a && b && c) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 4" { + let a = + match (len4 |> AltBinaryRandomAccessList.remove 0) with + | One("c", One(("b", "a"), Nil)) -> true + | _ -> false + + let b = + match (len4 |> AltBinaryRandomAccessList.remove 1) with + | One("d", One(("b", "a"), Nil)) -> true + | _ -> false + + let c = + match (len4 |> AltBinaryRandomAccessList.remove 2) with + | One("d", One(("c", "a"), Nil)) -> true + | _ -> false + + let d = + match (len4 |> AltBinaryRandomAccessList.remove 3) with + | One("d", One(("c", "b"), Nil)) -> true + | _ -> false + + (a && b && c && d) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 5" { + let a = + match (len5 |> AltBinaryRandomAccessList.remove 0) with + | Zero(Zero(One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let b = + match (len5 |> AltBinaryRandomAccessList.remove 1) with + | Zero(Zero(One((("e", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let c = + match (len5 |> AltBinaryRandomAccessList.remove 2) with + | Zero(Zero(One((("e", "d"), ("b", "a")), Nil))) -> true + | _ -> false + + let d = + match (len5 |> AltBinaryRandomAccessList.remove 3) with + | Zero(Zero(One((("e", "d"), ("c", "a")), Nil))) -> true + | _ -> false + + let e = + match (len5 |> AltBinaryRandomAccessList.remove 4) with + | Zero(Zero(One((("e", "d"), ("c", "b")), Nil))) -> true + | _ -> false + + (a && b && c && d && e) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 6" { + let a = + match (len6 |> AltBinaryRandomAccessList.remove 0) with + | One("e", Zero(One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let b = + match (len6 |> AltBinaryRandomAccessList.remove 1) with + | One("f", Zero(One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let c = + match (len6 |> AltBinaryRandomAccessList.remove 2) with + | One("f", Zero(One((("e", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let d = + match (len6 |> AltBinaryRandomAccessList.remove 3) with + | One("f", Zero(One((("e", "d"), ("b", "a")), Nil))) -> true + | _ -> false + + let e = + match (len6 |> AltBinaryRandomAccessList.remove 4) with + | One("f", Zero(One((("e", "d"), ("c", "a")), Nil))) -> true + | _ -> false + + let f = + match (len6 |> AltBinaryRandomAccessList.remove 5) with + | One("f", Zero(One((("e", "d"), ("c", "b")), Nil))) -> true + | _ -> false + + (a && b && c && d && e && f) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 7" { + let a = + match (len7 |> AltBinaryRandomAccessList.remove 0) with + | Zero(One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let b = + match (len7 |> AltBinaryRandomAccessList.remove 1) with + | Zero(One(("g", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let c = + match (len7 |> AltBinaryRandomAccessList.remove 2) with + | Zero(One(("g", "f"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let d = + match (len7 |> AltBinaryRandomAccessList.remove 3) with + | Zero(One(("g", "f"), One((("e", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let e = + match (len7 |> AltBinaryRandomAccessList.remove 4) with + | Zero(One(("g", "f"), One((("e", "d"), ("b", "a")), Nil))) -> true + | _ -> false + + let f = + match (len7 |> AltBinaryRandomAccessList.remove 5) with + | Zero(One(("g", "f"), One((("e", "d"), ("c", "a")), Nil))) -> true + | _ -> false + + let g = + match (len7 |> AltBinaryRandomAccessList.remove 6) with + | Zero(One(("g", "f"), One((("e", "d"), ("c", "b")), Nil))) -> true + | _ -> false + + (a && b && c && d && e && f && g) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 8" { + let a = + match (len8 |> AltBinaryRandomAccessList.remove 0) with + | One("g", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let b = + match (len8 |> AltBinaryRandomAccessList.remove 1) with + | One("h", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let c = + match (len8 |> AltBinaryRandomAccessList.remove 2) with + | One("h", One(("g", "e"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let d = + match (len8 |> AltBinaryRandomAccessList.remove 3) with + | One("h", One(("g", "f"), One((("d", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let e = + match (len8 |> AltBinaryRandomAccessList.remove 4) with + | One("h", One(("g", "f"), One((("e", "c"), ("b", "a")), Nil))) -> true + | _ -> false + + let f = + match (len8 |> AltBinaryRandomAccessList.remove 5) with + | One("h", One(("g", "f"), One((("e", "d"), ("b", "a")), Nil))) -> true + | _ -> false + + let g = + match (len8 |> AltBinaryRandomAccessList.remove 6) with + | One("h", One(("g", "f"), One((("e", "d"), ("c", "a")), Nil))) -> true + | _ -> false + + let h = + match (len8 |> AltBinaryRandomAccessList.remove 7) with + | One("h", One(("g", "f"), One((("e", "d"), ("c", "b")), Nil))) -> true + | _ -> false + + (a && b && c && d && e && f && g && h) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 9" { + let a = + match (len9 |> AltBinaryRandomAccessList.remove 0) with + | Zero(Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let b = + match (len9 |> AltBinaryRandomAccessList.remove 1) with + | Zero(Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let c = + match (len9 |> AltBinaryRandomAccessList.remove 2) with + | Zero(Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let d = + match (len9 |> AltBinaryRandomAccessList.remove 3) with + | Zero(Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let e = + match (len9 |> AltBinaryRandomAccessList.remove 4) with + | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let f = + match (len9 |> AltBinaryRandomAccessList.remove 5) with + | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let g = + match (len9 |> AltBinaryRandomAccessList.remove 6) with + | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let h = + match (len9 |> AltBinaryRandomAccessList.remove 7) with + | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil)))) -> true + | _ -> false + + let i = + match (len9 |> AltBinaryRandomAccessList.remove 8) with + | Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil)))) -> true + | _ -> false + + (a && b && c && d && e && f && g && h && i) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.remove elements length 10" { + let a = + match (lena |> AltBinaryRandomAccessList.remove 0) with + | One("i", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let b = + match (lena |> AltBinaryRandomAccessList.remove 1) with + | One("j", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let c = + match (lena |> AltBinaryRandomAccessList.remove 2) with + | One("j", Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let d = + match (lena |> AltBinaryRandomAccessList.remove 3) with + | One("j", Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let e = + match (lena |> AltBinaryRandomAccessList.remove 4) with + | One("j", Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let f = + match (lena |> AltBinaryRandomAccessList.remove 5) with + | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let g = + match (lena |> AltBinaryRandomAccessList.remove 6) with + | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let h = + match (lena |> AltBinaryRandomAccessList.remove 7) with + | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil)))) -> true + | _ -> false + + let i = + match (lena |> AltBinaryRandomAccessList.remove 8) with + | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil)))) -> true + | _ -> false + + let j = + match (lena |> AltBinaryRandomAccessList.remove 9) with + | One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil)))) -> true + | _ -> false + + (a && b && c && d && e && f && g && h && i && j) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 1" { + let a = AltBinaryRandomAccessList.tryRemove 0 len1 + (AltBinaryRandomAccessList.isEmpty a.Value) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 2" { + let a = + match (len2 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(One(("a"), Nil)) -> true + | _ -> false + + let b = + match (len2 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(One(("b"), Nil)) -> true + | _ -> false + + (a && b) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 3" { + let a = + match (len3 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(Zero(One(("b", "a"), Nil))) -> true + | _ -> false + + let b = + match (len3 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(Zero(One(("c", "a"), Nil))) -> true + | _ -> false + + let c = + match (len3 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(Zero(One(("c", "b"), Nil))) -> true + | _ -> false + + (a && b && c) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 4" { + let a = + match (len4 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(One("c", One(("b", "a"), Nil))) -> true + | _ -> false + + let b = + match (len4 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(One("d", One(("b", "a"), Nil))) -> true + | _ -> false + + let c = + match (len4 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(One("d", One(("c", "a"), Nil))) -> true + | _ -> false + + let d = + match (len4 |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(One("d", One(("c", "b"), Nil))) -> true + | _ -> false + + (a && b && c && d) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 5" { + let a = + match (len5 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(Zero(Zero(One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let b = + match (len5 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(Zero(Zero(One((("e", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let c = + match (len5 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(Zero(Zero(One((("e", "d"), ("b", "a")), Nil)))) -> true + | _ -> false + + let d = + match (len5 |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(Zero(Zero(One((("e", "d"), ("c", "a")), Nil)))) -> true + | _ -> false + + let e = + match (len5 |> AltBinaryRandomAccessList.tryRemove 4) with + | Some(Zero(Zero(One((("e", "d"), ("c", "b")), Nil)))) -> true + | _ -> false + + (a && b && c && d && e) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 6" { + let a = + match (len6 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(One("e", Zero(One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let b = + match (len6 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(One("f", Zero(One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let c = + match (len6 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(One("f", Zero(One((("e", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let d = + match (len6 |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(One("f", Zero(One((("e", "d"), ("b", "a")), Nil)))) -> true + | _ -> false + + let e = + match (len6 |> AltBinaryRandomAccessList.tryRemove 4) with + | Some(One("f", Zero(One((("e", "d"), ("c", "a")), Nil)))) -> true + | _ -> false + + let f = + match (len6 |> AltBinaryRandomAccessList.tryRemove 5) with + | Some(One("f", Zero(One((("e", "d"), ("c", "b")), Nil)))) -> true + | _ -> false + + (a && b && c && d && e && f) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 7" { + let a = + match (len7 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(Zero(One(("f", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let b = + match (len7 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(Zero(One(("g", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let c = + match (len7 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(Zero(One(("g", "f"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let d = + match (len7 |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(Zero(One(("g", "f"), One((("e", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let e = + match (len7 |> AltBinaryRandomAccessList.tryRemove 4) with + | Some(Zero(One(("g", "f"), One((("e", "d"), ("b", "a")), Nil)))) -> true + | _ -> false + + let f = + match (len7 |> AltBinaryRandomAccessList.tryRemove 5) with + | Some(Zero(One(("g", "f"), One((("e", "d"), ("c", "a")), Nil)))) -> true + | _ -> false + + let g = + match (len7 |> AltBinaryRandomAccessList.tryRemove 6) with + | Some(Zero(One(("g", "f"), One((("e", "d"), ("c", "b")), Nil)))) -> true + | _ -> false + + (a && b && c && d && e && f && g) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 8" { + let a = + match (len8 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(One("g", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let b = + match (len8 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(One("h", One(("f", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let c = + match (len8 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(One("h", One(("g", "e"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let d = + match (len8 |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(One("h", One(("g", "f"), One((("d", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let e = + match (len8 |> AltBinaryRandomAccessList.tryRemove 4) with + | Some(One("h", One(("g", "f"), One((("e", "c"), ("b", "a")), Nil)))) -> true + | _ -> false + + let f = + match (len8 |> AltBinaryRandomAccessList.tryRemove 5) with + | Some(One("h", One(("g", "f"), One((("e", "d"), ("b", "a")), Nil)))) -> true + | _ -> false + + let g = + match (len8 |> AltBinaryRandomAccessList.tryRemove 6) with + | Some(One("h", One(("g", "f"), One((("e", "d"), ("c", "a")), Nil)))) -> true + | _ -> false + + let h = + match (len8 |> AltBinaryRandomAccessList.tryRemove 7) with + | Some(One("h", One(("g", "f"), One((("e", "d"), ("c", "b")), Nil)))) -> true + | _ -> false + + (a && b && c && d && e && f && g && h) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 9" { + let a = + match (len9 |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(Zero(Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let b = + match (len9 |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(Zero(Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let c = + match (len9 |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let d = + match (len9 |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let e = + match (len9 |> AltBinaryRandomAccessList.tryRemove 4) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let f = + match (len9 |> AltBinaryRandomAccessList.tryRemove 5) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let g = + match (len9 |> AltBinaryRandomAccessList.tryRemove 6) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let h = + match (len9 |> AltBinaryRandomAccessList.tryRemove 7) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil))))) -> true + | _ -> false + + let i = + match (len9 |> AltBinaryRandomAccessList.tryRemove 8) with + | Some(Zero(Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil))))) -> true + | _ -> false + + (a && b && c && d && e && f && g && h && i) |> Expect.isTrue "" + } + + test "AltBinaryRandomAccessList.tryRemove elements length 10" { + let a = + match (lena |> AltBinaryRandomAccessList.tryRemove 0) with + | Some(One("i", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let b = + match (lena |> AltBinaryRandomAccessList.tryRemove 1) with + | Some(One("j", Zero(Zero(One(((("h", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let c = + match (lena |> AltBinaryRandomAccessList.tryRemove 2) with + | Some(One("j", Zero(Zero(One(((("i", "g"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let d = + match (lena |> AltBinaryRandomAccessList.tryRemove 3) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("f", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let e = + match (lena |> AltBinaryRandomAccessList.tryRemove 4) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "e")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let f = + match (lena |> AltBinaryRandomAccessList.tryRemove 5) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("d", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let g = + match (lena |> AltBinaryRandomAccessList.tryRemove 6) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "c"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let h = + match (lena |> AltBinaryRandomAccessList.tryRemove 7) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("b", "a"))), Nil))))) -> true + | _ -> false + + let i = + match (lena |> AltBinaryRandomAccessList.tryRemove 8) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "a"))), Nil))))) -> true + | _ -> false + + let j = + match (lena |> AltBinaryRandomAccessList.tryRemove 9) with + | Some(One("j", Zero(Zero(One(((("i", "h"), ("g", "f")), (("e", "d"), ("c", "b"))), Nil))))) -> true + | _ -> false + + (a && b && c && d && e && f && g && h && i && j) |> Expect.isTrue "" + } + + test "length of AltBinaryRandomAccessList.empty is 0" { + ((AltBinaryRandomAccessList.length AltBinaryRandomAccessList.empty) = 0) + |> Expect.isTrue "" + } + + test "length of 1 - 10 good" { + (((AltBinaryRandomAccessList.length len1) = 1) + && ((AltBinaryRandomAccessList.length len2) = 2) + && ((AltBinaryRandomAccessList.length len3) = 3) + && ((AltBinaryRandomAccessList.length len4) = 4) + && ((AltBinaryRandomAccessList.length len5) = 5) + && ((AltBinaryRandomAccessList.length len6) = 6) + && ((AltBinaryRandomAccessList.length len7) = 7) + && ((AltBinaryRandomAccessList.length len8) = 8) + && ((AltBinaryRandomAccessList.length len9) = 9) + && ((AltBinaryRandomAccessList.length lena) = 10)) + |> Expect.isTrue "" + } + + test "ofSeq" { + let x = + AltBinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] + + (((x |> AltBinaryRandomAccessList.lookup 0) = "a") + && ((x |> AltBinaryRandomAccessList.lookup 1) = "b") + && ((x |> AltBinaryRandomAccessList.lookup 2) = "c") + && ((x |> AltBinaryRandomAccessList.lookup 3) = "d") + && ((x |> AltBinaryRandomAccessList.lookup 4) = "e") + && ((x |> AltBinaryRandomAccessList.lookup 5) = "f") + && ((x |> AltBinaryRandomAccessList.lookup 6) = "g") + && ((x |> AltBinaryRandomAccessList.lookup 7) = "h") + && ((x |> AltBinaryRandomAccessList.lookup 8) = "i") + && ((x |> AltBinaryRandomAccessList.lookup 9) = "j")) + |> Expect.isTrue "" + } + + test "IRandomAccessList AltBinaryRandomAccessList.cons works" { + ((lena :> IRandomAccessList).Cons "zz").Head + |> Expect.equal "" "zz" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BKTreeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BKTreeTest.fs index c6440f9d..ba5b6d0e 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BKTreeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BKTreeTest.fs @@ -31,126 +31,127 @@ module BKTreeTest = [] let testBKTree = - testList "Experimental BKTree" [ - testPropertyWithConfig config10k "native empty" - <| fun (xs: int list) -> - BKTree.List.distance [] xs = List.length xs - && BKTree.List.distance xs [] = List.length xs + testList + "Experimental BKTree" + [ testPropertyWithConfig config10k "native empty" + <| fun (xs: int list) -> + BKTree.List.distance [] xs = List.length xs + && BKTree.List.distance xs [] = List.length xs - testPropertyWithConfig config10k "native cons" - <| fun (x: int) xs ys -> BKTree.List.distance (x :: xs) (x :: ys) = BKTree.List.distance xs ys + testPropertyWithConfig config10k "native cons" + <| fun (x: int) xs ys -> BKTree.List.distance (x :: xs) (x :: ys) = BKTree.List.distance xs ys - testPropertyWithConfig config10k "native diff" - <| fun (x: int) y xs ys -> - x <> y - ==> (BKTree.List.distance (x :: xs) (y :: ys) = 1 - + List.min [ - BKTree.List.distance (x :: xs) ys - BKTree.List.distance (x :: xs) (x :: ys) - BKTree.List.distance xs (y :: ys) - ]) + testPropertyWithConfig config10k "native diff" + <| fun (x: int) y xs ys -> + x <> y + ==> (BKTree.List.distance (x :: xs) (y :: ys) = 1 + + List.min + [ BKTree.List.distance (x :: xs) ys + BKTree.List.distance (x :: xs) (x :: ys) + BKTree.List.distance xs (y :: ys) ]) - testPropertyWithConfig config10k "empty" - <| fun n -> not <| BKTree.Int.exists n BKTree.empty + testPropertyWithConfig config10k "empty" + <| fun n -> not <| BKTree.Int.exists n BKTree.empty - testPropertyWithConfig config10k "isEmpty" - <| fun xs -> BKTree.isEmpty(BKTree.Int.ofList xs) = List.isEmpty xs + testPropertyWithConfig config10k "isEmpty" + <| fun xs -> BKTree.isEmpty(BKTree.Int.ofList xs) = List.isEmpty xs - testPropertyWithConfig config10k "singleton" - <| fun n -> BKTree.toList(BKTree.Int.ofList [ n ]) = [ n ] + testPropertyWithConfig config10k "singleton" + <| fun n -> BKTree.toList(BKTree.Int.ofList [ n ]) = [ n ] - testPropertyWithConfig config10k "ofList" - <| fun xs -> sem(BKTree.Int.ofList xs) = List.sort xs + testPropertyWithConfig config10k "ofList" + <| fun xs -> sem(BKTree.Int.ofList xs) = List.sort xs - testPropertyWithConfig config10k "ofList inv" - <| fun xs -> invariant(BKTree.Int.ofList xs) + testPropertyWithConfig config10k "ofList inv" + <| fun xs -> invariant(BKTree.Int.ofList xs) - testPropertyWithConfig config10k "add" - <| fun n xs -> trans (BKTree.Int.add n) xs = List.sort(n :: xs) + testPropertyWithConfig config10k "add" + <| fun n xs -> trans (BKTree.Int.add n) xs = List.sort(n :: xs) - testPropertyWithConfig config10k "add inv" - <| fun n xs -> invariant(BKTree.Int.add n (BKTree.Int.ofList xs)) + testPropertyWithConfig config10k "add inv" + <| fun n xs -> invariant(BKTree.Int.add n (BKTree.Int.ofList xs)) - testPropertyWithConfig config10k "exists" - <| fun n xs -> BKTree.Int.exists n (BKTree.Int.ofList xs) = List.exists ((=) n) xs + testPropertyWithConfig config10k "exists" + <| fun n xs -> BKTree.Int.exists n (BKTree.Int.ofList xs) = List.exists ((=) n) xs - testPropertyWithConfig config10k "existsDistance" - <| fun dist n xs -> - let d = dist % 5 - let reference = List.exists (fun e -> BKTree.Int.distance n e <= d) xs + testPropertyWithConfig config10k "existsDistance" + <| fun dist n xs -> + let d = dist % 5 + let reference = List.exists (fun e -> BKTree.Int.distance n e <= d) xs - Prop.collect reference (BKTree.Int.existsDistance d n (BKTree.Int.ofList xs) = List.exists (fun e -> BKTree.Int.distance n e <= d) xs) + Prop.collect + reference + (BKTree.Int.existsDistance d n (BKTree.Int.ofList xs) = List.exists (fun e -> BKTree.Int.distance n e <= d) xs) - testPropertyWithConfig config10k "delete" - <| fun n xs -> trans (BKTree.Int.delete n) xs = List.sort(removeFirst n xs) + testPropertyWithConfig config10k "delete" + <| fun n xs -> trans (BKTree.Int.delete n) xs = List.sort(removeFirst n xs) - testPropertyWithConfig config10k "delete inv" - <| fun n xs -> invariant(BKTree.Int.delete n (BKTree.Int.ofList xs)) + testPropertyWithConfig config10k "delete inv" + <| fun n xs -> invariant(BKTree.Int.delete n (BKTree.Int.ofList xs)) - testPropertyWithConfig config10k "toList" - <| fun xs -> List.sort(BKTree.toList(BKTree.Int.ofList xs)) = List.sort xs + testPropertyWithConfig config10k "toList" + <| fun xs -> List.sort(BKTree.toList(BKTree.Int.ofList xs)) = List.sort xs - testPropertyWithConfig config10k "toListDistance" - <| fun dist n xs -> - let d = dist % 5 + testPropertyWithConfig config10k "toListDistance" + <| fun dist n xs -> + let d = dist % 5 - List.sort(BKTree.Int.toListDistance d n (BKTree.Int.ofList xs)) = List.sort(List.filter (fun e -> BKTree.Int.distance n e <= d) xs) + List.sort(BKTree.Int.toListDistance d n (BKTree.Int.ofList xs)) = List.sort(List.filter (fun e -> BKTree.Int.distance n e <= d) xs) - testPropertyWithConfig config10k "concat" - <| fun xss -> sem(BKTree.Int.concat(List.map BKTree.Int.ofList xss)) = List.sort(List.concat xss) + testPropertyWithConfig config10k "concat" + <| fun xss -> sem(BKTree.Int.concat(List.map BKTree.Int.ofList xss)) = List.sort(List.concat xss) - testPropertyWithConfig config10k "concat inv" - <| fun xss -> invariant(BKTree.Int.concat(List.map BKTree.Int.ofList xss)) + testPropertyWithConfig config10k "concat inv" + <| fun xss -> invariant(BKTree.Int.concat(List.map BKTree.Int.ofList xss)) - testPropertyWithConfig config10k "append" - <| fun xs ys -> sem(BKTree.Int.append (BKTree.Int.ofList xs) (BKTree.Int.ofList ys)) = List.sort(List.append xs ys) + testPropertyWithConfig config10k "append" + <| fun xs ys -> sem(BKTree.Int.append (BKTree.Int.ofList xs) (BKTree.Int.ofList ys)) = List.sort(List.append xs ys) - testPropertyWithConfig config10k "append inv" - <| fun xs ys -> invariant(BKTree.Int.append (BKTree.Int.ofList xs) (BKTree.Int.ofList ys)) + testPropertyWithConfig config10k "append inv" + <| fun xs ys -> invariant(BKTree.Int.append (BKTree.Int.ofList xs) (BKTree.Int.ofList ys)) - testPropertyWithConfig config10k "delete . add = id" - <| fun n xs -> trans ((BKTree.Int.delete n) << (BKTree.Int.add n)) xs = List.sort xs + testPropertyWithConfig config10k "delete . add = id" + <| fun n xs -> trans ((BKTree.Int.delete n) << (BKTree.Int.add n)) xs = List.sort xs - testPropertyWithConfig config10k "The size of an empty BKTree is 0" - <| fun _ -> BKTree.size BKTree.empty = 0 + testPropertyWithConfig config10k "The size of an empty BKTree is 0" + <| fun _ -> BKTree.size BKTree.empty = 0 - testPropertyWithConfig config10k "ofList and size" - <| fun xs -> BKTree.size(BKTree.Int.ofList xs) = List.length xs + testPropertyWithConfig config10k "ofList and size" + <| fun xs -> BKTree.size(BKTree.Int.ofList xs) = List.length xs - testPropertyWithConfig config10k "add . size = size + 1" - <| fun n xs -> - let tree = BKTree.Int.ofList xs - BKTree.size(BKTree.Int.add n tree) = BKTree.size tree + 1 + testPropertyWithConfig config10k "add . size = size + 1" + <| fun n xs -> + let tree = BKTree.Int.ofList xs + BKTree.size(BKTree.Int.add n tree) = BKTree.size tree + 1 - testPropertyWithConfig config10k "delete . size = size - 1" - <| fun n xs -> - let tree = BKTree.Int.ofList xs - BKTree.size(BKTree.Int.delete n tree) = BKTree.size tree - if BKTree.Int.exists n tree then 1 else 0 + testPropertyWithConfig config10k "delete . size = size - 1" + <| fun n xs -> + let tree = BKTree.Int.ofList xs + BKTree.size(BKTree.Int.delete n tree) = BKTree.size tree - if BKTree.Int.exists n tree then 1 else 0 - testPropertyWithConfig config10k "append and size" - <| fun xs ys -> - let treeXs = BKTree.Int.ofList xs - let treeYs = BKTree.Int.ofList ys - BKTree.size(BKTree.Int.append treeXs treeYs) = BKTree.size treeXs + BKTree.size treeYs + testPropertyWithConfig config10k "append and size" + <| fun xs ys -> + let treeXs = BKTree.Int.ofList xs + let treeYs = BKTree.Int.ofList ys + BKTree.size(BKTree.Int.append treeXs treeYs) = BKTree.size treeXs + BKTree.size treeYs - testPropertyWithConfig config10k "concat and size" - <| fun xss -> - let trees = List.map BKTree.Int.ofList xss - BKTree.size(BKTree.Int.concat trees) = List.sum(List.map BKTree.size trees) + testPropertyWithConfig config10k "concat and size" + <| fun xss -> + let trees = List.map BKTree.Int.ofList xss + BKTree.size(BKTree.Int.concat trees) = List.sum(List.map BKTree.size trees) - testPropertyWithConfig config10k "concat and exists" - <| fun xss -> - let tree = BKTree.Int.concat(List.map BKTree.Int.ofList xss) - List.forall (fun x -> BKTree.Int.exists x tree) (List.concat xss) + testPropertyWithConfig config10k "concat and exists" + <| fun xss -> + let tree = BKTree.Int.concat(List.map BKTree.Int.ofList xss) + List.forall (fun x -> BKTree.Int.exists x tree) (List.concat xss) - testPropertyWithConfig config10k "ofList and exists" - <| fun xs -> - let tree = BKTree.Int.ofList xs - List.forall (fun x -> BKTree.Int.exists x tree) xs + testPropertyWithConfig config10k "ofList and exists" + <| fun xs -> + let tree = BKTree.Int.ofList xs + List.forall (fun x -> BKTree.Int.exists x tree) xs - testPropertyWithConfig config10k "implements IEnumerable" - <| fun values -> - let tree = BKTree.Int.ofList values - let a = tree :> _ seq |> Seq.toList - set values = set a && a.Length = values.Length - ] + testPropertyWithConfig config10k "implements IEnumerable" + <| fun values -> + let tree = BKTree.Int.ofList values + let a = tree :> _ seq |> Seq.toList + set values = set a && a.Length = values.Length ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BankersDequeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BankersDequeTest.fs index fc03d3a7..52aff26f 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BankersDequeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BankersDequeTest.fs @@ -317,3679 +317,3679 @@ module BankersDequeTest = [] let testBankersDeque = - testList "Experimental BankersDeque" [ - test "BankersDeque.empty dqueue should be BankersDeque.empty" { - - BankersDeque.isEmpty(BankersDeque.empty 2) |> Expect.isTrue "" - } - - test "BankersDeque.cons works" { - ((len2 |> BankersDeque.isEmpty) && (len2C3 |> BankersDeque.isEmpty)) - |> Expect.isFalse "" - } - - test "BankersDeque.snoc works" { - ((len2snoc |> BankersDeque.isEmpty) - && (len2C3snoc |> BankersDeque.isEmpty)) - |> Expect.isFalse "" - } - - test "BankersDeque.singleton BankersDeque.head works" { - (((BankersDeque.head len1) = "a") - && ((len1C3 |> BankersDeque.isEmpty)) = false) - |> Expect.isTrue "" - } - - test "BankersDeque.singleton BankersDeque.last works" { len1 |> BankersDeque.last |> Expect.equal "" "a" } - - test "BankersDeque.tail of BankersDeque.singleton BankersDeque.empty" { - len1 |> BankersDeque.tail |> BankersDeque.isEmpty |> Expect.isTrue "" - } - - test "BankersDeque.tail of BankersDeque.tail of 2 BankersDeque.empty" { - (len2 |> BankersDeque.tail |> BankersDeque.tail |> BankersDeque.isEmpty) - |> Expect.isTrue "" - } - - test "BankersDeque.init of BankersDeque.singleton BankersDeque.empty" { - ((BankersDeque.init len1) |> BankersDeque.isEmpty) |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 1" { - let t1 = BankersDeque.tail len2 - let t1C = BankersDeque.tail len2C3 - let t1s = BankersDeque.tail len2snoc - let t1Cs = BankersDeque.tail len2C3snoc - - (((BankersDeque.length t1) = 1) - && ((BankersDeque.length t1C) = 1) - && ((BankersDeque.length t1s) = 1) - && ((BankersDeque.length t1Cs) = 1) - && ((BankersDeque.head t1) = "a") - && ((BankersDeque.head t1C) = "a") - && ((BankersDeque.head t1s) = "a") - && ((BankersDeque.head t1Cs) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 2" { - let t1 = BankersDeque.tail len3 - let t1C = BankersDeque.tail len3C3 - let t1s = BankersDeque.tail len3snoc - let t1Cs = BankersDeque.tail len3C3snoc - - let t1_1 = BankersDeque.tail t1 - let t1C_1 = BankersDeque.tail t1C - let t1_1s = BankersDeque.tail t1s - let t1C_1s = BankersDeque.tail t1Cs - - (((BankersDeque.length t1) = 2) - && ((BankersDeque.length t1C) = 2) - && ((BankersDeque.length t1s) = 2) - && ((BankersDeque.length t1Cs) = 2) - && ((BankersDeque.head t1) = "b") - && ((BankersDeque.head t1C) = "b") - && ((BankersDeque.head t1s) = "b") - && ((BankersDeque.head t1Cs) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 3" { - let t1 = BankersDeque.tail len4 - let t1C = BankersDeque.tail len4C3 - let t1s = BankersDeque.tail len4snoc - let t1Cs = BankersDeque.tail len4C3snoc - - let t1_2 = BankersDeque.tail t1 - let t1C_2 = BankersDeque.tail t1C - let t1_2s = BankersDeque.tail t1s - let t1C_2s = BankersDeque.tail t1Cs - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 3) - && ((BankersDeque.length t1C) = 3) - && ((BankersDeque.length t1s) = 3) - && ((BankersDeque.length t1Cs) = 3) - && ((BankersDeque.head t1) = "c") - && ((BankersDeque.head t1C) = "c") - && ((BankersDeque.head t1s) = "c") - && ((BankersDeque.head t1Cs) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 4" { - let t1 = BankersDeque.tail len5 - let t1C = BankersDeque.tail len5C3 - let t1s = BankersDeque.tail len5snoc - let t1Cs = BankersDeque.tail len5C3snoc - - let t1_3 = BankersDeque.tail t1 - let t1C_3 = BankersDeque.tail t1C - let t1_3s = BankersDeque.tail t1s - let t1C_3s = BankersDeque.tail t1Cs - - let t1_2 = BankersDeque.tail t1_3 - let t1C_2 = BankersDeque.tail t1C_3 - let t1_2s = BankersDeque.tail t1_3s - let t1C_2s = BankersDeque.tail t1C_3s - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 4) - && ((BankersDeque.length t1C) = 4) - && ((BankersDeque.length t1s) = 4) - && ((BankersDeque.length t1Cs) = 4) - && ((BankersDeque.head t1) = "d") - && ((BankersDeque.head t1C) = "d") - && ((BankersDeque.head t1s) = "d") - && ((BankersDeque.head t1Cs) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.length t1_3s) = 3) - && ((BankersDeque.length t1C_3s) = 3) - && ((BankersDeque.head t1_3) = "c") - && ((BankersDeque.head t1C_3) = "c") - && ((BankersDeque.head t1_3s) = "c") - && ((BankersDeque.head t1C_3s) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 5" { - let t1 = BankersDeque.tail len6 - let t1C = BankersDeque.tail len6C3 - let t1s = BankersDeque.tail len6snoc - let t1Cs = BankersDeque.tail len6C3snoc - - let t1_4 = BankersDeque.tail t1 - let t1C_4 = BankersDeque.tail t1C - let t1_4s = BankersDeque.tail t1s - let t1C_4s = BankersDeque.tail t1Cs - - let t1_3 = BankersDeque.tail t1_4 - let t1C_3 = BankersDeque.tail t1C_4 - let t1_3s = BankersDeque.tail t1_4s - let t1C_3s = BankersDeque.tail t1C_4s - - let t1_2 = BankersDeque.tail t1_3 - let t1C_2 = BankersDeque.tail t1C_3 - let t1_2s = BankersDeque.tail t1_3s - let t1C_2s = BankersDeque.tail t1C_3s - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 5) - && ((BankersDeque.length t1C) = 5) - && ((BankersDeque.length t1s) = 5) - && ((BankersDeque.length t1Cs) = 5) - && ((BankersDeque.head t1) = "e") - && ((BankersDeque.head t1C) = "e") - && ((BankersDeque.head t1s) = "e") - && ((BankersDeque.head t1Cs) = "e") - && ((BankersDeque.length t1_4) = 4) - && ((BankersDeque.length t1C_4) = 4) - && ((BankersDeque.length t1_4s) = 4) - && ((BankersDeque.length t1C_4s) = 4) - && ((BankersDeque.head t1_4) = "d") - && ((BankersDeque.head t1C_4) = "d") - && ((BankersDeque.head t1_4s) = "d") - && ((BankersDeque.head t1C_4s) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.length t1_3s) = 3) - && ((BankersDeque.length t1C_3s) = 3) - && ((BankersDeque.head t1_3) = "c") - && ((BankersDeque.head t1C_3) = "c") - && ((BankersDeque.head t1_3s) = "c") - && ((BankersDeque.head t1C_3s) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 6" { - let t1 = BankersDeque.tail len7 - let t1C = BankersDeque.tail len7C3 - let t1s = BankersDeque.tail len7snoc - let t1Cs = BankersDeque.tail len7C3snoc - - let t1_5 = BankersDeque.tail t1 - let t1C_5 = BankersDeque.tail t1C - let t1_5s = BankersDeque.tail t1s - let t1C_5s = BankersDeque.tail t1Cs - - let t1_4 = BankersDeque.tail t1_5 - let t1C_4 = BankersDeque.tail t1C_5 - let t1_4s = BankersDeque.tail t1_5s - let t1C_4s = BankersDeque.tail t1C_5s - - let t1_3 = BankersDeque.tail t1_4 - let t1C_3 = BankersDeque.tail t1C_4 - let t1_3s = BankersDeque.tail t1_4s - let t1C_3s = BankersDeque.tail t1C_4s - - let t1_2 = BankersDeque.tail t1_3 - let t1C_2 = BankersDeque.tail t1C_3 - let t1_2s = BankersDeque.tail t1_3s - let t1C_2s = BankersDeque.tail t1C_3s - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 6) - && ((BankersDeque.length t1C) = 6) - && ((BankersDeque.length t1s) = 6) - && ((BankersDeque.length t1Cs) = 6) - && ((BankersDeque.head t1) = "f") - && ((BankersDeque.head t1C) = "f") - && ((BankersDeque.head t1s) = "f") - && ((BankersDeque.head t1Cs) = "f") - && ((BankersDeque.length t1_5) = 5) - && ((BankersDeque.length t1C_5) = 5) - && ((BankersDeque.length t1_5s) = 5) - && ((BankersDeque.length t1C_5s) = 5) - && ((BankersDeque.head t1_5) = "e") - && ((BankersDeque.head t1C_5) = "e") - && ((BankersDeque.head t1_5s) = "e") - && ((BankersDeque.head t1C_5s) = "e") - && ((BankersDeque.length t1_4) = 4) - && ((BankersDeque.length t1C_4) = 4) - && ((BankersDeque.length t1_4s) = 4) - && ((BankersDeque.length t1C_4s) = 4) - && ((BankersDeque.head t1_4) = "d") - && ((BankersDeque.head t1C_4) = "d") - && ((BankersDeque.head t1_4s) = "d") - && ((BankersDeque.head t1C_4s) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.length t1_3s) = 3) - && ((BankersDeque.length t1C_3s) = 3) - && ((BankersDeque.head t1_3) = "c") - && ((BankersDeque.head t1C_3) = "c") - && ((BankersDeque.head t1_3s) = "c") - && ((BankersDeque.head t1C_3s) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 7" { - let t1 = BankersDeque.tail len8 - let t1C = BankersDeque.tail len8C3 - let t1s = BankersDeque.tail len8snoc - let t1Cs = BankersDeque.tail len8C3snoc - - let t1_6 = BankersDeque.tail t1 - let t1C_6 = BankersDeque.tail t1C - let t1_6s = BankersDeque.tail t1s - let t1C_6s = BankersDeque.tail t1Cs - - let t1_5 = BankersDeque.tail t1_6 - let t1C_5 = BankersDeque.tail t1C_6 - let t1_5s = BankersDeque.tail t1_6s - let t1C_5s = BankersDeque.tail t1C_6s - - let t1_4 = BankersDeque.tail t1_5 - let t1C_4 = BankersDeque.tail t1C_5 - let t1_4s = BankersDeque.tail t1_5s - let t1C_4s = BankersDeque.tail t1C_5s - - let t1_3 = BankersDeque.tail t1_4 - let t1C_3 = BankersDeque.tail t1C_4 - let t1_3s = BankersDeque.tail t1_4s - let t1C_3s = BankersDeque.tail t1C_4s - - let t1_2 = BankersDeque.tail t1_3 - let t1C_2 = BankersDeque.tail t1C_3 - let t1_2s = BankersDeque.tail t1_3s - let t1C_2s = BankersDeque.tail t1C_3s - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 7) - && ((BankersDeque.length t1C) = 7) - && ((BankersDeque.length t1s) = 7) - && ((BankersDeque.length t1Cs) = 7) - && ((BankersDeque.head t1) = "g") - && ((BankersDeque.head t1C) = "g") - && ((BankersDeque.head t1s) = "g") - && ((BankersDeque.head t1Cs) = "g") - && ((BankersDeque.length t1_6) = 6) - && ((BankersDeque.length t1C_6) = 6) - && ((BankersDeque.length t1_6s) = 6) - && ((BankersDeque.length t1C_6s) = 6) - && ((BankersDeque.head t1_6) = "f") - && ((BankersDeque.head t1C_6) = "f") - && ((BankersDeque.head t1_6s) = "f") - && ((BankersDeque.head t1C_6s) = "f") - && ((BankersDeque.length t1_5) = 5) - && ((BankersDeque.length t1C_5) = 5) - && ((BankersDeque.length t1_5s) = 5) - && ((BankersDeque.length t1C_5s) = 5) - && ((BankersDeque.head t1_5) = "e") - && ((BankersDeque.head t1C_5) = "e") - && ((BankersDeque.head t1_5s) = "e") - && ((BankersDeque.head t1C_5s) = "e") - && ((BankersDeque.length t1_4) = 4) - && ((BankersDeque.length t1C_4) = 4) - && ((BankersDeque.length t1_4s) = 4) - && ((BankersDeque.length t1C_4s) = 4) - && ((BankersDeque.head t1_4) = "d") - && ((BankersDeque.head t1C_4) = "d") - && ((BankersDeque.head t1_4s) = "d") - && ((BankersDeque.head t1C_4s) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.length t1_3s) = 3) - && ((BankersDeque.length t1C_3s) = 3) - && ((BankersDeque.head t1_3) = "c") - && ((BankersDeque.head t1C_3) = "c") - && ((BankersDeque.head t1_3s) = "c") - && ((BankersDeque.head t1C_3s) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 8" { - let t1 = BankersDeque.tail len9 - let t1C = BankersDeque.tail len9C3 - let t1s = BankersDeque.tail len9snoc - let t1Cs = BankersDeque.tail len9C3snoc - - let t1_7 = BankersDeque.tail t1 - let t1C_7 = BankersDeque.tail t1C - let t1_7s = BankersDeque.tail t1s - let t1C_7s = BankersDeque.tail t1Cs - - let t1_6 = BankersDeque.tail t1_7 - let t1C_6 = BankersDeque.tail t1C_7 - let t1_6s = BankersDeque.tail t1_7s - let t1C_6s = BankersDeque.tail t1C_7s - - let t1_5 = BankersDeque.tail t1_6 - let t1C_5 = BankersDeque.tail t1C_6 - let t1_5s = BankersDeque.tail t1_6s - let t1C_5s = BankersDeque.tail t1C_6s - - let t1_4 = BankersDeque.tail t1_5 - let t1C_4 = BankersDeque.tail t1C_5 - let t1_4s = BankersDeque.tail t1_5s - let t1C_4s = BankersDeque.tail t1C_5s - - let t1_3 = BankersDeque.tail t1_4 - let t1C_3 = BankersDeque.tail t1C_4 - let t1_3s = BankersDeque.tail t1_4s - let t1C_3s = BankersDeque.tail t1C_4s - - let t1_2 = BankersDeque.tail t1_3 - let t1C_2 = BankersDeque.tail t1C_3 - let t1_2s = BankersDeque.tail t1_3s - let t1C_2s = BankersDeque.tail t1C_3s - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 8) - && ((BankersDeque.length t1C) = 8) - && ((BankersDeque.length t1s) = 8) - && ((BankersDeque.length t1Cs) = 8) - && ((BankersDeque.head t1) = "h") - && ((BankersDeque.head t1C) = "h") - && ((BankersDeque.head t1s) = "h") - && ((BankersDeque.head t1Cs) = "h") - && ((BankersDeque.length t1_7) = 7) - && ((BankersDeque.length t1C_7) = 7) - && ((BankersDeque.length t1_7s) = 7) - && ((BankersDeque.length t1C_7s) = 7) - && ((BankersDeque.head t1_7) = "g") - && ((BankersDeque.head t1C_7) = "g") - && ((BankersDeque.head t1_7s) = "g") - && ((BankersDeque.head t1C_7s) = "g") - && ((BankersDeque.length t1_6) = 6) - && ((BankersDeque.length t1C_6) = 6) - && ((BankersDeque.length t1_6s) = 6) - && ((BankersDeque.length t1C_6s) = 6) - && ((BankersDeque.head t1_6) = "f") - && ((BankersDeque.head t1C_6) = "f") - && ((BankersDeque.head t1_6s) = "f") - && ((BankersDeque.head t1C_6s) = "f") - && ((BankersDeque.length t1_5) = 5) - && ((BankersDeque.length t1C_5) = 5) - && ((BankersDeque.length t1_5s) = 5) - && ((BankersDeque.length t1C_5s) = 5) - && ((BankersDeque.head t1_5) = "e") - && ((BankersDeque.head t1C_5) = "e") - && ((BankersDeque.head t1_5s) = "e") - && ((BankersDeque.head t1C_5s) = "e") - && ((BankersDeque.length t1_4) = 4) - && ((BankersDeque.length t1C_4) = 4) - && ((BankersDeque.length t1_4s) = 4) - && ((BankersDeque.length t1C_4s) = 4) - && ((BankersDeque.head t1_4) = "d") - && ((BankersDeque.head t1C_4) = "d") - && ((BankersDeque.head t1_4s) = "d") - && ((BankersDeque.head t1C_4s) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.length t1_3s) = 3) - && ((BankersDeque.length t1C_3s) = 3) - && ((BankersDeque.head t1_3) = "c") - && ((BankersDeque.head t1C_3) = "c") - && ((BankersDeque.head t1_3s) = "c") - && ((BankersDeque.head t1C_3s) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 9" { - let t1 = BankersDeque.tail lena - let t1C = BankersDeque.tail lenaC3 - let t1s = BankersDeque.tail lenasnoc - let t1Cs = BankersDeque.tail lenaC3snoc - - let t1_8 = BankersDeque.tail t1 - let t1C_8 = BankersDeque.tail t1C - let t1_8s = BankersDeque.tail t1s - let t1C_8s = BankersDeque.tail t1Cs - - let t1_7 = BankersDeque.tail t1_8 - let t1C_7 = BankersDeque.tail t1C_8 - let t1_7s = BankersDeque.tail t1_8s - let t1C_7s = BankersDeque.tail t1C_8s - - let t1_6 = BankersDeque.tail t1_7 - let t1C_6 = BankersDeque.tail t1C_7 - let t1_6s = BankersDeque.tail t1_7s - let t1C_6s = BankersDeque.tail t1C_7s - - let t1_5 = BankersDeque.tail t1_6 - let t1C_5 = BankersDeque.tail t1C_6 - let t1_5s = BankersDeque.tail t1_6s - let t1C_5s = BankersDeque.tail t1C_6s - - let t1_4 = BankersDeque.tail t1_5 - let t1C_4 = BankersDeque.tail t1C_5 - let t1_4s = BankersDeque.tail t1_5s - let t1C_4s = BankersDeque.tail t1C_5s - - let t1_3 = BankersDeque.tail t1_4 - let t1C_3 = BankersDeque.tail t1C_4 - let t1_3s = BankersDeque.tail t1_4s - let t1C_3s = BankersDeque.tail t1C_4s - - let t1_2 = BankersDeque.tail t1_3 - let t1C_2 = BankersDeque.tail t1C_3 - let t1_2s = BankersDeque.tail t1_3s - let t1C_2s = BankersDeque.tail t1C_3s - - let t1_1 = BankersDeque.tail t1_2 - let t1C_1 = BankersDeque.tail t1C_2 - let t1_1s = BankersDeque.tail t1_2s - let t1C_1s = BankersDeque.tail t1C_2s - - (((BankersDeque.length t1) = 9) - && ((BankersDeque.length t1C) = 9) - && ((BankersDeque.length t1s) = 9) - && ((BankersDeque.length t1Cs) = 9) - && ((BankersDeque.head t1) = "i") - && ((BankersDeque.head t1C) = "i") - && ((BankersDeque.head t1s) = "i") - && ((BankersDeque.head t1Cs) = "i") - && ((BankersDeque.length t1_8) = 8) - && ((BankersDeque.length t1C_8) = 8) - && ((BankersDeque.length t1_8s) = 8) - && ((BankersDeque.length t1C_8s) = 8) - && ((BankersDeque.head t1_8) = "h") - && ((BankersDeque.head t1C_8) = "h") - && ((BankersDeque.head t1_8s) = "h") - && ((BankersDeque.head t1C_8s) = "h") - && ((BankersDeque.length t1_7) = 7) - && ((BankersDeque.length t1C_7) = 7) - && ((BankersDeque.length t1_7s) = 7) - && ((BankersDeque.length t1C_7s) = 7) - && ((BankersDeque.head t1_7) = "g") - && ((BankersDeque.head t1C_7) = "g") - && ((BankersDeque.head t1_7s) = "g") - && ((BankersDeque.head t1C_7s) = "g") - && ((BankersDeque.length t1_6) = 6) - && ((BankersDeque.length t1C_6) = 6) - && ((BankersDeque.length t1_6s) = 6) - && ((BankersDeque.length t1C_6s) = 6) - && ((BankersDeque.head t1_6) = "f") - && ((BankersDeque.head t1C_6) = "f") - && ((BankersDeque.head t1_6s) = "f") - && ((BankersDeque.head t1C_6s) = "f") - && ((BankersDeque.length t1_5) = 5) - && ((BankersDeque.length t1C_5) = 5) - && ((BankersDeque.length t1_5s) = 5) - && ((BankersDeque.length t1C_5s) = 5) - && ((BankersDeque.head t1_5) = "e") - && ((BankersDeque.head t1C_5) = "e") - && ((BankersDeque.head t1_5s) = "e") - && ((BankersDeque.head t1C_5s) = "e") - && ((BankersDeque.length t1_4) = 4) - && ((BankersDeque.length t1C_4) = 4) - && ((BankersDeque.length t1_4s) = 4) - && ((BankersDeque.length t1C_4s) = 4) - && ((BankersDeque.head t1_4) = "d") - && ((BankersDeque.head t1C_4) = "d") - && ((BankersDeque.head t1_4s) = "d") - && ((BankersDeque.head t1C_4s) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.length t1_3s) = 3) - && ((BankersDeque.length t1C_3s) = 3) - && ((BankersDeque.head t1_3) = "c") - && ((BankersDeque.head t1C_3) = "c") - && ((BankersDeque.head t1_3s) = "c") - && ((BankersDeque.head t1C_3s) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.length t1_2s) = 2) - && ((BankersDeque.length t1C_2s) = 2) - && ((BankersDeque.head t1_2) = "b") - && ((BankersDeque.head t1C_2) = "b") - && ((BankersDeque.head t1_2s) = "b") - && ((BankersDeque.head t1C_2s) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.length t1_1s) = 1) - && ((BankersDeque.length t1C_1s) = 1) - && ((BankersDeque.head t1_1) = "a") - && ((BankersDeque.head t1C_1) = "a") - && ((BankersDeque.head t1_1s) = "a") - && ((BankersDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - //the previous series thoroughly tested construction by BankersDeque.snoc, so we'll leave those out - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 1" { - let t1 = BankersDeque.init len2 - let t1C = BankersDeque.init len2C3 - - (((BankersDeque.length t1) = 1) - && ((BankersDeque.length t1C) = 1) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 2" { - let t1 = BankersDeque.init len3 - let t1C = BankersDeque.init len3C3 - - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - - (((BankersDeque.length t1) = 2) - && ((BankersDeque.length t1C) = 2) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 1) - && ((BankersDeque.length t1C_1) = 1) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 3" { - let t1 = BankersDeque.init len4 - let t1C = BankersDeque.init len4C3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - - (((BankersDeque.length t1) = 3) - && ((BankersDeque.length t1C) = 3) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 2) - && ((BankersDeque.length t1C_1) = 2) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 1) - && ((BankersDeque.length t1C_2) = 1) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 4" { - let t1 = BankersDeque.init len5 - let t1C = BankersDeque.init len5C3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - let t1_3 = BankersDeque.init t1_2 - let t1C_3 = BankersDeque.init t1C_2 - - (((BankersDeque.length t1) = 4) - && ((BankersDeque.length t1C) = 4) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 3) - && ((BankersDeque.length t1C_1) = 3) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 2) - && ((BankersDeque.length t1C_2) = 2) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d") - && ((BankersDeque.length t1_3) = 1) - && ((BankersDeque.length t1C_3) = 1) - && ((BankersDeque.last t1_3) = "e") - && ((BankersDeque.last t1C_3) = "e")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 5" { - let t1 = BankersDeque.init len6 - let t1C = BankersDeque.init len6C3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - let t1_3 = BankersDeque.init t1_2 - let t1C_3 = BankersDeque.init t1C_2 - let t1_4 = BankersDeque.init t1_3 - let t1C_4 = BankersDeque.init t1C_3 - - (((BankersDeque.length t1) = 5) - && ((BankersDeque.length t1C) = 5) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 4) - && ((BankersDeque.length t1C_1) = 4) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 3) - && ((BankersDeque.length t1C_2) = 3) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d") - && ((BankersDeque.length t1_3) = 2) - && ((BankersDeque.length t1C_3) = 2) - && ((BankersDeque.last t1_3) = "e") - && ((BankersDeque.last t1C_3) = "e") - && ((BankersDeque.length t1_4) = 1) - && ((BankersDeque.length t1C_4) = 1) - && ((BankersDeque.last t1_4) = "f") - && ((BankersDeque.last t1C_4) = "f")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 6" { - let t1 = BankersDeque.init len7 - let t1C = BankersDeque.init len7C3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - let t1_3 = BankersDeque.init t1_2 - let t1C_3 = BankersDeque.init t1C_2 - let t1_4 = BankersDeque.init t1_3 - let t1C_4 = BankersDeque.init t1C_3 - let t1_5 = BankersDeque.init t1_4 - let t1C_5 = BankersDeque.init t1C_4 - - (((BankersDeque.length t1) = 6) - && ((BankersDeque.length t1C) = 6) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 5) - && ((BankersDeque.length t1C_1) = 5) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 4) - && ((BankersDeque.length t1C_2) = 4) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d") - && ((BankersDeque.length t1_3) = 3) - && ((BankersDeque.length t1C_3) = 3) - && ((BankersDeque.last t1_3) = "e") - && ((BankersDeque.last t1C_3) = "e") - && ((BankersDeque.length t1_4) = 2) - && ((BankersDeque.length t1C_4) = 2) - && ((BankersDeque.last t1_4) = "f") - && ((BankersDeque.last t1C_4) = "f") - && ((BankersDeque.length t1_5) = 1) - && ((BankersDeque.length t1C_5) = 1) - && ((BankersDeque.last t1_5) = "g") - && ((BankersDeque.last t1C_5) = "g")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 7" { - let t1 = BankersDeque.init len8 - let t1C = BankersDeque.init len8C3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - let t1_3 = BankersDeque.init t1_2 - let t1C_3 = BankersDeque.init t1C_2 - let t1_4 = BankersDeque.init t1_3 - let t1C_4 = BankersDeque.init t1C_3 - let t1_5 = BankersDeque.init t1_4 - let t1C_5 = BankersDeque.init t1C_4 - let t1_6 = BankersDeque.init t1_5 - let t1C_6 = BankersDeque.init t1C_5 - - (((BankersDeque.length t1) = 7) - && ((BankersDeque.length t1C) = 7) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 6) - && ((BankersDeque.length t1C_1) = 6) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 5) - && ((BankersDeque.length t1C_2) = 5) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d") - && ((BankersDeque.length t1_3) = 4) - && ((BankersDeque.length t1C_3) = 4) - && ((BankersDeque.last t1_3) = "e") - && ((BankersDeque.last t1C_3) = "e") - && ((BankersDeque.length t1_4) = 3) - && ((BankersDeque.length t1C_4) = 3) - && ((BankersDeque.last t1_4) = "f") - && ((BankersDeque.last t1C_4) = "f") - && ((BankersDeque.length t1_5) = 2) - && ((BankersDeque.length t1C_5) = 2) - && ((BankersDeque.last t1_5) = "g") - && ((BankersDeque.last t1C_5) = "g") - && ((BankersDeque.length t1_6) = 1) - && ((BankersDeque.length t1C_6) = 1) - && ((BankersDeque.last t1_6) = "h") - && ((BankersDeque.last t1C_6) = "h")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 8" { - let t1 = BankersDeque.init len9 - let t1C = BankersDeque.init len9C3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - let t1_3 = BankersDeque.init t1_2 - let t1C_3 = BankersDeque.init t1C_2 - let t1_4 = BankersDeque.init t1_3 - let t1C_4 = BankersDeque.init t1C_3 - let t1_5 = BankersDeque.init t1_4 - let t1C_5 = BankersDeque.init t1C_4 - let t1_6 = BankersDeque.init t1_5 - let t1C_6 = BankersDeque.init t1C_5 - let t1_7 = BankersDeque.init t1_6 - let t1C_7 = BankersDeque.init t1C_6 - - (((BankersDeque.length t1) = 8) - && ((BankersDeque.length t1C) = 8) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 7) - && ((BankersDeque.length t1C_1) = 7) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 6) - && ((BankersDeque.length t1C_2) = 6) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d") - && ((BankersDeque.length t1_3) = 5) - && ((BankersDeque.length t1C_3) = 5) - && ((BankersDeque.last t1_3) = "e") - && ((BankersDeque.last t1C_3) = "e") - && ((BankersDeque.length t1_4) = 4) - && ((BankersDeque.length t1C_4) = 4) - && ((BankersDeque.last t1_4) = "f") - && ((BankersDeque.last t1C_4) = "f") - && ((BankersDeque.length t1_5) = 3) - && ((BankersDeque.length t1C_5) = 3) - && ((BankersDeque.last t1_5) = "g") - && ((BankersDeque.last t1C_5) = "g") - && ((BankersDeque.length t1_6) = 2) - && ((BankersDeque.length t1C_6) = 2) - && ((BankersDeque.last t1_6) = "h") - && ((BankersDeque.last t1C_6) = "h") - && ((BankersDeque.length t1_7) = 1) - && ((BankersDeque.length t1C_7) = 1) - && ((BankersDeque.last t1_7) = "i") - && ((BankersDeque.last t1C_7) = "i")) - |> Expect.isTrue "" - } - - test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 9" { - let t1 = BankersDeque.init lena - let t1C = BankersDeque.init lenaC3 - let t1_1 = BankersDeque.init t1 - let t1C_1 = BankersDeque.init t1C - let t1_2 = BankersDeque.init t1_1 - let t1C_2 = BankersDeque.init t1C_1 - let t1_3 = BankersDeque.init t1_2 - let t1C_3 = BankersDeque.init t1C_2 - let t1_4 = BankersDeque.init t1_3 - let t1C_4 = BankersDeque.init t1C_3 - let t1_5 = BankersDeque.init t1_4 - let t1C_5 = BankersDeque.init t1C_4 - let t1_6 = BankersDeque.init t1_5 - let t1C_6 = BankersDeque.init t1C_5 - let t1_7 = BankersDeque.init t1_6 - let t1C_7 = BankersDeque.init t1C_6 - let t1_8 = BankersDeque.init t1_7 - let t1C_8 = BankersDeque.init t1C_7 - - (((BankersDeque.length t1) = 9) - && ((BankersDeque.length t1C) = 9) - && ((BankersDeque.last t1) = "b") - && ((BankersDeque.last t1C) = "b") - && ((BankersDeque.length t1_1) = 8) - && ((BankersDeque.length t1C_1) = 8) - && ((BankersDeque.last t1_1) = "c") - && ((BankersDeque.last t1C_1) = "c") - && ((BankersDeque.length t1_2) = 7) - && ((BankersDeque.length t1C_2) = 7) - && ((BankersDeque.last t1_2) = "d") - && ((BankersDeque.last t1C_2) = "d") - && ((BankersDeque.length t1_3) = 6) - && ((BankersDeque.length t1C_3) = 6) - && ((BankersDeque.last t1_3) = "e") - && ((BankersDeque.last t1C_3) = "e") - && ((BankersDeque.length t1_4) = 5) - && ((BankersDeque.length t1C_4) = 5) - && ((BankersDeque.last t1_4) = "f") - && ((BankersDeque.last t1C_4) = "f") - && ((BankersDeque.length t1_5) = 4) - && ((BankersDeque.length t1C_5) = 4) - && ((BankersDeque.last t1_5) = "g") - && ((BankersDeque.last t1C_5) = "g") - && ((BankersDeque.length t1_6) = 3) - && ((BankersDeque.length t1C_6) = 3) - && ((BankersDeque.last t1_6) = "h") - && ((BankersDeque.last t1C_6) = "h") - && ((BankersDeque.length t1_7) = 2) - && ((BankersDeque.length t1C_7) = 2) - && ((BankersDeque.last t1_7) = "i") - && ((BankersDeque.last t1C_7) = "i") - && ((BankersDeque.length t1_8) = 1) - && ((BankersDeque.length t1C_8) = 1) - && ((BankersDeque.last t1_8) = "j") - && ((BankersDeque.last t1C_8) = "j")) - |> Expect.isTrue "" - } - - test "IEnumerable Seq" { (lena |> Seq.toArray).[5] |> Expect.equal "" "e" } - - test "IEnumerable Seq BankersDeque.length" { lena |> Seq.length |> Expect.equal "" 10 } - - test "type BankersDeque.cons works" { lena.Cons "zz" |> BankersDeque.head |> Expect.equal "" "zz" } - - test "IDeque BankersDeque.cons works" { ((lena :> IDeque).Cons "zz").Head |> Expect.equal "" "zz" } - - test "BankersDeque.ofCatLists and BankersDeque.uncons" { - let d = BankersDeque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] - let h1, t1 = BankersDeque.uncons d - let h2, t2 = BankersDeque.uncons t1 - let h3, t3 = BankersDeque.uncons t2 - let h4, t4 = BankersDeque.uncons t3 - let h5, t5 = BankersDeque.uncons t4 - let h6, t6 = BankersDeque.uncons t5 - - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f") - && (BankersDeque.isEmpty t6)) - |> Expect.isTrue "" - } - - test "BankersDeque.ofCatSeqs and BankersDeque.uncons" { - let d = BankersDeque.ofCatSeqs (seq { 'a' .. 'c' }) (seq { 'd' .. 'f' }) - let h1, t1 = BankersDeque.uncons d - let h2, t2 = BankersDeque.uncons t1 - let h3, t3 = BankersDeque.uncons t2 - let h4, t4 = BankersDeque.uncons t3 - let h5, t5 = BankersDeque.uncons t4 - let h6, t6 = BankersDeque.uncons t5 - - ((h1 = 'a') - && (h2 = 'b') - && (h3 = 'c') - && (h4 = 'd') - && (h5 = 'e') - && (h6 = 'f') - && (BankersDeque.isEmpty t6)) - |> Expect.isTrue "" - } - - test "BankersDeque.unsnoc works" { - let d = BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] - let i1, l1 = BankersDeque.unsnoc d - let i2, l2 = BankersDeque.unsnoc i1 - let i3, l3 = BankersDeque.unsnoc i2 - let i4, l4 = BankersDeque.unsnoc i3 - let i5, l5 = BankersDeque.unsnoc i4 - let i6, l6 = BankersDeque.unsnoc i5 - - ((l1 = "a") - && (l2 = "b") - && (l3 = "c") - && (l4 = "d") - && (l5 = "e") - && (l6 = "f") - && (BankersDeque.isEmpty i6)) - |> Expect.isTrue "" - } - - test "BankersDeque.snoc pattern discriminator" { - let d = (BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let i1, l1 = BankersDeque.unsnoc d - - let i2, l2 = - match i1 with - | BankersDeque.Snoc(i, l) -> i, l - | _ -> i1, "x" - - ((l2 = "b") && ((BankersDeque.length i2) = 4)) |> Expect.isTrue "" - } - - test "BankersDeque.cons pattern discriminator" { - let d = (BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let h1, t1 = BankersDeque.uncons d - - let h2, t2 = - match t1 with - | BankersDeque.Cons(h, t) -> h, t - | _ -> "x", t1 - - ((h2 = "e") && ((BankersDeque.length t2) = 4)) |> Expect.isTrue "" - } - - test "BankersDeque.cons and BankersDeque.snoc pattern discriminator" { - let d = (BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - - let mid1 = - match d with - | BankersDeque.Cons(h, BankersDeque.Snoc(i, l)) -> i - | _ -> d - - let head, last = - match mid1 with - | BankersDeque.Cons(h, BankersDeque.Snoc(i, l)) -> h, l - | _ -> "x", "x" - - ((head = "e") && (last = "b")) |> Expect.isTrue "" - } - - test "BankersDeque.rev BankersDeque.empty dqueue should be BankersDeque.empty" { - BankersDeque.isEmpty(BankersDeque.rev(BankersDeque.empty 2)) - |> Expect.isTrue "" - } - - test "BankersDeque.rev dqueue BankersDeque.length 1" { - ((BankersDeque.head(BankersDeque.rev len1) = "a") - && (BankersDeque.head(BankersDeque.rev len1C3) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.rev dqueue BankersDeque.length 2" { - let r1 = BankersDeque.rev len2 - let r1c = BankersDeque.rev len2C3 - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - - ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) - |> Expect.isTrue "" - } - - test "BankersDeque.rev dqueue BankersDeque.length 3" { - let r1 = BankersDeque.rev len3 - let r1c = BankersDeque.rev len3C3 - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c")) - |> Expect.isTrue "" - } - - test "BankersDeque.rev dqueue BankersDeque.length 4" { - let r1 = BankersDeque.rev len4 - let r1c = BankersDeque.rev len4C3 - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d")) - |> Expect.isTrue "" - } - - test "BankersDeque.rev dqueue BankersDeque.length 5" { - let r1 = BankersDeque.rev len5 - let r1c = BankersDeque.rev len5C3 - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e")) - |> Expect.isTrue "" - } - - //BankersDeque.length 6 more than sufficient to test BankersDeque.rev - test "BankersDeque.rev dqueue BankersDeque.length 6" { - let r1 = BankersDeque.rev len6 - let r1c = BankersDeque.rev len6C3 - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f")) - |> Expect.isTrue "" - } - - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.empty" { - ((BankersDeque.isEmpty(BankersDeque.ofSeq [])) - && (BankersDeque.isEmpty(BankersDeque.ofSeqC 3 []))) - |> Expect.isTrue "" - } - - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 1" { - ((BankersDeque.head(BankersDeque.ofSeq [ "a" ]) = "a") - && (BankersDeque.head(BankersDeque.ofSeqC 3 [ "a" ]) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 2" { - let r1 = BankersDeque.ofSeq [ "a"; "b" ] - let r1c = BankersDeque.ofSeqC 3 [ "a"; "b" ] - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - - ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) - |> Expect.isTrue "" - } - - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 3" { - let r1 = BankersDeque.ofSeq [ "a"; "b"; "c" ] - let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ] - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c")) - |> Expect.isTrue "" - } - - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 4" { - let r1 = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ] - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d")) - |> Expect.isTrue "" - } - - //BankersDeque.length 5 more than sufficient to test BankersDeque.ofSeq and BankersDeque.ofSeqC - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 5" { - let r1 = BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ] - let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ] - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e")) - |> Expect.isTrue "" - } - - //BankersDeque.length 5 more than sufficient to test BankersDeque.ofSeq and BankersDeque.ofSeqC - test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 6" { - let r1 = BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ] - let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ] - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.empty dqueus" { - ((BankersDeque.isEmpty(BankersDeque.append (BankersDeque.ofSeq []) (BankersDeque.ofSeq []))) - && (BankersDeque.isEmpty(BankersDeque.append (BankersDeque.empty 3) (BankersDeque.empty 3)))) - |> Expect.isTrue "" - } - - test "appending BankersDeque.empty and BankersDeque.length 1" { - ((BankersDeque.head(BankersDeque.append (BankersDeque.ofSeq []) len1) = "a") - && (BankersDeque.head(BankersDeque.append len1 (BankersDeque.empty 3)) = "a")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.empty and BankersDeque.length 2" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq []) (BankersDeque.ofSeq [ "a"; "b" ]) - - let r1c = - BankersDeque.append (BankersDeque.empty 3) (BankersDeque.ofSeqC 3 [ "a"; "b" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq []) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.empty 3) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 1 and BankersDeque.length 2" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 1 and BankersDeque.length 3" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c"; "d" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c"; "d" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c" ]) (BankersDeque.ofSeq [ "d" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (BankersDeque.ofSeqC 3 [ "d" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 1 and BankersDeque.length 4" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c"; "d"; "e" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c"; "d"; "e" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeq [ "e" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeqC 3 [ "e" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - - let t5r = BankersDeque.tail t4r - let t5cr = BankersDeque.tail t4cr - let h5r = BankersDeque.head t5r - let h5cr = BankersDeque.head t5cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 1 and BankersDeque.length 5" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c"; "d"; "e"; "f" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c"; "d"; "e"; "f" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeq [ "f" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeqC 3 [ "f" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - let t5r = BankersDeque.tail t4r - let t5cr = BankersDeque.tail t4cr - let h5r = BankersDeque.head t5r - let h5cr = BankersDeque.head t5cr - let t6r = BankersDeque.tail t5r - let t6cr = BankersDeque.tail t5cr - let h6r = BankersDeque.head t6r - let h6cr = BankersDeque.head t6cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 6 and BankersDeque.length 7" { - let r1 = - BankersDeque.append - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - (BankersDeque.ofSeq [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) - - let r1c = - BankersDeque.append - (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ]) - (BankersDeque.ofSeqC 3 [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - let t7 = BankersDeque.tail t6 - let t7c = BankersDeque.tail t6c - let h7 = BankersDeque.head t7 - let h7c = BankersDeque.head t7c - let h7 = BankersDeque.head t7 - let h7c = BankersDeque.head t7c - let t8 = BankersDeque.tail t7 - let t8c = BankersDeque.tail t7c - let h8 = BankersDeque.head t8 - let h8c = BankersDeque.head t8c - let h8 = BankersDeque.head t8 - let h8c = BankersDeque.head t8c - let t9 = BankersDeque.tail t8 - let t9c = BankersDeque.tail t8c - let h9 = BankersDeque.head t9 - let h9c = BankersDeque.head t9c - let h9 = BankersDeque.head t9 - let h9c = BankersDeque.head t9c - let t10 = BankersDeque.tail t9 - let t10c = BankersDeque.tail t9c - let h10 = BankersDeque.head t10 - let h10c = BankersDeque.head t10c - let h10 = BankersDeque.head t10 - let h10c = BankersDeque.head t10c - let t11 = BankersDeque.tail t10 - let t11c = BankersDeque.tail t10c - let h11 = BankersDeque.head t11 - let h11c = BankersDeque.head t11c - let h11 = BankersDeque.head t11 - let h11c = BankersDeque.head t11c - let t12 = BankersDeque.tail t11 - let t12c = BankersDeque.tail t11c - let h12 = BankersDeque.head t12 - let h12c = BankersDeque.head t12c - let h12 = BankersDeque.head t12 - let h12c = BankersDeque.head t12c - let t13 = BankersDeque.tail t12 - let t13c = BankersDeque.tail t12c - let h13 = BankersDeque.head t13 - let h13c = BankersDeque.head t13c - let h13 = BankersDeque.head t13 - let h13c = BankersDeque.head t13c - - let r1r = - BankersDeque.append - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) - (BankersDeque.ofSeq [ "h"; "i"; "j"; "k"; "l"; "m" ]) - - let r1cr = - BankersDeque.append - (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) - (BankersDeque.ofSeqC 3 [ "h"; "i"; "j"; "k"; "l"; "m" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - let t5r = BankersDeque.tail t4r - let t5cr = BankersDeque.tail t4cr - let h5r = BankersDeque.head t5r - let h5cr = BankersDeque.head t5cr - let t6r = BankersDeque.tail t5r - let t6cr = BankersDeque.tail t5cr - let h6r = BankersDeque.head t6r - let h6cr = BankersDeque.head t6cr - let t7r = BankersDeque.tail t6r - let t7cr = BankersDeque.tail t6cr - let h7r = BankersDeque.head t7r - let h7cr = BankersDeque.head t7cr - let h7r = BankersDeque.head t7r - let h7cr = BankersDeque.head t7cr - let t8r = BankersDeque.tail t7r - let t8cr = BankersDeque.tail t7cr - let h8r = BankersDeque.head t8r - let h8cr = BankersDeque.head t8cr - let h8r = BankersDeque.head t8r - let h8cr = BankersDeque.head t8cr - let t9r = BankersDeque.tail t8r - let t9cr = BankersDeque.tail t8cr - let h9r = BankersDeque.head t9r - let h9cr = BankersDeque.head t9cr - let h9r = BankersDeque.head t9r - let h9cr = BankersDeque.head t9cr - let t10r = BankersDeque.tail t9r - let t10cr = BankersDeque.tail t9cr - let h10r = BankersDeque.head t10r - let h10cr = BankersDeque.head t10cr - let h10r = BankersDeque.head t10r - let h10cr = BankersDeque.head t10cr - let t11r = BankersDeque.tail t10r - let t11cr = BankersDeque.tail t10cr - let h11r = BankersDeque.head t11r - let h11cr = BankersDeque.head t11cr - let h11r = BankersDeque.head t11r - let h11cr = BankersDeque.head t11cr - let t12r = BankersDeque.tail t11r - let t12cr = BankersDeque.tail t11cr - let h12r = BankersDeque.head t12r - let h12cr = BankersDeque.head t12cr - let h12r = BankersDeque.head t12r - let h12cr = BankersDeque.head t12cr - let t13r = BankersDeque.tail t12r - let t13cr = BankersDeque.tail t12cr - let h13r = BankersDeque.head t13r - let h13cr = BankersDeque.head t13cr - let h13r = BankersDeque.head t13r - let h13cr = BankersDeque.head t13cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h7 = "g") - && (h7c = "g") - && (h8 = "h") - && (h8c = "h") - && (h9 = "i") - && (h9c = "i") - && (h10 = "j") - && (h10c = "j") - && (h11 = "k") - && (h11c = "k") - && (h12 = "l") - && (h12c = "l") - && (h13 = "m") - && (h13c = "m") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f") - && (h7r = "g") - && (h7cr = "g") - && (h8r = "h") - && (h8cr = "h") - && (h9r = "i") - && (h9cr = "i") - && (h10r = "j") - && (h10cr = "j") - && (h11r = "k") - && (h11cr = "k") - && (h12r = "l") - && (h12cr = "l") - && (h13r = "m") - && (h13cr = "m")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 2 and BankersDeque.length 2" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 2 and BankersDeque.length 3" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d"; "e" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d"; "e" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c" ]) (BankersDeque.ofSeq [ "d"; "e" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (BankersDeque.ofSeqC 3 [ "d"; "e" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - - let t5r = BankersDeque.tail t4r - let t5cr = BankersDeque.tail t4cr - let h5r = BankersDeque.head t5r - let h5cr = BankersDeque.head t5cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 2 and BankersDeque.length 4" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d"; "e"; "f" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d"; "e"; "f" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeq [ "e"; "f" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeqC 3 [ "e"; "f" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - let t5r = BankersDeque.tail t4r - let t5cr = BankersDeque.tail t4cr - let h5r = BankersDeque.head t5r - let h5cr = BankersDeque.head t5cr - let t6r = BankersDeque.tail t5r - let t6cr = BankersDeque.tail t5cr - let h6r = BankersDeque.head t6r - let h6cr = BankersDeque.head t6cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 2 and BankersDeque.length 5" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d"; "e"; "f"; "g" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d"; "e"; "f"; "g" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - let t7 = BankersDeque.tail t6 - let t7c = BankersDeque.tail t6c - let h7 = BankersDeque.head t7 - let h7c = BankersDeque.head t7c - - let r1r = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeq [ "f"; "g" ]) - - let r1cr = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeqC 3 [ "f"; "g" ]) - - let h1r = BankersDeque.head r1r - let h1cr = BankersDeque.head r1cr - let t2r = BankersDeque.tail r1r - let t2cr = BankersDeque.tail r1cr - let h2r = BankersDeque.head t2r - let h2cr = BankersDeque.head t2cr - let t3r = BankersDeque.tail t2r - let t3cr = BankersDeque.tail t2cr - let h3r = BankersDeque.head t3r - let h3cr = BankersDeque.head t3cr - let t4r = BankersDeque.tail t3r - let t4cr = BankersDeque.tail t3cr - let h4r = BankersDeque.head t4r - let h4cr = BankersDeque.head t4cr - let t5r = BankersDeque.tail t4r - let t5cr = BankersDeque.tail t4cr - let h5r = BankersDeque.head t5r - let h5cr = BankersDeque.head t5cr - let t6r = BankersDeque.tail t5r - let t6cr = BankersDeque.tail t5cr - let h6r = BankersDeque.head t6r - let h6cr = BankersDeque.head t6cr - let t7r = BankersDeque.tail t6r - let t7cr = BankersDeque.tail t6cr - let h7r = BankersDeque.head t7r - let h7cr = BankersDeque.head t7cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h7 = "g") - && (h7c = "g") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f") - && (h7r = "g") - && (h7cr = "g")) - |> Expect.isTrue "" - } - - test "appending BankersDeque.length 3 and BankersDeque.length 3" { - let r1 = - BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c" ]) (BankersDeque.ofSeq [ "d"; "e"; "f" ]) - - let r1c = - BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (BankersDeque.ofSeqC 3 [ "d"; "e"; "f" ]) - - let h1 = BankersDeque.head r1 - let h1c = BankersDeque.head r1c - let t2 = BankersDeque.tail r1 - let t2c = BankersDeque.tail r1c - let h2 = BankersDeque.head t2 - let h2c = BankersDeque.head t2c - let t3 = BankersDeque.tail t2 - let t3c = BankersDeque.tail t2c - let h3 = BankersDeque.head t3 - let h3c = BankersDeque.head t3c - let t4 = BankersDeque.tail t3 - let t4c = BankersDeque.tail t3c - let h4 = BankersDeque.head t4 - let h4c = BankersDeque.head t4c - let t5 = BankersDeque.tail t4 - let t5c = BankersDeque.tail t4c - let h5 = BankersDeque.head t5 - let h5c = BankersDeque.head t5c - let t6 = BankersDeque.tail t5 - let t6c = BankersDeque.tail t5c - let h6 = BankersDeque.head t6 - let h6c = BankersDeque.head t6c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f")) - |> Expect.isTrue "" - } - - - test "BankersDeque.lookup BankersDeque.length 1" { len1 |> BankersDeque.lookup 0 |> Expect.equal "" "a" } - - test "BankersDeque.lookup BankersDeque.length 2" { - (((len2 |> BankersDeque.lookup 0) = "b") - && ((len2 |> BankersDeque.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 3" { - (((len3 |> BankersDeque.lookup 0) = "c") - && ((len3 |> BankersDeque.lookup 1) = "b") - && ((len3 |> BankersDeque.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 4" { - (((len4 |> BankersDeque.lookup 0) = "d") - && ((len4 |> BankersDeque.lookup 1) = "c") - && ((len4 |> BankersDeque.lookup 2) = "b") - && ((len4 |> BankersDeque.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 5" { - (((len5 |> BankersDeque.lookup 0) = "e") - && ((len5 |> BankersDeque.lookup 1) = "d") - && ((len5 |> BankersDeque.lookup 2) = "c") - && ((len5 |> BankersDeque.lookup 3) = "b") - && ((len5 |> BankersDeque.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 6" { - (((len6 |> BankersDeque.lookup 0) = "f") - && ((len6 |> BankersDeque.lookup 1) = "e") - && ((len6 |> BankersDeque.lookup 2) = "d") - && ((len6 |> BankersDeque.lookup 3) = "c") - && ((len6 |> BankersDeque.lookup 4) = "b") - && ((len6 |> BankersDeque.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 7" { - (((len7 |> BankersDeque.lookup 0) = "g") - && ((len7 |> BankersDeque.lookup 1) = "f") - && ((len7 |> BankersDeque.lookup 2) = "e") - && ((len7 |> BankersDeque.lookup 3) = "d") - && ((len7 |> BankersDeque.lookup 4) = "c") - && ((len7 |> BankersDeque.lookup 5) = "b") - && ((len7 |> BankersDeque.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 8" { - (((len8 |> BankersDeque.lookup 0) = "h") - && ((len8 |> BankersDeque.lookup 1) = "g") - && ((len8 |> BankersDeque.lookup 2) = "f") - && ((len8 |> BankersDeque.lookup 3) = "e") - && ((len8 |> BankersDeque.lookup 4) = "d") - && ((len8 |> BankersDeque.lookup 5) = "c") - && ((len8 |> BankersDeque.lookup 6) = "b") - && ((len8 |> BankersDeque.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 9" { - (((len9 |> BankersDeque.lookup 0) = "i") - && ((len9 |> BankersDeque.lookup 1) = "h") - && ((len9 |> BankersDeque.lookup 2) = "g") - && ((len9 |> BankersDeque.lookup 3) = "f") - && ((len9 |> BankersDeque.lookup 4) = "e") - && ((len9 |> BankersDeque.lookup 5) = "d") - && ((len9 |> BankersDeque.lookup 6) = "c") - && ((len9 |> BankersDeque.lookup 7) = "b") - && ((len9 |> BankersDeque.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.lookup BankersDeque.length 10" { - (((lena |> BankersDeque.lookup 0) = "j") - && ((lena |> BankersDeque.lookup 1) = "i") - && ((lena |> BankersDeque.lookup 2) = "h") - && ((lena |> BankersDeque.lookup 3) = "g") - && ((lena |> BankersDeque.lookup 4) = "f") - && ((lena |> BankersDeque.lookup 5) = "e") - && ((lena |> BankersDeque.lookup 6) = "d") - && ((lena |> BankersDeque.lookup 7) = "c") - && ((lena |> BankersDeque.lookup 8) = "b") - && ((lena |> BankersDeque.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 1" { - let a = len1 |> BankersDeque.tryLookup 0 - (a.Value = "a") |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 2" { - let b = len2 |> BankersDeque.tryLookup 0 - let a = len2 |> BankersDeque.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 3" { - let c = len3 |> BankersDeque.tryLookup 0 - let b = len3 |> BankersDeque.tryLookup 1 - let a = len3 |> BankersDeque.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 4" { - let d = len4 |> BankersDeque.tryLookup 0 - let c = len4 |> BankersDeque.tryLookup 1 - let b = len4 |> BankersDeque.tryLookup 2 - let a = len4 |> BankersDeque.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 5" { - let e = len5 |> BankersDeque.tryLookup 0 - let d = len5 |> BankersDeque.tryLookup 1 - let c = len5 |> BankersDeque.tryLookup 2 - let b = len5 |> BankersDeque.tryLookup 3 - let a = len5 |> BankersDeque.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 6" { - let f = len6 |> BankersDeque.tryLookup 0 - let e = len6 |> BankersDeque.tryLookup 1 - let d = len6 |> BankersDeque.tryLookup 2 - let c = len6 |> BankersDeque.tryLookup 3 - let b = len6 |> BankersDeque.tryLookup 4 - let a = len6 |> BankersDeque.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 7" { - let g = len7 |> BankersDeque.tryLookup 0 - let f = len7 |> BankersDeque.tryLookup 1 - let e = len7 |> BankersDeque.tryLookup 2 - let d = len7 |> BankersDeque.tryLookup 3 - let c = len7 |> BankersDeque.tryLookup 4 - let b = len7 |> BankersDeque.tryLookup 5 - let a = len7 |> BankersDeque.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 8" { - let h = len8 |> BankersDeque.tryLookup 0 - let g = len8 |> BankersDeque.tryLookup 1 - let f = len8 |> BankersDeque.tryLookup 2 - let e = len8 |> BankersDeque.tryLookup 3 - let d = len8 |> BankersDeque.tryLookup 4 - let c = len8 |> BankersDeque.tryLookup 5 - let b = len8 |> BankersDeque.tryLookup 6 - let a = len8 |> BankersDeque.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 9" { - let i = len9 |> BankersDeque.tryLookup 0 - let h = len9 |> BankersDeque.tryLookup 1 - let g = len9 |> BankersDeque.tryLookup 2 - let f = len9 |> BankersDeque.tryLookup 3 - let e = len9 |> BankersDeque.tryLookup 4 - let d = len9 |> BankersDeque.tryLookup 5 - let c = len9 |> BankersDeque.tryLookup 6 - let b = len9 |> BankersDeque.tryLookup 7 - let a = len9 |> BankersDeque.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup BankersDeque.length 10" { - let j = lena |> BankersDeque.tryLookup 0 - let i = lena |> BankersDeque.tryLookup 1 - let h = lena |> BankersDeque.tryLookup 2 - let g = lena |> BankersDeque.tryLookup 3 - let f = lena |> BankersDeque.tryLookup 4 - let e = lena |> BankersDeque.tryLookup 5 - let d = lena |> BankersDeque.tryLookup 6 - let c = lena |> BankersDeque.tryLookup 7 - let b = lena |> BankersDeque.tryLookup 8 - let a = lena |> BankersDeque.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryLookup not found" { lena |> BankersDeque.tryLookup 10 |> Expect.isNone "" } - - test "BankersDeque.remove elements BankersDeque.length 1" { - len1 - |> BankersDeque.remove 0 - |> BankersDeque.isEmpty - |> Expect.isTrue "" - } - - test "BankersDeque.remove elements BankersDeque.length 2" { - let a = len2 |> BankersDeque.remove 0 |> BankersDeque.head - let b = len2 |> BankersDeque.remove 1 |> BankersDeque.head - ((a = "a") && (b = "b")) |> Expect.isTrue "" - } - - test "BankersDeque.remove elements BankersDeque.length 3" { - let r0 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.remove 0 - let b0 = BankersDeque.head r0 - let t0 = BankersDeque.tail r0 - let c0 = BankersDeque.head t0 - - let r1 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.remove 1 - let a1 = BankersDeque.head r1 - let t1 = BankersDeque.tail r1 - let c1 = BankersDeque.head t1 - - let r2 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.remove 2 - let a2 = BankersDeque.head r2 - let t2 = BankersDeque.tail r2 - let b2 = BankersDeque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "BankersDeque.remove elements BankersDeque.length 4" { - let r0 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 0 - let b0 = BankersDeque.head r0 - let t0 = BankersDeque.tail r0 - let c0 = BankersDeque.head t0 - let t01 = BankersDeque.tail t0 - let d0 = BankersDeque.head t01 - - let r1 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 1 - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let c1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let d1 = BankersDeque.head t12 - - let r2 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 2 - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - - let r3 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 3 - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "BankersDeque.remove elements BankersDeque.length 5" { - let r0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.remove 0 - - let b0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let c0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let d0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let e0 = BankersDeque.head t03 - - let r1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.remove 1 - - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let c1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let d1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let e1 = BankersDeque.head t13 - - let r2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.remove 2 - - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let e2 = BankersDeque.head t23 - - let r3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.remove 3 - - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let e3 = BankersDeque.head t33 - - let r4 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.remove 4 - - let a4 = BankersDeque.head r4 - let t41 = BankersDeque.tail r4 - let b4 = BankersDeque.head t41 - let t42 = BankersDeque.tail t41 - let c4 = BankersDeque.head t42 - let t43 = BankersDeque.tail t42 - let d4 = BankersDeque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "BankersDeque.remove elements BankersDeque.length 6" { - let r0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.remove 0 - - let b0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let c0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let d0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let e0 = BankersDeque.head t03 - let t04 = BankersDeque.tail t03 - let f0 = BankersDeque.head t04 - - let r1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.remove 1 - - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let c1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let d1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let e1 = BankersDeque.head t13 - let t14 = BankersDeque.tail t13 - let f1 = BankersDeque.head t14 - - let r2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.remove 2 - - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let e2 = BankersDeque.head t23 - let t24 = BankersDeque.tail t23 - let f2 = BankersDeque.head t24 - - let r3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.remove 3 - - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let e3 = BankersDeque.head t33 - let t34 = BankersDeque.tail t33 - let f3 = BankersDeque.head t34 - - let r4 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.remove 4 - - let a4 = BankersDeque.head r4 - let t41 = BankersDeque.tail r4 - let b4 = BankersDeque.head t41 - let t42 = BankersDeque.tail t41 - let c4 = BankersDeque.head t42 - let t43 = BankersDeque.tail t42 - let d4 = BankersDeque.head t43 - let t44 = BankersDeque.tail t43 - let f4 = BankersDeque.head t44 - - let r5 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.remove 5 - - let a5 = BankersDeque.head r5 - let t51 = BankersDeque.tail r5 - let b5 = BankersDeque.head t51 - let t52 = BankersDeque.tail t51 - let c5 = BankersDeque.head t52 - let t53 = BankersDeque.tail t52 - let d5 = BankersDeque.head t53 - let t54 = BankersDeque.tail t53 - let e5 = BankersDeque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "tryRemoveempty" { (BankersDeque.empty 3) |> BankersDeque.tryRemove 0 |> Expect.isNone "" } - - test "BankersDeque.tryRemove elements BankersDeque.length 1" { - let a = len1 |> BankersDeque.tryRemove 0 - a.Value |> BankersDeque.isEmpty |> Expect.isTrue "" - } - - test "BankersDeque.tryRemove elements BankersDeque.length 2" { - let a = len2 |> BankersDeque.tryRemove 0 - let a1 = BankersDeque.head a.Value - let b = len2 |> BankersDeque.tryRemove 1 - let b1 = BankersDeque.head b.Value - ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" - } - - test "BankersDeque.tryRemove elements BankersDeque.length 3" { - let x0 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.tryRemove 0 - let r0 = x0.Value - let b0 = BankersDeque.head r0 - let t0 = BankersDeque.tail r0 - let c0 = BankersDeque.head t0 - - let x1 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.tryRemove 1 - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t1 = BankersDeque.tail r1 - let c1 = BankersDeque.head t1 - - let x2 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.tryRemove 2 - let r2 = x2.Value - let a2 = BankersDeque.head r2 - let t2 = BankersDeque.tail r2 - let b2 = BankersDeque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryRemove elements BankersDeque.length 4" { - let x0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = BankersDeque.head r0 - let t0 = BankersDeque.tail r0 - let c0 = BankersDeque.head t0 - let t01 = BankersDeque.tail t0 - let d0 = BankersDeque.head t01 - - let x1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let c1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let d1 = BankersDeque.head t12 - - let x2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - - let x3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryRemove elements BankersDeque.length 5" { - let x0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let c0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let d0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let e0 = BankersDeque.head t03 - - let x1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let c1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let d1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let e1 = BankersDeque.head t13 - - let x2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let e2 = BankersDeque.head t23 - - let x3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let e3 = BankersDeque.head t33 - - let x4 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.tryRemove 4 - - let r4 = x4.Value - let a4 = BankersDeque.head r4 - let t41 = BankersDeque.tail r4 - let b4 = BankersDeque.head t41 - let t42 = BankersDeque.tail t41 - let c4 = BankersDeque.head t42 - let t43 = BankersDeque.tail t42 - let d4 = BankersDeque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryRemove elements BankersDeque.length 6" { - let x0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let c0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let d0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let e0 = BankersDeque.head t03 - let t04 = BankersDeque.tail t03 - let f0 = BankersDeque.head t04 - - let x1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let c1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let d1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let e1 = BankersDeque.head t13 - let t14 = BankersDeque.tail t13 - let f1 = BankersDeque.head t14 - - let x2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let e2 = BankersDeque.head t23 - let t24 = BankersDeque.tail t23 - let f2 = BankersDeque.head t24 - - let x3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let e3 = BankersDeque.head t33 - let t34 = BankersDeque.tail t33 - let f3 = BankersDeque.head t34 - - let x4 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.tryRemove 4 - - let r4 = x4.Value - let a4 = BankersDeque.head r4 - let t41 = BankersDeque.tail r4 - let b4 = BankersDeque.head t41 - let t42 = BankersDeque.tail t41 - let c4 = BankersDeque.head t42 - let t43 = BankersDeque.tail t42 - let d4 = BankersDeque.head t43 - let t44 = BankersDeque.tail t43 - let f4 = BankersDeque.head t44 - - let x5 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.tryRemove 5 - - let r5 = x5.Value - let a5 = BankersDeque.head r5 - let t51 = BankersDeque.tail r5 - let b5 = BankersDeque.head t51 - let t52 = BankersDeque.tail t51 - let c5 = BankersDeque.head t52 - let t53 = BankersDeque.tail t52 - let d5 = BankersDeque.head t53 - let t54 = BankersDeque.tail t53 - let e5 = BankersDeque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "BankersDeque.update elements BankersDeque.length 1" { - len1 - |> BankersDeque.update 0 "aa" - |> BankersDeque.head - |> Expect.equal "" "aa" - } - - test "BankersDeque.update elements BankersDeque.length 2" { - let r0 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.update 0 "zz" - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - - let r1 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.update 1 "zz" - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.update elements BankersDeque.length 3" { - let r0 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.update 0 "zz" - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let c0 = BankersDeque.head t02 - - let r1 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.update 1 "zz" - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let c1 = BankersDeque.head t12 - - let r2 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.update 2 "zz" - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.update elements BankersDeque.length 4" { - let r0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.update 0 "zz" - - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let c0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let d0 = BankersDeque.head t03 - - let r1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.update 1 "zz" - - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let c1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let d1 = BankersDeque.head t13 - - let r2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.update 2 "zz" - - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let d2 = BankersDeque.head t23 - - let r3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.update 3 "zz" - - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let d3 = BankersDeque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.update elements BankersDeque.length 5" { - let r0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.update 0 "zz" - - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let c0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let d0 = BankersDeque.head t03 - let t04 = BankersDeque.tail t03 - let e0 = BankersDeque.head t04 - - let r1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.update 1 "zz" - - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let c1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let d1 = BankersDeque.head t13 - let t14 = BankersDeque.tail t13 - let e1 = BankersDeque.head t14 - - let r2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.update 2 "zz" - - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let d2 = BankersDeque.head t23 - let t24 = BankersDeque.tail t23 - let e2 = BankersDeque.head t24 - - let r3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.update 3 "zz" - - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let d3 = BankersDeque.head t33 - let t34 = BankersDeque.tail t33 - let e3 = BankersDeque.head t34 - - let r4 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BankersDeque.update 4 "zz" - - let a4 = BankersDeque.head r4 - let t41 = BankersDeque.tail r4 - let b4 = BankersDeque.head t41 - let t42 = BankersDeque.tail t41 - let c4 = BankersDeque.head t42 - let t43 = BankersDeque.tail t42 - let d4 = BankersDeque.head t43 - let t44 = BankersDeque.tail t43 - let e4 = BankersDeque.head t44 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.update elements BankersDeque.length 6" { - let r0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.update 0 "zz" - - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let c0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let d0 = BankersDeque.head t03 - let t04 = BankersDeque.tail t03 - let e0 = BankersDeque.head t04 - let t05 = BankersDeque.tail t04 - let f0 = BankersDeque.head t05 - - let r1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.update 1 "zz" - - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let c1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let d1 = BankersDeque.head t13 - let t14 = BankersDeque.tail t13 - let e1 = BankersDeque.head t14 - let t15 = BankersDeque.tail t14 - let f1 = BankersDeque.head t15 - - let r2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.update 2 "zz" - - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let d2 = BankersDeque.head t23 - let t24 = BankersDeque.tail t23 - let e2 = BankersDeque.head t24 - let t25 = BankersDeque.tail t24 - let f2 = BankersDeque.head t25 - - let r3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.update 3 "zz" - - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let d3 = BankersDeque.head t33 - let t34 = BankersDeque.tail t33 - let e3 = BankersDeque.head t34 - let t35 = BankersDeque.tail t34 - let f3 = BankersDeque.head t35 - - let r4 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.update 4 "zz" - - let a4 = BankersDeque.head r4 - let t41 = BankersDeque.tail r4 - let b4 = BankersDeque.head t41 - let t42 = BankersDeque.tail t41 - let c4 = BankersDeque.head t42 - let t43 = BankersDeque.tail t42 - let d4 = BankersDeque.head t43 - let t44 = BankersDeque.tail t43 - let e4 = BankersDeque.head t44 - let t45 = BankersDeque.tail t44 - let f4 = BankersDeque.head t45 - - let r5 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BankersDeque.update 5 "zz" - - let a5 = BankersDeque.head r5 - let t51 = BankersDeque.tail r5 - let b5 = BankersDeque.head t51 - let t52 = BankersDeque.tail t51 - let c5 = BankersDeque.head t52 - let t53 = BankersDeque.tail t52 - let d5 = BankersDeque.head t53 - let t54 = BankersDeque.tail t53 - let e5 = BankersDeque.head t54 - let t55 = BankersDeque.tail t54 - let f5 = BankersDeque.head t55 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e") - && (f5 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryUpdate elements BankersDeque.length 1" { - let a = len1 |> BankersDeque.tryUpdate 0 "aa" - a.Value |> BankersDeque.head |> Expect.equal "" "aa" - } - - test "BankersDeque.tryUpdate elements BankersDeque.length 2" { - let x0 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.tryUpdate 0 "zz" - let r0 = x0.Value - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - - let x1 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.tryUpdate 1 "zz" - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryUpdate elements BankersDeque.length 3" { - let x0 = - (BankersDeque.ofSeq [ "a"; "b"; "c" ]) - |> BankersDeque.tryUpdate 0 "zz" - - let r0 = x0.Value - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let c0 = BankersDeque.head t02 - - let x1 = - (BankersDeque.ofSeq [ "a"; "b"; "c" ]) - |> BankersDeque.tryUpdate 1 "zz" - - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let c1 = BankersDeque.head t12 - - let x2 = - (BankersDeque.ofSeq [ "a"; "b"; "c" ]) - |> BankersDeque.tryUpdate 2 "zz" - - let r2 = x2.Value - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryUpdate elements BankersDeque.length 4" { - let x0 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryUpdate 0 "zz" - - let r0 = x0.Value - let a0 = BankersDeque.head r0 - let t01 = BankersDeque.tail r0 - let b0 = BankersDeque.head t01 - let t02 = BankersDeque.tail t01 - let c0 = BankersDeque.head t02 - let t03 = BankersDeque.tail t02 - let d0 = BankersDeque.head t03 - - let x1 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryUpdate 1 "zz" - - let r1 = x1.Value - let a1 = BankersDeque.head r1 - let t11 = BankersDeque.tail r1 - let b1 = BankersDeque.head t11 - let t12 = BankersDeque.tail t11 - let c1 = BankersDeque.head t12 - let t13 = BankersDeque.tail t12 - let d1 = BankersDeque.head t13 - - let x2 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryUpdate 2 "zz" - - let r2 = x2.Value - let a2 = BankersDeque.head r2 - let t21 = BankersDeque.tail r2 - let b2 = BankersDeque.head t21 - let t22 = BankersDeque.tail t21 - let c2 = BankersDeque.head t22 - let t23 = BankersDeque.tail t22 - let d2 = BankersDeque.head t23 - - let x3 = - (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BankersDeque.tryUpdate 3 "zz" - - let r3 = x3.Value - let a3 = BankersDeque.head r3 - let t31 = BankersDeque.tail r3 - let b3 = BankersDeque.head t31 - let t32 = BankersDeque.tail t31 - let c3 = BankersDeque.head t32 - let t33 = BankersDeque.tail t32 - let d3 = BankersDeque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "BankersDeque.tryUncons on BankersDeque.empty" { - let q = BankersDeque.empty 2 - (BankersDeque.tryUncons q = None) |> Expect.isTrue "" - } - - test "BankersDeque.tryUncons on q" { - let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let x, xs = (BankersDeque.tryUncons q).Value - x |> Expect.equal "" "a" - } - - test "BankersDeque.tryUnsnoc on BankersDeque.empty" { - let q = BankersDeque.empty 2 - (BankersDeque.tryUnsnoc q = None) |> Expect.isTrue "" - } - - test "BankersDeque.tryUnsnoc on q" { - let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let xs, x = (BankersDeque.tryUnsnoc q).Value - x |> Expect.equal "" "d" - } - - test "BankersDeque.tryGetHead on BankersDeque.empty" { - let q = BankersDeque.empty 2 - (BankersDeque.tryGetHead q = None) |> Expect.isTrue "" - } - - test "BankersDeque.tryGetHead on q" { - let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - (BankersDeque.tryGetHead q).Value |> Expect.equal "" "a" - } - - test "BankersDeque.tryGetInit on BankersDeque.empty" { - let q = BankersDeque.empty 2 - (BankersDeque.tryGetInit q = None) |> Expect.isTrue "" - } - - test "BankersDeque.tryGetInit on q" { - let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let x = (BankersDeque.tryGetInit q).Value - let x2 = x |> BankersDeque.last - x2 |> Expect.equal "" "c" - } - - test "BankersDeque.tryGetLast on BankersDeque.empty" { - let q = BankersDeque.empty 2 - (BankersDeque.tryGetLast q = None) |> Expect.isTrue "" - } - - test "BankersDeque.tryGetLast on q" { - let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - (BankersDeque.tryGetLast q).Value |> Expect.equal "" "d" - } - - - test "BankersDeque.tryGetTail on BankersDeque.empty" { - let q = BankersDeque.empty 2 - (BankersDeque.tryGetTail q = None) |> Expect.isTrue "" - } - - test "BankersDeque.tryGetTail on q" { - let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] - - (BankersDeque.tryGetTail q).Value - |> BankersDeque.head - |> Expect.equal "" "b" - } - ] + testList + "Experimental BankersDeque" + [ test "BankersDeque.empty dqueue should be BankersDeque.empty" { + + BankersDeque.isEmpty(BankersDeque.empty 2) |> Expect.isTrue "" + } + + test "BankersDeque.cons works" { + ((len2 |> BankersDeque.isEmpty) && (len2C3 |> BankersDeque.isEmpty)) + |> Expect.isFalse "" + } + + test "BankersDeque.snoc works" { + ((len2snoc |> BankersDeque.isEmpty) + && (len2C3snoc |> BankersDeque.isEmpty)) + |> Expect.isFalse "" + } + + test "BankersDeque.singleton BankersDeque.head works" { + (((BankersDeque.head len1) = "a") + && ((len1C3 |> BankersDeque.isEmpty)) = false) + |> Expect.isTrue "" + } + + test "BankersDeque.singleton BankersDeque.last works" { len1 |> BankersDeque.last |> Expect.equal "" "a" } + + test "BankersDeque.tail of BankersDeque.singleton BankersDeque.empty" { + len1 |> BankersDeque.tail |> BankersDeque.isEmpty |> Expect.isTrue "" + } + + test "BankersDeque.tail of BankersDeque.tail of 2 BankersDeque.empty" { + (len2 |> BankersDeque.tail |> BankersDeque.tail |> BankersDeque.isEmpty) + |> Expect.isTrue "" + } + + test "BankersDeque.init of BankersDeque.singleton BankersDeque.empty" { + ((BankersDeque.init len1) |> BankersDeque.isEmpty) |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 1" { + let t1 = BankersDeque.tail len2 + let t1C = BankersDeque.tail len2C3 + let t1s = BankersDeque.tail len2snoc + let t1Cs = BankersDeque.tail len2C3snoc + + (((BankersDeque.length t1) = 1) + && ((BankersDeque.length t1C) = 1) + && ((BankersDeque.length t1s) = 1) + && ((BankersDeque.length t1Cs) = 1) + && ((BankersDeque.head t1) = "a") + && ((BankersDeque.head t1C) = "a") + && ((BankersDeque.head t1s) = "a") + && ((BankersDeque.head t1Cs) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 2" { + let t1 = BankersDeque.tail len3 + let t1C = BankersDeque.tail len3C3 + let t1s = BankersDeque.tail len3snoc + let t1Cs = BankersDeque.tail len3C3snoc + + let t1_1 = BankersDeque.tail t1 + let t1C_1 = BankersDeque.tail t1C + let t1_1s = BankersDeque.tail t1s + let t1C_1s = BankersDeque.tail t1Cs + + (((BankersDeque.length t1) = 2) + && ((BankersDeque.length t1C) = 2) + && ((BankersDeque.length t1s) = 2) + && ((BankersDeque.length t1Cs) = 2) + && ((BankersDeque.head t1) = "b") + && ((BankersDeque.head t1C) = "b") + && ((BankersDeque.head t1s) = "b") + && ((BankersDeque.head t1Cs) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 3" { + let t1 = BankersDeque.tail len4 + let t1C = BankersDeque.tail len4C3 + let t1s = BankersDeque.tail len4snoc + let t1Cs = BankersDeque.tail len4C3snoc + + let t1_2 = BankersDeque.tail t1 + let t1C_2 = BankersDeque.tail t1C + let t1_2s = BankersDeque.tail t1s + let t1C_2s = BankersDeque.tail t1Cs + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 3) + && ((BankersDeque.length t1C) = 3) + && ((BankersDeque.length t1s) = 3) + && ((BankersDeque.length t1Cs) = 3) + && ((BankersDeque.head t1) = "c") + && ((BankersDeque.head t1C) = "c") + && ((BankersDeque.head t1s) = "c") + && ((BankersDeque.head t1Cs) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 4" { + let t1 = BankersDeque.tail len5 + let t1C = BankersDeque.tail len5C3 + let t1s = BankersDeque.tail len5snoc + let t1Cs = BankersDeque.tail len5C3snoc + + let t1_3 = BankersDeque.tail t1 + let t1C_3 = BankersDeque.tail t1C + let t1_3s = BankersDeque.tail t1s + let t1C_3s = BankersDeque.tail t1Cs + + let t1_2 = BankersDeque.tail t1_3 + let t1C_2 = BankersDeque.tail t1C_3 + let t1_2s = BankersDeque.tail t1_3s + let t1C_2s = BankersDeque.tail t1C_3s + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 4) + && ((BankersDeque.length t1C) = 4) + && ((BankersDeque.length t1s) = 4) + && ((BankersDeque.length t1Cs) = 4) + && ((BankersDeque.head t1) = "d") + && ((BankersDeque.head t1C) = "d") + && ((BankersDeque.head t1s) = "d") + && ((BankersDeque.head t1Cs) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.length t1_3s) = 3) + && ((BankersDeque.length t1C_3s) = 3) + && ((BankersDeque.head t1_3) = "c") + && ((BankersDeque.head t1C_3) = "c") + && ((BankersDeque.head t1_3s) = "c") + && ((BankersDeque.head t1C_3s) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 5" { + let t1 = BankersDeque.tail len6 + let t1C = BankersDeque.tail len6C3 + let t1s = BankersDeque.tail len6snoc + let t1Cs = BankersDeque.tail len6C3snoc + + let t1_4 = BankersDeque.tail t1 + let t1C_4 = BankersDeque.tail t1C + let t1_4s = BankersDeque.tail t1s + let t1C_4s = BankersDeque.tail t1Cs + + let t1_3 = BankersDeque.tail t1_4 + let t1C_3 = BankersDeque.tail t1C_4 + let t1_3s = BankersDeque.tail t1_4s + let t1C_3s = BankersDeque.tail t1C_4s + + let t1_2 = BankersDeque.tail t1_3 + let t1C_2 = BankersDeque.tail t1C_3 + let t1_2s = BankersDeque.tail t1_3s + let t1C_2s = BankersDeque.tail t1C_3s + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 5) + && ((BankersDeque.length t1C) = 5) + && ((BankersDeque.length t1s) = 5) + && ((BankersDeque.length t1Cs) = 5) + && ((BankersDeque.head t1) = "e") + && ((BankersDeque.head t1C) = "e") + && ((BankersDeque.head t1s) = "e") + && ((BankersDeque.head t1Cs) = "e") + && ((BankersDeque.length t1_4) = 4) + && ((BankersDeque.length t1C_4) = 4) + && ((BankersDeque.length t1_4s) = 4) + && ((BankersDeque.length t1C_4s) = 4) + && ((BankersDeque.head t1_4) = "d") + && ((BankersDeque.head t1C_4) = "d") + && ((BankersDeque.head t1_4s) = "d") + && ((BankersDeque.head t1C_4s) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.length t1_3s) = 3) + && ((BankersDeque.length t1C_3s) = 3) + && ((BankersDeque.head t1_3) = "c") + && ((BankersDeque.head t1C_3) = "c") + && ((BankersDeque.head t1_3s) = "c") + && ((BankersDeque.head t1C_3s) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 6" { + let t1 = BankersDeque.tail len7 + let t1C = BankersDeque.tail len7C3 + let t1s = BankersDeque.tail len7snoc + let t1Cs = BankersDeque.tail len7C3snoc + + let t1_5 = BankersDeque.tail t1 + let t1C_5 = BankersDeque.tail t1C + let t1_5s = BankersDeque.tail t1s + let t1C_5s = BankersDeque.tail t1Cs + + let t1_4 = BankersDeque.tail t1_5 + let t1C_4 = BankersDeque.tail t1C_5 + let t1_4s = BankersDeque.tail t1_5s + let t1C_4s = BankersDeque.tail t1C_5s + + let t1_3 = BankersDeque.tail t1_4 + let t1C_3 = BankersDeque.tail t1C_4 + let t1_3s = BankersDeque.tail t1_4s + let t1C_3s = BankersDeque.tail t1C_4s + + let t1_2 = BankersDeque.tail t1_3 + let t1C_2 = BankersDeque.tail t1C_3 + let t1_2s = BankersDeque.tail t1_3s + let t1C_2s = BankersDeque.tail t1C_3s + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 6) + && ((BankersDeque.length t1C) = 6) + && ((BankersDeque.length t1s) = 6) + && ((BankersDeque.length t1Cs) = 6) + && ((BankersDeque.head t1) = "f") + && ((BankersDeque.head t1C) = "f") + && ((BankersDeque.head t1s) = "f") + && ((BankersDeque.head t1Cs) = "f") + && ((BankersDeque.length t1_5) = 5) + && ((BankersDeque.length t1C_5) = 5) + && ((BankersDeque.length t1_5s) = 5) + && ((BankersDeque.length t1C_5s) = 5) + && ((BankersDeque.head t1_5) = "e") + && ((BankersDeque.head t1C_5) = "e") + && ((BankersDeque.head t1_5s) = "e") + && ((BankersDeque.head t1C_5s) = "e") + && ((BankersDeque.length t1_4) = 4) + && ((BankersDeque.length t1C_4) = 4) + && ((BankersDeque.length t1_4s) = 4) + && ((BankersDeque.length t1C_4s) = 4) + && ((BankersDeque.head t1_4) = "d") + && ((BankersDeque.head t1C_4) = "d") + && ((BankersDeque.head t1_4s) = "d") + && ((BankersDeque.head t1C_4s) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.length t1_3s) = 3) + && ((BankersDeque.length t1C_3s) = 3) + && ((BankersDeque.head t1_3) = "c") + && ((BankersDeque.head t1C_3) = "c") + && ((BankersDeque.head t1_3s) = "c") + && ((BankersDeque.head t1C_3s) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 7" { + let t1 = BankersDeque.tail len8 + let t1C = BankersDeque.tail len8C3 + let t1s = BankersDeque.tail len8snoc + let t1Cs = BankersDeque.tail len8C3snoc + + let t1_6 = BankersDeque.tail t1 + let t1C_6 = BankersDeque.tail t1C + let t1_6s = BankersDeque.tail t1s + let t1C_6s = BankersDeque.tail t1Cs + + let t1_5 = BankersDeque.tail t1_6 + let t1C_5 = BankersDeque.tail t1C_6 + let t1_5s = BankersDeque.tail t1_6s + let t1C_5s = BankersDeque.tail t1C_6s + + let t1_4 = BankersDeque.tail t1_5 + let t1C_4 = BankersDeque.tail t1C_5 + let t1_4s = BankersDeque.tail t1_5s + let t1C_4s = BankersDeque.tail t1C_5s + + let t1_3 = BankersDeque.tail t1_4 + let t1C_3 = BankersDeque.tail t1C_4 + let t1_3s = BankersDeque.tail t1_4s + let t1C_3s = BankersDeque.tail t1C_4s + + let t1_2 = BankersDeque.tail t1_3 + let t1C_2 = BankersDeque.tail t1C_3 + let t1_2s = BankersDeque.tail t1_3s + let t1C_2s = BankersDeque.tail t1C_3s + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 7) + && ((BankersDeque.length t1C) = 7) + && ((BankersDeque.length t1s) = 7) + && ((BankersDeque.length t1Cs) = 7) + && ((BankersDeque.head t1) = "g") + && ((BankersDeque.head t1C) = "g") + && ((BankersDeque.head t1s) = "g") + && ((BankersDeque.head t1Cs) = "g") + && ((BankersDeque.length t1_6) = 6) + && ((BankersDeque.length t1C_6) = 6) + && ((BankersDeque.length t1_6s) = 6) + && ((BankersDeque.length t1C_6s) = 6) + && ((BankersDeque.head t1_6) = "f") + && ((BankersDeque.head t1C_6) = "f") + && ((BankersDeque.head t1_6s) = "f") + && ((BankersDeque.head t1C_6s) = "f") + && ((BankersDeque.length t1_5) = 5) + && ((BankersDeque.length t1C_5) = 5) + && ((BankersDeque.length t1_5s) = 5) + && ((BankersDeque.length t1C_5s) = 5) + && ((BankersDeque.head t1_5) = "e") + && ((BankersDeque.head t1C_5) = "e") + && ((BankersDeque.head t1_5s) = "e") + && ((BankersDeque.head t1C_5s) = "e") + && ((BankersDeque.length t1_4) = 4) + && ((BankersDeque.length t1C_4) = 4) + && ((BankersDeque.length t1_4s) = 4) + && ((BankersDeque.length t1C_4s) = 4) + && ((BankersDeque.head t1_4) = "d") + && ((BankersDeque.head t1C_4) = "d") + && ((BankersDeque.head t1_4s) = "d") + && ((BankersDeque.head t1C_4s) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.length t1_3s) = 3) + && ((BankersDeque.length t1C_3s) = 3) + && ((BankersDeque.head t1_3) = "c") + && ((BankersDeque.head t1C_3) = "c") + && ((BankersDeque.head t1_3s) = "c") + && ((BankersDeque.head t1C_3s) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 8" { + let t1 = BankersDeque.tail len9 + let t1C = BankersDeque.tail len9C3 + let t1s = BankersDeque.tail len9snoc + let t1Cs = BankersDeque.tail len9C3snoc + + let t1_7 = BankersDeque.tail t1 + let t1C_7 = BankersDeque.tail t1C + let t1_7s = BankersDeque.tail t1s + let t1C_7s = BankersDeque.tail t1Cs + + let t1_6 = BankersDeque.tail t1_7 + let t1C_6 = BankersDeque.tail t1C_7 + let t1_6s = BankersDeque.tail t1_7s + let t1C_6s = BankersDeque.tail t1C_7s + + let t1_5 = BankersDeque.tail t1_6 + let t1C_5 = BankersDeque.tail t1C_6 + let t1_5s = BankersDeque.tail t1_6s + let t1C_5s = BankersDeque.tail t1C_6s + + let t1_4 = BankersDeque.tail t1_5 + let t1C_4 = BankersDeque.tail t1C_5 + let t1_4s = BankersDeque.tail t1_5s + let t1C_4s = BankersDeque.tail t1C_5s + + let t1_3 = BankersDeque.tail t1_4 + let t1C_3 = BankersDeque.tail t1C_4 + let t1_3s = BankersDeque.tail t1_4s + let t1C_3s = BankersDeque.tail t1C_4s + + let t1_2 = BankersDeque.tail t1_3 + let t1C_2 = BankersDeque.tail t1C_3 + let t1_2s = BankersDeque.tail t1_3s + let t1C_2s = BankersDeque.tail t1C_3s + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 8) + && ((BankersDeque.length t1C) = 8) + && ((BankersDeque.length t1s) = 8) + && ((BankersDeque.length t1Cs) = 8) + && ((BankersDeque.head t1) = "h") + && ((BankersDeque.head t1C) = "h") + && ((BankersDeque.head t1s) = "h") + && ((BankersDeque.head t1Cs) = "h") + && ((BankersDeque.length t1_7) = 7) + && ((BankersDeque.length t1C_7) = 7) + && ((BankersDeque.length t1_7s) = 7) + && ((BankersDeque.length t1C_7s) = 7) + && ((BankersDeque.head t1_7) = "g") + && ((BankersDeque.head t1C_7) = "g") + && ((BankersDeque.head t1_7s) = "g") + && ((BankersDeque.head t1C_7s) = "g") + && ((BankersDeque.length t1_6) = 6) + && ((BankersDeque.length t1C_6) = 6) + && ((BankersDeque.length t1_6s) = 6) + && ((BankersDeque.length t1C_6s) = 6) + && ((BankersDeque.head t1_6) = "f") + && ((BankersDeque.head t1C_6) = "f") + && ((BankersDeque.head t1_6s) = "f") + && ((BankersDeque.head t1C_6s) = "f") + && ((BankersDeque.length t1_5) = 5) + && ((BankersDeque.length t1C_5) = 5) + && ((BankersDeque.length t1_5s) = 5) + && ((BankersDeque.length t1C_5s) = 5) + && ((BankersDeque.head t1_5) = "e") + && ((BankersDeque.head t1C_5) = "e") + && ((BankersDeque.head t1_5s) = "e") + && ((BankersDeque.head t1C_5s) = "e") + && ((BankersDeque.length t1_4) = 4) + && ((BankersDeque.length t1C_4) = 4) + && ((BankersDeque.length t1_4s) = 4) + && ((BankersDeque.length t1C_4s) = 4) + && ((BankersDeque.head t1_4) = "d") + && ((BankersDeque.head t1C_4) = "d") + && ((BankersDeque.head t1_4s) = "d") + && ((BankersDeque.head t1C_4s) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.length t1_3s) = 3) + && ((BankersDeque.length t1C_3s) = 3) + && ((BankersDeque.head t1_3) = "c") + && ((BankersDeque.head t1C_3) = "c") + && ((BankersDeque.head t1_3s) = "c") + && ((BankersDeque.head t1C_3s) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.head, BankersDeque.tail, and BankersDeque.length work test 9" { + let t1 = BankersDeque.tail lena + let t1C = BankersDeque.tail lenaC3 + let t1s = BankersDeque.tail lenasnoc + let t1Cs = BankersDeque.tail lenaC3snoc + + let t1_8 = BankersDeque.tail t1 + let t1C_8 = BankersDeque.tail t1C + let t1_8s = BankersDeque.tail t1s + let t1C_8s = BankersDeque.tail t1Cs + + let t1_7 = BankersDeque.tail t1_8 + let t1C_7 = BankersDeque.tail t1C_8 + let t1_7s = BankersDeque.tail t1_8s + let t1C_7s = BankersDeque.tail t1C_8s + + let t1_6 = BankersDeque.tail t1_7 + let t1C_6 = BankersDeque.tail t1C_7 + let t1_6s = BankersDeque.tail t1_7s + let t1C_6s = BankersDeque.tail t1C_7s + + let t1_5 = BankersDeque.tail t1_6 + let t1C_5 = BankersDeque.tail t1C_6 + let t1_5s = BankersDeque.tail t1_6s + let t1C_5s = BankersDeque.tail t1C_6s + + let t1_4 = BankersDeque.tail t1_5 + let t1C_4 = BankersDeque.tail t1C_5 + let t1_4s = BankersDeque.tail t1_5s + let t1C_4s = BankersDeque.tail t1C_5s + + let t1_3 = BankersDeque.tail t1_4 + let t1C_3 = BankersDeque.tail t1C_4 + let t1_3s = BankersDeque.tail t1_4s + let t1C_3s = BankersDeque.tail t1C_4s + + let t1_2 = BankersDeque.tail t1_3 + let t1C_2 = BankersDeque.tail t1C_3 + let t1_2s = BankersDeque.tail t1_3s + let t1C_2s = BankersDeque.tail t1C_3s + + let t1_1 = BankersDeque.tail t1_2 + let t1C_1 = BankersDeque.tail t1C_2 + let t1_1s = BankersDeque.tail t1_2s + let t1C_1s = BankersDeque.tail t1C_2s + + (((BankersDeque.length t1) = 9) + && ((BankersDeque.length t1C) = 9) + && ((BankersDeque.length t1s) = 9) + && ((BankersDeque.length t1Cs) = 9) + && ((BankersDeque.head t1) = "i") + && ((BankersDeque.head t1C) = "i") + && ((BankersDeque.head t1s) = "i") + && ((BankersDeque.head t1Cs) = "i") + && ((BankersDeque.length t1_8) = 8) + && ((BankersDeque.length t1C_8) = 8) + && ((BankersDeque.length t1_8s) = 8) + && ((BankersDeque.length t1C_8s) = 8) + && ((BankersDeque.head t1_8) = "h") + && ((BankersDeque.head t1C_8) = "h") + && ((BankersDeque.head t1_8s) = "h") + && ((BankersDeque.head t1C_8s) = "h") + && ((BankersDeque.length t1_7) = 7) + && ((BankersDeque.length t1C_7) = 7) + && ((BankersDeque.length t1_7s) = 7) + && ((BankersDeque.length t1C_7s) = 7) + && ((BankersDeque.head t1_7) = "g") + && ((BankersDeque.head t1C_7) = "g") + && ((BankersDeque.head t1_7s) = "g") + && ((BankersDeque.head t1C_7s) = "g") + && ((BankersDeque.length t1_6) = 6) + && ((BankersDeque.length t1C_6) = 6) + && ((BankersDeque.length t1_6s) = 6) + && ((BankersDeque.length t1C_6s) = 6) + && ((BankersDeque.head t1_6) = "f") + && ((BankersDeque.head t1C_6) = "f") + && ((BankersDeque.head t1_6s) = "f") + && ((BankersDeque.head t1C_6s) = "f") + && ((BankersDeque.length t1_5) = 5) + && ((BankersDeque.length t1C_5) = 5) + && ((BankersDeque.length t1_5s) = 5) + && ((BankersDeque.length t1C_5s) = 5) + && ((BankersDeque.head t1_5) = "e") + && ((BankersDeque.head t1C_5) = "e") + && ((BankersDeque.head t1_5s) = "e") + && ((BankersDeque.head t1C_5s) = "e") + && ((BankersDeque.length t1_4) = 4) + && ((BankersDeque.length t1C_4) = 4) + && ((BankersDeque.length t1_4s) = 4) + && ((BankersDeque.length t1C_4s) = 4) + && ((BankersDeque.head t1_4) = "d") + && ((BankersDeque.head t1C_4) = "d") + && ((BankersDeque.head t1_4s) = "d") + && ((BankersDeque.head t1C_4s) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.length t1_3s) = 3) + && ((BankersDeque.length t1C_3s) = 3) + && ((BankersDeque.head t1_3) = "c") + && ((BankersDeque.head t1C_3) = "c") + && ((BankersDeque.head t1_3s) = "c") + && ((BankersDeque.head t1C_3s) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.length t1_2s) = 2) + && ((BankersDeque.length t1C_2s) = 2) + && ((BankersDeque.head t1_2) = "b") + && ((BankersDeque.head t1C_2) = "b") + && ((BankersDeque.head t1_2s) = "b") + && ((BankersDeque.head t1C_2s) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.length t1_1s) = 1) + && ((BankersDeque.length t1C_1s) = 1) + && ((BankersDeque.head t1_1) = "a") + && ((BankersDeque.head t1C_1) = "a") + && ((BankersDeque.head t1_1s) = "a") + && ((BankersDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + //the previous series thoroughly tested construction by BankersDeque.snoc, so we'll leave those out + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 1" { + let t1 = BankersDeque.init len2 + let t1C = BankersDeque.init len2C3 + + (((BankersDeque.length t1) = 1) + && ((BankersDeque.length t1C) = 1) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 2" { + let t1 = BankersDeque.init len3 + let t1C = BankersDeque.init len3C3 + + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + + (((BankersDeque.length t1) = 2) + && ((BankersDeque.length t1C) = 2) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 1) + && ((BankersDeque.length t1C_1) = 1) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 3" { + let t1 = BankersDeque.init len4 + let t1C = BankersDeque.init len4C3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + + (((BankersDeque.length t1) = 3) + && ((BankersDeque.length t1C) = 3) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 2) + && ((BankersDeque.length t1C_1) = 2) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 1) + && ((BankersDeque.length t1C_2) = 1) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 4" { + let t1 = BankersDeque.init len5 + let t1C = BankersDeque.init len5C3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + let t1_3 = BankersDeque.init t1_2 + let t1C_3 = BankersDeque.init t1C_2 + + (((BankersDeque.length t1) = 4) + && ((BankersDeque.length t1C) = 4) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 3) + && ((BankersDeque.length t1C_1) = 3) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 2) + && ((BankersDeque.length t1C_2) = 2) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d") + && ((BankersDeque.length t1_3) = 1) + && ((BankersDeque.length t1C_3) = 1) + && ((BankersDeque.last t1_3) = "e") + && ((BankersDeque.last t1C_3) = "e")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 5" { + let t1 = BankersDeque.init len6 + let t1C = BankersDeque.init len6C3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + let t1_3 = BankersDeque.init t1_2 + let t1C_3 = BankersDeque.init t1C_2 + let t1_4 = BankersDeque.init t1_3 + let t1C_4 = BankersDeque.init t1C_3 + + (((BankersDeque.length t1) = 5) + && ((BankersDeque.length t1C) = 5) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 4) + && ((BankersDeque.length t1C_1) = 4) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 3) + && ((BankersDeque.length t1C_2) = 3) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d") + && ((BankersDeque.length t1_3) = 2) + && ((BankersDeque.length t1C_3) = 2) + && ((BankersDeque.last t1_3) = "e") + && ((BankersDeque.last t1C_3) = "e") + && ((BankersDeque.length t1_4) = 1) + && ((BankersDeque.length t1C_4) = 1) + && ((BankersDeque.last t1_4) = "f") + && ((BankersDeque.last t1C_4) = "f")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 6" { + let t1 = BankersDeque.init len7 + let t1C = BankersDeque.init len7C3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + let t1_3 = BankersDeque.init t1_2 + let t1C_3 = BankersDeque.init t1C_2 + let t1_4 = BankersDeque.init t1_3 + let t1C_4 = BankersDeque.init t1C_3 + let t1_5 = BankersDeque.init t1_4 + let t1C_5 = BankersDeque.init t1C_4 + + (((BankersDeque.length t1) = 6) + && ((BankersDeque.length t1C) = 6) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 5) + && ((BankersDeque.length t1C_1) = 5) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 4) + && ((BankersDeque.length t1C_2) = 4) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d") + && ((BankersDeque.length t1_3) = 3) + && ((BankersDeque.length t1C_3) = 3) + && ((BankersDeque.last t1_3) = "e") + && ((BankersDeque.last t1C_3) = "e") + && ((BankersDeque.length t1_4) = 2) + && ((BankersDeque.length t1C_4) = 2) + && ((BankersDeque.last t1_4) = "f") + && ((BankersDeque.last t1C_4) = "f") + && ((BankersDeque.length t1_5) = 1) + && ((BankersDeque.length t1C_5) = 1) + && ((BankersDeque.last t1_5) = "g") + && ((BankersDeque.last t1C_5) = "g")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 7" { + let t1 = BankersDeque.init len8 + let t1C = BankersDeque.init len8C3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + let t1_3 = BankersDeque.init t1_2 + let t1C_3 = BankersDeque.init t1C_2 + let t1_4 = BankersDeque.init t1_3 + let t1C_4 = BankersDeque.init t1C_3 + let t1_5 = BankersDeque.init t1_4 + let t1C_5 = BankersDeque.init t1C_4 + let t1_6 = BankersDeque.init t1_5 + let t1C_6 = BankersDeque.init t1C_5 + + (((BankersDeque.length t1) = 7) + && ((BankersDeque.length t1C) = 7) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 6) + && ((BankersDeque.length t1C_1) = 6) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 5) + && ((BankersDeque.length t1C_2) = 5) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d") + && ((BankersDeque.length t1_3) = 4) + && ((BankersDeque.length t1C_3) = 4) + && ((BankersDeque.last t1_3) = "e") + && ((BankersDeque.last t1C_3) = "e") + && ((BankersDeque.length t1_4) = 3) + && ((BankersDeque.length t1C_4) = 3) + && ((BankersDeque.last t1_4) = "f") + && ((BankersDeque.last t1C_4) = "f") + && ((BankersDeque.length t1_5) = 2) + && ((BankersDeque.length t1C_5) = 2) + && ((BankersDeque.last t1_5) = "g") + && ((BankersDeque.last t1C_5) = "g") + && ((BankersDeque.length t1_6) = 1) + && ((BankersDeque.length t1C_6) = 1) + && ((BankersDeque.last t1_6) = "h") + && ((BankersDeque.last t1C_6) = "h")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 8" { + let t1 = BankersDeque.init len9 + let t1C = BankersDeque.init len9C3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + let t1_3 = BankersDeque.init t1_2 + let t1C_3 = BankersDeque.init t1C_2 + let t1_4 = BankersDeque.init t1_3 + let t1C_4 = BankersDeque.init t1C_3 + let t1_5 = BankersDeque.init t1_4 + let t1C_5 = BankersDeque.init t1C_4 + let t1_6 = BankersDeque.init t1_5 + let t1C_6 = BankersDeque.init t1C_5 + let t1_7 = BankersDeque.init t1_6 + let t1C_7 = BankersDeque.init t1C_6 + + (((BankersDeque.length t1) = 8) + && ((BankersDeque.length t1C) = 8) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 7) + && ((BankersDeque.length t1C_1) = 7) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 6) + && ((BankersDeque.length t1C_2) = 6) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d") + && ((BankersDeque.length t1_3) = 5) + && ((BankersDeque.length t1C_3) = 5) + && ((BankersDeque.last t1_3) = "e") + && ((BankersDeque.last t1C_3) = "e") + && ((BankersDeque.length t1_4) = 4) + && ((BankersDeque.length t1C_4) = 4) + && ((BankersDeque.last t1_4) = "f") + && ((BankersDeque.last t1C_4) = "f") + && ((BankersDeque.length t1_5) = 3) + && ((BankersDeque.length t1C_5) = 3) + && ((BankersDeque.last t1_5) = "g") + && ((BankersDeque.last t1C_5) = "g") + && ((BankersDeque.length t1_6) = 2) + && ((BankersDeque.length t1C_6) = 2) + && ((BankersDeque.last t1_6) = "h") + && ((BankersDeque.last t1C_6) = "h") + && ((BankersDeque.length t1_7) = 1) + && ((BankersDeque.length t1C_7) = 1) + && ((BankersDeque.last t1_7) = "i") + && ((BankersDeque.last t1C_7) = "i")) + |> Expect.isTrue "" + } + + test "BankersDeque.last, BankersDeque.init, and BankersDeque.length work test 9" { + let t1 = BankersDeque.init lena + let t1C = BankersDeque.init lenaC3 + let t1_1 = BankersDeque.init t1 + let t1C_1 = BankersDeque.init t1C + let t1_2 = BankersDeque.init t1_1 + let t1C_2 = BankersDeque.init t1C_1 + let t1_3 = BankersDeque.init t1_2 + let t1C_3 = BankersDeque.init t1C_2 + let t1_4 = BankersDeque.init t1_3 + let t1C_4 = BankersDeque.init t1C_3 + let t1_5 = BankersDeque.init t1_4 + let t1C_5 = BankersDeque.init t1C_4 + let t1_6 = BankersDeque.init t1_5 + let t1C_6 = BankersDeque.init t1C_5 + let t1_7 = BankersDeque.init t1_6 + let t1C_7 = BankersDeque.init t1C_6 + let t1_8 = BankersDeque.init t1_7 + let t1C_8 = BankersDeque.init t1C_7 + + (((BankersDeque.length t1) = 9) + && ((BankersDeque.length t1C) = 9) + && ((BankersDeque.last t1) = "b") + && ((BankersDeque.last t1C) = "b") + && ((BankersDeque.length t1_1) = 8) + && ((BankersDeque.length t1C_1) = 8) + && ((BankersDeque.last t1_1) = "c") + && ((BankersDeque.last t1C_1) = "c") + && ((BankersDeque.length t1_2) = 7) + && ((BankersDeque.length t1C_2) = 7) + && ((BankersDeque.last t1_2) = "d") + && ((BankersDeque.last t1C_2) = "d") + && ((BankersDeque.length t1_3) = 6) + && ((BankersDeque.length t1C_3) = 6) + && ((BankersDeque.last t1_3) = "e") + && ((BankersDeque.last t1C_3) = "e") + && ((BankersDeque.length t1_4) = 5) + && ((BankersDeque.length t1C_4) = 5) + && ((BankersDeque.last t1_4) = "f") + && ((BankersDeque.last t1C_4) = "f") + && ((BankersDeque.length t1_5) = 4) + && ((BankersDeque.length t1C_5) = 4) + && ((BankersDeque.last t1_5) = "g") + && ((BankersDeque.last t1C_5) = "g") + && ((BankersDeque.length t1_6) = 3) + && ((BankersDeque.length t1C_6) = 3) + && ((BankersDeque.last t1_6) = "h") + && ((BankersDeque.last t1C_6) = "h") + && ((BankersDeque.length t1_7) = 2) + && ((BankersDeque.length t1C_7) = 2) + && ((BankersDeque.last t1_7) = "i") + && ((BankersDeque.last t1C_7) = "i") + && ((BankersDeque.length t1_8) = 1) + && ((BankersDeque.length t1C_8) = 1) + && ((BankersDeque.last t1_8) = "j") + && ((BankersDeque.last t1C_8) = "j")) + |> Expect.isTrue "" + } + + test "IEnumerable Seq" { (lena |> Seq.toArray).[5] |> Expect.equal "" "e" } + + test "IEnumerable Seq BankersDeque.length" { lena |> Seq.length |> Expect.equal "" 10 } + + test "type BankersDeque.cons works" { lena.Cons "zz" |> BankersDeque.head |> Expect.equal "" "zz" } + + test "IDeque BankersDeque.cons works" { ((lena :> IDeque).Cons "zz").Head |> Expect.equal "" "zz" } + + test "BankersDeque.ofCatLists and BankersDeque.uncons" { + let d = BankersDeque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] + let h1, t1 = BankersDeque.uncons d + let h2, t2 = BankersDeque.uncons t1 + let h3, t3 = BankersDeque.uncons t2 + let h4, t4 = BankersDeque.uncons t3 + let h5, t5 = BankersDeque.uncons t4 + let h6, t6 = BankersDeque.uncons t5 + + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f") + && (BankersDeque.isEmpty t6)) + |> Expect.isTrue "" + } + + test "BankersDeque.ofCatSeqs and BankersDeque.uncons" { + let d = BankersDeque.ofCatSeqs (seq { 'a' .. 'c' }) (seq { 'd' .. 'f' }) + let h1, t1 = BankersDeque.uncons d + let h2, t2 = BankersDeque.uncons t1 + let h3, t3 = BankersDeque.uncons t2 + let h4, t4 = BankersDeque.uncons t3 + let h5, t5 = BankersDeque.uncons t4 + let h6, t6 = BankersDeque.uncons t5 + + ((h1 = 'a') + && (h2 = 'b') + && (h3 = 'c') + && (h4 = 'd') + && (h5 = 'e') + && (h6 = 'f') + && (BankersDeque.isEmpty t6)) + |> Expect.isTrue "" + } + + test "BankersDeque.unsnoc works" { + let d = BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] + let i1, l1 = BankersDeque.unsnoc d + let i2, l2 = BankersDeque.unsnoc i1 + let i3, l3 = BankersDeque.unsnoc i2 + let i4, l4 = BankersDeque.unsnoc i3 + let i5, l5 = BankersDeque.unsnoc i4 + let i6, l6 = BankersDeque.unsnoc i5 + + ((l1 = "a") + && (l2 = "b") + && (l3 = "c") + && (l4 = "d") + && (l5 = "e") + && (l6 = "f") + && (BankersDeque.isEmpty i6)) + |> Expect.isTrue "" + } + + test "BankersDeque.snoc pattern discriminator" { + let d = (BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let i1, l1 = BankersDeque.unsnoc d + + let i2, l2 = + match i1 with + | BankersDeque.Snoc(i, l) -> i, l + | _ -> i1, "x" + + ((l2 = "b") && ((BankersDeque.length i2) = 4)) |> Expect.isTrue "" + } + + test "BankersDeque.cons pattern discriminator" { + let d = (BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let h1, t1 = BankersDeque.uncons d + + let h2, t2 = + match t1 with + | BankersDeque.Cons(h, t) -> h, t + | _ -> "x", t1 + + ((h2 = "e") && ((BankersDeque.length t2) = 4)) |> Expect.isTrue "" + } + + test "BankersDeque.cons and BankersDeque.snoc pattern discriminator" { + let d = (BankersDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + + let mid1 = + match d with + | BankersDeque.Cons(h, BankersDeque.Snoc(i, l)) -> i + | _ -> d + + let head, last = + match mid1 with + | BankersDeque.Cons(h, BankersDeque.Snoc(i, l)) -> h, l + | _ -> "x", "x" + + ((head = "e") && (last = "b")) |> Expect.isTrue "" + } + + test "BankersDeque.rev BankersDeque.empty dqueue should be BankersDeque.empty" { + BankersDeque.isEmpty(BankersDeque.rev(BankersDeque.empty 2)) + |> Expect.isTrue "" + } + + test "BankersDeque.rev dqueue BankersDeque.length 1" { + ((BankersDeque.head(BankersDeque.rev len1) = "a") + && (BankersDeque.head(BankersDeque.rev len1C3) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.rev dqueue BankersDeque.length 2" { + let r1 = BankersDeque.rev len2 + let r1c = BankersDeque.rev len2C3 + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + + ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) + |> Expect.isTrue "" + } + + test "BankersDeque.rev dqueue BankersDeque.length 3" { + let r1 = BankersDeque.rev len3 + let r1c = BankersDeque.rev len3C3 + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c")) + |> Expect.isTrue "" + } + + test "BankersDeque.rev dqueue BankersDeque.length 4" { + let r1 = BankersDeque.rev len4 + let r1c = BankersDeque.rev len4C3 + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d")) + |> Expect.isTrue "" + } + + test "BankersDeque.rev dqueue BankersDeque.length 5" { + let r1 = BankersDeque.rev len5 + let r1c = BankersDeque.rev len5C3 + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e")) + |> Expect.isTrue "" + } + + //BankersDeque.length 6 more than sufficient to test BankersDeque.rev + test "BankersDeque.rev dqueue BankersDeque.length 6" { + let r1 = BankersDeque.rev len6 + let r1c = BankersDeque.rev len6C3 + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f")) + |> Expect.isTrue "" + } + + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.empty" { + ((BankersDeque.isEmpty(BankersDeque.ofSeq [])) + && (BankersDeque.isEmpty(BankersDeque.ofSeqC 3 []))) + |> Expect.isTrue "" + } + + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 1" { + ((BankersDeque.head(BankersDeque.ofSeq [ "a" ]) = "a") + && (BankersDeque.head(BankersDeque.ofSeqC 3 [ "a" ]) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 2" { + let r1 = BankersDeque.ofSeq [ "a"; "b" ] + let r1c = BankersDeque.ofSeqC 3 [ "a"; "b" ] + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + + ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) + |> Expect.isTrue "" + } + + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 3" { + let r1 = BankersDeque.ofSeq [ "a"; "b"; "c" ] + let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ] + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c")) + |> Expect.isTrue "" + } + + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 4" { + let r1 = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ] + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d")) + |> Expect.isTrue "" + } + + //BankersDeque.length 5 more than sufficient to test BankersDeque.ofSeq and BankersDeque.ofSeqC + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 5" { + let r1 = BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ] + let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ] + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e")) + |> Expect.isTrue "" + } + + //BankersDeque.length 5 more than sufficient to test BankersDeque.ofSeq and BankersDeque.ofSeqC + test "BankersDeque.ofSeq and BankersDeque.ofSeqC BankersDeque.length 6" { + let r1 = BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ] + let r1c = BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ] + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.empty dqueus" { + ((BankersDeque.isEmpty(BankersDeque.append (BankersDeque.ofSeq []) (BankersDeque.ofSeq []))) + && (BankersDeque.isEmpty(BankersDeque.append (BankersDeque.empty 3) (BankersDeque.empty 3)))) + |> Expect.isTrue "" + } + + test "appending BankersDeque.empty and BankersDeque.length 1" { + ((BankersDeque.head(BankersDeque.append (BankersDeque.ofSeq []) len1) = "a") + && (BankersDeque.head(BankersDeque.append len1 (BankersDeque.empty 3)) = "a")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.empty and BankersDeque.length 2" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq []) (BankersDeque.ofSeq [ "a"; "b" ]) + + let r1c = + BankersDeque.append (BankersDeque.empty 3) (BankersDeque.ofSeqC 3 [ "a"; "b" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq []) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.empty 3) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 1 and BankersDeque.length 2" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 1 and BankersDeque.length 3" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c"; "d" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c"; "d" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c" ]) (BankersDeque.ofSeq [ "d" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (BankersDeque.ofSeqC 3 [ "d" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 1 and BankersDeque.length 4" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c"; "d"; "e" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c"; "d"; "e" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeq [ "e" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeqC 3 [ "e" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + + let t5r = BankersDeque.tail t4r + let t5cr = BankersDeque.tail t4cr + let h5r = BankersDeque.head t5r + let h5cr = BankersDeque.head t5cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 1 and BankersDeque.length 5" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a" ]) (BankersDeque.ofSeq [ "b"; "c"; "d"; "e"; "f" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a" ]) (BankersDeque.ofSeqC 3 [ "b"; "c"; "d"; "e"; "f" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeq [ "f" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeqC 3 [ "f" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + let t5r = BankersDeque.tail t4r + let t5cr = BankersDeque.tail t4cr + let h5r = BankersDeque.head t5r + let h5cr = BankersDeque.head t5cr + let t6r = BankersDeque.tail t5r + let t6cr = BankersDeque.tail t5cr + let h6r = BankersDeque.head t6r + let h6cr = BankersDeque.head t6cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 6 and BankersDeque.length 7" { + let r1 = + BankersDeque.append + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + (BankersDeque.ofSeq [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) + + let r1c = + BankersDeque.append + (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ]) + (BankersDeque.ofSeqC 3 [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + let t7 = BankersDeque.tail t6 + let t7c = BankersDeque.tail t6c + let h7 = BankersDeque.head t7 + let h7c = BankersDeque.head t7c + let h7 = BankersDeque.head t7 + let h7c = BankersDeque.head t7c + let t8 = BankersDeque.tail t7 + let t8c = BankersDeque.tail t7c + let h8 = BankersDeque.head t8 + let h8c = BankersDeque.head t8c + let h8 = BankersDeque.head t8 + let h8c = BankersDeque.head t8c + let t9 = BankersDeque.tail t8 + let t9c = BankersDeque.tail t8c + let h9 = BankersDeque.head t9 + let h9c = BankersDeque.head t9c + let h9 = BankersDeque.head t9 + let h9c = BankersDeque.head t9c + let t10 = BankersDeque.tail t9 + let t10c = BankersDeque.tail t9c + let h10 = BankersDeque.head t10 + let h10c = BankersDeque.head t10c + let h10 = BankersDeque.head t10 + let h10c = BankersDeque.head t10c + let t11 = BankersDeque.tail t10 + let t11c = BankersDeque.tail t10c + let h11 = BankersDeque.head t11 + let h11c = BankersDeque.head t11c + let h11 = BankersDeque.head t11 + let h11c = BankersDeque.head t11c + let t12 = BankersDeque.tail t11 + let t12c = BankersDeque.tail t11c + let h12 = BankersDeque.head t12 + let h12c = BankersDeque.head t12c + let h12 = BankersDeque.head t12 + let h12c = BankersDeque.head t12c + let t13 = BankersDeque.tail t12 + let t13c = BankersDeque.tail t12c + let h13 = BankersDeque.head t13 + let h13c = BankersDeque.head t13c + let h13 = BankersDeque.head t13 + let h13c = BankersDeque.head t13c + + let r1r = + BankersDeque.append + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) + (BankersDeque.ofSeq [ "h"; "i"; "j"; "k"; "l"; "m" ]) + + let r1cr = + BankersDeque.append + (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) + (BankersDeque.ofSeqC 3 [ "h"; "i"; "j"; "k"; "l"; "m" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + let t5r = BankersDeque.tail t4r + let t5cr = BankersDeque.tail t4cr + let h5r = BankersDeque.head t5r + let h5cr = BankersDeque.head t5cr + let t6r = BankersDeque.tail t5r + let t6cr = BankersDeque.tail t5cr + let h6r = BankersDeque.head t6r + let h6cr = BankersDeque.head t6cr + let t7r = BankersDeque.tail t6r + let t7cr = BankersDeque.tail t6cr + let h7r = BankersDeque.head t7r + let h7cr = BankersDeque.head t7cr + let h7r = BankersDeque.head t7r + let h7cr = BankersDeque.head t7cr + let t8r = BankersDeque.tail t7r + let t8cr = BankersDeque.tail t7cr + let h8r = BankersDeque.head t8r + let h8cr = BankersDeque.head t8cr + let h8r = BankersDeque.head t8r + let h8cr = BankersDeque.head t8cr + let t9r = BankersDeque.tail t8r + let t9cr = BankersDeque.tail t8cr + let h9r = BankersDeque.head t9r + let h9cr = BankersDeque.head t9cr + let h9r = BankersDeque.head t9r + let h9cr = BankersDeque.head t9cr + let t10r = BankersDeque.tail t9r + let t10cr = BankersDeque.tail t9cr + let h10r = BankersDeque.head t10r + let h10cr = BankersDeque.head t10cr + let h10r = BankersDeque.head t10r + let h10cr = BankersDeque.head t10cr + let t11r = BankersDeque.tail t10r + let t11cr = BankersDeque.tail t10cr + let h11r = BankersDeque.head t11r + let h11cr = BankersDeque.head t11cr + let h11r = BankersDeque.head t11r + let h11cr = BankersDeque.head t11cr + let t12r = BankersDeque.tail t11r + let t12cr = BankersDeque.tail t11cr + let h12r = BankersDeque.head t12r + let h12cr = BankersDeque.head t12cr + let h12r = BankersDeque.head t12r + let h12cr = BankersDeque.head t12cr + let t13r = BankersDeque.tail t12r + let t13cr = BankersDeque.tail t12cr + let h13r = BankersDeque.head t13r + let h13cr = BankersDeque.head t13cr + let h13r = BankersDeque.head t13r + let h13cr = BankersDeque.head t13cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h7 = "g") + && (h7c = "g") + && (h8 = "h") + && (h8c = "h") + && (h9 = "i") + && (h9c = "i") + && (h10 = "j") + && (h10c = "j") + && (h11 = "k") + && (h11c = "k") + && (h12 = "l") + && (h12c = "l") + && (h13 = "m") + && (h13c = "m") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f") + && (h7r = "g") + && (h7cr = "g") + && (h8r = "h") + && (h8cr = "h") + && (h9r = "i") + && (h9cr = "i") + && (h10r = "j") + && (h10cr = "j") + && (h11r = "k") + && (h11cr = "k") + && (h12r = "l") + && (h12cr = "l") + && (h13r = "m") + && (h13cr = "m")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 2 and BankersDeque.length 2" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 2 and BankersDeque.length 3" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d"; "e" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d"; "e" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c" ]) (BankersDeque.ofSeq [ "d"; "e" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (BankersDeque.ofSeqC 3 [ "d"; "e" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + + let t5r = BankersDeque.tail t4r + let t5cr = BankersDeque.tail t4cr + let h5r = BankersDeque.head t5r + let h5cr = BankersDeque.head t5cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 2 and BankersDeque.length 4" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d"; "e"; "f" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d"; "e"; "f" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeq [ "e"; "f" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (BankersDeque.ofSeqC 3 [ "e"; "f" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + let t5r = BankersDeque.tail t4r + let t5cr = BankersDeque.tail t4cr + let h5r = BankersDeque.head t5r + let h5cr = BankersDeque.head t5cr + let t6r = BankersDeque.tail t5r + let t6cr = BankersDeque.tail t5cr + let h6r = BankersDeque.head t6r + let h6cr = BankersDeque.head t6cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 2 and BankersDeque.length 5" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b" ]) (BankersDeque.ofSeq [ "c"; "d"; "e"; "f"; "g" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b" ]) (BankersDeque.ofSeqC 3 [ "c"; "d"; "e"; "f"; "g" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + let t7 = BankersDeque.tail t6 + let t7c = BankersDeque.tail t6c + let h7 = BankersDeque.head t7 + let h7c = BankersDeque.head t7c + + let r1r = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeq [ "f"; "g" ]) + + let r1cr = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (BankersDeque.ofSeqC 3 [ "f"; "g" ]) + + let h1r = BankersDeque.head r1r + let h1cr = BankersDeque.head r1cr + let t2r = BankersDeque.tail r1r + let t2cr = BankersDeque.tail r1cr + let h2r = BankersDeque.head t2r + let h2cr = BankersDeque.head t2cr + let t3r = BankersDeque.tail t2r + let t3cr = BankersDeque.tail t2cr + let h3r = BankersDeque.head t3r + let h3cr = BankersDeque.head t3cr + let t4r = BankersDeque.tail t3r + let t4cr = BankersDeque.tail t3cr + let h4r = BankersDeque.head t4r + let h4cr = BankersDeque.head t4cr + let t5r = BankersDeque.tail t4r + let t5cr = BankersDeque.tail t4cr + let h5r = BankersDeque.head t5r + let h5cr = BankersDeque.head t5cr + let t6r = BankersDeque.tail t5r + let t6cr = BankersDeque.tail t5cr + let h6r = BankersDeque.head t6r + let h6cr = BankersDeque.head t6cr + let t7r = BankersDeque.tail t6r + let t7cr = BankersDeque.tail t6cr + let h7r = BankersDeque.head t7r + let h7cr = BankersDeque.head t7cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h7 = "g") + && (h7c = "g") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f") + && (h7r = "g") + && (h7cr = "g")) + |> Expect.isTrue "" + } + + test "appending BankersDeque.length 3 and BankersDeque.length 3" { + let r1 = + BankersDeque.append (BankersDeque.ofSeq [ "a"; "b"; "c" ]) (BankersDeque.ofSeq [ "d"; "e"; "f" ]) + + let r1c = + BankersDeque.append (BankersDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (BankersDeque.ofSeqC 3 [ "d"; "e"; "f" ]) + + let h1 = BankersDeque.head r1 + let h1c = BankersDeque.head r1c + let t2 = BankersDeque.tail r1 + let t2c = BankersDeque.tail r1c + let h2 = BankersDeque.head t2 + let h2c = BankersDeque.head t2c + let t3 = BankersDeque.tail t2 + let t3c = BankersDeque.tail t2c + let h3 = BankersDeque.head t3 + let h3c = BankersDeque.head t3c + let t4 = BankersDeque.tail t3 + let t4c = BankersDeque.tail t3c + let h4 = BankersDeque.head t4 + let h4c = BankersDeque.head t4c + let t5 = BankersDeque.tail t4 + let t5c = BankersDeque.tail t4c + let h5 = BankersDeque.head t5 + let h5c = BankersDeque.head t5c + let t6 = BankersDeque.tail t5 + let t6c = BankersDeque.tail t5c + let h6 = BankersDeque.head t6 + let h6c = BankersDeque.head t6c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f")) + |> Expect.isTrue "" + } + + + test "BankersDeque.lookup BankersDeque.length 1" { len1 |> BankersDeque.lookup 0 |> Expect.equal "" "a" } + + test "BankersDeque.lookup BankersDeque.length 2" { + (((len2 |> BankersDeque.lookup 0) = "b") + && ((len2 |> BankersDeque.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 3" { + (((len3 |> BankersDeque.lookup 0) = "c") + && ((len3 |> BankersDeque.lookup 1) = "b") + && ((len3 |> BankersDeque.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 4" { + (((len4 |> BankersDeque.lookup 0) = "d") + && ((len4 |> BankersDeque.lookup 1) = "c") + && ((len4 |> BankersDeque.lookup 2) = "b") + && ((len4 |> BankersDeque.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 5" { + (((len5 |> BankersDeque.lookup 0) = "e") + && ((len5 |> BankersDeque.lookup 1) = "d") + && ((len5 |> BankersDeque.lookup 2) = "c") + && ((len5 |> BankersDeque.lookup 3) = "b") + && ((len5 |> BankersDeque.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 6" { + (((len6 |> BankersDeque.lookup 0) = "f") + && ((len6 |> BankersDeque.lookup 1) = "e") + && ((len6 |> BankersDeque.lookup 2) = "d") + && ((len6 |> BankersDeque.lookup 3) = "c") + && ((len6 |> BankersDeque.lookup 4) = "b") + && ((len6 |> BankersDeque.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 7" { + (((len7 |> BankersDeque.lookup 0) = "g") + && ((len7 |> BankersDeque.lookup 1) = "f") + && ((len7 |> BankersDeque.lookup 2) = "e") + && ((len7 |> BankersDeque.lookup 3) = "d") + && ((len7 |> BankersDeque.lookup 4) = "c") + && ((len7 |> BankersDeque.lookup 5) = "b") + && ((len7 |> BankersDeque.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 8" { + (((len8 |> BankersDeque.lookup 0) = "h") + && ((len8 |> BankersDeque.lookup 1) = "g") + && ((len8 |> BankersDeque.lookup 2) = "f") + && ((len8 |> BankersDeque.lookup 3) = "e") + && ((len8 |> BankersDeque.lookup 4) = "d") + && ((len8 |> BankersDeque.lookup 5) = "c") + && ((len8 |> BankersDeque.lookup 6) = "b") + && ((len8 |> BankersDeque.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 9" { + (((len9 |> BankersDeque.lookup 0) = "i") + && ((len9 |> BankersDeque.lookup 1) = "h") + && ((len9 |> BankersDeque.lookup 2) = "g") + && ((len9 |> BankersDeque.lookup 3) = "f") + && ((len9 |> BankersDeque.lookup 4) = "e") + && ((len9 |> BankersDeque.lookup 5) = "d") + && ((len9 |> BankersDeque.lookup 6) = "c") + && ((len9 |> BankersDeque.lookup 7) = "b") + && ((len9 |> BankersDeque.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.lookup BankersDeque.length 10" { + (((lena |> BankersDeque.lookup 0) = "j") + && ((lena |> BankersDeque.lookup 1) = "i") + && ((lena |> BankersDeque.lookup 2) = "h") + && ((lena |> BankersDeque.lookup 3) = "g") + && ((lena |> BankersDeque.lookup 4) = "f") + && ((lena |> BankersDeque.lookup 5) = "e") + && ((lena |> BankersDeque.lookup 6) = "d") + && ((lena |> BankersDeque.lookup 7) = "c") + && ((lena |> BankersDeque.lookup 8) = "b") + && ((lena |> BankersDeque.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 1" { + let a = len1 |> BankersDeque.tryLookup 0 + (a.Value = "a") |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 2" { + let b = len2 |> BankersDeque.tryLookup 0 + let a = len2 |> BankersDeque.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 3" { + let c = len3 |> BankersDeque.tryLookup 0 + let b = len3 |> BankersDeque.tryLookup 1 + let a = len3 |> BankersDeque.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 4" { + let d = len4 |> BankersDeque.tryLookup 0 + let c = len4 |> BankersDeque.tryLookup 1 + let b = len4 |> BankersDeque.tryLookup 2 + let a = len4 |> BankersDeque.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 5" { + let e = len5 |> BankersDeque.tryLookup 0 + let d = len5 |> BankersDeque.tryLookup 1 + let c = len5 |> BankersDeque.tryLookup 2 + let b = len5 |> BankersDeque.tryLookup 3 + let a = len5 |> BankersDeque.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 6" { + let f = len6 |> BankersDeque.tryLookup 0 + let e = len6 |> BankersDeque.tryLookup 1 + let d = len6 |> BankersDeque.tryLookup 2 + let c = len6 |> BankersDeque.tryLookup 3 + let b = len6 |> BankersDeque.tryLookup 4 + let a = len6 |> BankersDeque.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 7" { + let g = len7 |> BankersDeque.tryLookup 0 + let f = len7 |> BankersDeque.tryLookup 1 + let e = len7 |> BankersDeque.tryLookup 2 + let d = len7 |> BankersDeque.tryLookup 3 + let c = len7 |> BankersDeque.tryLookup 4 + let b = len7 |> BankersDeque.tryLookup 5 + let a = len7 |> BankersDeque.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 8" { + let h = len8 |> BankersDeque.tryLookup 0 + let g = len8 |> BankersDeque.tryLookup 1 + let f = len8 |> BankersDeque.tryLookup 2 + let e = len8 |> BankersDeque.tryLookup 3 + let d = len8 |> BankersDeque.tryLookup 4 + let c = len8 |> BankersDeque.tryLookup 5 + let b = len8 |> BankersDeque.tryLookup 6 + let a = len8 |> BankersDeque.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 9" { + let i = len9 |> BankersDeque.tryLookup 0 + let h = len9 |> BankersDeque.tryLookup 1 + let g = len9 |> BankersDeque.tryLookup 2 + let f = len9 |> BankersDeque.tryLookup 3 + let e = len9 |> BankersDeque.tryLookup 4 + let d = len9 |> BankersDeque.tryLookup 5 + let c = len9 |> BankersDeque.tryLookup 6 + let b = len9 |> BankersDeque.tryLookup 7 + let a = len9 |> BankersDeque.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup BankersDeque.length 10" { + let j = lena |> BankersDeque.tryLookup 0 + let i = lena |> BankersDeque.tryLookup 1 + let h = lena |> BankersDeque.tryLookup 2 + let g = lena |> BankersDeque.tryLookup 3 + let f = lena |> BankersDeque.tryLookup 4 + let e = lena |> BankersDeque.tryLookup 5 + let d = lena |> BankersDeque.tryLookup 6 + let c = lena |> BankersDeque.tryLookup 7 + let b = lena |> BankersDeque.tryLookup 8 + let a = lena |> BankersDeque.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryLookup not found" { lena |> BankersDeque.tryLookup 10 |> Expect.isNone "" } + + test "BankersDeque.remove elements BankersDeque.length 1" { + len1 + |> BankersDeque.remove 0 + |> BankersDeque.isEmpty + |> Expect.isTrue "" + } + + test "BankersDeque.remove elements BankersDeque.length 2" { + let a = len2 |> BankersDeque.remove 0 |> BankersDeque.head + let b = len2 |> BankersDeque.remove 1 |> BankersDeque.head + ((a = "a") && (b = "b")) |> Expect.isTrue "" + } + + test "BankersDeque.remove elements BankersDeque.length 3" { + let r0 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.remove 0 + let b0 = BankersDeque.head r0 + let t0 = BankersDeque.tail r0 + let c0 = BankersDeque.head t0 + + let r1 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.remove 1 + let a1 = BankersDeque.head r1 + let t1 = BankersDeque.tail r1 + let c1 = BankersDeque.head t1 + + let r2 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.remove 2 + let a2 = BankersDeque.head r2 + let t2 = BankersDeque.tail r2 + let b2 = BankersDeque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "BankersDeque.remove elements BankersDeque.length 4" { + let r0 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 0 + let b0 = BankersDeque.head r0 + let t0 = BankersDeque.tail r0 + let c0 = BankersDeque.head t0 + let t01 = BankersDeque.tail t0 + let d0 = BankersDeque.head t01 + + let r1 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 1 + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let c1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let d1 = BankersDeque.head t12 + + let r2 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 2 + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + + let r3 = (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BankersDeque.remove 3 + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "BankersDeque.remove elements BankersDeque.length 5" { + let r0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.remove 0 + + let b0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let c0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let d0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let e0 = BankersDeque.head t03 + + let r1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.remove 1 + + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let c1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let d1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let e1 = BankersDeque.head t13 + + let r2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.remove 2 + + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let e2 = BankersDeque.head t23 + + let r3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.remove 3 + + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let e3 = BankersDeque.head t33 + + let r4 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.remove 4 + + let a4 = BankersDeque.head r4 + let t41 = BankersDeque.tail r4 + let b4 = BankersDeque.head t41 + let t42 = BankersDeque.tail t41 + let c4 = BankersDeque.head t42 + let t43 = BankersDeque.tail t42 + let d4 = BankersDeque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "BankersDeque.remove elements BankersDeque.length 6" { + let r0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.remove 0 + + let b0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let c0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let d0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let e0 = BankersDeque.head t03 + let t04 = BankersDeque.tail t03 + let f0 = BankersDeque.head t04 + + let r1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.remove 1 + + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let c1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let d1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let e1 = BankersDeque.head t13 + let t14 = BankersDeque.tail t13 + let f1 = BankersDeque.head t14 + + let r2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.remove 2 + + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let e2 = BankersDeque.head t23 + let t24 = BankersDeque.tail t23 + let f2 = BankersDeque.head t24 + + let r3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.remove 3 + + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let e3 = BankersDeque.head t33 + let t34 = BankersDeque.tail t33 + let f3 = BankersDeque.head t34 + + let r4 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.remove 4 + + let a4 = BankersDeque.head r4 + let t41 = BankersDeque.tail r4 + let b4 = BankersDeque.head t41 + let t42 = BankersDeque.tail t41 + let c4 = BankersDeque.head t42 + let t43 = BankersDeque.tail t42 + let d4 = BankersDeque.head t43 + let t44 = BankersDeque.tail t43 + let f4 = BankersDeque.head t44 + + let r5 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.remove 5 + + let a5 = BankersDeque.head r5 + let t51 = BankersDeque.tail r5 + let b5 = BankersDeque.head t51 + let t52 = BankersDeque.tail t51 + let c5 = BankersDeque.head t52 + let t53 = BankersDeque.tail t52 + let d5 = BankersDeque.head t53 + let t54 = BankersDeque.tail t53 + let e5 = BankersDeque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "tryRemoveempty" { (BankersDeque.empty 3) |> BankersDeque.tryRemove 0 |> Expect.isNone "" } + + test "BankersDeque.tryRemove elements BankersDeque.length 1" { + let a = len1 |> BankersDeque.tryRemove 0 + a.Value |> BankersDeque.isEmpty |> Expect.isTrue "" + } + + test "BankersDeque.tryRemove elements BankersDeque.length 2" { + let a = len2 |> BankersDeque.tryRemove 0 + let a1 = BankersDeque.head a.Value + let b = len2 |> BankersDeque.tryRemove 1 + let b1 = BankersDeque.head b.Value + ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" + } + + test "BankersDeque.tryRemove elements BankersDeque.length 3" { + let x0 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.tryRemove 0 + let r0 = x0.Value + let b0 = BankersDeque.head r0 + let t0 = BankersDeque.tail r0 + let c0 = BankersDeque.head t0 + + let x1 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.tryRemove 1 + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t1 = BankersDeque.tail r1 + let c1 = BankersDeque.head t1 + + let x2 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.tryRemove 2 + let r2 = x2.Value + let a2 = BankersDeque.head r2 + let t2 = BankersDeque.tail r2 + let b2 = BankersDeque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryRemove elements BankersDeque.length 4" { + let x0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = BankersDeque.head r0 + let t0 = BankersDeque.tail r0 + let c0 = BankersDeque.head t0 + let t01 = BankersDeque.tail t0 + let d0 = BankersDeque.head t01 + + let x1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let c1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let d1 = BankersDeque.head t12 + + let x2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + + let x3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryRemove elements BankersDeque.length 5" { + let x0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let c0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let d0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let e0 = BankersDeque.head t03 + + let x1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let c1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let d1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let e1 = BankersDeque.head t13 + + let x2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let e2 = BankersDeque.head t23 + + let x3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let e3 = BankersDeque.head t33 + + let x4 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.tryRemove 4 + + let r4 = x4.Value + let a4 = BankersDeque.head r4 + let t41 = BankersDeque.tail r4 + let b4 = BankersDeque.head t41 + let t42 = BankersDeque.tail t41 + let c4 = BankersDeque.head t42 + let t43 = BankersDeque.tail t42 + let d4 = BankersDeque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryRemove elements BankersDeque.length 6" { + let x0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let c0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let d0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let e0 = BankersDeque.head t03 + let t04 = BankersDeque.tail t03 + let f0 = BankersDeque.head t04 + + let x1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let c1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let d1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let e1 = BankersDeque.head t13 + let t14 = BankersDeque.tail t13 + let f1 = BankersDeque.head t14 + + let x2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let e2 = BankersDeque.head t23 + let t24 = BankersDeque.tail t23 + let f2 = BankersDeque.head t24 + + let x3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let e3 = BankersDeque.head t33 + let t34 = BankersDeque.tail t33 + let f3 = BankersDeque.head t34 + + let x4 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.tryRemove 4 + + let r4 = x4.Value + let a4 = BankersDeque.head r4 + let t41 = BankersDeque.tail r4 + let b4 = BankersDeque.head t41 + let t42 = BankersDeque.tail t41 + let c4 = BankersDeque.head t42 + let t43 = BankersDeque.tail t42 + let d4 = BankersDeque.head t43 + let t44 = BankersDeque.tail t43 + let f4 = BankersDeque.head t44 + + let x5 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.tryRemove 5 + + let r5 = x5.Value + let a5 = BankersDeque.head r5 + let t51 = BankersDeque.tail r5 + let b5 = BankersDeque.head t51 + let t52 = BankersDeque.tail t51 + let c5 = BankersDeque.head t52 + let t53 = BankersDeque.tail t52 + let d5 = BankersDeque.head t53 + let t54 = BankersDeque.tail t53 + let e5 = BankersDeque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "BankersDeque.update elements BankersDeque.length 1" { + len1 + |> BankersDeque.update 0 "aa" + |> BankersDeque.head + |> Expect.equal "" "aa" + } + + test "BankersDeque.update elements BankersDeque.length 2" { + let r0 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.update 0 "zz" + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + + let r1 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.update 1 "zz" + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.update elements BankersDeque.length 3" { + let r0 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.update 0 "zz" + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let c0 = BankersDeque.head t02 + + let r1 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.update 1 "zz" + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let c1 = BankersDeque.head t12 + + let r2 = (BankersDeque.ofSeq [ "a"; "b"; "c" ]) |> BankersDeque.update 2 "zz" + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.update elements BankersDeque.length 4" { + let r0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.update 0 "zz" + + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let c0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let d0 = BankersDeque.head t03 + + let r1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.update 1 "zz" + + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let c1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let d1 = BankersDeque.head t13 + + let r2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.update 2 "zz" + + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let d2 = BankersDeque.head t23 + + let r3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.update 3 "zz" + + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let d3 = BankersDeque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.update elements BankersDeque.length 5" { + let r0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.update 0 "zz" + + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let c0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let d0 = BankersDeque.head t03 + let t04 = BankersDeque.tail t03 + let e0 = BankersDeque.head t04 + + let r1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.update 1 "zz" + + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let c1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let d1 = BankersDeque.head t13 + let t14 = BankersDeque.tail t13 + let e1 = BankersDeque.head t14 + + let r2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.update 2 "zz" + + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let d2 = BankersDeque.head t23 + let t24 = BankersDeque.tail t23 + let e2 = BankersDeque.head t24 + + let r3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.update 3 "zz" + + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let d3 = BankersDeque.head t33 + let t34 = BankersDeque.tail t33 + let e3 = BankersDeque.head t34 + + let r4 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BankersDeque.update 4 "zz" + + let a4 = BankersDeque.head r4 + let t41 = BankersDeque.tail r4 + let b4 = BankersDeque.head t41 + let t42 = BankersDeque.tail t41 + let c4 = BankersDeque.head t42 + let t43 = BankersDeque.tail t42 + let d4 = BankersDeque.head t43 + let t44 = BankersDeque.tail t43 + let e4 = BankersDeque.head t44 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.update elements BankersDeque.length 6" { + let r0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.update 0 "zz" + + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let c0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let d0 = BankersDeque.head t03 + let t04 = BankersDeque.tail t03 + let e0 = BankersDeque.head t04 + let t05 = BankersDeque.tail t04 + let f0 = BankersDeque.head t05 + + let r1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.update 1 "zz" + + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let c1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let d1 = BankersDeque.head t13 + let t14 = BankersDeque.tail t13 + let e1 = BankersDeque.head t14 + let t15 = BankersDeque.tail t14 + let f1 = BankersDeque.head t15 + + let r2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.update 2 "zz" + + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let d2 = BankersDeque.head t23 + let t24 = BankersDeque.tail t23 + let e2 = BankersDeque.head t24 + let t25 = BankersDeque.tail t24 + let f2 = BankersDeque.head t25 + + let r3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.update 3 "zz" + + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let d3 = BankersDeque.head t33 + let t34 = BankersDeque.tail t33 + let e3 = BankersDeque.head t34 + let t35 = BankersDeque.tail t34 + let f3 = BankersDeque.head t35 + + let r4 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.update 4 "zz" + + let a4 = BankersDeque.head r4 + let t41 = BankersDeque.tail r4 + let b4 = BankersDeque.head t41 + let t42 = BankersDeque.tail t41 + let c4 = BankersDeque.head t42 + let t43 = BankersDeque.tail t42 + let d4 = BankersDeque.head t43 + let t44 = BankersDeque.tail t43 + let e4 = BankersDeque.head t44 + let t45 = BankersDeque.tail t44 + let f4 = BankersDeque.head t45 + + let r5 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BankersDeque.update 5 "zz" + + let a5 = BankersDeque.head r5 + let t51 = BankersDeque.tail r5 + let b5 = BankersDeque.head t51 + let t52 = BankersDeque.tail t51 + let c5 = BankersDeque.head t52 + let t53 = BankersDeque.tail t52 + let d5 = BankersDeque.head t53 + let t54 = BankersDeque.tail t53 + let e5 = BankersDeque.head t54 + let t55 = BankersDeque.tail t54 + let f5 = BankersDeque.head t55 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e") + && (f5 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryUpdate elements BankersDeque.length 1" { + let a = len1 |> BankersDeque.tryUpdate 0 "aa" + a.Value |> BankersDeque.head |> Expect.equal "" "aa" + } + + test "BankersDeque.tryUpdate elements BankersDeque.length 2" { + let x0 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.tryUpdate 0 "zz" + let r0 = x0.Value + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + + let x1 = (BankersDeque.ofSeq [ "a"; "b" ]) |> BankersDeque.tryUpdate 1 "zz" + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryUpdate elements BankersDeque.length 3" { + let x0 = + (BankersDeque.ofSeq [ "a"; "b"; "c" ]) + |> BankersDeque.tryUpdate 0 "zz" + + let r0 = x0.Value + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let c0 = BankersDeque.head t02 + + let x1 = + (BankersDeque.ofSeq [ "a"; "b"; "c" ]) + |> BankersDeque.tryUpdate 1 "zz" + + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let c1 = BankersDeque.head t12 + + let x2 = + (BankersDeque.ofSeq [ "a"; "b"; "c" ]) + |> BankersDeque.tryUpdate 2 "zz" + + let r2 = x2.Value + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryUpdate elements BankersDeque.length 4" { + let x0 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryUpdate 0 "zz" + + let r0 = x0.Value + let a0 = BankersDeque.head r0 + let t01 = BankersDeque.tail r0 + let b0 = BankersDeque.head t01 + let t02 = BankersDeque.tail t01 + let c0 = BankersDeque.head t02 + let t03 = BankersDeque.tail t02 + let d0 = BankersDeque.head t03 + + let x1 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryUpdate 1 "zz" + + let r1 = x1.Value + let a1 = BankersDeque.head r1 + let t11 = BankersDeque.tail r1 + let b1 = BankersDeque.head t11 + let t12 = BankersDeque.tail t11 + let c1 = BankersDeque.head t12 + let t13 = BankersDeque.tail t12 + let d1 = BankersDeque.head t13 + + let x2 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryUpdate 2 "zz" + + let r2 = x2.Value + let a2 = BankersDeque.head r2 + let t21 = BankersDeque.tail r2 + let b2 = BankersDeque.head t21 + let t22 = BankersDeque.tail t21 + let c2 = BankersDeque.head t22 + let t23 = BankersDeque.tail t22 + let d2 = BankersDeque.head t23 + + let x3 = + (BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BankersDeque.tryUpdate 3 "zz" + + let r3 = x3.Value + let a3 = BankersDeque.head r3 + let t31 = BankersDeque.tail r3 + let b3 = BankersDeque.head t31 + let t32 = BankersDeque.tail t31 + let c3 = BankersDeque.head t32 + let t33 = BankersDeque.tail t32 + let d3 = BankersDeque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "BankersDeque.tryUncons on BankersDeque.empty" { + let q = BankersDeque.empty 2 + (BankersDeque.tryUncons q = None) |> Expect.isTrue "" + } + + test "BankersDeque.tryUncons on q" { + let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let x, xs = (BankersDeque.tryUncons q).Value + x |> Expect.equal "" "a" + } + + test "BankersDeque.tryUnsnoc on BankersDeque.empty" { + let q = BankersDeque.empty 2 + (BankersDeque.tryUnsnoc q = None) |> Expect.isTrue "" + } + + test "BankersDeque.tryUnsnoc on q" { + let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let xs, x = (BankersDeque.tryUnsnoc q).Value + x |> Expect.equal "" "d" + } + + test "BankersDeque.tryGetHead on BankersDeque.empty" { + let q = BankersDeque.empty 2 + (BankersDeque.tryGetHead q = None) |> Expect.isTrue "" + } + + test "BankersDeque.tryGetHead on q" { + let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + (BankersDeque.tryGetHead q).Value |> Expect.equal "" "a" + } + + test "BankersDeque.tryGetInit on BankersDeque.empty" { + let q = BankersDeque.empty 2 + (BankersDeque.tryGetInit q = None) |> Expect.isTrue "" + } + + test "BankersDeque.tryGetInit on q" { + let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let x = (BankersDeque.tryGetInit q).Value + let x2 = x |> BankersDeque.last + x2 |> Expect.equal "" "c" + } + + test "BankersDeque.tryGetLast on BankersDeque.empty" { + let q = BankersDeque.empty 2 + (BankersDeque.tryGetLast q = None) |> Expect.isTrue "" + } + + test "BankersDeque.tryGetLast on q" { + let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + (BankersDeque.tryGetLast q).Value |> Expect.equal "" "d" + } + + + test "BankersDeque.tryGetTail on BankersDeque.empty" { + let q = BankersDeque.empty 2 + (BankersDeque.tryGetTail q = None) |> Expect.isTrue "" + } + + test "BankersDeque.tryGetTail on q" { + let q = BankersDeque.ofSeq [ "a"; "b"; "c"; "d" ] + + (BankersDeque.tryGetTail q).Value + |> BankersDeque.head + |> Expect.equal "" "b" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BatchedDequeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BatchedDequeTest.fs index 7d961ae7..ba883fed 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BatchedDequeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BatchedDequeTest.fs @@ -155,2110 +155,2111 @@ module BatchDequeTest = [] let testBatchDeque = - testList "Experimental BatchDeque" [ - - test "empty dqueue should be empty" { BatchedDeque.empty() |> BatchedDeque.isEmpty |> Expect.isTrue "" } - - test "BatchedDeque.cons works" { len2 |> BatchedDeque.isEmpty |> Expect.isFalse "" } - - test "BatchedDeque.snoc works" { len2snoc |> BatchedDeque.isEmpty |> Expect.isFalse "" } - - test "BatchedDeque.singleton BatchedDeque.head works" { len1 |> BatchedDeque.head |> Expect.equal "" "a" } - - test "BatchedDeque.singleton BatchedDeque.last works" { len1 |> BatchedDeque.last |> Expect.equal "" "a" } - - test "BatchedDeque.tail of BatchedDeque.singleton empty" { len1 |> BatchedDeque.tail |> BatchedDeque.isEmpty |> Expect.isTrue "" } - - test "BatchedDeque.tail of BatchedDeque.tail of 2 empty" { - (len2 |> BatchedDeque.tail |> BatchedDeque.tail |> BatchedDeque.isEmpty) - |> Expect.isTrue "" - } - - test "BatchedDeque.init of BatchedDeque.singleton empty" { len1 |> BatchedDeque.init |> BatchedDeque.isEmpty |> Expect.isTrue "" } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 1" { - let t1 = BatchedDeque.tail len2 - let t1s = BatchedDeque.tail len2snoc - - (((BatchedDeque.length t1) = 1) - && ((BatchedDeque.length t1s) = 1) - && ((BatchedDeque.head t1) = "a") - && ((BatchedDeque.head t1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 2" { - let t1 = BatchedDeque.tail len3 - let t1s = BatchedDeque.tail len3snoc - - let t1_1 = BatchedDeque.tail t1 - let t1_1s = BatchedDeque.tail t1s - - (((BatchedDeque.length t1) = 2) - && ((BatchedDeque.length t1s) = 2) - && ((BatchedDeque.head t1) = "b") - && ((BatchedDeque.head t1s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 3" { - let t1 = BatchedDeque.tail len4 - let t1s = BatchedDeque.tail len4snoc - - let t1_2 = BatchedDeque.tail t1 - let t1_2s = BatchedDeque.tail t1s - - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 3) - && ((BatchedDeque.length t1s) = 3) - && ((BatchedDeque.head t1) = "c") - && ((BatchedDeque.head t1s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 4" { - let t1 = BatchedDeque.tail len5 - let t1s = BatchedDeque.tail len5snoc - - let t1_3 = BatchedDeque.tail t1 - let t1_3s = BatchedDeque.tail t1s - - let t1_2 = BatchedDeque.tail t1_3 - let t1_2s = BatchedDeque.tail t1_3s - - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 4) - && ((BatchedDeque.length t1s) = 4) - && ((BatchedDeque.head t1) = "d") - && ((BatchedDeque.head t1s) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.length t1_3s) = 3) - && ((BatchedDeque.head t1_3) = "c") - && ((BatchedDeque.head t1_3s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 5" { - let t1 = BatchedDeque.tail len6 - let t1s = BatchedDeque.tail len6snoc - - let t1_4 = BatchedDeque.tail t1 - let t1_4s = BatchedDeque.tail t1s - - let t1_3 = BatchedDeque.tail t1_4 - let t1_3s = BatchedDeque.tail t1_4s - - let t1_2 = BatchedDeque.tail t1_3 - let t1_2s = BatchedDeque.tail t1_3s - - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 5) - && ((BatchedDeque.length t1s) = 5) - && ((BatchedDeque.head t1) = "e") - && ((BatchedDeque.head t1s) = "e") - && ((BatchedDeque.length t1_4) = 4) - && ((BatchedDeque.length t1_4s) = 4) - && ((BatchedDeque.head t1_4) = "d") - && ((BatchedDeque.head t1_4s) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.length t1_3s) = 3) - && ((BatchedDeque.head t1_3) = "c") - && ((BatchedDeque.head t1_3s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 6" { - let t1 = BatchedDeque.tail len7 - let t1s = BatchedDeque.tail len7snoc - - let t1_5 = BatchedDeque.tail t1 - let t1_5s = BatchedDeque.tail t1s - - let t1_4 = BatchedDeque.tail t1_5 - let t1_4s = BatchedDeque.tail t1_5s - - let t1_3 = BatchedDeque.tail t1_4 - let t1_3s = BatchedDeque.tail t1_4s - - let t1_2 = BatchedDeque.tail t1_3 - let t1_2s = BatchedDeque.tail t1_3s - - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 6) - && ((BatchedDeque.length t1s) = 6) - && ((BatchedDeque.head t1) = "f") - && ((BatchedDeque.head t1s) = "f") - && ((BatchedDeque.length t1_5) = 5) - && ((BatchedDeque.length t1_5s) = 5) - && ((BatchedDeque.head t1_5) = "e") - && ((BatchedDeque.head t1_5s) = "e") - && ((BatchedDeque.length t1_4) = 4) - && ((BatchedDeque.length t1_4s) = 4) - && ((BatchedDeque.head t1_4) = "d") - && ((BatchedDeque.head t1_4s) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.length t1_3s) = 3) - && ((BatchedDeque.head t1_3) = "c") - && ((BatchedDeque.head t1_3s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 7" { - let t1 = BatchedDeque.tail len8 - let t1s = BatchedDeque.tail len8snoc - let t1_6 = BatchedDeque.tail t1 - let t1_6s = BatchedDeque.tail t1s - let t1_5 = BatchedDeque.tail t1_6 - let t1_5s = BatchedDeque.tail t1_6s - let t1_4 = BatchedDeque.tail t1_5 - let t1_4s = BatchedDeque.tail t1_5s - let t1_3 = BatchedDeque.tail t1_4 - let t1_3s = BatchedDeque.tail t1_4s - let t1_2 = BatchedDeque.tail t1_3 - let t1_2s = BatchedDeque.tail t1_3s - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 7) - && ((BatchedDeque.length t1s) = 7) - && ((BatchedDeque.head t1) = "g") - && ((BatchedDeque.head t1s) = "g") - && ((BatchedDeque.length t1_6) = 6) - && ((BatchedDeque.length t1_6s) = 6) - && ((BatchedDeque.head t1_6) = "f") - && ((BatchedDeque.head t1_6s) = "f") - && ((BatchedDeque.length t1_5) = 5) - && ((BatchedDeque.length t1_5s) = 5) - && ((BatchedDeque.head t1_5) = "e") - && ((BatchedDeque.head t1_5s) = "e") - && ((BatchedDeque.length t1_4) = 4) - && ((BatchedDeque.length t1_4s) = 4) - && ((BatchedDeque.head t1_4) = "d") - && ((BatchedDeque.head t1_4s) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.length t1_3s) = 3) - && ((BatchedDeque.head t1_3) = "c") - && ((BatchedDeque.head t1_3s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 8" { - let t1 = BatchedDeque.tail len9 - let t1s = BatchedDeque.tail len9snoc - let t1_7 = BatchedDeque.tail t1 - let t1_7s = BatchedDeque.tail t1s - let t1_6 = BatchedDeque.tail t1_7 - let t1_6s = BatchedDeque.tail t1_7s - let t1_5 = BatchedDeque.tail t1_6 - let t1_5s = BatchedDeque.tail t1_6s - let t1_4 = BatchedDeque.tail t1_5 - let t1_4s = BatchedDeque.tail t1_5s - let t1_3 = BatchedDeque.tail t1_4 - let t1_3s = BatchedDeque.tail t1_4s - let t1_2 = BatchedDeque.tail t1_3 - let t1_2s = BatchedDeque.tail t1_3s - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 8) - && ((BatchedDeque.length t1s) = 8) - && ((BatchedDeque.head t1) = "h") - && ((BatchedDeque.head t1s) = "h") - && ((BatchedDeque.length t1_7) = 7) - && ((BatchedDeque.length t1_7s) = 7) - && ((BatchedDeque.head t1_7) = "g") - && ((BatchedDeque.head t1_7s) = "g") - && ((BatchedDeque.length t1_6) = 6) - && ((BatchedDeque.length t1_6s) = 6) - && ((BatchedDeque.head t1_6) = "f") - && ((BatchedDeque.head t1_6s) = "f") - && ((BatchedDeque.length t1_5) = 5) - && ((BatchedDeque.length t1_5s) = 5) - && ((BatchedDeque.head t1_5) = "e") - && ((BatchedDeque.head t1_5s) = "e") - && ((BatchedDeque.length t1_4) = 4) - && ((BatchedDeque.length t1_4s) = 4) - && ((BatchedDeque.head t1_4) = "d") - && ((BatchedDeque.head t1_4s) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.length t1_3s) = 3) - && ((BatchedDeque.head t1_3) = "c") - && ((BatchedDeque.head t1_3s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 9" { - let t1 = BatchedDeque.tail lena - let t1s = BatchedDeque.tail lenasnoc - let t1_8 = BatchedDeque.tail t1 - let t1_8s = BatchedDeque.tail t1s - let t1_7 = BatchedDeque.tail t1_8 - let t1_7s = BatchedDeque.tail t1_8s - let t1_6 = BatchedDeque.tail t1_7 - let t1_6s = BatchedDeque.tail t1_7s - let t1_5 = BatchedDeque.tail t1_6 - let t1_5s = BatchedDeque.tail t1_6s - let t1_4 = BatchedDeque.tail t1_5 - let t1_4s = BatchedDeque.tail t1_5s - let t1_3 = BatchedDeque.tail t1_4 - let t1_3s = BatchedDeque.tail t1_4s - let t1_2 = BatchedDeque.tail t1_3 - let t1_2s = BatchedDeque.tail t1_3s - let t1_1 = BatchedDeque.tail t1_2 - let t1_1s = BatchedDeque.tail t1_2s - - (((BatchedDeque.length t1) = 9) - && ((BatchedDeque.length t1s) = 9) - && ((BatchedDeque.head t1) = "i") - && ((BatchedDeque.head t1s) = "i") - && ((BatchedDeque.length t1_8) = 8) - && ((BatchedDeque.length t1_8s) = 8) - && ((BatchedDeque.head t1_8) = "h") - && ((BatchedDeque.head t1_8s) = "h") - && ((BatchedDeque.length t1_7) = 7) - && ((BatchedDeque.length t1_7s) = 7) - && ((BatchedDeque.head t1_7) = "g") - && ((BatchedDeque.head t1_7s) = "g") - && ((BatchedDeque.length t1_6) = 6) - && ((BatchedDeque.length t1_6s) = 6) - && ((BatchedDeque.head t1_6) = "f") - && ((BatchedDeque.head t1_6s) = "f") - && ((BatchedDeque.length t1_5) = 5) - && ((BatchedDeque.length t1_5s) = 5) - && ((BatchedDeque.head t1_5) = "e") - && ((BatchedDeque.head t1_5s) = "e") - && ((BatchedDeque.length t1_4) = 4) - && ((BatchedDeque.length t1_4s) = 4) - && ((BatchedDeque.head t1_4) = "d") - && ((BatchedDeque.head t1_4s) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.length t1_3s) = 3) - && ((BatchedDeque.head t1_3) = "c") - && ((BatchedDeque.head t1_3s) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.length t1_2s) = 2) - && ((BatchedDeque.head t1_2) = "b") - && ((BatchedDeque.head t1_2s) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.length t1_1s) = 1) - && ((BatchedDeque.head t1_1) = "a") - && ((BatchedDeque.head t1_1s) = "a")) - |> Expect.isTrue "" - } - - //the previous series thoroughly tested construction by BatchedDeque.snoc, so we'll leave those out - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 1" { - let t1 = BatchedDeque.init len2 - - (((BatchedDeque.length t1) = 1) && ((BatchedDeque.last t1) = "b")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 2" { - let t1 = BatchedDeque.init len3 - let t1_1 = BatchedDeque.init t1 - - (((BatchedDeque.length t1) = 2) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 1) - && ((BatchedDeque.last t1_1) = "c")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 3" { - let t1 = BatchedDeque.init len4 - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - - (((BatchedDeque.length t1) = 3) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 2) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 1) - && ((BatchedDeque.last t1_2) = "d")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 4" { - let t1 = BatchedDeque.init len5 - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - let t1_3 = BatchedDeque.init t1_2 - - (((BatchedDeque.length t1) = 4) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 3) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 2) - && ((BatchedDeque.last t1_2) = "d") - && ((BatchedDeque.length t1_3) = 1) - && ((BatchedDeque.last t1_3) = "e")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 5" { - let t1 = BatchedDeque.init len6 - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - let t1_3 = BatchedDeque.init t1_2 - let t1_4 = BatchedDeque.init t1_3 - - (((BatchedDeque.length t1) = 5) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 4) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 3) - && ((BatchedDeque.last t1_2) = "d") - && ((BatchedDeque.length t1_3) = 2) - && ((BatchedDeque.last t1_3) = "e") - && ((BatchedDeque.length t1_4) = 1) - && ((BatchedDeque.last t1_4) = "f")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 6" { - let t1 = BatchedDeque.init len7 - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - let t1_3 = BatchedDeque.init t1_2 - let t1_4 = BatchedDeque.init t1_3 - let t1_5 = BatchedDeque.init t1_4 - - (((BatchedDeque.length t1) = 6) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 5) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 4) - && ((BatchedDeque.last t1_2) = "d") - && ((BatchedDeque.length t1_3) = 3) - && ((BatchedDeque.last t1_3) = "e") - && ((BatchedDeque.length t1_4) = 2) - && ((BatchedDeque.last t1_4) = "f") - && ((BatchedDeque.length t1_5) = 1) - && ((BatchedDeque.last t1_5) = "g")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 7" { - let t1 = BatchedDeque.init len8 - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - let t1_3 = BatchedDeque.init t1_2 - let t1_4 = BatchedDeque.init t1_3 - let t1_5 = BatchedDeque.init t1_4 - let t1_6 = BatchedDeque.init t1_5 - - (((BatchedDeque.length t1) = 7) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 6) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 5) - && ((BatchedDeque.last t1_2) = "d") - && ((BatchedDeque.length t1_3) = 4) - && ((BatchedDeque.last t1_3) = "e") - && ((BatchedDeque.length t1_4) = 3) - && ((BatchedDeque.last t1_4) = "f") - && ((BatchedDeque.length t1_5) = 2) - && ((BatchedDeque.last t1_5) = "g") - && ((BatchedDeque.length t1_6) = 1) - && ((BatchedDeque.last t1_6) = "h")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 8" { - let t1 = BatchedDeque.init len9 - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - let t1_3 = BatchedDeque.init t1_2 - let t1_4 = BatchedDeque.init t1_3 - let t1_5 = BatchedDeque.init t1_4 - let t1_6 = BatchedDeque.init t1_5 - let t1_7 = BatchedDeque.init t1_6 - - (((BatchedDeque.length t1) = 8) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 7) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 6) - && ((BatchedDeque.last t1_2) = "d") - && ((BatchedDeque.length t1_3) = 5) - && ((BatchedDeque.last t1_3) = "e") - && ((BatchedDeque.length t1_4) = 4) - && ((BatchedDeque.last t1_4) = "f") - && ((BatchedDeque.length t1_5) = 3) - && ((BatchedDeque.last t1_5) = "g") - && ((BatchedDeque.length t1_6) = 2) - && ((BatchedDeque.last t1_6) = "h") - && ((BatchedDeque.length t1_7) = 1) - && ((BatchedDeque.last t1_7) = "i")) - |> Expect.isTrue "" - } - - test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 9" { - let t1 = BatchedDeque.init lena - let t1_1 = BatchedDeque.init t1 - let t1_2 = BatchedDeque.init t1_1 - let t1_3 = BatchedDeque.init t1_2 - let t1_4 = BatchedDeque.init t1_3 - let t1_5 = BatchedDeque.init t1_4 - let t1_6 = BatchedDeque.init t1_5 - let t1_7 = BatchedDeque.init t1_6 - let t1_8 = BatchedDeque.init t1_7 - - (((BatchedDeque.length t1) = 9) - && ((BatchedDeque.last t1) = "b") - && ((BatchedDeque.length t1_1) = 8) - && ((BatchedDeque.last t1_1) = "c") - && ((BatchedDeque.length t1_2) = 7) - && ((BatchedDeque.last t1_2) = "d") - && ((BatchedDeque.length t1_3) = 6) - && ((BatchedDeque.last t1_3) = "e") - && ((BatchedDeque.length t1_4) = 5) - && ((BatchedDeque.last t1_4) = "f") - && ((BatchedDeque.length t1_5) = 4) - && ((BatchedDeque.last t1_5) = "g") - && ((BatchedDeque.length t1_6) = 3) - && ((BatchedDeque.last t1_6) = "h") - && ((BatchedDeque.length t1_7) = 2) - && ((BatchedDeque.last t1_7) = "i") - && ((BatchedDeque.length t1_8) = 1) - && ((BatchedDeque.last t1_8) = "j")) - |> Expect.isTrue "" - } - - test "IEnumerable Seq" { (lena |> Seq.toArray).[5] |> Expect.equal "" "e" } - - test "IEnumerable Seq BatchedDeque.length" { lena |> Seq.length |> Expect.equal "" 10 } - - test "type BatchedDeque.cons works" { lena.Cons "zz" |> BatchedDeque.head |> Expect.equal "" "zz" } - - test "IDeque BatchedDeque.cons works" { ((lena :> IDeque).Cons "zz").Head |> Expect.equal "" "zz" } - - test "BatchedDeque.ofCatLists and BatchedDeque.uncons" { - let d = BatchedDeque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] - let h1, t1 = BatchedDeque.uncons d - let h2, t2 = BatchedDeque.uncons t1 - let h3, t3 = BatchedDeque.uncons t2 - let h4, t4 = BatchedDeque.uncons t3 - let h5, t5 = BatchedDeque.uncons t4 - let h6, t6 = BatchedDeque.uncons t5 - - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f") - && (BatchedDeque.isEmpty t6)) - |> Expect.isTrue "" - } - - test "BatchedDeque.unsnoc works" { - let d = BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] - let i1, l1 = BatchedDeque.unsnoc d - let i2, l2 = BatchedDeque.unsnoc i1 - let i3, l3 = BatchedDeque.unsnoc i2 - let i4, l4 = BatchedDeque.unsnoc i3 - let i5, l5 = BatchedDeque.unsnoc i4 - let i6, l6 = BatchedDeque.unsnoc i5 - - ((l1 = "a") - && (l2 = "b") - && (l3 = "c") - && (l4 = "d") - && (l5 = "e") - && (l6 = "f") - && (BatchedDeque.isEmpty i6)) - |> Expect.isTrue "" - } - - test "BatchedDeque.snoc pattern discriminator" { - let d = (BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let i1, l1 = BatchedDeque.unsnoc d - - let i2, l2 = - match i1 with - | BatchedDeque.Snoc(i, l) -> i, l - | _ -> i1, "x" - - ((l2 = "b") && ((BatchedDeque.length i2) = 4)) |> Expect.isTrue "" - } - - test "BatchedDeque.cons pattern discriminator" { - let d = (BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let h1, t1 = BatchedDeque.uncons d - - let h2, t2 = - match t1 with - | BatchedDeque.Cons(h, t) -> h, t - | _ -> "x", t1 - - ((h2 = "e") && ((BatchedDeque.length t2) = 4)) |> Expect.isTrue "" - } - - test "BatchedDeque.cons and BatchedDeque.snoc pattern discriminator" { - let d = (BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - - let mid1 = - match d with - | BatchedDeque.Cons(h, BatchedDeque.Snoc(i, l)) -> i - | _ -> d - - let head, last = - match mid1 with - | BatchedDeque.Cons(h, BatchedDeque.Snoc(i, l)) -> h, l - | _ -> "x", "x" - - ((head = "e") && (last = "b")) |> Expect.isTrue "" - } - - test "BatchedDeque.rev dqueue BatchedDeque.length 1" { BatchedDeque.rev len1 |> BatchedDeque.head |> Expect.equal "" "a" } - - test "BatchedDeque.rev dqueue BatchedDeque.length 2" { - let r1 = BatchedDeque.rev len2 - let h1 = BatchedDeque.head r1 - let t2 = BatchedDeque.tail r1 - let h2 = BatchedDeque.head t2 - - ((h1 = "a") && (h2 = "b")) |> Expect.isTrue "" - } - - test "BatchedDeque.rev dqueue BatchedDeque.length 3" { - let r1 = BatchedDeque.rev len3 - let h1 = BatchedDeque.head r1 - let t2 = BatchedDeque.tail r1 - let h2 = BatchedDeque.head t2 - let t3 = BatchedDeque.tail t2 - let h3 = BatchedDeque.head t3 - - ((h1 = "a") && (h2 = "b") && (h3 = "c")) |> Expect.isTrue "" - } - - test "BatchedDeque.rev dqueue BatchedDeque.length 4" { - let r1 = BatchedDeque.rev len4 - let h1 = BatchedDeque.head r1 - let t2 = BatchedDeque.tail r1 - let h2 = BatchedDeque.head t2 - let t3 = BatchedDeque.tail t2 - let h3 = BatchedDeque.head t3 - let t4 = BatchedDeque.tail t3 - let h4 = BatchedDeque.head t4 - - ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d")) - |> Expect.isTrue "" - } - - test "BatchedDeque.rev dqueue BatchedDeque.length 5" { - let r1 = BatchedDeque.rev len5 - let h1 = BatchedDeque.head r1 - let t2 = BatchedDeque.tail r1 - let h2 = BatchedDeque.head t2 - let t3 = BatchedDeque.tail t2 - let h3 = BatchedDeque.head t3 - let t4 = BatchedDeque.tail t3 - let h4 = BatchedDeque.head t4 - let t5 = BatchedDeque.tail t4 - let h5 = BatchedDeque.head t5 - - ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d") && (h5 = "e")) - |> Expect.isTrue "" - } - - //BatchedDeque.length 6 more than sufficient to test BatchedDeque.rev - test "BatchedDeque.rev dqueue BatchedDeque.length 6" { - let r1 = BatchedDeque.rev len6 - let h1 = BatchedDeque.head r1 - let t2 = BatchedDeque.tail r1 - let h2 = BatchedDeque.head t2 - let t3 = BatchedDeque.tail t2 - let h3 = BatchedDeque.head t3 - let t4 = BatchedDeque.tail t3 - let h4 = BatchedDeque.head t4 - let t5 = BatchedDeque.tail t4 - let h5 = BatchedDeque.head t5 - let t6 = BatchedDeque.tail t5 - let h6 = BatchedDeque.head t6 - - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 1" { len1 |> BatchedDeque.lookup 0 |> Expect.equal "" "a" } - - test "BatchedDeque.lookup BatchedDeque.length 2" { - (((len2 |> BatchedDeque.lookup 0) = "b") - && ((len2 |> BatchedDeque.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 3" { - (((len3 |> BatchedDeque.lookup 0) = "c") - && ((len3 |> BatchedDeque.lookup 1) = "b") - && ((len3 |> BatchedDeque.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 4" { - (((len4 |> BatchedDeque.lookup 0) = "d") - && ((len4 |> BatchedDeque.lookup 1) = "c") - && ((len4 |> BatchedDeque.lookup 2) = "b") - && ((len4 |> BatchedDeque.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 5" { - (((len5 |> BatchedDeque.lookup 0) = "e") - && ((len5 |> BatchedDeque.lookup 1) = "d") - && ((len5 |> BatchedDeque.lookup 2) = "c") - && ((len5 |> BatchedDeque.lookup 3) = "b") - && ((len5 |> BatchedDeque.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 6" { - (((len6 |> BatchedDeque.lookup 0) = "f") - && ((len6 |> BatchedDeque.lookup 1) = "e") - && ((len6 |> BatchedDeque.lookup 2) = "d") - && ((len6 |> BatchedDeque.lookup 3) = "c") - && ((len6 |> BatchedDeque.lookup 4) = "b") - && ((len6 |> BatchedDeque.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 7" { - (((len7 |> BatchedDeque.lookup 0) = "g") - && ((len7 |> BatchedDeque.lookup 1) = "f") - && ((len7 |> BatchedDeque.lookup 2) = "e") - && ((len7 |> BatchedDeque.lookup 3) = "d") - && ((len7 |> BatchedDeque.lookup 4) = "c") - && ((len7 |> BatchedDeque.lookup 5) = "b") - && ((len7 |> BatchedDeque.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 8" { - (((len8 |> BatchedDeque.lookup 0) = "h") - && ((len8 |> BatchedDeque.lookup 1) = "g") - && ((len8 |> BatchedDeque.lookup 2) = "f") - && ((len8 |> BatchedDeque.lookup 3) = "e") - && ((len8 |> BatchedDeque.lookup 4) = "d") - && ((len8 |> BatchedDeque.lookup 5) = "c") - && ((len8 |> BatchedDeque.lookup 6) = "b") - && ((len8 |> BatchedDeque.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 9" { - (((len9 |> BatchedDeque.lookup 0) = "i") - && ((len9 |> BatchedDeque.lookup 1) = "h") - && ((len9 |> BatchedDeque.lookup 2) = "g") - && ((len9 |> BatchedDeque.lookup 3) = "f") - && ((len9 |> BatchedDeque.lookup 4) = "e") - && ((len9 |> BatchedDeque.lookup 5) = "d") - && ((len9 |> BatchedDeque.lookup 6) = "c") - && ((len9 |> BatchedDeque.lookup 7) = "b") - && ((len9 |> BatchedDeque.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.lookup BatchedDeque.length 10" { - (((lena |> BatchedDeque.lookup 0) = "j") - && ((lena |> BatchedDeque.lookup 1) = "i") - && ((lena |> BatchedDeque.lookup 2) = "h") - && ((lena |> BatchedDeque.lookup 3) = "g") - && ((lena |> BatchedDeque.lookup 4) = "f") - && ((lena |> BatchedDeque.lookup 5) = "e") - && ((lena |> BatchedDeque.lookup 6) = "d") - && ((lena |> BatchedDeque.lookup 7) = "c") - && ((lena |> BatchedDeque.lookup 8) = "b") - && ((lena |> BatchedDeque.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 1" { - let a = len1 |> BatchedDeque.tryLookup 0 - (a.Value = "a") |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 2" { - let b = len2 |> BatchedDeque.tryLookup 0 - let a = len2 |> BatchedDeque.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 3" { - let c = len3 |> BatchedDeque.tryLookup 0 - let b = len3 |> BatchedDeque.tryLookup 1 - let a = len3 |> BatchedDeque.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 4" { - let d = len4 |> BatchedDeque.tryLookup 0 - let c = len4 |> BatchedDeque.tryLookup 1 - let b = len4 |> BatchedDeque.tryLookup 2 - let a = len4 |> BatchedDeque.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 5" { - let e = len5 |> BatchedDeque.tryLookup 0 - let d = len5 |> BatchedDeque.tryLookup 1 - let c = len5 |> BatchedDeque.tryLookup 2 - let b = len5 |> BatchedDeque.tryLookup 3 - let a = len5 |> BatchedDeque.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 6" { - let f = len6 |> BatchedDeque.tryLookup 0 - let e = len6 |> BatchedDeque.tryLookup 1 - let d = len6 |> BatchedDeque.tryLookup 2 - let c = len6 |> BatchedDeque.tryLookup 3 - let b = len6 |> BatchedDeque.tryLookup 4 - let a = len6 |> BatchedDeque.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 7" { - let g = len7 |> BatchedDeque.tryLookup 0 - let f = len7 |> BatchedDeque.tryLookup 1 - let e = len7 |> BatchedDeque.tryLookup 2 - let d = len7 |> BatchedDeque.tryLookup 3 - let c = len7 |> BatchedDeque.tryLookup 4 - let b = len7 |> BatchedDeque.tryLookup 5 - let a = len7 |> BatchedDeque.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 8" { - let h = len8 |> BatchedDeque.tryLookup 0 - let g = len8 |> BatchedDeque.tryLookup 1 - let f = len8 |> BatchedDeque.tryLookup 2 - let e = len8 |> BatchedDeque.tryLookup 3 - let d = len8 |> BatchedDeque.tryLookup 4 - let c = len8 |> BatchedDeque.tryLookup 5 - let b = len8 |> BatchedDeque.tryLookup 6 - let a = len8 |> BatchedDeque.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 9" { - let i = len9 |> BatchedDeque.tryLookup 0 - let h = len9 |> BatchedDeque.tryLookup 1 - let g = len9 |> BatchedDeque.tryLookup 2 - let f = len9 |> BatchedDeque.tryLookup 3 - let e = len9 |> BatchedDeque.tryLookup 4 - let d = len9 |> BatchedDeque.tryLookup 5 - let c = len9 |> BatchedDeque.tryLookup 6 - let b = len9 |> BatchedDeque.tryLookup 7 - let a = len9 |> BatchedDeque.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup BatchedDeque.length 10" { - let j = lena |> BatchedDeque.tryLookup 0 - let i = lena |> BatchedDeque.tryLookup 1 - let h = lena |> BatchedDeque.tryLookup 2 - let g = lena |> BatchedDeque.tryLookup 3 - let f = lena |> BatchedDeque.tryLookup 4 - let e = lena |> BatchedDeque.tryLookup 5 - let d = lena |> BatchedDeque.tryLookup 6 - let c = lena |> BatchedDeque.tryLookup 7 - let b = lena |> BatchedDeque.tryLookup 8 - let a = lena |> BatchedDeque.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryLookup not found" { lena |> BatchedDeque.tryLookup 10 |> Expect.isNone "" } - - test "BatchedDeque.remove elements BatchedDeque.length 1" { - len1 - |> BatchedDeque.remove 0 - |> BatchedDeque.isEmpty - |> Expect.isTrue "" - } - - test "BatchedDeque.remove elements BatchedDeque.length 2" { - let a = len2 |> BatchedDeque.remove 0 |> BatchedDeque.head - let b = len2 |> BatchedDeque.remove 1 |> BatchedDeque.head - ((a = "a") && (b = "b")) |> Expect.isTrue "" - } - - test "BatchedDeque.remove elements BatchedDeque.length 3" { - let r0 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.remove 0 - let b0 = BatchedDeque.head r0 - let t0 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t0 - - let r1 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.remove 1 - let a1 = BatchedDeque.head r1 - let t1 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t1 - - let r2 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.remove 2 - let a2 = BatchedDeque.head r2 - let t2 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "BatchedDeque.remove elements BatchedDeque.length 4" { - let r0 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 0 - let b0 = BatchedDeque.head r0 - let t0 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t0 - let t01 = BatchedDeque.tail t0 - let d0 = BatchedDeque.head t01 - - let r1 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 1 - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let d1 = BatchedDeque.head t12 - - let r2 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 2 - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - - let r3 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 3 - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "BatchedDeque.remove elements BatchedDeque.length 5" { - let r0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.remove 0 - - let b0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let d0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let e0 = BatchedDeque.head t03 - - let r1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.remove 1 - - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let d1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let e1 = BatchedDeque.head t13 - - let r2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.remove 2 - - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let e2 = BatchedDeque.head t23 - - let r3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.remove 3 - - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let e3 = BatchedDeque.head t33 - - let r4 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.remove 4 - - let a4 = BatchedDeque.head r4 - let t41 = BatchedDeque.tail r4 - let b4 = BatchedDeque.head t41 - let t42 = BatchedDeque.tail t41 - let c4 = BatchedDeque.head t42 - let t43 = BatchedDeque.tail t42 - let d4 = BatchedDeque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "BatchedDeque.remove elements BatchedDeque.length 6" { - let r0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.remove 0 - - let b0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let d0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let e0 = BatchedDeque.head t03 - let t04 = BatchedDeque.tail t03 - let f0 = BatchedDeque.head t04 - - let r1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.remove 1 - - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let d1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let e1 = BatchedDeque.head t13 - let t14 = BatchedDeque.tail t13 - let f1 = BatchedDeque.head t14 - - let r2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.remove 2 - - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let e2 = BatchedDeque.head t23 - let t24 = BatchedDeque.tail t23 - let f2 = BatchedDeque.head t24 - - let r3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.remove 3 - - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let e3 = BatchedDeque.head t33 - let t34 = BatchedDeque.tail t33 - let f3 = BatchedDeque.head t34 - - let r4 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.remove 4 - - let a4 = BatchedDeque.head r4 - let t41 = BatchedDeque.tail r4 - let b4 = BatchedDeque.head t41 - let t42 = BatchedDeque.tail t41 - let c4 = BatchedDeque.head t42 - let t43 = BatchedDeque.tail t42 - let d4 = BatchedDeque.head t43 - let t44 = BatchedDeque.tail t43 - let f4 = BatchedDeque.head t44 - - let r5 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.remove 5 - - let a5 = BatchedDeque.head r5 - let t51 = BatchedDeque.tail r5 - let b5 = BatchedDeque.head t51 - let t52 = BatchedDeque.tail t51 - let c5 = BatchedDeque.head t52 - let t53 = BatchedDeque.tail t52 - let d5 = BatchedDeque.head t53 - let t54 = BatchedDeque.tail t53 - let e5 = BatchedDeque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "tryRemoveempty" { BatchedDeque.empty() |> BatchedDeque.tryRemove 0 |> Expect.isNone "" } - - test "BatchedDeque.tryRemove elements BatchedDeque.length 1" { - let a = len1 |> BatchedDeque.tryRemove 0 - a.Value |> BatchedDeque.isEmpty |> Expect.isTrue "" - } - - test "BatchedDeque.tryRemove elements BatchedDeque.length 2" { - let a = len2 |> BatchedDeque.tryRemove 0 - let a1 = BatchedDeque.head a.Value - let b = len2 |> BatchedDeque.tryRemove 1 - let b1 = BatchedDeque.head b.Value - ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" - } - - test "BatchedDeque.tryRemove elements BatchedDeque.length 3" { - let x0 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.tryRemove 0 - let r0 = x0.Value - let b0 = BatchedDeque.head r0 - let t0 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t0 - - let x1 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.tryRemove 1 - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t1 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t1 - - let x2 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.tryRemove 2 - let r2 = x2.Value - let a2 = BatchedDeque.head r2 - let t2 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryRemove elements BatchedDeque.length 4" { - let x0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = BatchedDeque.head r0 - let t0 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t0 - let t01 = BatchedDeque.tail t0 - let d0 = BatchedDeque.head t01 - - let x1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let d1 = BatchedDeque.head t12 - - let x2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - - let x3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryRemove elements BatchedDeque.length 5" { - let x0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let d0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let e0 = BatchedDeque.head t03 - - let x1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let d1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let e1 = BatchedDeque.head t13 - - let x2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let e2 = BatchedDeque.head t23 - - let x3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let e3 = BatchedDeque.head t33 - - let x4 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.tryRemove 4 - - let r4 = x4.Value - let a4 = BatchedDeque.head r4 - let t41 = BatchedDeque.tail r4 - let b4 = BatchedDeque.head t41 - let t42 = BatchedDeque.tail t41 - let c4 = BatchedDeque.head t42 - let t43 = BatchedDeque.tail t42 - let d4 = BatchedDeque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryRemove elements BatchedDeque.length 6" { - let x0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let c0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let d0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let e0 = BatchedDeque.head t03 - let t04 = BatchedDeque.tail t03 - let f0 = BatchedDeque.head t04 - - let x1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let c1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let d1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let e1 = BatchedDeque.head t13 - let t14 = BatchedDeque.tail t13 - let f1 = BatchedDeque.head t14 - - let x2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let e2 = BatchedDeque.head t23 - let t24 = BatchedDeque.tail t23 - let f2 = BatchedDeque.head t24 - - let x3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let e3 = BatchedDeque.head t33 - let t34 = BatchedDeque.tail t33 - let f3 = BatchedDeque.head t34 - - let x4 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.tryRemove 4 - - let r4 = x4.Value - let a4 = BatchedDeque.head r4 - let t41 = BatchedDeque.tail r4 - let b4 = BatchedDeque.head t41 - let t42 = BatchedDeque.tail t41 - let c4 = BatchedDeque.head t42 - let t43 = BatchedDeque.tail t42 - let d4 = BatchedDeque.head t43 - let t44 = BatchedDeque.tail t43 - let f4 = BatchedDeque.head t44 - - let x5 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.tryRemove 5 - - let r5 = x5.Value - let a5 = BatchedDeque.head r5 - let t51 = BatchedDeque.tail r5 - let b5 = BatchedDeque.head t51 - let t52 = BatchedDeque.tail t51 - let c5 = BatchedDeque.head t52 - let t53 = BatchedDeque.tail t52 - let d5 = BatchedDeque.head t53 - let t54 = BatchedDeque.tail t53 - let e5 = BatchedDeque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "BatchedDeque.update elements BatchedDeque.length 1" { - len1 - |> BatchedDeque.update 0 "aa" - |> BatchedDeque.head - |> Expect.equal "" "aa" - } - - test "BatchedDeque.update elements BatchedDeque.length 2" { - let r0 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.update 0 "zz" - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - - let r1 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.update 1 "zz" - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.update elements BatchedDeque.length 3" { - let r0 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.update 0 "zz" - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let c0 = BatchedDeque.head t02 - - let r1 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.update 1 "zz" - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let c1 = BatchedDeque.head t12 - - let r2 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.update 2 "zz" - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.update elements BatchedDeque.length 4" { - let r0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.update 0 "zz" - - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let c0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let d0 = BatchedDeque.head t03 - - let r1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.update 1 "zz" - - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let c1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let d1 = BatchedDeque.head t13 - - let r2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.update 2 "zz" - - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let d2 = BatchedDeque.head t23 - - let r3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.update 3 "zz" - - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let d3 = BatchedDeque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.update elements BatchedDeque.length 5" { - let r0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.update 0 "zz" - - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let c0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let d0 = BatchedDeque.head t03 - let t04 = BatchedDeque.tail t03 - let e0 = BatchedDeque.head t04 - - let r1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.update 1 "zz" - - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let c1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let d1 = BatchedDeque.head t13 - let t14 = BatchedDeque.tail t13 - let e1 = BatchedDeque.head t14 - - let r2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.update 2 "zz" - - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let d2 = BatchedDeque.head t23 - let t24 = BatchedDeque.tail t23 - let e2 = BatchedDeque.head t24 - - let r3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.update 3 "zz" - - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let d3 = BatchedDeque.head t33 - let t34 = BatchedDeque.tail t33 - let e3 = BatchedDeque.head t34 - - let r4 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> BatchedDeque.update 4 "zz" - - let a4 = BatchedDeque.head r4 - let t41 = BatchedDeque.tail r4 - let b4 = BatchedDeque.head t41 - let t42 = BatchedDeque.tail t41 - let c4 = BatchedDeque.head t42 - let t43 = BatchedDeque.tail t42 - let d4 = BatchedDeque.head t43 - let t44 = BatchedDeque.tail t43 - let e4 = BatchedDeque.head t44 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.update elements BatchedDeque.length 6" { - let r0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.update 0 "zz" - - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let c0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let d0 = BatchedDeque.head t03 - let t04 = BatchedDeque.tail t03 - let e0 = BatchedDeque.head t04 - let t05 = BatchedDeque.tail t04 - let f0 = BatchedDeque.head t05 - - let r1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.update 1 "zz" - - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let c1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let d1 = BatchedDeque.head t13 - let t14 = BatchedDeque.tail t13 - let e1 = BatchedDeque.head t14 - let t15 = BatchedDeque.tail t14 - let f1 = BatchedDeque.head t15 - - let r2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.update 2 "zz" - - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let d2 = BatchedDeque.head t23 - let t24 = BatchedDeque.tail t23 - let e2 = BatchedDeque.head t24 - let t25 = BatchedDeque.tail t24 - let f2 = BatchedDeque.head t25 - - let r3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.update 3 "zz" - - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let d3 = BatchedDeque.head t33 - let t34 = BatchedDeque.tail t33 - let e3 = BatchedDeque.head t34 - let t35 = BatchedDeque.tail t34 - let f3 = BatchedDeque.head t35 - - let r4 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.update 4 "zz" - - let a4 = BatchedDeque.head r4 - let t41 = BatchedDeque.tail r4 - let b4 = BatchedDeque.head t41 - let t42 = BatchedDeque.tail t41 - let c4 = BatchedDeque.head t42 - let t43 = BatchedDeque.tail t42 - let d4 = BatchedDeque.head t43 - let t44 = BatchedDeque.tail t43 - let e4 = BatchedDeque.head t44 - let t45 = BatchedDeque.tail t44 - let f4 = BatchedDeque.head t45 - - let r5 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> BatchedDeque.update 5 "zz" - - let a5 = BatchedDeque.head r5 - let t51 = BatchedDeque.tail r5 - let b5 = BatchedDeque.head t51 - let t52 = BatchedDeque.tail t51 - let c5 = BatchedDeque.head t52 - let t53 = BatchedDeque.tail t52 - let d5 = BatchedDeque.head t53 - let t54 = BatchedDeque.tail t53 - let e5 = BatchedDeque.head t54 - let t55 = BatchedDeque.tail t54 - let f5 = BatchedDeque.head t55 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e") - && (f5 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryUpdate elements BatchedDeque.length 1" { - let a = len1 |> BatchedDeque.tryUpdate 0 "aa" - a.Value |> BatchedDeque.head |> Expect.equal "" "aa" - } - - test "BatchedDeque.tryUpdate elements BatchedDeque.length 2" { - let x0 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.tryUpdate 0 "zz" - let r0 = x0.Value - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - - let x1 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.tryUpdate 1 "zz" - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryUpdate elements BatchedDeque.length 3" { - let x0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) - |> BatchedDeque.tryUpdate 0 "zz" - - let r0 = x0.Value - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let c0 = BatchedDeque.head t02 - - let x1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) - |> BatchedDeque.tryUpdate 1 "zz" - - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let c1 = BatchedDeque.head t12 - - let x2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) - |> BatchedDeque.tryUpdate 2 "zz" - - let r2 = x2.Value - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryUpdate elements BatchedDeque.length 4" { - let x0 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryUpdate 0 "zz" - - let r0 = x0.Value - let a0 = BatchedDeque.head r0 - let t01 = BatchedDeque.tail r0 - let b0 = BatchedDeque.head t01 - let t02 = BatchedDeque.tail t01 - let c0 = BatchedDeque.head t02 - let t03 = BatchedDeque.tail t02 - let d0 = BatchedDeque.head t03 - - let x1 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryUpdate 1 "zz" - - let r1 = x1.Value - let a1 = BatchedDeque.head r1 - let t11 = BatchedDeque.tail r1 - let b1 = BatchedDeque.head t11 - let t12 = BatchedDeque.tail t11 - let c1 = BatchedDeque.head t12 - let t13 = BatchedDeque.tail t12 - let d1 = BatchedDeque.head t13 - - let x2 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryUpdate 2 "zz" - - let r2 = x2.Value - let a2 = BatchedDeque.head r2 - let t21 = BatchedDeque.tail r2 - let b2 = BatchedDeque.head t21 - let t22 = BatchedDeque.tail t21 - let c2 = BatchedDeque.head t22 - let t23 = BatchedDeque.tail t22 - let d2 = BatchedDeque.head t23 - - let x3 = - (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> BatchedDeque.tryUpdate 3 "zz" - - let r3 = x3.Value - let a3 = BatchedDeque.head r3 - let t31 = BatchedDeque.tail r3 - let b3 = BatchedDeque.head t31 - let t32 = BatchedDeque.tail t31 - let c3 = BatchedDeque.head t32 - let t33 = BatchedDeque.tail t32 - let d3 = BatchedDeque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "BatchedDeque.tryUncons on empty" { - let q = BatchedDeque.empty() - (BatchedDeque.tryUncons q = None) |> Expect.isTrue "" - } - - test "BatchedDeque.tryUncons on q" { - let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let x, xs = (BatchedDeque.tryUncons q).Value - x |> Expect.equal "" "a" - } - - test "BatchedDeque.tryUnsnoc on empty" { - let q = BatchedDeque.empty() - (BatchedDeque.tryUnsnoc q = None) |> Expect.isTrue "" - } - - test "BatchedDeque.tryUnsnoc on q" { - let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let xs, x = (BatchedDeque.tryUnsnoc q).Value - x |> Expect.equal "" "d" - } - - test "BatchedDeque.tryGetHead on empty" { - let q = BatchedDeque.empty() - (BatchedDeque.tryGetHead q = None) |> Expect.isTrue "" - } - - test "BatchedDeque.tryGetHead on q" { - let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] - (BatchedDeque.tryGetHead q).Value |> Expect.equal "" "a" - } - - test "BatchedDeque.tryGetInit on empty" { - let q = BatchedDeque.empty() - (BatchedDeque.tryGetInit q = None) |> Expect.isTrue "" - } - - test "BatchedDeque.tryGetInit on q" { - let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let x = (BatchedDeque.tryGetInit q).Value - let x2 = x |> BatchedDeque.last - x2 |> Expect.equal "" "c" - } - - test "BatchedDeque.tryGetLast on empty" { - let q = BatchedDeque.empty() - (BatchedDeque.tryGetLast q = None) |> Expect.isTrue "" - } - - test "BatchedDeque.tryGetLast on q" { - let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] - (BatchedDeque.tryGetLast q).Value |> Expect.equal "" "d" - } - - - test "BatchedDeque.tryGetTail on empty" { - let q = BatchedDeque.empty() - (BatchedDeque.tryGetTail q = None) |> Expect.isTrue "" - } - - test "BatchedDeque.tryGetTail on q" { - let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] - - (BatchedDeque.tryGetTail q).Value - |> BatchedDeque.head - |> Expect.equal "" "b" - } - ] + testList + "Experimental BatchDeque" + [ + + test "empty dqueue should be empty" { BatchedDeque.empty() |> BatchedDeque.isEmpty |> Expect.isTrue "" } + + test "BatchedDeque.cons works" { len2 |> BatchedDeque.isEmpty |> Expect.isFalse "" } + + test "BatchedDeque.snoc works" { len2snoc |> BatchedDeque.isEmpty |> Expect.isFalse "" } + + test "BatchedDeque.singleton BatchedDeque.head works" { len1 |> BatchedDeque.head |> Expect.equal "" "a" } + + test "BatchedDeque.singleton BatchedDeque.last works" { len1 |> BatchedDeque.last |> Expect.equal "" "a" } + + test "BatchedDeque.tail of BatchedDeque.singleton empty" { len1 |> BatchedDeque.tail |> BatchedDeque.isEmpty |> Expect.isTrue "" } + + test "BatchedDeque.tail of BatchedDeque.tail of 2 empty" { + (len2 |> BatchedDeque.tail |> BatchedDeque.tail |> BatchedDeque.isEmpty) + |> Expect.isTrue "" + } + + test "BatchedDeque.init of BatchedDeque.singleton empty" { len1 |> BatchedDeque.init |> BatchedDeque.isEmpty |> Expect.isTrue "" } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 1" { + let t1 = BatchedDeque.tail len2 + let t1s = BatchedDeque.tail len2snoc + + (((BatchedDeque.length t1) = 1) + && ((BatchedDeque.length t1s) = 1) + && ((BatchedDeque.head t1) = "a") + && ((BatchedDeque.head t1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 2" { + let t1 = BatchedDeque.tail len3 + let t1s = BatchedDeque.tail len3snoc + + let t1_1 = BatchedDeque.tail t1 + let t1_1s = BatchedDeque.tail t1s + + (((BatchedDeque.length t1) = 2) + && ((BatchedDeque.length t1s) = 2) + && ((BatchedDeque.head t1) = "b") + && ((BatchedDeque.head t1s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 3" { + let t1 = BatchedDeque.tail len4 + let t1s = BatchedDeque.tail len4snoc + + let t1_2 = BatchedDeque.tail t1 + let t1_2s = BatchedDeque.tail t1s + + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 3) + && ((BatchedDeque.length t1s) = 3) + && ((BatchedDeque.head t1) = "c") + && ((BatchedDeque.head t1s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 4" { + let t1 = BatchedDeque.tail len5 + let t1s = BatchedDeque.tail len5snoc + + let t1_3 = BatchedDeque.tail t1 + let t1_3s = BatchedDeque.tail t1s + + let t1_2 = BatchedDeque.tail t1_3 + let t1_2s = BatchedDeque.tail t1_3s + + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 4) + && ((BatchedDeque.length t1s) = 4) + && ((BatchedDeque.head t1) = "d") + && ((BatchedDeque.head t1s) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.length t1_3s) = 3) + && ((BatchedDeque.head t1_3) = "c") + && ((BatchedDeque.head t1_3s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 5" { + let t1 = BatchedDeque.tail len6 + let t1s = BatchedDeque.tail len6snoc + + let t1_4 = BatchedDeque.tail t1 + let t1_4s = BatchedDeque.tail t1s + + let t1_3 = BatchedDeque.tail t1_4 + let t1_3s = BatchedDeque.tail t1_4s + + let t1_2 = BatchedDeque.tail t1_3 + let t1_2s = BatchedDeque.tail t1_3s + + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 5) + && ((BatchedDeque.length t1s) = 5) + && ((BatchedDeque.head t1) = "e") + && ((BatchedDeque.head t1s) = "e") + && ((BatchedDeque.length t1_4) = 4) + && ((BatchedDeque.length t1_4s) = 4) + && ((BatchedDeque.head t1_4) = "d") + && ((BatchedDeque.head t1_4s) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.length t1_3s) = 3) + && ((BatchedDeque.head t1_3) = "c") + && ((BatchedDeque.head t1_3s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 6" { + let t1 = BatchedDeque.tail len7 + let t1s = BatchedDeque.tail len7snoc + + let t1_5 = BatchedDeque.tail t1 + let t1_5s = BatchedDeque.tail t1s + + let t1_4 = BatchedDeque.tail t1_5 + let t1_4s = BatchedDeque.tail t1_5s + + let t1_3 = BatchedDeque.tail t1_4 + let t1_3s = BatchedDeque.tail t1_4s + + let t1_2 = BatchedDeque.tail t1_3 + let t1_2s = BatchedDeque.tail t1_3s + + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 6) + && ((BatchedDeque.length t1s) = 6) + && ((BatchedDeque.head t1) = "f") + && ((BatchedDeque.head t1s) = "f") + && ((BatchedDeque.length t1_5) = 5) + && ((BatchedDeque.length t1_5s) = 5) + && ((BatchedDeque.head t1_5) = "e") + && ((BatchedDeque.head t1_5s) = "e") + && ((BatchedDeque.length t1_4) = 4) + && ((BatchedDeque.length t1_4s) = 4) + && ((BatchedDeque.head t1_4) = "d") + && ((BatchedDeque.head t1_4s) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.length t1_3s) = 3) + && ((BatchedDeque.head t1_3) = "c") + && ((BatchedDeque.head t1_3s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 7" { + let t1 = BatchedDeque.tail len8 + let t1s = BatchedDeque.tail len8snoc + let t1_6 = BatchedDeque.tail t1 + let t1_6s = BatchedDeque.tail t1s + let t1_5 = BatchedDeque.tail t1_6 + let t1_5s = BatchedDeque.tail t1_6s + let t1_4 = BatchedDeque.tail t1_5 + let t1_4s = BatchedDeque.tail t1_5s + let t1_3 = BatchedDeque.tail t1_4 + let t1_3s = BatchedDeque.tail t1_4s + let t1_2 = BatchedDeque.tail t1_3 + let t1_2s = BatchedDeque.tail t1_3s + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 7) + && ((BatchedDeque.length t1s) = 7) + && ((BatchedDeque.head t1) = "g") + && ((BatchedDeque.head t1s) = "g") + && ((BatchedDeque.length t1_6) = 6) + && ((BatchedDeque.length t1_6s) = 6) + && ((BatchedDeque.head t1_6) = "f") + && ((BatchedDeque.head t1_6s) = "f") + && ((BatchedDeque.length t1_5) = 5) + && ((BatchedDeque.length t1_5s) = 5) + && ((BatchedDeque.head t1_5) = "e") + && ((BatchedDeque.head t1_5s) = "e") + && ((BatchedDeque.length t1_4) = 4) + && ((BatchedDeque.length t1_4s) = 4) + && ((BatchedDeque.head t1_4) = "d") + && ((BatchedDeque.head t1_4s) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.length t1_3s) = 3) + && ((BatchedDeque.head t1_3) = "c") + && ((BatchedDeque.head t1_3s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 8" { + let t1 = BatchedDeque.tail len9 + let t1s = BatchedDeque.tail len9snoc + let t1_7 = BatchedDeque.tail t1 + let t1_7s = BatchedDeque.tail t1s + let t1_6 = BatchedDeque.tail t1_7 + let t1_6s = BatchedDeque.tail t1_7s + let t1_5 = BatchedDeque.tail t1_6 + let t1_5s = BatchedDeque.tail t1_6s + let t1_4 = BatchedDeque.tail t1_5 + let t1_4s = BatchedDeque.tail t1_5s + let t1_3 = BatchedDeque.tail t1_4 + let t1_3s = BatchedDeque.tail t1_4s + let t1_2 = BatchedDeque.tail t1_3 + let t1_2s = BatchedDeque.tail t1_3s + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 8) + && ((BatchedDeque.length t1s) = 8) + && ((BatchedDeque.head t1) = "h") + && ((BatchedDeque.head t1s) = "h") + && ((BatchedDeque.length t1_7) = 7) + && ((BatchedDeque.length t1_7s) = 7) + && ((BatchedDeque.head t1_7) = "g") + && ((BatchedDeque.head t1_7s) = "g") + && ((BatchedDeque.length t1_6) = 6) + && ((BatchedDeque.length t1_6s) = 6) + && ((BatchedDeque.head t1_6) = "f") + && ((BatchedDeque.head t1_6s) = "f") + && ((BatchedDeque.length t1_5) = 5) + && ((BatchedDeque.length t1_5s) = 5) + && ((BatchedDeque.head t1_5) = "e") + && ((BatchedDeque.head t1_5s) = "e") + && ((BatchedDeque.length t1_4) = 4) + && ((BatchedDeque.length t1_4s) = 4) + && ((BatchedDeque.head t1_4) = "d") + && ((BatchedDeque.head t1_4s) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.length t1_3s) = 3) + && ((BatchedDeque.head t1_3) = "c") + && ((BatchedDeque.head t1_3s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.head, BatchedDeque.tail, and BatchedDeque.length work test 9" { + let t1 = BatchedDeque.tail lena + let t1s = BatchedDeque.tail lenasnoc + let t1_8 = BatchedDeque.tail t1 + let t1_8s = BatchedDeque.tail t1s + let t1_7 = BatchedDeque.tail t1_8 + let t1_7s = BatchedDeque.tail t1_8s + let t1_6 = BatchedDeque.tail t1_7 + let t1_6s = BatchedDeque.tail t1_7s + let t1_5 = BatchedDeque.tail t1_6 + let t1_5s = BatchedDeque.tail t1_6s + let t1_4 = BatchedDeque.tail t1_5 + let t1_4s = BatchedDeque.tail t1_5s + let t1_3 = BatchedDeque.tail t1_4 + let t1_3s = BatchedDeque.tail t1_4s + let t1_2 = BatchedDeque.tail t1_3 + let t1_2s = BatchedDeque.tail t1_3s + let t1_1 = BatchedDeque.tail t1_2 + let t1_1s = BatchedDeque.tail t1_2s + + (((BatchedDeque.length t1) = 9) + && ((BatchedDeque.length t1s) = 9) + && ((BatchedDeque.head t1) = "i") + && ((BatchedDeque.head t1s) = "i") + && ((BatchedDeque.length t1_8) = 8) + && ((BatchedDeque.length t1_8s) = 8) + && ((BatchedDeque.head t1_8) = "h") + && ((BatchedDeque.head t1_8s) = "h") + && ((BatchedDeque.length t1_7) = 7) + && ((BatchedDeque.length t1_7s) = 7) + && ((BatchedDeque.head t1_7) = "g") + && ((BatchedDeque.head t1_7s) = "g") + && ((BatchedDeque.length t1_6) = 6) + && ((BatchedDeque.length t1_6s) = 6) + && ((BatchedDeque.head t1_6) = "f") + && ((BatchedDeque.head t1_6s) = "f") + && ((BatchedDeque.length t1_5) = 5) + && ((BatchedDeque.length t1_5s) = 5) + && ((BatchedDeque.head t1_5) = "e") + && ((BatchedDeque.head t1_5s) = "e") + && ((BatchedDeque.length t1_4) = 4) + && ((BatchedDeque.length t1_4s) = 4) + && ((BatchedDeque.head t1_4) = "d") + && ((BatchedDeque.head t1_4s) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.length t1_3s) = 3) + && ((BatchedDeque.head t1_3) = "c") + && ((BatchedDeque.head t1_3s) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.length t1_2s) = 2) + && ((BatchedDeque.head t1_2) = "b") + && ((BatchedDeque.head t1_2s) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.length t1_1s) = 1) + && ((BatchedDeque.head t1_1) = "a") + && ((BatchedDeque.head t1_1s) = "a")) + |> Expect.isTrue "" + } + + //the previous series thoroughly tested construction by BatchedDeque.snoc, so we'll leave those out + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 1" { + let t1 = BatchedDeque.init len2 + + (((BatchedDeque.length t1) = 1) && ((BatchedDeque.last t1) = "b")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 2" { + let t1 = BatchedDeque.init len3 + let t1_1 = BatchedDeque.init t1 + + (((BatchedDeque.length t1) = 2) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 1) + && ((BatchedDeque.last t1_1) = "c")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 3" { + let t1 = BatchedDeque.init len4 + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + + (((BatchedDeque.length t1) = 3) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 2) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 1) + && ((BatchedDeque.last t1_2) = "d")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 4" { + let t1 = BatchedDeque.init len5 + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + let t1_3 = BatchedDeque.init t1_2 + + (((BatchedDeque.length t1) = 4) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 3) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 2) + && ((BatchedDeque.last t1_2) = "d") + && ((BatchedDeque.length t1_3) = 1) + && ((BatchedDeque.last t1_3) = "e")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 5" { + let t1 = BatchedDeque.init len6 + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + let t1_3 = BatchedDeque.init t1_2 + let t1_4 = BatchedDeque.init t1_3 + + (((BatchedDeque.length t1) = 5) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 4) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 3) + && ((BatchedDeque.last t1_2) = "d") + && ((BatchedDeque.length t1_3) = 2) + && ((BatchedDeque.last t1_3) = "e") + && ((BatchedDeque.length t1_4) = 1) + && ((BatchedDeque.last t1_4) = "f")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 6" { + let t1 = BatchedDeque.init len7 + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + let t1_3 = BatchedDeque.init t1_2 + let t1_4 = BatchedDeque.init t1_3 + let t1_5 = BatchedDeque.init t1_4 + + (((BatchedDeque.length t1) = 6) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 5) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 4) + && ((BatchedDeque.last t1_2) = "d") + && ((BatchedDeque.length t1_3) = 3) + && ((BatchedDeque.last t1_3) = "e") + && ((BatchedDeque.length t1_4) = 2) + && ((BatchedDeque.last t1_4) = "f") + && ((BatchedDeque.length t1_5) = 1) + && ((BatchedDeque.last t1_5) = "g")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 7" { + let t1 = BatchedDeque.init len8 + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + let t1_3 = BatchedDeque.init t1_2 + let t1_4 = BatchedDeque.init t1_3 + let t1_5 = BatchedDeque.init t1_4 + let t1_6 = BatchedDeque.init t1_5 + + (((BatchedDeque.length t1) = 7) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 6) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 5) + && ((BatchedDeque.last t1_2) = "d") + && ((BatchedDeque.length t1_3) = 4) + && ((BatchedDeque.last t1_3) = "e") + && ((BatchedDeque.length t1_4) = 3) + && ((BatchedDeque.last t1_4) = "f") + && ((BatchedDeque.length t1_5) = 2) + && ((BatchedDeque.last t1_5) = "g") + && ((BatchedDeque.length t1_6) = 1) + && ((BatchedDeque.last t1_6) = "h")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 8" { + let t1 = BatchedDeque.init len9 + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + let t1_3 = BatchedDeque.init t1_2 + let t1_4 = BatchedDeque.init t1_3 + let t1_5 = BatchedDeque.init t1_4 + let t1_6 = BatchedDeque.init t1_5 + let t1_7 = BatchedDeque.init t1_6 + + (((BatchedDeque.length t1) = 8) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 7) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 6) + && ((BatchedDeque.last t1_2) = "d") + && ((BatchedDeque.length t1_3) = 5) + && ((BatchedDeque.last t1_3) = "e") + && ((BatchedDeque.length t1_4) = 4) + && ((BatchedDeque.last t1_4) = "f") + && ((BatchedDeque.length t1_5) = 3) + && ((BatchedDeque.last t1_5) = "g") + && ((BatchedDeque.length t1_6) = 2) + && ((BatchedDeque.last t1_6) = "h") + && ((BatchedDeque.length t1_7) = 1) + && ((BatchedDeque.last t1_7) = "i")) + |> Expect.isTrue "" + } + + test "BatchedDeque.last, BatchedDeque.init, and BatchedDeque.length work test 9" { + let t1 = BatchedDeque.init lena + let t1_1 = BatchedDeque.init t1 + let t1_2 = BatchedDeque.init t1_1 + let t1_3 = BatchedDeque.init t1_2 + let t1_4 = BatchedDeque.init t1_3 + let t1_5 = BatchedDeque.init t1_4 + let t1_6 = BatchedDeque.init t1_5 + let t1_7 = BatchedDeque.init t1_6 + let t1_8 = BatchedDeque.init t1_7 + + (((BatchedDeque.length t1) = 9) + && ((BatchedDeque.last t1) = "b") + && ((BatchedDeque.length t1_1) = 8) + && ((BatchedDeque.last t1_1) = "c") + && ((BatchedDeque.length t1_2) = 7) + && ((BatchedDeque.last t1_2) = "d") + && ((BatchedDeque.length t1_3) = 6) + && ((BatchedDeque.last t1_3) = "e") + && ((BatchedDeque.length t1_4) = 5) + && ((BatchedDeque.last t1_4) = "f") + && ((BatchedDeque.length t1_5) = 4) + && ((BatchedDeque.last t1_5) = "g") + && ((BatchedDeque.length t1_6) = 3) + && ((BatchedDeque.last t1_6) = "h") + && ((BatchedDeque.length t1_7) = 2) + && ((BatchedDeque.last t1_7) = "i") + && ((BatchedDeque.length t1_8) = 1) + && ((BatchedDeque.last t1_8) = "j")) + |> Expect.isTrue "" + } + + test "IEnumerable Seq" { (lena |> Seq.toArray).[5] |> Expect.equal "" "e" } + + test "IEnumerable Seq BatchedDeque.length" { lena |> Seq.length |> Expect.equal "" 10 } + + test "type BatchedDeque.cons works" { lena.Cons "zz" |> BatchedDeque.head |> Expect.equal "" "zz" } + + test "IDeque BatchedDeque.cons works" { ((lena :> IDeque).Cons "zz").Head |> Expect.equal "" "zz" } + + test "BatchedDeque.ofCatLists and BatchedDeque.uncons" { + let d = BatchedDeque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] + let h1, t1 = BatchedDeque.uncons d + let h2, t2 = BatchedDeque.uncons t1 + let h3, t3 = BatchedDeque.uncons t2 + let h4, t4 = BatchedDeque.uncons t3 + let h5, t5 = BatchedDeque.uncons t4 + let h6, t6 = BatchedDeque.uncons t5 + + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f") + && (BatchedDeque.isEmpty t6)) + |> Expect.isTrue "" + } + + test "BatchedDeque.unsnoc works" { + let d = BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] + let i1, l1 = BatchedDeque.unsnoc d + let i2, l2 = BatchedDeque.unsnoc i1 + let i3, l3 = BatchedDeque.unsnoc i2 + let i4, l4 = BatchedDeque.unsnoc i3 + let i5, l5 = BatchedDeque.unsnoc i4 + let i6, l6 = BatchedDeque.unsnoc i5 + + ((l1 = "a") + && (l2 = "b") + && (l3 = "c") + && (l4 = "d") + && (l5 = "e") + && (l6 = "f") + && (BatchedDeque.isEmpty i6)) + |> Expect.isTrue "" + } + + test "BatchedDeque.snoc pattern discriminator" { + let d = (BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let i1, l1 = BatchedDeque.unsnoc d + + let i2, l2 = + match i1 with + | BatchedDeque.Snoc(i, l) -> i, l + | _ -> i1, "x" + + ((l2 = "b") && ((BatchedDeque.length i2) = 4)) |> Expect.isTrue "" + } + + test "BatchedDeque.cons pattern discriminator" { + let d = (BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let h1, t1 = BatchedDeque.uncons d + + let h2, t2 = + match t1 with + | BatchedDeque.Cons(h, t) -> h, t + | _ -> "x", t1 + + ((h2 = "e") && ((BatchedDeque.length t2) = 4)) |> Expect.isTrue "" + } + + test "BatchedDeque.cons and BatchedDeque.snoc pattern discriminator" { + let d = (BatchedDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + + let mid1 = + match d with + | BatchedDeque.Cons(h, BatchedDeque.Snoc(i, l)) -> i + | _ -> d + + let head, last = + match mid1 with + | BatchedDeque.Cons(h, BatchedDeque.Snoc(i, l)) -> h, l + | _ -> "x", "x" + + ((head = "e") && (last = "b")) |> Expect.isTrue "" + } + + test "BatchedDeque.rev dqueue BatchedDeque.length 1" { BatchedDeque.rev len1 |> BatchedDeque.head |> Expect.equal "" "a" } + + test "BatchedDeque.rev dqueue BatchedDeque.length 2" { + let r1 = BatchedDeque.rev len2 + let h1 = BatchedDeque.head r1 + let t2 = BatchedDeque.tail r1 + let h2 = BatchedDeque.head t2 + + ((h1 = "a") && (h2 = "b")) |> Expect.isTrue "" + } + + test "BatchedDeque.rev dqueue BatchedDeque.length 3" { + let r1 = BatchedDeque.rev len3 + let h1 = BatchedDeque.head r1 + let t2 = BatchedDeque.tail r1 + let h2 = BatchedDeque.head t2 + let t3 = BatchedDeque.tail t2 + let h3 = BatchedDeque.head t3 + + ((h1 = "a") && (h2 = "b") && (h3 = "c")) |> Expect.isTrue "" + } + + test "BatchedDeque.rev dqueue BatchedDeque.length 4" { + let r1 = BatchedDeque.rev len4 + let h1 = BatchedDeque.head r1 + let t2 = BatchedDeque.tail r1 + let h2 = BatchedDeque.head t2 + let t3 = BatchedDeque.tail t2 + let h3 = BatchedDeque.head t3 + let t4 = BatchedDeque.tail t3 + let h4 = BatchedDeque.head t4 + + ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d")) + |> Expect.isTrue "" + } + + test "BatchedDeque.rev dqueue BatchedDeque.length 5" { + let r1 = BatchedDeque.rev len5 + let h1 = BatchedDeque.head r1 + let t2 = BatchedDeque.tail r1 + let h2 = BatchedDeque.head t2 + let t3 = BatchedDeque.tail t2 + let h3 = BatchedDeque.head t3 + let t4 = BatchedDeque.tail t3 + let h4 = BatchedDeque.head t4 + let t5 = BatchedDeque.tail t4 + let h5 = BatchedDeque.head t5 + + ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d") && (h5 = "e")) + |> Expect.isTrue "" + } + + //BatchedDeque.length 6 more than sufficient to test BatchedDeque.rev + test "BatchedDeque.rev dqueue BatchedDeque.length 6" { + let r1 = BatchedDeque.rev len6 + let h1 = BatchedDeque.head r1 + let t2 = BatchedDeque.tail r1 + let h2 = BatchedDeque.head t2 + let t3 = BatchedDeque.tail t2 + let h3 = BatchedDeque.head t3 + let t4 = BatchedDeque.tail t3 + let h4 = BatchedDeque.head t4 + let t5 = BatchedDeque.tail t4 + let h5 = BatchedDeque.head t5 + let t6 = BatchedDeque.tail t5 + let h6 = BatchedDeque.head t6 + + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 1" { len1 |> BatchedDeque.lookup 0 |> Expect.equal "" "a" } + + test "BatchedDeque.lookup BatchedDeque.length 2" { + (((len2 |> BatchedDeque.lookup 0) = "b") + && ((len2 |> BatchedDeque.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 3" { + (((len3 |> BatchedDeque.lookup 0) = "c") + && ((len3 |> BatchedDeque.lookup 1) = "b") + && ((len3 |> BatchedDeque.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 4" { + (((len4 |> BatchedDeque.lookup 0) = "d") + && ((len4 |> BatchedDeque.lookup 1) = "c") + && ((len4 |> BatchedDeque.lookup 2) = "b") + && ((len4 |> BatchedDeque.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 5" { + (((len5 |> BatchedDeque.lookup 0) = "e") + && ((len5 |> BatchedDeque.lookup 1) = "d") + && ((len5 |> BatchedDeque.lookup 2) = "c") + && ((len5 |> BatchedDeque.lookup 3) = "b") + && ((len5 |> BatchedDeque.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 6" { + (((len6 |> BatchedDeque.lookup 0) = "f") + && ((len6 |> BatchedDeque.lookup 1) = "e") + && ((len6 |> BatchedDeque.lookup 2) = "d") + && ((len6 |> BatchedDeque.lookup 3) = "c") + && ((len6 |> BatchedDeque.lookup 4) = "b") + && ((len6 |> BatchedDeque.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 7" { + (((len7 |> BatchedDeque.lookup 0) = "g") + && ((len7 |> BatchedDeque.lookup 1) = "f") + && ((len7 |> BatchedDeque.lookup 2) = "e") + && ((len7 |> BatchedDeque.lookup 3) = "d") + && ((len7 |> BatchedDeque.lookup 4) = "c") + && ((len7 |> BatchedDeque.lookup 5) = "b") + && ((len7 |> BatchedDeque.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 8" { + (((len8 |> BatchedDeque.lookup 0) = "h") + && ((len8 |> BatchedDeque.lookup 1) = "g") + && ((len8 |> BatchedDeque.lookup 2) = "f") + && ((len8 |> BatchedDeque.lookup 3) = "e") + && ((len8 |> BatchedDeque.lookup 4) = "d") + && ((len8 |> BatchedDeque.lookup 5) = "c") + && ((len8 |> BatchedDeque.lookup 6) = "b") + && ((len8 |> BatchedDeque.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 9" { + (((len9 |> BatchedDeque.lookup 0) = "i") + && ((len9 |> BatchedDeque.lookup 1) = "h") + && ((len9 |> BatchedDeque.lookup 2) = "g") + && ((len9 |> BatchedDeque.lookup 3) = "f") + && ((len9 |> BatchedDeque.lookup 4) = "e") + && ((len9 |> BatchedDeque.lookup 5) = "d") + && ((len9 |> BatchedDeque.lookup 6) = "c") + && ((len9 |> BatchedDeque.lookup 7) = "b") + && ((len9 |> BatchedDeque.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.lookup BatchedDeque.length 10" { + (((lena |> BatchedDeque.lookup 0) = "j") + && ((lena |> BatchedDeque.lookup 1) = "i") + && ((lena |> BatchedDeque.lookup 2) = "h") + && ((lena |> BatchedDeque.lookup 3) = "g") + && ((lena |> BatchedDeque.lookup 4) = "f") + && ((lena |> BatchedDeque.lookup 5) = "e") + && ((lena |> BatchedDeque.lookup 6) = "d") + && ((lena |> BatchedDeque.lookup 7) = "c") + && ((lena |> BatchedDeque.lookup 8) = "b") + && ((lena |> BatchedDeque.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 1" { + let a = len1 |> BatchedDeque.tryLookup 0 + (a.Value = "a") |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 2" { + let b = len2 |> BatchedDeque.tryLookup 0 + let a = len2 |> BatchedDeque.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 3" { + let c = len3 |> BatchedDeque.tryLookup 0 + let b = len3 |> BatchedDeque.tryLookup 1 + let a = len3 |> BatchedDeque.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 4" { + let d = len4 |> BatchedDeque.tryLookup 0 + let c = len4 |> BatchedDeque.tryLookup 1 + let b = len4 |> BatchedDeque.tryLookup 2 + let a = len4 |> BatchedDeque.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 5" { + let e = len5 |> BatchedDeque.tryLookup 0 + let d = len5 |> BatchedDeque.tryLookup 1 + let c = len5 |> BatchedDeque.tryLookup 2 + let b = len5 |> BatchedDeque.tryLookup 3 + let a = len5 |> BatchedDeque.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 6" { + let f = len6 |> BatchedDeque.tryLookup 0 + let e = len6 |> BatchedDeque.tryLookup 1 + let d = len6 |> BatchedDeque.tryLookup 2 + let c = len6 |> BatchedDeque.tryLookup 3 + let b = len6 |> BatchedDeque.tryLookup 4 + let a = len6 |> BatchedDeque.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 7" { + let g = len7 |> BatchedDeque.tryLookup 0 + let f = len7 |> BatchedDeque.tryLookup 1 + let e = len7 |> BatchedDeque.tryLookup 2 + let d = len7 |> BatchedDeque.tryLookup 3 + let c = len7 |> BatchedDeque.tryLookup 4 + let b = len7 |> BatchedDeque.tryLookup 5 + let a = len7 |> BatchedDeque.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 8" { + let h = len8 |> BatchedDeque.tryLookup 0 + let g = len8 |> BatchedDeque.tryLookup 1 + let f = len8 |> BatchedDeque.tryLookup 2 + let e = len8 |> BatchedDeque.tryLookup 3 + let d = len8 |> BatchedDeque.tryLookup 4 + let c = len8 |> BatchedDeque.tryLookup 5 + let b = len8 |> BatchedDeque.tryLookup 6 + let a = len8 |> BatchedDeque.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 9" { + let i = len9 |> BatchedDeque.tryLookup 0 + let h = len9 |> BatchedDeque.tryLookup 1 + let g = len9 |> BatchedDeque.tryLookup 2 + let f = len9 |> BatchedDeque.tryLookup 3 + let e = len9 |> BatchedDeque.tryLookup 4 + let d = len9 |> BatchedDeque.tryLookup 5 + let c = len9 |> BatchedDeque.tryLookup 6 + let b = len9 |> BatchedDeque.tryLookup 7 + let a = len9 |> BatchedDeque.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup BatchedDeque.length 10" { + let j = lena |> BatchedDeque.tryLookup 0 + let i = lena |> BatchedDeque.tryLookup 1 + let h = lena |> BatchedDeque.tryLookup 2 + let g = lena |> BatchedDeque.tryLookup 3 + let f = lena |> BatchedDeque.tryLookup 4 + let e = lena |> BatchedDeque.tryLookup 5 + let d = lena |> BatchedDeque.tryLookup 6 + let c = lena |> BatchedDeque.tryLookup 7 + let b = lena |> BatchedDeque.tryLookup 8 + let a = lena |> BatchedDeque.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryLookup not found" { lena |> BatchedDeque.tryLookup 10 |> Expect.isNone "" } + + test "BatchedDeque.remove elements BatchedDeque.length 1" { + len1 + |> BatchedDeque.remove 0 + |> BatchedDeque.isEmpty + |> Expect.isTrue "" + } + + test "BatchedDeque.remove elements BatchedDeque.length 2" { + let a = len2 |> BatchedDeque.remove 0 |> BatchedDeque.head + let b = len2 |> BatchedDeque.remove 1 |> BatchedDeque.head + ((a = "a") && (b = "b")) |> Expect.isTrue "" + } + + test "BatchedDeque.remove elements BatchedDeque.length 3" { + let r0 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.remove 0 + let b0 = BatchedDeque.head r0 + let t0 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t0 + + let r1 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.remove 1 + let a1 = BatchedDeque.head r1 + let t1 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t1 + + let r2 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.remove 2 + let a2 = BatchedDeque.head r2 + let t2 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "BatchedDeque.remove elements BatchedDeque.length 4" { + let r0 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 0 + let b0 = BatchedDeque.head r0 + let t0 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t0 + let t01 = BatchedDeque.tail t0 + let d0 = BatchedDeque.head t01 + + let r1 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 1 + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let d1 = BatchedDeque.head t12 + + let r2 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 2 + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + + let r3 = (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> BatchedDeque.remove 3 + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "BatchedDeque.remove elements BatchedDeque.length 5" { + let r0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.remove 0 + + let b0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let d0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let e0 = BatchedDeque.head t03 + + let r1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.remove 1 + + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let d1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let e1 = BatchedDeque.head t13 + + let r2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.remove 2 + + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let e2 = BatchedDeque.head t23 + + let r3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.remove 3 + + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let e3 = BatchedDeque.head t33 + + let r4 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.remove 4 + + let a4 = BatchedDeque.head r4 + let t41 = BatchedDeque.tail r4 + let b4 = BatchedDeque.head t41 + let t42 = BatchedDeque.tail t41 + let c4 = BatchedDeque.head t42 + let t43 = BatchedDeque.tail t42 + let d4 = BatchedDeque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "BatchedDeque.remove elements BatchedDeque.length 6" { + let r0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.remove 0 + + let b0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let d0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let e0 = BatchedDeque.head t03 + let t04 = BatchedDeque.tail t03 + let f0 = BatchedDeque.head t04 + + let r1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.remove 1 + + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let d1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let e1 = BatchedDeque.head t13 + let t14 = BatchedDeque.tail t13 + let f1 = BatchedDeque.head t14 + + let r2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.remove 2 + + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let e2 = BatchedDeque.head t23 + let t24 = BatchedDeque.tail t23 + let f2 = BatchedDeque.head t24 + + let r3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.remove 3 + + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let e3 = BatchedDeque.head t33 + let t34 = BatchedDeque.tail t33 + let f3 = BatchedDeque.head t34 + + let r4 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.remove 4 + + let a4 = BatchedDeque.head r4 + let t41 = BatchedDeque.tail r4 + let b4 = BatchedDeque.head t41 + let t42 = BatchedDeque.tail t41 + let c4 = BatchedDeque.head t42 + let t43 = BatchedDeque.tail t42 + let d4 = BatchedDeque.head t43 + let t44 = BatchedDeque.tail t43 + let f4 = BatchedDeque.head t44 + + let r5 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.remove 5 + + let a5 = BatchedDeque.head r5 + let t51 = BatchedDeque.tail r5 + let b5 = BatchedDeque.head t51 + let t52 = BatchedDeque.tail t51 + let c5 = BatchedDeque.head t52 + let t53 = BatchedDeque.tail t52 + let d5 = BatchedDeque.head t53 + let t54 = BatchedDeque.tail t53 + let e5 = BatchedDeque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "tryRemoveempty" { BatchedDeque.empty() |> BatchedDeque.tryRemove 0 |> Expect.isNone "" } + + test "BatchedDeque.tryRemove elements BatchedDeque.length 1" { + let a = len1 |> BatchedDeque.tryRemove 0 + a.Value |> BatchedDeque.isEmpty |> Expect.isTrue "" + } + + test "BatchedDeque.tryRemove elements BatchedDeque.length 2" { + let a = len2 |> BatchedDeque.tryRemove 0 + let a1 = BatchedDeque.head a.Value + let b = len2 |> BatchedDeque.tryRemove 1 + let b1 = BatchedDeque.head b.Value + ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" + } + + test "BatchedDeque.tryRemove elements BatchedDeque.length 3" { + let x0 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.tryRemove 0 + let r0 = x0.Value + let b0 = BatchedDeque.head r0 + let t0 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t0 + + let x1 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.tryRemove 1 + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t1 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t1 + + let x2 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.tryRemove 2 + let r2 = x2.Value + let a2 = BatchedDeque.head r2 + let t2 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryRemove elements BatchedDeque.length 4" { + let x0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = BatchedDeque.head r0 + let t0 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t0 + let t01 = BatchedDeque.tail t0 + let d0 = BatchedDeque.head t01 + + let x1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let d1 = BatchedDeque.head t12 + + let x2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + + let x3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryRemove elements BatchedDeque.length 5" { + let x0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let d0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let e0 = BatchedDeque.head t03 + + let x1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let d1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let e1 = BatchedDeque.head t13 + + let x2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let e2 = BatchedDeque.head t23 + + let x3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let e3 = BatchedDeque.head t33 + + let x4 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.tryRemove 4 + + let r4 = x4.Value + let a4 = BatchedDeque.head r4 + let t41 = BatchedDeque.tail r4 + let b4 = BatchedDeque.head t41 + let t42 = BatchedDeque.tail t41 + let c4 = BatchedDeque.head t42 + let t43 = BatchedDeque.tail t42 + let d4 = BatchedDeque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryRemove elements BatchedDeque.length 6" { + let x0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let c0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let d0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let e0 = BatchedDeque.head t03 + let t04 = BatchedDeque.tail t03 + let f0 = BatchedDeque.head t04 + + let x1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let c1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let d1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let e1 = BatchedDeque.head t13 + let t14 = BatchedDeque.tail t13 + let f1 = BatchedDeque.head t14 + + let x2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let e2 = BatchedDeque.head t23 + let t24 = BatchedDeque.tail t23 + let f2 = BatchedDeque.head t24 + + let x3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let e3 = BatchedDeque.head t33 + let t34 = BatchedDeque.tail t33 + let f3 = BatchedDeque.head t34 + + let x4 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.tryRemove 4 + + let r4 = x4.Value + let a4 = BatchedDeque.head r4 + let t41 = BatchedDeque.tail r4 + let b4 = BatchedDeque.head t41 + let t42 = BatchedDeque.tail t41 + let c4 = BatchedDeque.head t42 + let t43 = BatchedDeque.tail t42 + let d4 = BatchedDeque.head t43 + let t44 = BatchedDeque.tail t43 + let f4 = BatchedDeque.head t44 + + let x5 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.tryRemove 5 + + let r5 = x5.Value + let a5 = BatchedDeque.head r5 + let t51 = BatchedDeque.tail r5 + let b5 = BatchedDeque.head t51 + let t52 = BatchedDeque.tail t51 + let c5 = BatchedDeque.head t52 + let t53 = BatchedDeque.tail t52 + let d5 = BatchedDeque.head t53 + let t54 = BatchedDeque.tail t53 + let e5 = BatchedDeque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "BatchedDeque.update elements BatchedDeque.length 1" { + len1 + |> BatchedDeque.update 0 "aa" + |> BatchedDeque.head + |> Expect.equal "" "aa" + } + + test "BatchedDeque.update elements BatchedDeque.length 2" { + let r0 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.update 0 "zz" + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + + let r1 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.update 1 "zz" + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.update elements BatchedDeque.length 3" { + let r0 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.update 0 "zz" + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let c0 = BatchedDeque.head t02 + + let r1 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.update 1 "zz" + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let c1 = BatchedDeque.head t12 + + let r2 = (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) |> BatchedDeque.update 2 "zz" + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.update elements BatchedDeque.length 4" { + let r0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.update 0 "zz" + + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let c0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let d0 = BatchedDeque.head t03 + + let r1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.update 1 "zz" + + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let c1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let d1 = BatchedDeque.head t13 + + let r2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.update 2 "zz" + + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let d2 = BatchedDeque.head t23 + + let r3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.update 3 "zz" + + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let d3 = BatchedDeque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.update elements BatchedDeque.length 5" { + let r0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.update 0 "zz" + + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let c0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let d0 = BatchedDeque.head t03 + let t04 = BatchedDeque.tail t03 + let e0 = BatchedDeque.head t04 + + let r1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.update 1 "zz" + + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let c1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let d1 = BatchedDeque.head t13 + let t14 = BatchedDeque.tail t13 + let e1 = BatchedDeque.head t14 + + let r2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.update 2 "zz" + + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let d2 = BatchedDeque.head t23 + let t24 = BatchedDeque.tail t23 + let e2 = BatchedDeque.head t24 + + let r3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.update 3 "zz" + + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let d3 = BatchedDeque.head t33 + let t34 = BatchedDeque.tail t33 + let e3 = BatchedDeque.head t34 + + let r4 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> BatchedDeque.update 4 "zz" + + let a4 = BatchedDeque.head r4 + let t41 = BatchedDeque.tail r4 + let b4 = BatchedDeque.head t41 + let t42 = BatchedDeque.tail t41 + let c4 = BatchedDeque.head t42 + let t43 = BatchedDeque.tail t42 + let d4 = BatchedDeque.head t43 + let t44 = BatchedDeque.tail t43 + let e4 = BatchedDeque.head t44 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.update elements BatchedDeque.length 6" { + let r0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.update 0 "zz" + + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let c0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let d0 = BatchedDeque.head t03 + let t04 = BatchedDeque.tail t03 + let e0 = BatchedDeque.head t04 + let t05 = BatchedDeque.tail t04 + let f0 = BatchedDeque.head t05 + + let r1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.update 1 "zz" + + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let c1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let d1 = BatchedDeque.head t13 + let t14 = BatchedDeque.tail t13 + let e1 = BatchedDeque.head t14 + let t15 = BatchedDeque.tail t14 + let f1 = BatchedDeque.head t15 + + let r2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.update 2 "zz" + + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let d2 = BatchedDeque.head t23 + let t24 = BatchedDeque.tail t23 + let e2 = BatchedDeque.head t24 + let t25 = BatchedDeque.tail t24 + let f2 = BatchedDeque.head t25 + + let r3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.update 3 "zz" + + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let d3 = BatchedDeque.head t33 + let t34 = BatchedDeque.tail t33 + let e3 = BatchedDeque.head t34 + let t35 = BatchedDeque.tail t34 + let f3 = BatchedDeque.head t35 + + let r4 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.update 4 "zz" + + let a4 = BatchedDeque.head r4 + let t41 = BatchedDeque.tail r4 + let b4 = BatchedDeque.head t41 + let t42 = BatchedDeque.tail t41 + let c4 = BatchedDeque.head t42 + let t43 = BatchedDeque.tail t42 + let d4 = BatchedDeque.head t43 + let t44 = BatchedDeque.tail t43 + let e4 = BatchedDeque.head t44 + let t45 = BatchedDeque.tail t44 + let f4 = BatchedDeque.head t45 + + let r5 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> BatchedDeque.update 5 "zz" + + let a5 = BatchedDeque.head r5 + let t51 = BatchedDeque.tail r5 + let b5 = BatchedDeque.head t51 + let t52 = BatchedDeque.tail t51 + let c5 = BatchedDeque.head t52 + let t53 = BatchedDeque.tail t52 + let d5 = BatchedDeque.head t53 + let t54 = BatchedDeque.tail t53 + let e5 = BatchedDeque.head t54 + let t55 = BatchedDeque.tail t54 + let f5 = BatchedDeque.head t55 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e") + && (f5 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryUpdate elements BatchedDeque.length 1" { + let a = len1 |> BatchedDeque.tryUpdate 0 "aa" + a.Value |> BatchedDeque.head |> Expect.equal "" "aa" + } + + test "BatchedDeque.tryUpdate elements BatchedDeque.length 2" { + let x0 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.tryUpdate 0 "zz" + let r0 = x0.Value + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + + let x1 = (BatchedDeque.ofSeq [ "a"; "b" ]) |> BatchedDeque.tryUpdate 1 "zz" + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryUpdate elements BatchedDeque.length 3" { + let x0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) + |> BatchedDeque.tryUpdate 0 "zz" + + let r0 = x0.Value + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let c0 = BatchedDeque.head t02 + + let x1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) + |> BatchedDeque.tryUpdate 1 "zz" + + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let c1 = BatchedDeque.head t12 + + let x2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c" ]) + |> BatchedDeque.tryUpdate 2 "zz" + + let r2 = x2.Value + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryUpdate elements BatchedDeque.length 4" { + let x0 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryUpdate 0 "zz" + + let r0 = x0.Value + let a0 = BatchedDeque.head r0 + let t01 = BatchedDeque.tail r0 + let b0 = BatchedDeque.head t01 + let t02 = BatchedDeque.tail t01 + let c0 = BatchedDeque.head t02 + let t03 = BatchedDeque.tail t02 + let d0 = BatchedDeque.head t03 + + let x1 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryUpdate 1 "zz" + + let r1 = x1.Value + let a1 = BatchedDeque.head r1 + let t11 = BatchedDeque.tail r1 + let b1 = BatchedDeque.head t11 + let t12 = BatchedDeque.tail t11 + let c1 = BatchedDeque.head t12 + let t13 = BatchedDeque.tail t12 + let d1 = BatchedDeque.head t13 + + let x2 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryUpdate 2 "zz" + + let r2 = x2.Value + let a2 = BatchedDeque.head r2 + let t21 = BatchedDeque.tail r2 + let b2 = BatchedDeque.head t21 + let t22 = BatchedDeque.tail t21 + let c2 = BatchedDeque.head t22 + let t23 = BatchedDeque.tail t22 + let d2 = BatchedDeque.head t23 + + let x3 = + (BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> BatchedDeque.tryUpdate 3 "zz" + + let r3 = x3.Value + let a3 = BatchedDeque.head r3 + let t31 = BatchedDeque.tail r3 + let b3 = BatchedDeque.head t31 + let t32 = BatchedDeque.tail t31 + let c3 = BatchedDeque.head t32 + let t33 = BatchedDeque.tail t32 + let d3 = BatchedDeque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "BatchedDeque.tryUncons on empty" { + let q = BatchedDeque.empty() + (BatchedDeque.tryUncons q = None) |> Expect.isTrue "" + } + + test "BatchedDeque.tryUncons on q" { + let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let x, xs = (BatchedDeque.tryUncons q).Value + x |> Expect.equal "" "a" + } + + test "BatchedDeque.tryUnsnoc on empty" { + let q = BatchedDeque.empty() + (BatchedDeque.tryUnsnoc q = None) |> Expect.isTrue "" + } + + test "BatchedDeque.tryUnsnoc on q" { + let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let xs, x = (BatchedDeque.tryUnsnoc q).Value + x |> Expect.equal "" "d" + } + + test "BatchedDeque.tryGetHead on empty" { + let q = BatchedDeque.empty() + (BatchedDeque.tryGetHead q = None) |> Expect.isTrue "" + } + + test "BatchedDeque.tryGetHead on q" { + let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] + (BatchedDeque.tryGetHead q).Value |> Expect.equal "" "a" + } + + test "BatchedDeque.tryGetInit on empty" { + let q = BatchedDeque.empty() + (BatchedDeque.tryGetInit q = None) |> Expect.isTrue "" + } + + test "BatchedDeque.tryGetInit on q" { + let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let x = (BatchedDeque.tryGetInit q).Value + let x2 = x |> BatchedDeque.last + x2 |> Expect.equal "" "c" + } + + test "BatchedDeque.tryGetLast on empty" { + let q = BatchedDeque.empty() + (BatchedDeque.tryGetLast q = None) |> Expect.isTrue "" + } + + test "BatchedDeque.tryGetLast on q" { + let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] + (BatchedDeque.tryGetLast q).Value |> Expect.equal "" "d" + } + + + test "BatchedDeque.tryGetTail on empty" { + let q = BatchedDeque.empty() + (BatchedDeque.tryGetTail q = None) |> Expect.isTrue "" + } + + test "BatchedDeque.tryGetTail on q" { + let q = BatchedDeque.ofSeq [ "a"; "b"; "c"; "d" ] + + (BatchedDeque.tryGetTail q).Value + |> BatchedDeque.head + |> Expect.equal "" "b" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BinaryRandomAccessListTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BinaryRandomAccessListTest.fs index f057b1f7..966f8ca8 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BinaryRandomAccessListTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BinaryRandomAccessListTest.fs @@ -96,815 +96,815 @@ module BinaryRandomAccessListTest = [] let testBinaryRandomAccessList = - testList "Experimental BinaryRandomAccessList" [ - test "empty list should be empty" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.isEmpty - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.cons works" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.isEmpty - |> Expect.isFalse "" - } - - test "BinaryRandomAccessList.uncons 1 element" { - let x, _ = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.uncons - - (x = 1) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.uncons 2 elements" { - let x, _ = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.uncons - - (x = 2) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.uncons 3 elements" { - let x, _ = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.cons 3 - |> BinaryRandomAccessList.uncons - - (x = 3) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUncons 1 element" { - let x = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.tryUncons - - (fst(x.Value) = 1) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUncons 2 elements" { - let x = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.tryUncons - - (fst(x.Value) = 2) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUncons 3 elements" { - let x = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.cons 3 - |> BinaryRandomAccessList.tryUncons - - (fst(x.Value) = 3) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUncons empty" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.tryUncons - |> Expect.isNone "" - } - - test "BinaryRandomAccessList.head should return" { - let x = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.head - - x |> Expect.equal "" 2 - } - - test "BinaryRandomAccessList.tryGetHead should return" { - let x = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.tryGetHead - - x.Value |> Expect.equal "" 2 - } - - test "BinaryRandomAccessList.tryGetHead on empty should return None" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.tryGetHead - |> Expect.isNone "" - } - - test "BinaryRandomAccessList.tryGetTail on empty should return None" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.tryGetTail - |> Expect.isNone "" - } - - test "BinaryRandomAccessList.tryGetTail on len 1 should return Some empty" { - let x = - (BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.tryGetTail) - .Value - - x |> BinaryRandomAccessList.isEmpty |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tail on len 2 should return" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.tail - |> BinaryRandomAccessList.head - |> Expect.equal "" 1 - } - - test "BinaryRandomAccessList.tryGetTail on len 2 should return" { - let a = - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.cons 1 - |> BinaryRandomAccessList.cons 2 - |> BinaryRandomAccessList.tryGetTail - - ((BinaryRandomAccessList.head a.Value) = 1) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 1" { len1 |> BinaryRandomAccessList.lookup 0 |> Expect.equal "" "a" } - - test "BinaryRandomAccessList.rev empty" { - BinaryRandomAccessList.isEmpty(BinaryRandomAccessList.empty() |> BinaryRandomAccessList.rev) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.rev elements BinaryRandomAccessList.length 5" { - let a = BinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e" ] - - let b = BinaryRandomAccessList.rev a - - let c = List.ofSeq b - - c.Head |> Expect.equal "" "e" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 2" { - (((len2 |> BinaryRandomAccessList.lookup 0) = "b") - && ((len2 |> BinaryRandomAccessList.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 3" { - (((len3 |> BinaryRandomAccessList.lookup 0) = "c") - && ((len3 |> BinaryRandomAccessList.lookup 1) = "b") - && ((len3 |> BinaryRandomAccessList.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 4" { - (((len4 |> BinaryRandomAccessList.lookup 0) = "d") - && ((len4 |> BinaryRandomAccessList.lookup 1) = "c") - && ((len4 |> BinaryRandomAccessList.lookup 2) = "b") - && ((len4 |> BinaryRandomAccessList.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 5" { - (((len5 |> BinaryRandomAccessList.lookup 0) = "e") - && ((len5 |> BinaryRandomAccessList.lookup 1) = "d") - && ((len5 |> BinaryRandomAccessList.lookup 2) = "c") - && ((len5 |> BinaryRandomAccessList.lookup 3) = "b") - && ((len5 |> BinaryRandomAccessList.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 6" { - (((len6 |> BinaryRandomAccessList.lookup 0) = "f") - && ((len6 |> BinaryRandomAccessList.lookup 1) = "e") - && ((len6 |> BinaryRandomAccessList.lookup 2) = "d") - && ((len6 |> BinaryRandomAccessList.lookup 3) = "c") - && ((len6 |> BinaryRandomAccessList.lookup 4) = "b") - && ((len6 |> BinaryRandomAccessList.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 7" { - (((len7 |> BinaryRandomAccessList.lookup 0) = "g") - && ((len7 |> BinaryRandomAccessList.lookup 1) = "f") - && ((len7 |> BinaryRandomAccessList.lookup 2) = "e") - && ((len7 |> BinaryRandomAccessList.lookup 3) = "d") - && ((len7 |> BinaryRandomAccessList.lookup 4) = "c") - && ((len7 |> BinaryRandomAccessList.lookup 5) = "b") - && ((len7 |> BinaryRandomAccessList.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 8" { - (((len8 |> BinaryRandomAccessList.lookup 0) = "h") - && ((len8 |> BinaryRandomAccessList.lookup 1) = "g") - && ((len8 |> BinaryRandomAccessList.lookup 2) = "f") - && ((len8 |> BinaryRandomAccessList.lookup 3) = "e") - && ((len8 |> BinaryRandomAccessList.lookup 4) = "d") - && ((len8 |> BinaryRandomAccessList.lookup 5) = "c") - && ((len8 |> BinaryRandomAccessList.lookup 6) = "b") - && ((len8 |> BinaryRandomAccessList.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 9" { - (((len9 |> BinaryRandomAccessList.lookup 0) = "i") - && ((len9 |> BinaryRandomAccessList.lookup 1) = "h") - && ((len9 |> BinaryRandomAccessList.lookup 2) = "g") - && ((len9 |> BinaryRandomAccessList.lookup 3) = "f") - && ((len9 |> BinaryRandomAccessList.lookup 4) = "e") - && ((len9 |> BinaryRandomAccessList.lookup 5) = "d") - && ((len9 |> BinaryRandomAccessList.lookup 6) = "c") - && ((len9 |> BinaryRandomAccessList.lookup 7) = "b") - && ((len9 |> BinaryRandomAccessList.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 10" { - (((lena |> BinaryRandomAccessList.lookup 0) = "j") - && ((lena |> BinaryRandomAccessList.lookup 1) = "i") - && ((lena |> BinaryRandomAccessList.lookup 2) = "h") - && ((lena |> BinaryRandomAccessList.lookup 3) = "g") - && ((lena |> BinaryRandomAccessList.lookup 4) = "f") - && ((lena |> BinaryRandomAccessList.lookup 5) = "e") - && ((lena |> BinaryRandomAccessList.lookup 6) = "d") - && ((lena |> BinaryRandomAccessList.lookup 7) = "c") - && ((lena |> BinaryRandomAccessList.lookup 8) = "b") - && ((lena |> BinaryRandomAccessList.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 1" { - let a = len1 |> BinaryRandomAccessList.tryLookup 0 - (a.Value = "a") |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 2" { - let b = len2 |> BinaryRandomAccessList.tryLookup 0 - let a = len2 |> BinaryRandomAccessList.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 3" { - let c = len3 |> BinaryRandomAccessList.tryLookup 0 - let b = len3 |> BinaryRandomAccessList.tryLookup 1 - let a = len3 |> BinaryRandomAccessList.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 4" { - let d = len4 |> BinaryRandomAccessList.tryLookup 0 - let c = len4 |> BinaryRandomAccessList.tryLookup 1 - let b = len4 |> BinaryRandomAccessList.tryLookup 2 - let a = len4 |> BinaryRandomAccessList.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 5" { - let e = len5 |> BinaryRandomAccessList.tryLookup 0 - let d = len5 |> BinaryRandomAccessList.tryLookup 1 - let c = len5 |> BinaryRandomAccessList.tryLookup 2 - let b = len5 |> BinaryRandomAccessList.tryLookup 3 - let a = len5 |> BinaryRandomAccessList.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 6" { - let f = len6 |> BinaryRandomAccessList.tryLookup 0 - let e = len6 |> BinaryRandomAccessList.tryLookup 1 - let d = len6 |> BinaryRandomAccessList.tryLookup 2 - let c = len6 |> BinaryRandomAccessList.tryLookup 3 - let b = len6 |> BinaryRandomAccessList.tryLookup 4 - let a = len6 |> BinaryRandomAccessList.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 7" { - let g = len7 |> BinaryRandomAccessList.tryLookup 0 - let f = len7 |> BinaryRandomAccessList.tryLookup 1 - let e = len7 |> BinaryRandomAccessList.tryLookup 2 - let d = len7 |> BinaryRandomAccessList.tryLookup 3 - let c = len7 |> BinaryRandomAccessList.tryLookup 4 - let b = len7 |> BinaryRandomAccessList.tryLookup 5 - let a = len7 |> BinaryRandomAccessList.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 8" { - let h = len8 |> BinaryRandomAccessList.tryLookup 0 - let g = len8 |> BinaryRandomAccessList.tryLookup 1 - let f = len8 |> BinaryRandomAccessList.tryLookup 2 - let e = len8 |> BinaryRandomAccessList.tryLookup 3 - let d = len8 |> BinaryRandomAccessList.tryLookup 4 - let c = len8 |> BinaryRandomAccessList.tryLookup 5 - let b = len8 |> BinaryRandomAccessList.tryLookup 6 - let a = len8 |> BinaryRandomAccessList.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 9" { - let i = len9 |> BinaryRandomAccessList.tryLookup 0 - let h = len9 |> BinaryRandomAccessList.tryLookup 1 - let g = len9 |> BinaryRandomAccessList.tryLookup 2 - let f = len9 |> BinaryRandomAccessList.tryLookup 3 - let e = len9 |> BinaryRandomAccessList.tryLookup 4 - let d = len9 |> BinaryRandomAccessList.tryLookup 5 - let c = len9 |> BinaryRandomAccessList.tryLookup 6 - let b = len9 |> BinaryRandomAccessList.tryLookup 7 - let a = len9 |> BinaryRandomAccessList.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 10" { - let j = lena |> BinaryRandomAccessList.tryLookup 0 - let i = lena |> BinaryRandomAccessList.tryLookup 1 - let h = lena |> BinaryRandomAccessList.tryLookup 2 - let g = lena |> BinaryRandomAccessList.tryLookup 3 - let f = lena |> BinaryRandomAccessList.tryLookup 4 - let e = lena |> BinaryRandomAccessList.tryLookup 5 - let d = lena |> BinaryRandomAccessList.tryLookup 6 - let c = lena |> BinaryRandomAccessList.tryLookup 7 - let b = lena |> BinaryRandomAccessList.tryLookup 8 - let a = lena |> BinaryRandomAccessList.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryLookup not found" { lena |> BinaryRandomAccessList.tryLookup 10 |> Expect.isNone "" } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 1" { - len1 - |> BinaryRandomAccessList.update 0 "aa" - |> BinaryRandomAccessList.lookup 0 - |> Expect.equal "" "aa" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 2" { - (((len2 - |> BinaryRandomAccessList.update 0 "bb" - |> BinaryRandomAccessList.lookup 0) = "bb") - && ((len2 - |> BinaryRandomAccessList.update 1 "aa" - |> BinaryRandomAccessList.lookup 1) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 3" { - (((len3 - |> BinaryRandomAccessList.update 0 "cc" - |> BinaryRandomAccessList.lookup 0) = "cc") - && ((len3 - |> BinaryRandomAccessList.update 1 "bb" - |> BinaryRandomAccessList.lookup 1) = "bb") - && ((len3 - |> BinaryRandomAccessList.update 2 "aa" - |> BinaryRandomAccessList.lookup 2) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 4" { - (((len4 - |> BinaryRandomAccessList.update 0 "dd" - |> BinaryRandomAccessList.lookup 0) = "dd") - && ((len4 - |> BinaryRandomAccessList.update 1 "cc" - |> BinaryRandomAccessList.lookup 1) = "cc") - && ((len4 - |> BinaryRandomAccessList.update 2 "bb" - |> BinaryRandomAccessList.lookup 2) = "bb") - && ((len4 - |> BinaryRandomAccessList.update 3 "aa" - |> BinaryRandomAccessList.lookup 3) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 5" { - (((len5 - |> BinaryRandomAccessList.update 0 "ee" - |> BinaryRandomAccessList.lookup 0) = "ee") - && ((len5 - |> BinaryRandomAccessList.update 1 "dd" - |> BinaryRandomAccessList.lookup 1) = "dd") - && ((len5 - |> BinaryRandomAccessList.update 2 "cc" - |> BinaryRandomAccessList.lookup 2) = "cc") - && ((len5 - |> BinaryRandomAccessList.update 3 "bb" - |> BinaryRandomAccessList.lookup 3) = "bb") - && ((len5 - |> BinaryRandomAccessList.update 4 "aa" - |> BinaryRandomAccessList.lookup 4) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 6" { - (((len6 - |> BinaryRandomAccessList.update 0 "ff" - |> BinaryRandomAccessList.lookup 0) = "ff") - && ((len6 - |> BinaryRandomAccessList.update 1 "ee" - |> BinaryRandomAccessList.lookup 1) = "ee") - && ((len6 - |> BinaryRandomAccessList.update 2 "dd" - |> BinaryRandomAccessList.lookup 2) = "dd") - && ((len6 - |> BinaryRandomAccessList.update 3 "cc" - |> BinaryRandomAccessList.lookup 3) = "cc") - && ((len6 - |> BinaryRandomAccessList.update 4 "bb" - |> BinaryRandomAccessList.lookup 4) = "bb") - && ((len6 - |> BinaryRandomAccessList.update 5 "aa" - |> BinaryRandomAccessList.lookup 5) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 7" { - (((len7 - |> BinaryRandomAccessList.update 0 "gg" - |> BinaryRandomAccessList.lookup 0) = "gg") - && ((len7 - |> BinaryRandomAccessList.update 1 "ff" - |> BinaryRandomAccessList.lookup 1) = "ff") - && ((len7 - |> BinaryRandomAccessList.update 2 "ee" - |> BinaryRandomAccessList.lookup 2) = "ee") - && ((len7 - |> BinaryRandomAccessList.update 3 "dd" - |> BinaryRandomAccessList.lookup 3) = "dd") - && ((len7 - |> BinaryRandomAccessList.update 4 "cc" - |> BinaryRandomAccessList.lookup 4) = "cc") - && ((len7 - |> BinaryRandomAccessList.update 5 "bb" - |> BinaryRandomAccessList.lookup 5) = "bb") - && ((len7 - |> BinaryRandomAccessList.update 6 "aa" - |> BinaryRandomAccessList.lookup 6) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 8" { - (((len8 - |> BinaryRandomAccessList.update 0 "hh" - |> BinaryRandomAccessList.lookup 0) = "hh") - && ((len8 - |> BinaryRandomAccessList.update 1 "gg" - |> BinaryRandomAccessList.lookup 1) = "gg") - && ((len8 - |> BinaryRandomAccessList.update 2 "ff" - |> BinaryRandomAccessList.lookup 2) = "ff") - && ((len8 - |> BinaryRandomAccessList.update 3 "ee" - |> BinaryRandomAccessList.lookup 3) = "ee") - && ((len8 - |> BinaryRandomAccessList.update 4 "dd" - |> BinaryRandomAccessList.lookup 4) = "dd") - && ((len8 - |> BinaryRandomAccessList.update 5 "cc" - |> BinaryRandomAccessList.lookup 5) = "cc") - && ((len8 - |> BinaryRandomAccessList.update 6 "bb" - |> BinaryRandomAccessList.lookup 6) = "bb") - && ((len8 - |> BinaryRandomAccessList.update 7 "aa" - |> BinaryRandomAccessList.lookup 7) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 9" { - (((len9 - |> BinaryRandomAccessList.update 0 "ii" - |> BinaryRandomAccessList.lookup 0) = "ii") - && ((len9 - |> BinaryRandomAccessList.update 1 "hh" - |> BinaryRandomAccessList.lookup 1) = "hh") - && ((len9 - |> BinaryRandomAccessList.update 2 "gg" - |> BinaryRandomAccessList.lookup 2) = "gg") - && ((len9 - |> BinaryRandomAccessList.update 3 "ff" - |> BinaryRandomAccessList.lookup 3) = "ff") - && ((len9 - |> BinaryRandomAccessList.update 4 "ee" - |> BinaryRandomAccessList.lookup 4) = "ee") - && ((len9 - |> BinaryRandomAccessList.update 5 "dd" - |> BinaryRandomAccessList.lookup 5) = "dd") - && ((len9 - |> BinaryRandomAccessList.update 6 "cc" - |> BinaryRandomAccessList.lookup 6) = "cc") - && ((len9 - |> BinaryRandomAccessList.update 7 "bb" - |> BinaryRandomAccessList.lookup 7) = "bb") - && ((len9 - |> BinaryRandomAccessList.update 8 "aa" - |> BinaryRandomAccessList.lookup 8) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.update BinaryRandomAccessList.length 10" { - (((lena - |> BinaryRandomAccessList.update 0 "jj" - |> BinaryRandomAccessList.lookup 0) = "jj") - && ((lena - |> BinaryRandomAccessList.update 1 "ii" - |> BinaryRandomAccessList.lookup 1) = "ii") - && ((lena - |> BinaryRandomAccessList.update 2 "hh" - |> BinaryRandomAccessList.lookup 2) = "hh") - && ((lena - |> BinaryRandomAccessList.update 3 "gg" - |> BinaryRandomAccessList.lookup 3) = "gg") - && ((lena - |> BinaryRandomAccessList.update 4 "ff" - |> BinaryRandomAccessList.lookup 4) = "ff") - && ((lena - |> BinaryRandomAccessList.update 5 "ee" - |> BinaryRandomAccessList.lookup 5) = "ee") - && ((lena - |> BinaryRandomAccessList.update 6 "dd" - |> BinaryRandomAccessList.lookup 6) = "dd") - && ((lena - |> BinaryRandomAccessList.update 7 "cc" - |> BinaryRandomAccessList.lookup 7) = "cc") - && ((lena - |> BinaryRandomAccessList.update 8 "bb" - |> BinaryRandomAccessList.lookup 8) = "bb") - && ((lena - |> BinaryRandomAccessList.update 9 "aa" - |> BinaryRandomAccessList.lookup 9) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 1" { - let a = len1 |> BinaryRandomAccessList.tryUpdate 0 "aa" - - ((a.Value |> BinaryRandomAccessList.lookup 0) = "aa") - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 2" { - let b = len2 |> BinaryRandomAccessList.tryUpdate 0 "bb" - let a = len2 |> BinaryRandomAccessList.tryUpdate 1 "aa" - - (((b.Value |> BinaryRandomAccessList.lookup 0) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 1) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 3" { - let c = len3 |> BinaryRandomAccessList.tryUpdate 0 "cc" - let b = len3 |> BinaryRandomAccessList.tryUpdate 1 "bb" - let a = len3 |> BinaryRandomAccessList.tryUpdate 2 "aa" - - (((c.Value |> BinaryRandomAccessList.lookup 0) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 1) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 2) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 4" { - let d = len4 |> BinaryRandomAccessList.tryUpdate 0 "dd" - let c = len4 |> BinaryRandomAccessList.tryUpdate 1 "cc" - let b = len4 |> BinaryRandomAccessList.tryUpdate 2 "bb" - let a = len4 |> BinaryRandomAccessList.tryUpdate 3 "aa" - - (((d.Value |> BinaryRandomAccessList.lookup 0) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 1) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 2) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 3) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 5" { - let e = len5 |> BinaryRandomAccessList.tryUpdate 0 "ee" - let d = len5 |> BinaryRandomAccessList.tryUpdate 1 "dd" - let c = len5 |> BinaryRandomAccessList.tryUpdate 2 "cc" - let b = len5 |> BinaryRandomAccessList.tryUpdate 3 "bb" - let a = len5 |> BinaryRandomAccessList.tryUpdate 4 "aa" - - (((e.Value |> BinaryRandomAccessList.lookup 0) = "ee") - && ((d.Value |> BinaryRandomAccessList.lookup 1) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 2) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 3) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 4) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 6" { - let f = len6 |> BinaryRandomAccessList.tryUpdate 0 "ff" - let e = len6 |> BinaryRandomAccessList.tryUpdate 1 "ee" - let d = len6 |> BinaryRandomAccessList.tryUpdate 2 "dd" - let c = len6 |> BinaryRandomAccessList.tryUpdate 3 "cc" - let b = len6 |> BinaryRandomAccessList.tryUpdate 4 "bb" - let a = len6 |> BinaryRandomAccessList.tryUpdate 5 "aa" - - (((f.Value |> BinaryRandomAccessList.lookup 0) = "ff") - && ((e.Value |> BinaryRandomAccessList.lookup 1) = "ee") - && ((d.Value |> BinaryRandomAccessList.lookup 2) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 3) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 4) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 5) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 7" { - let g = len7 |> BinaryRandomAccessList.tryUpdate 0 "gg" - let f = len7 |> BinaryRandomAccessList.tryUpdate 1 "ff" - let e = len7 |> BinaryRandomAccessList.tryUpdate 2 "ee" - let d = len7 |> BinaryRandomAccessList.tryUpdate 3 "dd" - let c = len7 |> BinaryRandomAccessList.tryUpdate 4 "cc" - let b = len7 |> BinaryRandomAccessList.tryUpdate 5 "bb" - let a = len7 |> BinaryRandomAccessList.tryUpdate 6 "aa" - - (((g.Value |> BinaryRandomAccessList.lookup 0) = "gg") - && ((f.Value |> BinaryRandomAccessList.lookup 1) = "ff") - && ((e.Value |> BinaryRandomAccessList.lookup 2) = "ee") - && ((d.Value |> BinaryRandomAccessList.lookup 3) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 4) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 5) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 6) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 8" { - let h = len8 |> BinaryRandomAccessList.tryUpdate 0 "hh" - let g = len8 |> BinaryRandomAccessList.tryUpdate 1 "gg" - let f = len8 |> BinaryRandomAccessList.tryUpdate 2 "ff" - let e = len8 |> BinaryRandomAccessList.tryUpdate 3 "ee" - let d = len8 |> BinaryRandomAccessList.tryUpdate 4 "dd" - let c = len8 |> BinaryRandomAccessList.tryUpdate 5 "cc" - let b = len8 |> BinaryRandomAccessList.tryUpdate 6 "bb" - let a = len8 |> BinaryRandomAccessList.tryUpdate 7 "aa" - - (((h.Value |> BinaryRandomAccessList.lookup 0) = "hh") - && ((g.Value |> BinaryRandomAccessList.lookup 1) = "gg") - && ((f.Value |> BinaryRandomAccessList.lookup 2) = "ff") - && ((e.Value |> BinaryRandomAccessList.lookup 3) = "ee") - && ((d.Value |> BinaryRandomAccessList.lookup 4) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 5) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 6) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 7) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 9" { - let i = len9 |> BinaryRandomAccessList.tryUpdate 0 "ii" - let h = len9 |> BinaryRandomAccessList.tryUpdate 1 "hh" - let g = len9 |> BinaryRandomAccessList.tryUpdate 2 "gg" - let f = len9 |> BinaryRandomAccessList.tryUpdate 3 "ff" - let e = len9 |> BinaryRandomAccessList.tryUpdate 4 "ee" - let d = len9 |> BinaryRandomAccessList.tryUpdate 5 "dd" - let c = len9 |> BinaryRandomAccessList.tryUpdate 6 "cc" - let b = len9 |> BinaryRandomAccessList.tryUpdate 7 "bb" - let a = len9 |> BinaryRandomAccessList.tryUpdate 8 "aa" - - (((i.Value |> BinaryRandomAccessList.lookup 0) = "ii") - && ((h.Value |> BinaryRandomAccessList.lookup 1) = "hh") - && ((g.Value |> BinaryRandomAccessList.lookup 2) = "gg") - && ((f.Value |> BinaryRandomAccessList.lookup 3) = "ff") - && ((e.Value |> BinaryRandomAccessList.lookup 4) = "ee") - && ((d.Value |> BinaryRandomAccessList.lookup 5) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 6) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 7) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 8) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 10" { - let j = lena |> BinaryRandomAccessList.tryUpdate 0 "jj" - let i = lena |> BinaryRandomAccessList.tryUpdate 1 "ii" - let h = lena |> BinaryRandomAccessList.tryUpdate 2 "hh" - let g = lena |> BinaryRandomAccessList.tryUpdate 3 "gg" - let f = lena |> BinaryRandomAccessList.tryUpdate 4 "ff" - let e = lena |> BinaryRandomAccessList.tryUpdate 5 "ee" - let d = lena |> BinaryRandomAccessList.tryUpdate 6 "dd" - let c = lena |> BinaryRandomAccessList.tryUpdate 7 "cc" - let b = lena |> BinaryRandomAccessList.tryUpdate 8 "bb" - let a = lena |> BinaryRandomAccessList.tryUpdate 9 "aa" - - (((j.Value |> BinaryRandomAccessList.lookup 0) = "jj") - && ((i.Value |> BinaryRandomAccessList.lookup 1) = "ii") - && ((h.Value |> BinaryRandomAccessList.lookup 2) = "hh") - && ((g.Value |> BinaryRandomAccessList.lookup 3) = "gg") - && ((f.Value |> BinaryRandomAccessList.lookup 4) = "ff") - && ((e.Value |> BinaryRandomAccessList.lookup 5) = "ee") - && ((d.Value |> BinaryRandomAccessList.lookup 6) = "dd") - && ((c.Value |> BinaryRandomAccessList.lookup 7) = "cc") - && ((b.Value |> BinaryRandomAccessList.lookup 8) = "bb") - && ((a.Value |> BinaryRandomAccessList.lookup 9) = "aa")) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.length of empty is 0" { - BinaryRandomAccessList.empty() - |> BinaryRandomAccessList.length - |> Expect.equal "" 0 - } - - test "BinaryRandomAccessList.length of 1 - 10 good" { - - (((BinaryRandomAccessList.length len1) = 1) - && ((BinaryRandomAccessList.length len2) = 2) - && ((BinaryRandomAccessList.length len3) = 3) - && ((BinaryRandomAccessList.length len4) = 4) - && ((BinaryRandomAccessList.length len5) = 5) - && ((BinaryRandomAccessList.length len6) = 6) - && ((BinaryRandomAccessList.length len7) = 7) - && ((BinaryRandomAccessList.length len8) = 8) - && ((BinaryRandomAccessList.length len9) = 9) - && ((BinaryRandomAccessList.length lena) = 10)) - |> Expect.isTrue "" - } - - test "BinaryRandomAccessList.ofSeq" { - let x = - BinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] - - (((x |> BinaryRandomAccessList.lookup 0) = "a") - && ((x |> BinaryRandomAccessList.lookup 1) = "b") - && ((x |> BinaryRandomAccessList.lookup 2) = "c") - && ((x |> BinaryRandomAccessList.lookup 3) = "d") - && ((x |> BinaryRandomAccessList.lookup 4) = "e") - && ((x |> BinaryRandomAccessList.lookup 5) = "f") - && ((x |> BinaryRandomAccessList.lookup 6) = "g") - && ((x |> BinaryRandomAccessList.lookup 7) = "h") - && ((x |> BinaryRandomAccessList.lookup 8) = "i") - && ((x |> BinaryRandomAccessList.lookup 9) = "j")) - |> Expect.isTrue "" - } - - test "IRandomAccessList BinaryRandomAccessList.cons works" { - ((lena :> IRandomAccessList).Cons "zz").Head - |> Expect.equal "" "zz" - } - ] + testList + "Experimental BinaryRandomAccessList" + [ test "empty list should be empty" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.isEmpty + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.cons works" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.isEmpty + |> Expect.isFalse "" + } + + test "BinaryRandomAccessList.uncons 1 element" { + let x, _ = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.uncons + + (x = 1) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.uncons 2 elements" { + let x, _ = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.uncons + + (x = 2) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.uncons 3 elements" { + let x, _ = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.cons 3 + |> BinaryRandomAccessList.uncons + + (x = 3) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUncons 1 element" { + let x = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.tryUncons + + (fst(x.Value) = 1) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUncons 2 elements" { + let x = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.tryUncons + + (fst(x.Value) = 2) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUncons 3 elements" { + let x = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.cons 3 + |> BinaryRandomAccessList.tryUncons + + (fst(x.Value) = 3) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUncons empty" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.tryUncons + |> Expect.isNone "" + } + + test "BinaryRandomAccessList.head should return" { + let x = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.head + + x |> Expect.equal "" 2 + } + + test "BinaryRandomAccessList.tryGetHead should return" { + let x = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.tryGetHead + + x.Value |> Expect.equal "" 2 + } + + test "BinaryRandomAccessList.tryGetHead on empty should return None" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.tryGetHead + |> Expect.isNone "" + } + + test "BinaryRandomAccessList.tryGetTail on empty should return None" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.tryGetTail + |> Expect.isNone "" + } + + test "BinaryRandomAccessList.tryGetTail on len 1 should return Some empty" { + let x = + (BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.tryGetTail) + .Value + + x |> BinaryRandomAccessList.isEmpty |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tail on len 2 should return" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.tail + |> BinaryRandomAccessList.head + |> Expect.equal "" 1 + } + + test "BinaryRandomAccessList.tryGetTail on len 2 should return" { + let a = + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.cons 1 + |> BinaryRandomAccessList.cons 2 + |> BinaryRandomAccessList.tryGetTail + + ((BinaryRandomAccessList.head a.Value) = 1) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 1" { len1 |> BinaryRandomAccessList.lookup 0 |> Expect.equal "" "a" } + + test "BinaryRandomAccessList.rev empty" { + BinaryRandomAccessList.isEmpty(BinaryRandomAccessList.empty() |> BinaryRandomAccessList.rev) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.rev elements BinaryRandomAccessList.length 5" { + let a = BinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e" ] + + let b = BinaryRandomAccessList.rev a + + let c = List.ofSeq b + + c.Head |> Expect.equal "" "e" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 2" { + (((len2 |> BinaryRandomAccessList.lookup 0) = "b") + && ((len2 |> BinaryRandomAccessList.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 3" { + (((len3 |> BinaryRandomAccessList.lookup 0) = "c") + && ((len3 |> BinaryRandomAccessList.lookup 1) = "b") + && ((len3 |> BinaryRandomAccessList.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 4" { + (((len4 |> BinaryRandomAccessList.lookup 0) = "d") + && ((len4 |> BinaryRandomAccessList.lookup 1) = "c") + && ((len4 |> BinaryRandomAccessList.lookup 2) = "b") + && ((len4 |> BinaryRandomAccessList.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 5" { + (((len5 |> BinaryRandomAccessList.lookup 0) = "e") + && ((len5 |> BinaryRandomAccessList.lookup 1) = "d") + && ((len5 |> BinaryRandomAccessList.lookup 2) = "c") + && ((len5 |> BinaryRandomAccessList.lookup 3) = "b") + && ((len5 |> BinaryRandomAccessList.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 6" { + (((len6 |> BinaryRandomAccessList.lookup 0) = "f") + && ((len6 |> BinaryRandomAccessList.lookup 1) = "e") + && ((len6 |> BinaryRandomAccessList.lookup 2) = "d") + && ((len6 |> BinaryRandomAccessList.lookup 3) = "c") + && ((len6 |> BinaryRandomAccessList.lookup 4) = "b") + && ((len6 |> BinaryRandomAccessList.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 7" { + (((len7 |> BinaryRandomAccessList.lookup 0) = "g") + && ((len7 |> BinaryRandomAccessList.lookup 1) = "f") + && ((len7 |> BinaryRandomAccessList.lookup 2) = "e") + && ((len7 |> BinaryRandomAccessList.lookup 3) = "d") + && ((len7 |> BinaryRandomAccessList.lookup 4) = "c") + && ((len7 |> BinaryRandomAccessList.lookup 5) = "b") + && ((len7 |> BinaryRandomAccessList.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 8" { + (((len8 |> BinaryRandomAccessList.lookup 0) = "h") + && ((len8 |> BinaryRandomAccessList.lookup 1) = "g") + && ((len8 |> BinaryRandomAccessList.lookup 2) = "f") + && ((len8 |> BinaryRandomAccessList.lookup 3) = "e") + && ((len8 |> BinaryRandomAccessList.lookup 4) = "d") + && ((len8 |> BinaryRandomAccessList.lookup 5) = "c") + && ((len8 |> BinaryRandomAccessList.lookup 6) = "b") + && ((len8 |> BinaryRandomAccessList.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 9" { + (((len9 |> BinaryRandomAccessList.lookup 0) = "i") + && ((len9 |> BinaryRandomAccessList.lookup 1) = "h") + && ((len9 |> BinaryRandomAccessList.lookup 2) = "g") + && ((len9 |> BinaryRandomAccessList.lookup 3) = "f") + && ((len9 |> BinaryRandomAccessList.lookup 4) = "e") + && ((len9 |> BinaryRandomAccessList.lookup 5) = "d") + && ((len9 |> BinaryRandomAccessList.lookup 6) = "c") + && ((len9 |> BinaryRandomAccessList.lookup 7) = "b") + && ((len9 |> BinaryRandomAccessList.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.lookup BinaryRandomAccessList.length 10" { + (((lena |> BinaryRandomAccessList.lookup 0) = "j") + && ((lena |> BinaryRandomAccessList.lookup 1) = "i") + && ((lena |> BinaryRandomAccessList.lookup 2) = "h") + && ((lena |> BinaryRandomAccessList.lookup 3) = "g") + && ((lena |> BinaryRandomAccessList.lookup 4) = "f") + && ((lena |> BinaryRandomAccessList.lookup 5) = "e") + && ((lena |> BinaryRandomAccessList.lookup 6) = "d") + && ((lena |> BinaryRandomAccessList.lookup 7) = "c") + && ((lena |> BinaryRandomAccessList.lookup 8) = "b") + && ((lena |> BinaryRandomAccessList.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 1" { + let a = len1 |> BinaryRandomAccessList.tryLookup 0 + (a.Value = "a") |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 2" { + let b = len2 |> BinaryRandomAccessList.tryLookup 0 + let a = len2 |> BinaryRandomAccessList.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 3" { + let c = len3 |> BinaryRandomAccessList.tryLookup 0 + let b = len3 |> BinaryRandomAccessList.tryLookup 1 + let a = len3 |> BinaryRandomAccessList.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 4" { + let d = len4 |> BinaryRandomAccessList.tryLookup 0 + let c = len4 |> BinaryRandomAccessList.tryLookup 1 + let b = len4 |> BinaryRandomAccessList.tryLookup 2 + let a = len4 |> BinaryRandomAccessList.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 5" { + let e = len5 |> BinaryRandomAccessList.tryLookup 0 + let d = len5 |> BinaryRandomAccessList.tryLookup 1 + let c = len5 |> BinaryRandomAccessList.tryLookup 2 + let b = len5 |> BinaryRandomAccessList.tryLookup 3 + let a = len5 |> BinaryRandomAccessList.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 6" { + let f = len6 |> BinaryRandomAccessList.tryLookup 0 + let e = len6 |> BinaryRandomAccessList.tryLookup 1 + let d = len6 |> BinaryRandomAccessList.tryLookup 2 + let c = len6 |> BinaryRandomAccessList.tryLookup 3 + let b = len6 |> BinaryRandomAccessList.tryLookup 4 + let a = len6 |> BinaryRandomAccessList.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 7" { + let g = len7 |> BinaryRandomAccessList.tryLookup 0 + let f = len7 |> BinaryRandomAccessList.tryLookup 1 + let e = len7 |> BinaryRandomAccessList.tryLookup 2 + let d = len7 |> BinaryRandomAccessList.tryLookup 3 + let c = len7 |> BinaryRandomAccessList.tryLookup 4 + let b = len7 |> BinaryRandomAccessList.tryLookup 5 + let a = len7 |> BinaryRandomAccessList.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 8" { + let h = len8 |> BinaryRandomAccessList.tryLookup 0 + let g = len8 |> BinaryRandomAccessList.tryLookup 1 + let f = len8 |> BinaryRandomAccessList.tryLookup 2 + let e = len8 |> BinaryRandomAccessList.tryLookup 3 + let d = len8 |> BinaryRandomAccessList.tryLookup 4 + let c = len8 |> BinaryRandomAccessList.tryLookup 5 + let b = len8 |> BinaryRandomAccessList.tryLookup 6 + let a = len8 |> BinaryRandomAccessList.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 9" { + let i = len9 |> BinaryRandomAccessList.tryLookup 0 + let h = len9 |> BinaryRandomAccessList.tryLookup 1 + let g = len9 |> BinaryRandomAccessList.tryLookup 2 + let f = len9 |> BinaryRandomAccessList.tryLookup 3 + let e = len9 |> BinaryRandomAccessList.tryLookup 4 + let d = len9 |> BinaryRandomAccessList.tryLookup 5 + let c = len9 |> BinaryRandomAccessList.tryLookup 6 + let b = len9 |> BinaryRandomAccessList.tryLookup 7 + let a = len9 |> BinaryRandomAccessList.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup BinaryRandomAccessList.length 10" { + let j = lena |> BinaryRandomAccessList.tryLookup 0 + let i = lena |> BinaryRandomAccessList.tryLookup 1 + let h = lena |> BinaryRandomAccessList.tryLookup 2 + let g = lena |> BinaryRandomAccessList.tryLookup 3 + let f = lena |> BinaryRandomAccessList.tryLookup 4 + let e = lena |> BinaryRandomAccessList.tryLookup 5 + let d = lena |> BinaryRandomAccessList.tryLookup 6 + let c = lena |> BinaryRandomAccessList.tryLookup 7 + let b = lena |> BinaryRandomAccessList.tryLookup 8 + let a = lena |> BinaryRandomAccessList.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryLookup not found" { lena |> BinaryRandomAccessList.tryLookup 10 |> Expect.isNone "" } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 1" { + len1 + |> BinaryRandomAccessList.update 0 "aa" + |> BinaryRandomAccessList.lookup 0 + |> Expect.equal "" "aa" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 2" { + (((len2 + |> BinaryRandomAccessList.update 0 "bb" + |> BinaryRandomAccessList.lookup 0) = "bb") + && ((len2 + |> BinaryRandomAccessList.update 1 "aa" + |> BinaryRandomAccessList.lookup 1) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 3" { + (((len3 + |> BinaryRandomAccessList.update 0 "cc" + |> BinaryRandomAccessList.lookup 0) = "cc") + && ((len3 + |> BinaryRandomAccessList.update 1 "bb" + |> BinaryRandomAccessList.lookup 1) = "bb") + && ((len3 + |> BinaryRandomAccessList.update 2 "aa" + |> BinaryRandomAccessList.lookup 2) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 4" { + (((len4 + |> BinaryRandomAccessList.update 0 "dd" + |> BinaryRandomAccessList.lookup 0) = "dd") + && ((len4 + |> BinaryRandomAccessList.update 1 "cc" + |> BinaryRandomAccessList.lookup 1) = "cc") + && ((len4 + |> BinaryRandomAccessList.update 2 "bb" + |> BinaryRandomAccessList.lookup 2) = "bb") + && ((len4 + |> BinaryRandomAccessList.update 3 "aa" + |> BinaryRandomAccessList.lookup 3) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 5" { + (((len5 + |> BinaryRandomAccessList.update 0 "ee" + |> BinaryRandomAccessList.lookup 0) = "ee") + && ((len5 + |> BinaryRandomAccessList.update 1 "dd" + |> BinaryRandomAccessList.lookup 1) = "dd") + && ((len5 + |> BinaryRandomAccessList.update 2 "cc" + |> BinaryRandomAccessList.lookup 2) = "cc") + && ((len5 + |> BinaryRandomAccessList.update 3 "bb" + |> BinaryRandomAccessList.lookup 3) = "bb") + && ((len5 + |> BinaryRandomAccessList.update 4 "aa" + |> BinaryRandomAccessList.lookup 4) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 6" { + (((len6 + |> BinaryRandomAccessList.update 0 "ff" + |> BinaryRandomAccessList.lookup 0) = "ff") + && ((len6 + |> BinaryRandomAccessList.update 1 "ee" + |> BinaryRandomAccessList.lookup 1) = "ee") + && ((len6 + |> BinaryRandomAccessList.update 2 "dd" + |> BinaryRandomAccessList.lookup 2) = "dd") + && ((len6 + |> BinaryRandomAccessList.update 3 "cc" + |> BinaryRandomAccessList.lookup 3) = "cc") + && ((len6 + |> BinaryRandomAccessList.update 4 "bb" + |> BinaryRandomAccessList.lookup 4) = "bb") + && ((len6 + |> BinaryRandomAccessList.update 5 "aa" + |> BinaryRandomAccessList.lookup 5) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 7" { + (((len7 + |> BinaryRandomAccessList.update 0 "gg" + |> BinaryRandomAccessList.lookup 0) = "gg") + && ((len7 + |> BinaryRandomAccessList.update 1 "ff" + |> BinaryRandomAccessList.lookup 1) = "ff") + && ((len7 + |> BinaryRandomAccessList.update 2 "ee" + |> BinaryRandomAccessList.lookup 2) = "ee") + && ((len7 + |> BinaryRandomAccessList.update 3 "dd" + |> BinaryRandomAccessList.lookup 3) = "dd") + && ((len7 + |> BinaryRandomAccessList.update 4 "cc" + |> BinaryRandomAccessList.lookup 4) = "cc") + && ((len7 + |> BinaryRandomAccessList.update 5 "bb" + |> BinaryRandomAccessList.lookup 5) = "bb") + && ((len7 + |> BinaryRandomAccessList.update 6 "aa" + |> BinaryRandomAccessList.lookup 6) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 8" { + (((len8 + |> BinaryRandomAccessList.update 0 "hh" + |> BinaryRandomAccessList.lookup 0) = "hh") + && ((len8 + |> BinaryRandomAccessList.update 1 "gg" + |> BinaryRandomAccessList.lookup 1) = "gg") + && ((len8 + |> BinaryRandomAccessList.update 2 "ff" + |> BinaryRandomAccessList.lookup 2) = "ff") + && ((len8 + |> BinaryRandomAccessList.update 3 "ee" + |> BinaryRandomAccessList.lookup 3) = "ee") + && ((len8 + |> BinaryRandomAccessList.update 4 "dd" + |> BinaryRandomAccessList.lookup 4) = "dd") + && ((len8 + |> BinaryRandomAccessList.update 5 "cc" + |> BinaryRandomAccessList.lookup 5) = "cc") + && ((len8 + |> BinaryRandomAccessList.update 6 "bb" + |> BinaryRandomAccessList.lookup 6) = "bb") + && ((len8 + |> BinaryRandomAccessList.update 7 "aa" + |> BinaryRandomAccessList.lookup 7) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 9" { + (((len9 + |> BinaryRandomAccessList.update 0 "ii" + |> BinaryRandomAccessList.lookup 0) = "ii") + && ((len9 + |> BinaryRandomAccessList.update 1 "hh" + |> BinaryRandomAccessList.lookup 1) = "hh") + && ((len9 + |> BinaryRandomAccessList.update 2 "gg" + |> BinaryRandomAccessList.lookup 2) = "gg") + && ((len9 + |> BinaryRandomAccessList.update 3 "ff" + |> BinaryRandomAccessList.lookup 3) = "ff") + && ((len9 + |> BinaryRandomAccessList.update 4 "ee" + |> BinaryRandomAccessList.lookup 4) = "ee") + && ((len9 + |> BinaryRandomAccessList.update 5 "dd" + |> BinaryRandomAccessList.lookup 5) = "dd") + && ((len9 + |> BinaryRandomAccessList.update 6 "cc" + |> BinaryRandomAccessList.lookup 6) = "cc") + && ((len9 + |> BinaryRandomAccessList.update 7 "bb" + |> BinaryRandomAccessList.lookup 7) = "bb") + && ((len9 + |> BinaryRandomAccessList.update 8 "aa" + |> BinaryRandomAccessList.lookup 8) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.update BinaryRandomAccessList.length 10" { + (((lena + |> BinaryRandomAccessList.update 0 "jj" + |> BinaryRandomAccessList.lookup 0) = "jj") + && ((lena + |> BinaryRandomAccessList.update 1 "ii" + |> BinaryRandomAccessList.lookup 1) = "ii") + && ((lena + |> BinaryRandomAccessList.update 2 "hh" + |> BinaryRandomAccessList.lookup 2) = "hh") + && ((lena + |> BinaryRandomAccessList.update 3 "gg" + |> BinaryRandomAccessList.lookup 3) = "gg") + && ((lena + |> BinaryRandomAccessList.update 4 "ff" + |> BinaryRandomAccessList.lookup 4) = "ff") + && ((lena + |> BinaryRandomAccessList.update 5 "ee" + |> BinaryRandomAccessList.lookup 5) = "ee") + && ((lena + |> BinaryRandomAccessList.update 6 "dd" + |> BinaryRandomAccessList.lookup 6) = "dd") + && ((lena + |> BinaryRandomAccessList.update 7 "cc" + |> BinaryRandomAccessList.lookup 7) = "cc") + && ((lena + |> BinaryRandomAccessList.update 8 "bb" + |> BinaryRandomAccessList.lookup 8) = "bb") + && ((lena + |> BinaryRandomAccessList.update 9 "aa" + |> BinaryRandomAccessList.lookup 9) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 1" { + let a = len1 |> BinaryRandomAccessList.tryUpdate 0 "aa" + + ((a.Value |> BinaryRandomAccessList.lookup 0) = "aa") + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 2" { + let b = len2 |> BinaryRandomAccessList.tryUpdate 0 "bb" + let a = len2 |> BinaryRandomAccessList.tryUpdate 1 "aa" + + (((b.Value |> BinaryRandomAccessList.lookup 0) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 1) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 3" { + let c = len3 |> BinaryRandomAccessList.tryUpdate 0 "cc" + let b = len3 |> BinaryRandomAccessList.tryUpdate 1 "bb" + let a = len3 |> BinaryRandomAccessList.tryUpdate 2 "aa" + + (((c.Value |> BinaryRandomAccessList.lookup 0) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 1) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 2) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 4" { + let d = len4 |> BinaryRandomAccessList.tryUpdate 0 "dd" + let c = len4 |> BinaryRandomAccessList.tryUpdate 1 "cc" + let b = len4 |> BinaryRandomAccessList.tryUpdate 2 "bb" + let a = len4 |> BinaryRandomAccessList.tryUpdate 3 "aa" + + (((d.Value |> BinaryRandomAccessList.lookup 0) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 1) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 2) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 3) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 5" { + let e = len5 |> BinaryRandomAccessList.tryUpdate 0 "ee" + let d = len5 |> BinaryRandomAccessList.tryUpdate 1 "dd" + let c = len5 |> BinaryRandomAccessList.tryUpdate 2 "cc" + let b = len5 |> BinaryRandomAccessList.tryUpdate 3 "bb" + let a = len5 |> BinaryRandomAccessList.tryUpdate 4 "aa" + + (((e.Value |> BinaryRandomAccessList.lookup 0) = "ee") + && ((d.Value |> BinaryRandomAccessList.lookup 1) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 2) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 3) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 4) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 6" { + let f = len6 |> BinaryRandomAccessList.tryUpdate 0 "ff" + let e = len6 |> BinaryRandomAccessList.tryUpdate 1 "ee" + let d = len6 |> BinaryRandomAccessList.tryUpdate 2 "dd" + let c = len6 |> BinaryRandomAccessList.tryUpdate 3 "cc" + let b = len6 |> BinaryRandomAccessList.tryUpdate 4 "bb" + let a = len6 |> BinaryRandomAccessList.tryUpdate 5 "aa" + + (((f.Value |> BinaryRandomAccessList.lookup 0) = "ff") + && ((e.Value |> BinaryRandomAccessList.lookup 1) = "ee") + && ((d.Value |> BinaryRandomAccessList.lookup 2) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 3) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 4) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 5) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 7" { + let g = len7 |> BinaryRandomAccessList.tryUpdate 0 "gg" + let f = len7 |> BinaryRandomAccessList.tryUpdate 1 "ff" + let e = len7 |> BinaryRandomAccessList.tryUpdate 2 "ee" + let d = len7 |> BinaryRandomAccessList.tryUpdate 3 "dd" + let c = len7 |> BinaryRandomAccessList.tryUpdate 4 "cc" + let b = len7 |> BinaryRandomAccessList.tryUpdate 5 "bb" + let a = len7 |> BinaryRandomAccessList.tryUpdate 6 "aa" + + (((g.Value |> BinaryRandomAccessList.lookup 0) = "gg") + && ((f.Value |> BinaryRandomAccessList.lookup 1) = "ff") + && ((e.Value |> BinaryRandomAccessList.lookup 2) = "ee") + && ((d.Value |> BinaryRandomAccessList.lookup 3) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 4) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 5) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 6) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 8" { + let h = len8 |> BinaryRandomAccessList.tryUpdate 0 "hh" + let g = len8 |> BinaryRandomAccessList.tryUpdate 1 "gg" + let f = len8 |> BinaryRandomAccessList.tryUpdate 2 "ff" + let e = len8 |> BinaryRandomAccessList.tryUpdate 3 "ee" + let d = len8 |> BinaryRandomAccessList.tryUpdate 4 "dd" + let c = len8 |> BinaryRandomAccessList.tryUpdate 5 "cc" + let b = len8 |> BinaryRandomAccessList.tryUpdate 6 "bb" + let a = len8 |> BinaryRandomAccessList.tryUpdate 7 "aa" + + (((h.Value |> BinaryRandomAccessList.lookup 0) = "hh") + && ((g.Value |> BinaryRandomAccessList.lookup 1) = "gg") + && ((f.Value |> BinaryRandomAccessList.lookup 2) = "ff") + && ((e.Value |> BinaryRandomAccessList.lookup 3) = "ee") + && ((d.Value |> BinaryRandomAccessList.lookup 4) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 5) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 6) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 7) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 9" { + let i = len9 |> BinaryRandomAccessList.tryUpdate 0 "ii" + let h = len9 |> BinaryRandomAccessList.tryUpdate 1 "hh" + let g = len9 |> BinaryRandomAccessList.tryUpdate 2 "gg" + let f = len9 |> BinaryRandomAccessList.tryUpdate 3 "ff" + let e = len9 |> BinaryRandomAccessList.tryUpdate 4 "ee" + let d = len9 |> BinaryRandomAccessList.tryUpdate 5 "dd" + let c = len9 |> BinaryRandomAccessList.tryUpdate 6 "cc" + let b = len9 |> BinaryRandomAccessList.tryUpdate 7 "bb" + let a = len9 |> BinaryRandomAccessList.tryUpdate 8 "aa" + + (((i.Value |> BinaryRandomAccessList.lookup 0) = "ii") + && ((h.Value |> BinaryRandomAccessList.lookup 1) = "hh") + && ((g.Value |> BinaryRandomAccessList.lookup 2) = "gg") + && ((f.Value |> BinaryRandomAccessList.lookup 3) = "ff") + && ((e.Value |> BinaryRandomAccessList.lookup 4) = "ee") + && ((d.Value |> BinaryRandomAccessList.lookup 5) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 6) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 7) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 8) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.tryUpdate BinaryRandomAccessList.length 10" { + let j = lena |> BinaryRandomAccessList.tryUpdate 0 "jj" + let i = lena |> BinaryRandomAccessList.tryUpdate 1 "ii" + let h = lena |> BinaryRandomAccessList.tryUpdate 2 "hh" + let g = lena |> BinaryRandomAccessList.tryUpdate 3 "gg" + let f = lena |> BinaryRandomAccessList.tryUpdate 4 "ff" + let e = lena |> BinaryRandomAccessList.tryUpdate 5 "ee" + let d = lena |> BinaryRandomAccessList.tryUpdate 6 "dd" + let c = lena |> BinaryRandomAccessList.tryUpdate 7 "cc" + let b = lena |> BinaryRandomAccessList.tryUpdate 8 "bb" + let a = lena |> BinaryRandomAccessList.tryUpdate 9 "aa" + + (((j.Value |> BinaryRandomAccessList.lookup 0) = "jj") + && ((i.Value |> BinaryRandomAccessList.lookup 1) = "ii") + && ((h.Value |> BinaryRandomAccessList.lookup 2) = "hh") + && ((g.Value |> BinaryRandomAccessList.lookup 3) = "gg") + && ((f.Value |> BinaryRandomAccessList.lookup 4) = "ff") + && ((e.Value |> BinaryRandomAccessList.lookup 5) = "ee") + && ((d.Value |> BinaryRandomAccessList.lookup 6) = "dd") + && ((c.Value |> BinaryRandomAccessList.lookup 7) = "cc") + && ((b.Value |> BinaryRandomAccessList.lookup 8) = "bb") + && ((a.Value |> BinaryRandomAccessList.lookup 9) = "aa")) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.length of empty is 0" { + BinaryRandomAccessList.empty() + |> BinaryRandomAccessList.length + |> Expect.equal "" 0 + } + + test "BinaryRandomAccessList.length of 1 - 10 good" { + + (((BinaryRandomAccessList.length len1) = 1) + && ((BinaryRandomAccessList.length len2) = 2) + && ((BinaryRandomAccessList.length len3) = 3) + && ((BinaryRandomAccessList.length len4) = 4) + && ((BinaryRandomAccessList.length len5) = 5) + && ((BinaryRandomAccessList.length len6) = 6) + && ((BinaryRandomAccessList.length len7) = 7) + && ((BinaryRandomAccessList.length len8) = 8) + && ((BinaryRandomAccessList.length len9) = 9) + && ((BinaryRandomAccessList.length lena) = 10)) + |> Expect.isTrue "" + } + + test "BinaryRandomAccessList.ofSeq" { + let x = + BinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] + + (((x |> BinaryRandomAccessList.lookup 0) = "a") + && ((x |> BinaryRandomAccessList.lookup 1) = "b") + && ((x |> BinaryRandomAccessList.lookup 2) = "c") + && ((x |> BinaryRandomAccessList.lookup 3) = "d") + && ((x |> BinaryRandomAccessList.lookup 4) = "e") + && ((x |> BinaryRandomAccessList.lookup 5) = "f") + && ((x |> BinaryRandomAccessList.lookup 6) = "g") + && ((x |> BinaryRandomAccessList.lookup 7) = "h") + && ((x |> BinaryRandomAccessList.lookup 8) = "i") + && ((x |> BinaryRandomAccessList.lookup 9) = "j")) + |> Expect.isTrue "" + } + + test "IRandomAccessList BinaryRandomAccessList.cons works" { + ((lena :> IRandomAccessList).Cons "zz").Head + |> Expect.equal "" "zz" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BinaryRoseTreeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BinaryRoseTreeTest.fs index f4afef67..035c0644 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BinaryRoseTreeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BinaryRoseTreeTest.fs @@ -41,43 +41,43 @@ module BinaryRoseTreeTest = [] let testBinaryRoseTree = - testList "Experimental BinaryRoseTree" [ - test "preOrder works" { - let actual = BinaryRoseTree.preOrder ctree |> Seq.toList - Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual - } - - test "postOrder works" { - let actual = BinaryRoseTree.postOrder ctree |> Seq.toList - Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual - } - - test "map" { - let actual = BinaryRoseTree.map ((+) 1) atree - Expect.equal "" expected actual - } - - test "fold via preOrder" { - let actual = BinaryRoseTree.preOrder atree |> Seq.fold (*) 1 - Expect.equal "" 720 actual - } - - test "functor laws" { - let iRT = BinaryRoseTree.createTree 1 (BinaryRoseTree.createForest 2 atree expected) - let singleRT = BinaryRoseTree.singleton 1 - - //fsCheck version of functor and monad laws stackoverflows - let map = BinaryRoseTree.map - - //preserves identity - ((map id iRT) = iRT) |> Expect.isTrue "" - ((map id singleRT) = singleRT) |> Expect.isTrue "" - - let f = (fun x -> x + 5) - let g = (fun x -> x - 2) - - //preserves composition - map (f << g) iRT = (map f << map g) iRT |> Expect.isTrue "" - map (f << g) singleRT = (map f << map g) singleRT |> Expect.isTrue "" - } - ] + testList + "Experimental BinaryRoseTree" + [ test "preOrder works" { + let actual = BinaryRoseTree.preOrder ctree |> Seq.toList + Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual + } + + test "postOrder works" { + let actual = BinaryRoseTree.postOrder ctree |> Seq.toList + Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual + } + + test "map" { + let actual = BinaryRoseTree.map ((+) 1) atree + Expect.equal "" expected actual + } + + test "fold via preOrder" { + let actual = BinaryRoseTree.preOrder atree |> Seq.fold (*) 1 + Expect.equal "" 720 actual + } + + test "functor laws" { + let iRT = BinaryRoseTree.createTree 1 (BinaryRoseTree.createForest 2 atree expected) + let singleRT = BinaryRoseTree.singleton 1 + + //fsCheck version of functor and monad laws stackoverflows + let map = BinaryRoseTree.map + + //preserves identity + ((map id iRT) = iRT) |> Expect.isTrue "" + ((map id singleRT) = singleRT) |> Expect.isTrue "" + + let f = (fun x -> x + 5) + let g = (fun x -> x - 2) + + //preserves composition + map (f << g) iRT = (map f << map g) iRT |> Expect.isTrue "" + map (f << g) singleRT = (map f << map g) singleRT |> Expect.isTrue "" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BinaryTreeZipperTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BinaryTreeZipperTest.fs index 56b4f248..41747488 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BinaryTreeZipperTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BinaryTreeZipperTest.fs @@ -11,81 +11,79 @@ module BinaryTreeZipperTest = [] let testBinaryTreeZipper = - testList "Experimental BinaryTreeZipper" [ - - test "Can create BinaryTreeZipper.zipper from tree" { - let z1 = tree |> BinaryTreeZipper.zipper - Expect.equal "" tree z1.Focus - } - - test "Can BinaryTreeZipper.move down to the BinaryTreeZipper.left inside the BinaryTreeZipper.zipper" { - let z1 = tree |> BinaryTreeZipper.zipper |> BinaryTreeZipper.left - - Expect.equal "" (Branch("b", BinaryTree.Leaf, Branch("c", BinaryTree.Leaf, BinaryTree.Leaf))) z1.Focus - } - - test "Can BinaryTreeZipper.move down to the BinaryTreeZipper.right inside the BinaryTreeZipper.zipper" { - let z1 = tree |> BinaryTreeZipper.zipper |> BinaryTreeZipper.right - Expect.equal "" (Branch("d", BinaryTree.Leaf, BinaryTree.Leaf)) z1.Focus - } - - test "Can BinaryTreeZipper.move down to the BinaryTreeZipper.left and the BinaryTreeZipper.right inside the BinaryTreeZipper.zipper" { - let z1 = - tree - |> BinaryTreeZipper.zipper - |> BinaryTreeZipper.move [ - BinaryTreeZipper.TreeZipperDirection.Left - BinaryTreeZipper.TreeZipperDirection.Right - ] - - Expect.equal "" (Branch("c", BinaryTree.Leaf, BinaryTree.Leaf)) z1.Focus - } - - test "Can BinaryTreeZipper.move up inside the BinaryTreeZipper.zipper" { - let z1 = - tree - |> BinaryTreeZipper.zipper - |> BinaryTreeZipper.move [ - BinaryTreeZipper.TreeZipperDirection.Left - BinaryTreeZipper.TreeZipperDirection.Right - BinaryTreeZipper.TreeZipperDirection.Right - BinaryTreeZipper.Up - BinaryTreeZipper.Up - BinaryTreeZipper.Up - ] - - Expect.equal "" tree z1.Focus - } - - test "Can BinaryTreeZipper.move to the top from inside the BinaryTreeZipper.zipper" { - let z1 = - tree - |> BinaryTreeZipper.zipper - |> BinaryTreeZipper.move [ - BinaryTreeZipper.TreeZipperDirection.Left - BinaryTreeZipper.TreeZipperDirection.Right - BinaryTreeZipper.TreeZipperDirection.Right - ] - |> BinaryTreeZipper.top - - Expect.equal "" tree z1.Focus - } - - test "Can modify inside the BinaryTreeZipper.zipper" { - let z1 = - tree - |> BinaryTreeZipper.zipper - |> BinaryTreeZipper.right - |> BinaryTreeZipper.setFocus(BinaryTreeZipper.branch "e") - |> BinaryTreeZipper.top - - Expect.equal - "" - (Branch( - "a", - Branch("b", BinaryTree.Leaf, Branch("c", BinaryTree.Leaf, BinaryTree.Leaf)), - Branch("e", BinaryTree.Leaf, BinaryTree.Leaf) - )) - z1.Focus - } - ] + testList + "Experimental BinaryTreeZipper" + [ + + test "Can create BinaryTreeZipper.zipper from tree" { + let z1 = tree |> BinaryTreeZipper.zipper + Expect.equal "" tree z1.Focus + } + + test "Can BinaryTreeZipper.move down to the BinaryTreeZipper.left inside the BinaryTreeZipper.zipper" { + let z1 = tree |> BinaryTreeZipper.zipper |> BinaryTreeZipper.left + + Expect.equal "" (Branch("b", BinaryTree.Leaf, Branch("c", BinaryTree.Leaf, BinaryTree.Leaf))) z1.Focus + } + + test "Can BinaryTreeZipper.move down to the BinaryTreeZipper.right inside the BinaryTreeZipper.zipper" { + let z1 = tree |> BinaryTreeZipper.zipper |> BinaryTreeZipper.right + Expect.equal "" (Branch("d", BinaryTree.Leaf, BinaryTree.Leaf)) z1.Focus + } + + test "Can BinaryTreeZipper.move down to the BinaryTreeZipper.left and the BinaryTreeZipper.right inside the BinaryTreeZipper.zipper" { + let z1 = + tree + |> BinaryTreeZipper.zipper + |> BinaryTreeZipper.move + [ BinaryTreeZipper.TreeZipperDirection.Left + BinaryTreeZipper.TreeZipperDirection.Right ] + + Expect.equal "" (Branch("c", BinaryTree.Leaf, BinaryTree.Leaf)) z1.Focus + } + + test "Can BinaryTreeZipper.move up inside the BinaryTreeZipper.zipper" { + let z1 = + tree + |> BinaryTreeZipper.zipper + |> BinaryTreeZipper.move + [ BinaryTreeZipper.TreeZipperDirection.Left + BinaryTreeZipper.TreeZipperDirection.Right + BinaryTreeZipper.TreeZipperDirection.Right + BinaryTreeZipper.Up + BinaryTreeZipper.Up + BinaryTreeZipper.Up ] + + Expect.equal "" tree z1.Focus + } + + test "Can BinaryTreeZipper.move to the top from inside the BinaryTreeZipper.zipper" { + let z1 = + tree + |> BinaryTreeZipper.zipper + |> BinaryTreeZipper.move + [ BinaryTreeZipper.TreeZipperDirection.Left + BinaryTreeZipper.TreeZipperDirection.Right + BinaryTreeZipper.TreeZipperDirection.Right ] + |> BinaryTreeZipper.top + + Expect.equal "" tree z1.Focus + } + + test "Can modify inside the BinaryTreeZipper.zipper" { + let z1 = + tree + |> BinaryTreeZipper.zipper + |> BinaryTreeZipper.right + |> BinaryTreeZipper.setFocus(BinaryTreeZipper.branch "e") + |> BinaryTreeZipper.top + + Expect.equal + "" + (Branch( + "a", + Branch("b", BinaryTree.Leaf, Branch("c", BinaryTree.Leaf, BinaryTree.Leaf)), + Branch("e", BinaryTree.Leaf, BinaryTree.Leaf) + )) + z1.Focus + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BinomialHeapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BinomialHeapTest.fs index 9a239b3b..97b571b6 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BinomialHeapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BinomialHeapTest.fs @@ -14,64 +14,65 @@ module BinomialHeapTest = [] let testBinomialHeap = - testList "Experimental BinomialHeap" [ + testList + "Experimental BinomialHeap" + [ - test "cons pattern discriminator" { - let h = BinomialHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h1, t1 = BinomialHeap.uncons h + test "cons pattern discriminator" { + let h = BinomialHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h1, t1 = BinomialHeap.uncons h - let h2, t2 = - match t1 with - | BinomialHeap.Cons(h, t) -> h, t - | _ -> "x", t1 + let h2, t2 = + match t1 with + | BinomialHeap.Cons(h, t) -> h, t + | _ -> "x", t1 - ((h2 = "e") && ((BinomialHeap.length t2) = 4)) |> Expect.isTrue "" - } + ((h2 = "e") && ((BinomialHeap.length t2) = 4)) |> Expect.isTrue "" + } - test "cons pattern discriminator 2" { - let h = BinomialHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "cons pattern discriminator 2" { + let h = BinomialHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let t2 = - match h with - | BinomialHeap.Cons("f", BinomialHeap.Cons(_, t)) -> t - | _ -> h + let t2 = + match h with + | BinomialHeap.Cons("f", BinomialHeap.Cons(_, t)) -> t + | _ -> h - let h1, t3 = BinomialHeap.uncons t2 + let h1, t3 = BinomialHeap.uncons t2 - ((h1 = "d") && ((BinomialHeap.length t2) = 4)) |> Expect.isTrue "" - } + ((h1 = "d") && ((BinomialHeap.length t2) = 4)) |> Expect.isTrue "" + } - test "empty list should be empty" { (BinomialHeap.empty true).IsEmpty |> Expect.isTrue "" } + test "empty list should be empty" { (BinomialHeap.empty true).IsEmpty |> Expect.isTrue "" } - test "BinomialHeap.length of empty is 0" { (BinomialHeap.empty true).Length() |> Expect.equal "" 0 } + test "BinomialHeap.length of empty is 0" { (BinomialHeap.empty true).Length() |> Expect.equal "" 0 } - test "tryGetHead on empty should return None" { (BinomialHeap.empty true).TryGetHead() |> Expect.isNone "" } + test "tryGetHead on empty should return None" { (BinomialHeap.empty true).TryGetHead() |> Expect.isNone "" } - test "BinomialHeap.tryGetTail on empty should return None" { (BinomialHeap.empty true).TryGetTail() |> Expect.isNone "" } + test "BinomialHeap.tryGetTail on empty should return None" { (BinomialHeap.empty true).TryGetTail() |> Expect.isNone "" } - test "BinomialHeap.tryGetTail on len 1 should return Some empty" { - let h = - BinomialHeap.empty true - |> BinomialHeap.insert 1 - |> BinomialHeap.tryGetTail + test "BinomialHeap.tryGetTail on len 1 should return Some empty" { + let h = + BinomialHeap.empty true + |> BinomialHeap.insert 1 + |> BinomialHeap.tryGetTail - h.Value |> BinomialHeap.isEmpty |> Expect.isTrue "" - } + h.Value |> BinomialHeap.isEmpty |> Expect.isTrue "" + } - test "BinomialHeap.tryMerge max and mis should be None" { - let h1 = BinomialHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h2 = BinomialHeap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] + test "BinomialHeap.tryMerge max and mis should be None" { + let h1 = BinomialHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h2 = BinomialHeap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] - BinomialHeap.tryMerge h1 h2 |> Expect.isNone "" - } + BinomialHeap.tryMerge h1 h2 |> Expect.isNone "" + } - test "BinomialHeap.insert works" { - (((BinomialHeap.empty true).Insert 1).Insert 2).IsEmpty - |> Expect.isFalse "" - } + test "BinomialHeap.insert works" { + (((BinomialHeap.empty true).Insert 1).Insert 2).IsEmpty + |> Expect.isFalse "" + } - test "tryUncons empty" { (BinomialHeap.empty true).TryUncons() |> Expect.isNone "" } - ] + test "tryUncons empty" { (BinomialHeap.empty true).TryUncons() |> Expect.isNone "" } ] [] let propertyBinomialHeap = @@ -108,323 +109,324 @@ module BinomialHeapTest = let intGensStart2 = intGens 2 // this will accept 11 out of 12 - testList "Experimental BinomialHeap property tests" [ - - testPropertyWithConfig - config10k - "head should return 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "head should return 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "head should return 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "head should return 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "head should return 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "head should return 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list max" - (Prop.forAll(Arb.fromGen maxBinomialHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list min" - (Prop.forAll(Arb.fromGen minBinomialHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 3" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 4" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 5" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list string 0" - (Prop.forAll(Arb.fromGen stringGens.[0]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "seq enumerate matches build list string 1" - (Prop.forAll(Arb.fromGen stringGens.[1]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tail should return 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tail should return 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tail should return 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tail should return 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tail should return 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tail should return 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryGetHead should return 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryGetHead should return 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryGetHead should return 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryGetHead should return 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryGetHead should return 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryGetHead should return 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryUncons 1 element 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryUncons 1 element 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryUncons 1 element 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryUncons 1 element 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryUncons 1 element 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "tryUncons 1 element 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "BinomialHeap.uncons 1 element 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "BinomialHeap.uncons 1 element 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "BinomialHeap.uncons 1 element 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "BinomialHeap.uncons 1 element 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "BinomialHeap.uncons 1 element 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "BinomialHeap.uncons 1 element 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - ] + testList + "Experimental BinomialHeap property tests" + [ + + testPropertyWithConfig + config10k + "head should return 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "head should return 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "head should return 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "head should return 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "head should return 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "head should return 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list max" + (Prop.forAll(Arb.fromGen maxBinomialHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list min" + (Prop.forAll(Arb.fromGen minBinomialHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 3" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 4" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 5" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list string 0" + (Prop.forAll(Arb.fromGen stringGens.[0]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "seq enumerate matches build list string 1" + (Prop.forAll(Arb.fromGen stringGens.[1]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tail should return 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tail should return 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tail should return 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tail should return 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tail should return 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tail should return 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryGetHead should return 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryGetHead should return 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryGetHead should return 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryGetHead should return 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryGetHead should return 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryGetHead should return 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryUncons 1 element 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryUncons 1 element 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryUncons 1 element 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryUncons 1 element 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryUncons 1 element 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "tryUncons 1 element 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "BinomialHeap.uncons 1 element 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "BinomialHeap.uncons 1 element 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "BinomialHeap.uncons 1 element 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "BinomialHeap.uncons 1 element 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "BinomialHeap.uncons 1 element 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "BinomialHeap.uncons 1 element 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BlockResizeArrayTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BlockResizeArrayTest.fs index f786697d..ce04d296 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BlockResizeArrayTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BlockResizeArrayTest.fs @@ -32,292 +32,294 @@ module BlockResizeArrayTest = [] let testBlockResizeArray = - testList "Experimental BlockResizeArray" [ + testList + "Experimental BlockResizeArray" + [ #if MONO #else - test "allocation performance" { + test "allocation performance" { - averageTime testIters "ResizeArrayAlloc" (fun () -> - let a = new ResizeArray() + averageTime testIters "ResizeArrayAlloc" (fun () -> + let a = new ResizeArray() - for i in 0..arraySize do - a.Add x) + for i in 0..arraySize do + a.Add x) - averageTime testIters "BlockResizeArrayAlloc" (fun () -> - let a = new BlockResizeArray() + averageTime testIters "BlockResizeArrayAlloc" (fun () -> + let a = new BlockResizeArray() - for i in 0..arraySize do - a.Add x) - } + for i in 0..arraySize do + a.Add x) + } - test "random access performance" { - let rand = System.Random() - let access = [| for i in 0 .. arraySize - 1 -> rand.Next(0, arraySize - 1) |] - let a = Array.init arraySize (fun _ -> x) - let ra = new ResizeArray() + test "random access performance" { + let rand = System.Random() + let access = [| for i in 0 .. arraySize - 1 -> rand.Next(0, arraySize - 1) |] + let a = Array.init arraySize (fun _ -> x) + let ra = new ResizeArray() - for i in 0..arraySize do - ra.Add x + for i in 0..arraySize do + ra.Add x - let bra = new BlockResizeArray() + let bra = new BlockResizeArray() - for i in 0..arraySize do - bra.Add x + for i in 0..arraySize do + bra.Add x - let b = ref 0UL + let b = ref 0UL - averageTime testIters "ResizeArray random access" (fun () -> - for i in access do - ra.[i] <- 0UL) + averageTime testIters "ResizeArray random access" (fun () -> + for i in access do + ra.[i] <- 0UL) - averageTime testIters "Array random access" (fun () -> - for i in access do - a.[i] <- 0UL) + averageTime testIters "Array random access" (fun () -> + for i in access do + a.[i] <- 0UL) - averageTime testIters "BlockResizeArray random access" (fun () -> - for i in access do - bra.[i] <- 0UL) - } + averageTime testIters "BlockResizeArray random access" (fun () -> + for i in access do + bra.[i] <- 0UL) + } - test "sequential access performance" { - let rand = System.Random() - let access = [| 0 .. arraySize - 1 |] - let a = Array.init arraySize (fun _ -> x) - let ra = new ResizeArray() + test "sequential access performance" { + let rand = System.Random() + let access = [| 0 .. arraySize - 1 |] + let a = Array.init arraySize (fun _ -> x) + let ra = new ResizeArray() - for i in 0..arraySize do - ra.Add x + for i in 0..arraySize do + ra.Add x - let bra = new BlockResizeArray() + let bra = new BlockResizeArray() - for i in 0..arraySize do - bra.Add x + for i in 0..arraySize do + bra.Add x - let b = ref 0UL + let b = ref 0UL - averageTime testIters "ResizeArray sequential access" (fun () -> - for i in access do - ra.[i] <- 0UL) + averageTime testIters "ResizeArray sequential access" (fun () -> + for i in access do + ra.[i] <- 0UL) - averageTime testIters "Array sequential access" (fun () -> - for i in access do - a.[i] <- 0UL) + averageTime testIters "Array sequential access" (fun () -> + for i in access do + a.[i] <- 0UL) - averageTime testIters "BlockResize sequential access" (fun () -> - for i in access do - bra.[i] <- 0UL) - } + averageTime testIters "BlockResize sequential access" (fun () -> + for i in access do + bra.[i] <- 0UL) + } - test "map performance" { - let a = Array.init arraySize (fun _ -> x) - let ra = new ResizeArray() + test "map performance" { + let a = Array.init arraySize (fun _ -> x) + let ra = new ResizeArray() - for i in 0..arraySize do - ra.Add x + for i in 0..arraySize do + ra.Add x - let bra = BlockResizeArray.Init arraySize (fun _ -> x) - averageTime testIters "ResizeArray map" (fun () -> (ResizeArray.map (fun x -> x * 2UL) ra)) - averageTime testIters "Array map" (fun () -> (Array.map (fun x -> x * 2UL) a)) - averageTime testIters "BlockResizeArray map" (fun () -> bra.Map(fun x -> x * 2UL)) - } + let bra = BlockResizeArray.Init arraySize (fun _ -> x) + averageTime testIters "ResizeArray map" (fun () -> (ResizeArray.map (fun x -> x * 2UL) ra)) + averageTime testIters "Array map" (fun () -> (Array.map (fun x -> x * 2UL) a)) + averageTime testIters "BlockResizeArray map" (fun () -> bra.Map(fun x -> x * 2UL)) + } - test "iter performance" { - let a = Array.init arraySize (fun _ -> x) - let ra = new ResizeArray() + test "iter performance" { + let a = Array.init arraySize (fun _ -> x) + let ra = new ResizeArray() - for i in 0..arraySize do - ra.Add x + for i in 0..arraySize do + ra.Add x - let bra = BlockResizeArray.Init arraySize (fun _ -> x) - averageTime testIters "ResizeArray iter" (fun () -> (ResizeArray.iter (fun i -> ()) ra)) - averageTime testIters "Array iter" (fun () -> (Array.iter(fun i -> ()))) - averageTime testIters "BlockResizeArray iter" (fun () -> bra.Iter(fun i -> ())) - } + let bra = BlockResizeArray.Init arraySize (fun _ -> x) + averageTime testIters "ResizeArray iter" (fun () -> (ResizeArray.iter (fun i -> ()) ra)) + averageTime testIters "Array iter" (fun () -> (Array.iter(fun i -> ()))) + averageTime testIters "BlockResizeArray iter" (fun () -> bra.Iter(fun i -> ())) + } - test "fold performance" { - let a = Array.init arraySize (fun _ -> x) - let ra = new ResizeArray() + test "fold performance" { + let a = Array.init arraySize (fun _ -> x) + let ra = new ResizeArray() - for i in 0..arraySize do - ra.Add x + for i in 0..arraySize do + ra.Add x - let bra = BlockResizeArray.Init arraySize (fun _ -> x) + let bra = BlockResizeArray.Init arraySize (fun _ -> x) - averageTime testIters "ResizeArray fold" (fun () -> (ResizeArray.fold (fun x acc -> acc + x * 2UL) 0UL ra)) + averageTime testIters "ResizeArray fold" (fun () -> (ResizeArray.fold (fun x acc -> acc + x * 2UL) 0UL ra)) - averageTime testIters "Array fold" (fun () -> (Array.fold (fun x acc -> acc + x * 2UL) 0UL a)) + averageTime testIters "Array fold" (fun () -> (Array.fold (fun x acc -> acc + x * 2UL) 0UL a)) - averageTime testIters "BlockResizeArray fold" (fun () -> - (FSharpx.Collections.Experimental.BlockResizeArray.fold (fun x acc -> acc + x * 2UL) 0UL bra)) - } + averageTime testIters "BlockResizeArray fold" (fun () -> + (FSharpx.Collections.Experimental.BlockResizeArray.fold (fun x acc -> acc + x * 2UL) 0UL bra)) + } - test "find performance" { - let x = 1000 - let a = Array.init arraySize (fun i -> x + i) - let ra = new ResizeArray() - let s = 1010000 + test "find performance" { + let x = 1000 + let a = Array.init arraySize (fun i -> x + i) + let ra = new ResizeArray() + let s = 1010000 - for i in 0..arraySize do - ra.Add(x + i) + for i in 0..arraySize do + ra.Add(x + i) - let bra = BlockResizeArray.Init arraySize (fun i -> x + i) + let bra = BlockResizeArray.Init arraySize (fun i -> x + i) - averageTime testIters "ResizeArray find" (fun () -> ResizeArray.find (fun e -> e <> 0 && e % s = 0) ra) + averageTime testIters "ResizeArray find" (fun () -> ResizeArray.find (fun e -> e <> 0 && e % s = 0) ra) - averageTime testIters "Array find" (fun () -> (Array.find (fun e -> e <> 0 && e % s = 0) a)) + averageTime testIters "Array find" (fun () -> (Array.find (fun e -> e <> 0 && e % s = 0) a)) - averageTime testIters "BlockResizeArray find" (fun () -> - (FSharpx.Collections.Experimental.BlockResizeArray.find (fun e -> e <> 0 && e % s = 0) bra)) - } + averageTime testIters "BlockResizeArray find" (fun () -> + (FSharpx.Collections.Experimental.BlockResizeArray.find (fun e -> e <> 0 && e % s = 0) bra)) + } #endif - test "map function test" { - let bra = BlockResizeArray.Init testLen (fun i -> i) - let a = Array.init testLen (fun i -> i * 2) - let bra = bra.Map(fun i -> i * 2) - compareByElems bra a - } - - test "iter function test" { - let bra = BlockResizeArray.Init testLen (fun i -> i) - let a = Array.init testLen (fun i -> i) - Array.iter (fun i -> a.[i] <- i * 2) a - bra.Iter(fun i -> bra.[i] <- i * 2) - compareByElems bra a - } - - test "init function test" { - let bra = BlockResizeArray.Init testLen (fun i -> i) - let a = Array.init testLen (fun i -> i) - compareByElems bra a - Expect.equal "" bra.Length testLen - } - - test "zeroCreate function test" { - let bra = BlockResizeArray<_>.ZeroCreate testLen - Expect.equal "" bra.Length testLen - } - - test "find function test" { - let c = 500000 - let bra = BlockResizeArray.Init testLen (fun i -> i) - let res = bra.Find(fun i -> i <> 0 && i % c = 0) - Expect.equal "" c res - } - - test "tryFind function test" { - let c = 500000 - let bra = BlockResizeArray.Init testLen (fun i -> i) - let res = bra.TryFind(fun i -> i <> 0 && i % c = 0) - Expect.isTrue "" res.IsSome - Expect.equal "" c res.Value - } - - test "filter function test" { - let c = 10000 - let a = Array.init testLen (fun i -> i) - let a = Array.filter (fun i -> i % c = 0) a - let bra = BlockResizeArray.Init testLen (fun i -> i) - let bra = bra.Filter(fun e -> e % c = 0) - compareByElems bra a - } - - test "fold function test" { - let a = Array.init testLen (fun i -> i) - let aRes = Array.fold (fun acc elem -> acc + elem) 0 a - let bra = BlockResizeArray.Init testLen (fun i -> i) - let braRes = bra.Fold (fun acc elem -> acc + elem) 0 - Expect.equal "" braRes aRes - } - ] + test "map function test" { + let bra = BlockResizeArray.Init testLen (fun i -> i) + let a = Array.init testLen (fun i -> i * 2) + let bra = bra.Map(fun i -> i * 2) + compareByElems bra a + } + + test "iter function test" { + let bra = BlockResizeArray.Init testLen (fun i -> i) + let a = Array.init testLen (fun i -> i) + Array.iter (fun i -> a.[i] <- i * 2) a + bra.Iter(fun i -> bra.[i] <- i * 2) + compareByElems bra a + } + + test "init function test" { + let bra = BlockResizeArray.Init testLen (fun i -> i) + let a = Array.init testLen (fun i -> i) + compareByElems bra a + Expect.equal "" bra.Length testLen + } + + test "zeroCreate function test" { + let bra = BlockResizeArray<_>.ZeroCreate testLen + Expect.equal "" bra.Length testLen + } + + test "find function test" { + let c = 500000 + let bra = BlockResizeArray.Init testLen (fun i -> i) + let res = bra.Find(fun i -> i <> 0 && i % c = 0) + Expect.equal "" c res + } + + test "tryFind function test" { + let c = 500000 + let bra = BlockResizeArray.Init testLen (fun i -> i) + let res = bra.TryFind(fun i -> i <> 0 && i % c = 0) + Expect.isTrue "" res.IsSome + Expect.equal "" c res.Value + } + + test "filter function test" { + let c = 10000 + let a = Array.init testLen (fun i -> i) + let a = Array.filter (fun i -> i % c = 0) a + let bra = BlockResizeArray.Init testLen (fun i -> i) + let bra = bra.Filter(fun e -> e % c = 0) + compareByElems bra a + } + + test "fold function test" { + let a = Array.init testLen (fun i -> i) + let aRes = Array.fold (fun acc elem -> acc + elem) 0 a + let bra = BlockResizeArray.Init testLen (fun i -> i) + let braRes = bra.Fold (fun acc elem -> acc + elem) 0 + Expect.equal "" braRes aRes + } ] [] let testBlockResizeArrayPropeerties = - testList "Experimental BlockResizeArray properties" [ - // destabilizing test function - ptestPropertyWithConfig config10k "Random map" - <| fun xs -> - let testFun f (bra: BlockResizeArray) = - let arr = bra.ToArray() - let b = bra.Map f - let a = Array.map f arr - compareByElems b a - - testFun (fun e -> e * 2) xs - - // destabilizing test function - ptestPropertyWithConfig config10k "Random filter" - <| fun xs -> - let testFun f (bra: BlockResizeArray) = - let arr = bra.ToArray() - let b = bra.Filter f - let a = Array.filter f arr - compareByElems b a - - testFun (fun e -> e % 3 = 2) xs - - // destabilizing test function - ptestPropertyWithConfig config10k "Random TryFind" - <| fun xs -> - let testFun f (bra: BlockResizeArray) = - let arr = bra.ToArray() - let b = bra.TryFind f - let a = Array.tryFind f arr - Expect.isTrue "" (b = a) - - testFun (fun e -> e % 3 = 2) xs - - // destabilizing test function - ptestPropertyWithConfig config10k "Random Find" - <| fun xs -> - let testFun f (bra: BlockResizeArray) = - let arr = bra.ToArray() - - let b = - try - bra.Find f |> Some - with :? System.Collections.Generic.KeyNotFoundException -> - None - - let a = - try - Array.find f arr |> Some - with :? System.Collections.Generic.KeyNotFoundException -> - None - - Expect.isTrue "" (b = a) - - testFun (fun e -> e % 3 = 2) xs - - // destabilizing test function - ptestPropertyWithConfig config10k "Random ToArray" - <| fun xs -> - let testFun(bra: BlockResizeArray) = - let arr = bra.ToArray() - compareByElems bra arr - - testFun xs - - // destabilizing test function - ptestPropertyWithConfig config10k "Random iter" - <| fun xs -> - let testFun f (bra: BlockResizeArray) = - let arr = bra.ToArray() - let acc1 = ref 0 - let acc2 = ref 0 - bra.Iter(f acc1) - Array.iter (f acc2) arr - Expect.equal "" !acc1 !acc2 - - testFun (fun acc -> (fun e -> acc := !acc + e)) xs - - // destabilizing test function - ptestPropertyWithConfig config10k "Random fold" - <| fun xs -> - let testFun f (bra: BlockResizeArray) = - let arr = bra.ToArray() - let r1 = bra.Fold f 0 - let r2 = Array.fold f 0 arr - Expect.equal "" r2 r1 - - testFun (fun s e -> s + e) xs - ] + testList + "Experimental BlockResizeArray properties" + [ + // destabilizing test function + ptestPropertyWithConfig config10k "Random map" + <| fun xs -> + let testFun f (bra: BlockResizeArray) = + let arr = bra.ToArray() + let b = bra.Map f + let a = Array.map f arr + compareByElems b a + + testFun (fun e -> e * 2) xs + + // destabilizing test function + ptestPropertyWithConfig config10k "Random filter" + <| fun xs -> + let testFun f (bra: BlockResizeArray) = + let arr = bra.ToArray() + let b = bra.Filter f + let a = Array.filter f arr + compareByElems b a + + testFun (fun e -> e % 3 = 2) xs + + // destabilizing test function + ptestPropertyWithConfig config10k "Random TryFind" + <| fun xs -> + let testFun f (bra: BlockResizeArray) = + let arr = bra.ToArray() + let b = bra.TryFind f + let a = Array.tryFind f arr + Expect.isTrue "" (b = a) + + testFun (fun e -> e % 3 = 2) xs + + // destabilizing test function + ptestPropertyWithConfig config10k "Random Find" + <| fun xs -> + let testFun f (bra: BlockResizeArray) = + let arr = bra.ToArray() + + let b = + try + bra.Find f |> Some + with :? System.Collections.Generic.KeyNotFoundException -> + None + + let a = + try + Array.find f arr |> Some + with :? System.Collections.Generic.KeyNotFoundException -> + None + + Expect.isTrue "" (b = a) + + testFun (fun e -> e % 3 = 2) xs + + // destabilizing test function + ptestPropertyWithConfig config10k "Random ToArray" + <| fun xs -> + let testFun(bra: BlockResizeArray) = + let arr = bra.ToArray() + compareByElems bra arr + + testFun xs + + // destabilizing test function + ptestPropertyWithConfig config10k "Random iter" + <| fun xs -> + let testFun f (bra: BlockResizeArray) = + let arr = bra.ToArray() + let acc1 = ref 0 + let acc2 = ref 0 + bra.Iter(f acc1) + Array.iter (f acc2) arr + Expect.equal "" !acc1 !acc2 + + testFun (fun acc -> (fun e -> acc := !acc + e)) xs + + // destabilizing test function + ptestPropertyWithConfig config10k "Random fold" + <| fun xs -> + let testFun f (bra: BlockResizeArray) = + let arr = bra.ToArray() + let r1 = bra.Fold f 0 + let r2 = Array.fold f 0 arr + Expect.equal "" r2 r1 + + testFun (fun s e -> s + e) xs ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BootstrappedQueueTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BootstrappedQueueTest.fs index 3f4bf58b..d58c36c4 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BootstrappedQueueTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BootstrappedQueueTest.fs @@ -10,103 +10,103 @@ module BootstrappedQueueTest = [] let testBootstrappedQueue = - testList "Experimental BootstrappedQueue" [ - test "BootstrappedQueue.empty queue should be BootstrappedQueue.empty" { - BootstrappedQueue.isEmpty BootstrappedQueue.empty |> Expect.isTrue "" - } - - test "it should allow to enqueue" { - BootstrappedQueue.empty - |> BootstrappedQueue.snoc 1 - |> BootstrappedQueue.snoc 2 - |> BootstrappedQueue.isEmpty - |> Expect.isFalse "" - } - - test "it should allow to dequeue" { - BootstrappedQueue.empty - |> BootstrappedQueue.snoc 1 - |> BootstrappedQueue.tail - |> BootstrappedQueue.isEmpty - |> Expect.isTrue "" - } - - test "it should fail if there is no BootstrappedQueue.head in the queue" { - let ok = ref false - - try - BootstrappedQueue.empty |> BootstrappedQueue.head |> ignore - with x when x = Exceptions.Empty -> - ok := true - - !ok |> Expect.isTrue "" - } - - test "it should give None if there is no BootstrappedQueue.head in the queue" { - BootstrappedQueue.empty - |> BootstrappedQueue.tryGetHead - |> Expect.isNone "" - } - - test "it should fail if there is no BootstrappedQueue.tail the queue" { - let ok = ref false - - try - BootstrappedQueue.empty |> BootstrappedQueue.tail |> ignore - with x when x = Exceptions.Empty -> - ok := true - - !ok |> Expect.isTrue "" - } - - test "it should give None if there is no BootstrappedQueue.tail in the queue" { - BootstrappedQueue.empty - |> BootstrappedQueue.tryGetTail - |> Expect.isNone "" - } - - test "it should allow to get the BootstrappedQueue.head from a queue" { - BootstrappedQueue.empty - |> BootstrappedQueue.snoc 1 - |> BootstrappedQueue.snoc 2 - |> BootstrappedQueue.head - |> Expect.equal "" 1 - } - - test "it should allow to get the BootstrappedQueue.head from a queue safely" { - BootstrappedQueue.empty - |> BootstrappedQueue.snoc 1 - |> BootstrappedQueue.snoc 2 - |> BootstrappedQueue.tryGetHead - |> Expect.equal "" (Some 1) - } - - test "it should allow to get the BootstrappedQueue.tail from the queue" { - BootstrappedQueue.empty - |> BootstrappedQueue.snoc "a" - |> BootstrappedQueue.snoc "b" - |> BootstrappedQueue.snoc "c" - |> BootstrappedQueue.tail - |> BootstrappedQueue.head - |> Expect.equal "" "b" - } - - test "it should allow to get the BootstrappedQueue.tail from a queue safely" { - let value = - BootstrappedQueue.empty - |> BootstrappedQueue.snoc 1 - |> BootstrappedQueue.snoc 2 - |> BootstrappedQueue.tryGetTail - - value.Value |> BootstrappedQueue.head |> Expect.equal "" 2 - } - - test "it should initialize from a list" { - BootstrappedQueue.ofList [ 1..10 ] - |> BootstrappedQueue.snoc 11 - |> BootstrappedQueue.snoc 12 - |> BootstrappedQueue.tail - |> BootstrappedQueue.length - |> Expect.equal "" 11 - } - ] + testList + "Experimental BootstrappedQueue" + [ test "BootstrappedQueue.empty queue should be BootstrappedQueue.empty" { + BootstrappedQueue.isEmpty BootstrappedQueue.empty |> Expect.isTrue "" + } + + test "it should allow to enqueue" { + BootstrappedQueue.empty + |> BootstrappedQueue.snoc 1 + |> BootstrappedQueue.snoc 2 + |> BootstrappedQueue.isEmpty + |> Expect.isFalse "" + } + + test "it should allow to dequeue" { + BootstrappedQueue.empty + |> BootstrappedQueue.snoc 1 + |> BootstrappedQueue.tail + |> BootstrappedQueue.isEmpty + |> Expect.isTrue "" + } + + test "it should fail if there is no BootstrappedQueue.head in the queue" { + let ok = ref false + + try + BootstrappedQueue.empty |> BootstrappedQueue.head |> ignore + with x when x = Exceptions.Empty -> + ok := true + + !ok |> Expect.isTrue "" + } + + test "it should give None if there is no BootstrappedQueue.head in the queue" { + BootstrappedQueue.empty + |> BootstrappedQueue.tryGetHead + |> Expect.isNone "" + } + + test "it should fail if there is no BootstrappedQueue.tail the queue" { + let ok = ref false + + try + BootstrappedQueue.empty |> BootstrappedQueue.tail |> ignore + with x when x = Exceptions.Empty -> + ok := true + + !ok |> Expect.isTrue "" + } + + test "it should give None if there is no BootstrappedQueue.tail in the queue" { + BootstrappedQueue.empty + |> BootstrappedQueue.tryGetTail + |> Expect.isNone "" + } + + test "it should allow to get the BootstrappedQueue.head from a queue" { + BootstrappedQueue.empty + |> BootstrappedQueue.snoc 1 + |> BootstrappedQueue.snoc 2 + |> BootstrappedQueue.head + |> Expect.equal "" 1 + } + + test "it should allow to get the BootstrappedQueue.head from a queue safely" { + BootstrappedQueue.empty + |> BootstrappedQueue.snoc 1 + |> BootstrappedQueue.snoc 2 + |> BootstrappedQueue.tryGetHead + |> Expect.equal "" (Some 1) + } + + test "it should allow to get the BootstrappedQueue.tail from the queue" { + BootstrappedQueue.empty + |> BootstrappedQueue.snoc "a" + |> BootstrappedQueue.snoc "b" + |> BootstrappedQueue.snoc "c" + |> BootstrappedQueue.tail + |> BootstrappedQueue.head + |> Expect.equal "" "b" + } + + test "it should allow to get the BootstrappedQueue.tail from a queue safely" { + let value = + BootstrappedQueue.empty + |> BootstrappedQueue.snoc 1 + |> BootstrappedQueue.snoc 2 + |> BootstrappedQueue.tryGetTail + + value.Value |> BootstrappedQueue.head |> Expect.equal "" 2 + } + + test "it should initialize from a list" { + BootstrappedQueue.ofList [ 1..10 ] + |> BootstrappedQueue.snoc 11 + |> BootstrappedQueue.snoc 12 + |> BootstrappedQueue.tail + |> BootstrappedQueue.length + |> Expect.equal "" 11 + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/BottomUpMergeSortTest.fs b/tests/FSharpx.Collections.Experimental.Tests/BottomUpMergeSortTest.fs index ad045fbc..f40e5184 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/BottomUpMergeSortTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/BottomUpMergeSortTest.fs @@ -9,44 +9,44 @@ module BottomUpMergeSortTest = [] let testBottomUpMergeSort = - testList "Experimental BottomUpMergeSort" [ - test "empty list should be empty" { - BottomUpMergeSort.empty - |> BottomUpMergeSort.isEmpty - |> Expect.isTrue "" - } - - test "empty list should be empty after sort" { BottomUpMergeSort.sort BottomUpMergeSort.empty |> Expect.equal "" [] } - - test "singleton list should be the same after sort" { - BottomUpMergeSort.sort(BottomUpMergeSort.singleton 1) - |> Expect.equal "" [ 1 ] - } - - test "adding a element to an empty list" { - BottomUpMergeSort.empty - |> BottomUpMergeSort.add 1 - |> BottomUpMergeSort.sort - |> Expect.equal "" [ 1 ] - } - - test "adding multiple elements to an empty list" { - BottomUpMergeSort.empty - |> BottomUpMergeSort.add 100 - |> BottomUpMergeSort.add 1 - |> BottomUpMergeSort.add 3 - |> BottomUpMergeSort.add 42 - |> BottomUpMergeSort.sort - |> Expect.equal "" [ 1; 3; 42; 100 ] - } - - test "adding multiple strings to an empty list" { - BottomUpMergeSort.empty - |> BottomUpMergeSort.add "100" - |> BottomUpMergeSort.add "1" - |> BottomUpMergeSort.add "3" - |> BottomUpMergeSort.add "42" - |> BottomUpMergeSort.sort - |> Expect.equal "" [ "1"; "100"; "3"; "42" ] - } - ] + testList + "Experimental BottomUpMergeSort" + [ test "empty list should be empty" { + BottomUpMergeSort.empty + |> BottomUpMergeSort.isEmpty + |> Expect.isTrue "" + } + + test "empty list should be empty after sort" { BottomUpMergeSort.sort BottomUpMergeSort.empty |> Expect.equal "" [] } + + test "singleton list should be the same after sort" { + BottomUpMergeSort.sort(BottomUpMergeSort.singleton 1) + |> Expect.equal "" [ 1 ] + } + + test "adding a element to an empty list" { + BottomUpMergeSort.empty + |> BottomUpMergeSort.add 1 + |> BottomUpMergeSort.sort + |> Expect.equal "" [ 1 ] + } + + test "adding multiple elements to an empty list" { + BottomUpMergeSort.empty + |> BottomUpMergeSort.add 100 + |> BottomUpMergeSort.add 1 + |> BottomUpMergeSort.add 3 + |> BottomUpMergeSort.add 42 + |> BottomUpMergeSort.sort + |> Expect.equal "" [ 1; 3; 42; 100 ] + } + + test "adding multiple strings to an empty list" { + BottomUpMergeSort.empty + |> BottomUpMergeSort.add "100" + |> BottomUpMergeSort.add "1" + |> BottomUpMergeSort.add "3" + |> BottomUpMergeSort.add "42" + |> BottomUpMergeSort.sort + |> Expect.equal "" [ "1"; "100"; "3"; "42" ] + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/ChampHashMapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/ChampHashMapTest.fs index 156d26f1..2407f7ed 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/ChampHashMapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/ChampHashMapTest.fs @@ -16,199 +16,198 @@ type CollidingKey<'T when 'T: equality>(value: 'T) = | :? CollidingKey<'T> as key -> key.item.Equals(this.item) | _ -> false - with - interface IEquatable> with - member this.Equals(other) = - this.item.Equals(other.item) + interface IEquatable> with + member this.Equals(other) = + this.item.Equals(other.item) module ChampHashMapTests = [] let testQueue = - testList "Experimental ChampHashMap tests" [ - test "Insert 1000 elements and make sure they are retrieved." { - let startingMap = ChampHashMap() + testList + "Experimental ChampHashMap tests" + [ test "Insert 1000 elements and make sure they are retrieved." { + let startingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add (i.ToString()) i) (startingMap) (seq { 1..1000 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add (i.ToString()) i) (startingMap) (seq { 1..1000 }) - let valExists i = - let returnedVal = fullMap.TryGetValue(i.ToString()) + let valExists i = + let returnedVal = fullMap.TryGetValue(i.ToString()) - match returnedVal with - | Some(value) -> value = i - | None -> false + match returnedVal with + | Some(value) -> value = i + | None -> false - let truthVal = Seq.forall valExists (seq { 1..1000 }) - Expect.isTrue truthVal "Inserted objects were not retrieved from hashmap" - } - test "Insert 1000 colliding elements and make sure they are retrieved" { - let startingMap = ChampHashMap, int>() + let truthVal = Seq.forall valExists (seq { 1..1000 }) + Expect.isTrue truthVal "Inserted objects were not retrieved from hashmap" + } + test "Insert 1000 colliding elements and make sure they are retrieved" { + let startingMap = ChampHashMap, int>() - let fullMap = - Seq.fold - (fun (data: ChampHashMap, int>) (i: int) -> data.Add (CollidingKey(i.ToString())) i) - (startingMap) - (seq { 1..1000 }) + let fullMap = + Seq.fold + (fun (data: ChampHashMap, int>) (i: int) -> data.Add (CollidingKey(i.ToString())) i) + (startingMap) + (seq { 1..1000 }) - let valExists i = - let returnedVal = fullMap.TryGetValue(CollidingKey(i.ToString())) + let valExists i = + let returnedVal = fullMap.TryGetValue(CollidingKey(i.ToString())) - match returnedVal with - | Some(value) -> value = i - | None -> false + match returnedVal with + | Some(value) -> value = i + | None -> false - let truthVal = Seq.forall valExists (seq { 1..1000 }) - Expect.isTrue truthVal "Inserted objects were not retrieved from hashmap" - } - test "Insert 1000 elements and then remove the first 500 elements" { - let startingMap = ChampHashMap() + let truthVal = Seq.forall valExists (seq { 1..1000 }) + Expect.isTrue truthVal "Inserted objects were not retrieved from hashmap" + } + test "Insert 1000 elements and then remove the first 500 elements" { + let startingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) - let filteredMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Remove(i.ToString())) (fullMap) (seq { 1..500 }) + let filteredMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Remove(i.ToString())) (fullMap) (seq { 1..500 }) - let valExists i = - let returnVal = filteredMap.TryGetValue(i.ToString()) + let valExists i = + let returnVal = filteredMap.TryGetValue(i.ToString()) - match returnVal with - | Some(value) -> value = i - | None -> false + match returnVal with + | Some(value) -> value = i + | None -> false - let valNotExists i = - not(valExists i) + let valNotExists i = + not(valExists i) - Expect.all (seq { 1..500 }) valNotExists "Elements were supposed to be removed but were not removed from the collection" + Expect.all (seq { 1..500 }) valNotExists "Elements were supposed to be removed but were not removed from the collection" - Expect.all (seq { 501..1000 }) valExists "Elements were supposed to be still present in the collection but they were removed" - } - test "Insert 1000 colliding elements and then remove the first 500 elements" { - let startingMap = ChampHashMap, int>() + Expect.all (seq { 501..1000 }) valExists "Elements were supposed to be still present in the collection but they were removed" + } + test "Insert 1000 colliding elements and then remove the first 500 elements" { + let startingMap = ChampHashMap, int>() - let fullMap = - Seq.fold - (fun (data: ChampHashMap, int>) (i: int) -> data.Add ((CollidingKey(i.ToString()))) i) - (startingMap) - (seq { 1..1000 }) + let fullMap = + Seq.fold + (fun (data: ChampHashMap, int>) (i: int) -> data.Add ((CollidingKey(i.ToString()))) i) + (startingMap) + (seq { 1..1000 }) - let filteredMap = - Seq.fold - (fun (data: ChampHashMap, int>) (i: int) -> data.Remove(CollidingKey(i.ToString()))) - (fullMap) - (seq { 1..500 }) + let filteredMap = + Seq.fold + (fun (data: ChampHashMap, int>) (i: int) -> data.Remove(CollidingKey(i.ToString()))) + (fullMap) + (seq { 1..500 }) - let valExists i = - let returnVal = filteredMap.TryGetValue(CollidingKey(i.ToString())) + let valExists i = + let returnVal = filteredMap.TryGetValue(CollidingKey(i.ToString())) - match returnVal with - | Some(value) -> value = i - | None -> false + match returnVal with + | Some(value) -> value = i + | None -> false - let valNotExists i = - not(valExists i) + let valNotExists i = + not(valExists i) - Expect.all (seq { 1..500 }) valNotExists "Elements were supposed to be removed but were not removed from the collection" + Expect.all (seq { 1..500 }) valNotExists "Elements were supposed to be removed but were not removed from the collection" - Expect.all (seq { 501..1000 }) valExists "Elements were supposed to be still present in the collection but they were removed" - } - test "Two references to the same hashmap should be equal" { - let startingMap = ChampHashMap() + Expect.all (seq { 501..1000 }) valExists "Elements were supposed to be still present in the collection but they were removed" + } + test "Two references to the same hashmap should be equal" { + let startingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..100 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..100 }) - let secondMap = fullMap + let secondMap = fullMap - Expect.isTrue (fullMap = secondMap) "Two references pointing to the same object should be equal" - } - test "Two maps holding the same values should be equal" { - let startingMap = ChampHashMap() - let secondStartingMap = ChampHashMap() + Expect.isTrue (fullMap = secondMap) "Two references pointing to the same object should be equal" + } + test "Two maps holding the same values should be equal" { + let startingMap = ChampHashMap() + let secondStartingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..100 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..100 }) - let secondMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (secondStartingMap) (seq { 1..100 }) + let secondMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (secondStartingMap) (seq { 1..100 }) - Expect.isTrue (fullMap = secondMap) "Two maps holding the same values should be equal" - } + Expect.isTrue (fullMap = secondMap) "Two maps holding the same values should be equal" + } - test "Two colliding maps holding the same values should be equal" { - let startingMap = ChampHashMap, int>() - let secondStartingMap = ChampHashMap, int>() + test "Two colliding maps holding the same values should be equal" { + let startingMap = ChampHashMap, int>() + let secondStartingMap = ChampHashMap, int>() - let fullMap = - Seq.fold - (fun (data: ChampHashMap, int>) (i: int) -> data.Add (CollidingKey(i.ToString())) i) - (startingMap) - (seq { 1..100 }) + let fullMap = + Seq.fold + (fun (data: ChampHashMap, int>) (i: int) -> data.Add (CollidingKey(i.ToString())) i) + (startingMap) + (seq { 1..100 }) - let secondMap = - Seq.fold - (fun (data: ChampHashMap, int>) (i: int) -> data.Add (CollidingKey(i.ToString())) i) - (secondStartingMap) - (seq { 1..100 }) + let secondMap = + Seq.fold + (fun (data: ChampHashMap, int>) (i: int) -> data.Add (CollidingKey(i.ToString())) i) + (secondStartingMap) + (seq { 1..100 }) - Expect.isTrue (fullMap = secondMap) "Two maps holding the same values should be equal" - } + Expect.isTrue (fullMap = secondMap) "Two maps holding the same values should be equal" + } - test "Two maps with removed values but containing the same values should be equal" { - let startingMap = ChampHashMap() + test "Two maps with removed values but containing the same values should be equal" { + let startingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) - let filteredMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Remove(i.ToString())) (fullMap) (seq { 1..500 }) + let filteredMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Remove(i.ToString())) (fullMap) (seq { 1..500 }) - let secondFullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) + let secondFullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) - let secondFilteredMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Remove(i.ToString())) (secondFullMap) (seq { 1..500 }) + let secondFilteredMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Remove(i.ToString())) (secondFullMap) (seq { 1..500 }) - Expect.isTrue (filteredMap = secondFilteredMap) "Two maps holding the same values should be equal" - } + Expect.isTrue (filteredMap = secondFilteredMap) "Two maps holding the same values should be equal" + } - test "Count is correct" { - let startingMap = ChampHashMap() + test "Count is correct" { + let startingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) - Expect.equal - (ChampHashMap.count fullMap) - 1000 - ("Count should have been 1000 but was " - + (ChampHashMap.count fullMap).ToString()) - } + Expect.equal + (ChampHashMap.count fullMap) + 1000 + ("Count should have been 1000 but was " + + (ChampHashMap.count fullMap).ToString()) + } - test "Make Sure all values in toSeq are returned" { - let startingMap = ChampHashMap() + test "Make Sure all values in toSeq are returned" { + let startingMap = ChampHashMap() - let fullMap = - Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) + let fullMap = + Seq.fold (fun (data: ChampHashMap) (i: int) -> data.Add ((i.ToString())) i) (startingMap) (seq { 1..1000 }) - let fullSeq = fullMap.ToSeq + let fullSeq = fullMap.ToSeq - Expect.equal (Seq.length fullSeq) (ChampHashMap.count fullMap) "Count of sequence should be the same as the map" + Expect.equal (Seq.length fullSeq) (ChampHashMap.count fullMap) "Count of sequence should be the same as the map" - for pair in fullSeq do - Expect.equal pair.Value (fullMap.GetValue pair.Key) "Element of sequence should exist in the dictionary" - } + for pair in fullSeq do + Expect.equal pair.Value (fullMap.GetValue pair.Key) "Element of sequence should exist in the dictionary" + } - test "OfSeq gives the correct map" { - let map = ChampHashMap.ofSeq (fun i -> i.ToString()) (fun i -> i) { 1..1000 } + test "OfSeq gives the correct map" { + let map = ChampHashMap.ofSeq (fun i -> i.ToString()) (fun i -> i) { 1..1000 } - let valExists i = - let returnedVal = map.TryGetValue(i.ToString()) + let valExists i = + let returnedVal = map.TryGetValue(i.ToString()) - match returnedVal with - | Some(value) -> value = i - | None -> false + match returnedVal with + | Some(value) -> value = i + | None -> false - Expect.all (seq { 1..1000 }) valExists "Inserted objects were not retrieved from hashmap" - } - ] + Expect.all (seq { 1..1000 }) valExists "Inserted objects were not retrieved from hashmap" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs b/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs index 7b3a90cd..5b81d82d 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs @@ -14,72 +14,74 @@ module DListTest = let expected2 = Join(Unit 1, Join(Unit 2, Join(Unit 3, Unit 4, 2), 3), 4) - testList "Experimental DList" [ - test "test should verify DList.empty is Nil" { DList.empty<_> |> Expect.equal "" DList.Nil } - - test "test DList.length should return 5" { DList.length expected |> Expect.equal "" 5 } - - ptest "test ofSeq should create a DList from a seq" { - let test = seq { for i in 0..4 -> i } - DList.ofSeq test |> Expect.equal "" expected - } - - ptest "test ofSeq should create a DList from a list" { - let test = [ for i in 0..4 -> i ] - DList.ofSeq test |> Expect.equal "" expected - } - - ptest "test ofSeq should create a DList from an array" { - let test = [| for i in 0..4 -> i |] - DList.ofSeq test |> Expect.equal "" expected - } - - test "test DList.cons should prepend 10 to the front of the original list" { - DList.cons 10 expected |> Expect.equal "" (Join(Unit 10, expected, 6)) - } - - test "test DList.singleton should return a Unit containing the solo value" { DList.singleton 1 |> Expect.equal "" (Unit 1) } - - test "test DList.cons should return a Unit when the tail is Nil" { DList.cons 1 DList.empty |> Expect.equal "" (Unit 1) } - - test "test subsequent DList.cons should create a DList just as the constructor functions" { - DList.cons 0 (DList.cons 1 (DList.cons 2 (DList.cons 3 (DList.cons 4 DList.empty)))) - |> Expect.equal "" expected - } - - test "test DList.append should join two DLists together" { - DList.append expected expected2 - |> Expect.equal "" (Join(expected, expected2, 9)) - } - - test "test DList.snoc should join DList and one element together" { DList.snoc expected 5 |> Expect.equal "" (Join(expected, Unit 5, 6)) } - - test "test head should return the first item in the DList" { DList.head(DList.append expected expected) |> Expect.equal "" 0 } - - test "test tail should return all items except the head" { - DList.tail(DList.append expected expected) - |> Expect.equal "" (Join(DList.cons 1 (DList.cons 2 (DList.cons 3 (DList.cons 4 DList.empty))), expected, 9)) - } - - test "test DList should respond to Seq functions such as map" { - let testmap x = x * x - let actual = Seq.map testmap (DList.append expected expected) - - let expected = - seq { - yield 0 - yield 1 - yield 2 - yield 3 - yield 4 - yield 0 - yield 1 - yield 2 - yield 3 - yield 4 - } - |> Seq.map testmap - - Expect.sequenceEqual "" expected actual - } - ] + testList + "Experimental DList" + [ test "test should verify DList.empty is Nil" { DList.empty<_> |> Expect.equal "" DList.Nil } + + test "test DList.length should return 5" { DList.length expected |> Expect.equal "" 5 } + + ptest "test ofSeq should create a DList from a seq" { + let test = seq { for i in 0..4 -> i } + DList.ofSeq test |> Expect.equal "" expected + } + + ptest "test ofSeq should create a DList from a list" { + let test = [ for i in 0..4 -> i ] + DList.ofSeq test |> Expect.equal "" expected + } + + ptest "test ofSeq should create a DList from an array" { + let test = [| for i in 0..4 -> i |] + DList.ofSeq test |> Expect.equal "" expected + } + + test "test DList.cons should prepend 10 to the front of the original list" { + DList.cons 10 expected |> Expect.equal "" (Join(Unit 10, expected, 6)) + } + + test "test DList.singleton should return a Unit containing the solo value" { DList.singleton 1 |> Expect.equal "" (Unit 1) } + + test "test DList.cons should return a Unit when the tail is Nil" { DList.cons 1 DList.empty |> Expect.equal "" (Unit 1) } + + test "test subsequent DList.cons should create a DList just as the constructor functions" { + DList.cons 0 (DList.cons 1 (DList.cons 2 (DList.cons 3 (DList.cons 4 DList.empty)))) + |> Expect.equal "" expected + } + + test "test DList.append should join two DLists together" { + DList.append expected expected2 + |> Expect.equal "" (Join(expected, expected2, 9)) + } + + test "test DList.snoc should join DList and one element together" { + DList.snoc expected 5 |> Expect.equal "" (Join(expected, Unit 5, 6)) + } + + test "test head should return the first item in the DList" { DList.head(DList.append expected expected) |> Expect.equal "" 0 } + + test "test tail should return all items except the head" { + DList.tail(DList.append expected expected) + |> Expect.equal "" (Join(DList.cons 1 (DList.cons 2 (DList.cons 3 (DList.cons 4 DList.empty))), expected, 9)) + } + + test "test DList should respond to Seq functions such as map" { + let testmap x = x * x + let actual = Seq.map testmap (DList.append expected expected) + + let expected = + seq { + yield 0 + yield 1 + yield 2 + yield 3 + yield 4 + yield 0 + yield 1 + yield 2 + yield 3 + yield 4 + } + |> Seq.map testmap + + Expect.sequenceEqual "" expected actual + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/DequeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/DequeTest.fs index 1726a54e..ada24837 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/DequeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/DequeTest.fs @@ -146,1961 +146,1961 @@ module DequeTest = [] let testDeque = - testList "Experimental Deque" [ - test "empty dqueue should be empty" { Expect.isTrue "empty is empty" (Deque.empty() |> Deque.isEmpty) } - - test "Deque.cons works" { Expect.isFalse "not empty" (len2 |> Deque.isEmpty) } - - test "Deque.snoc works" { Expect.isFalse "" (len2snoc |> Deque.isEmpty) } - - test "Deque.singleton Deque.head works" { Expect.equal "Deque.singleton" "a" (len1 |> Deque.head) } - - test "Deque.singleton Deque.last works" { Expect.equal "" "a" (len1 |> Deque.last) } - - test "Deque.tail of Deque.singleton empty" { Expect.isTrue "Deque.isEmpty" (len1 |> Deque.tail |> Deque.isEmpty) } - - test "Deque.tail of Deque.tail of 2 empty" { - Expect.isTrue "Deque.isEmpty" (len2 |> Deque.tail |> Deque.tail |> Deque.isEmpty) - Expect.isTrue "Deque.isEmpty" (len2snoc |> Deque.tail |> Deque.tail |> Deque.isEmpty) - } - - test "initial of Deque.singleton empty" { Expect.isTrue "Deque.isEmpty" (len1 |> Deque.init |> Deque.isEmpty) } - - test "Deque.head, Deque.tail, and Deque.length work test 1" { - let t1 = Deque.tail len2 - let t1s = Deque.tail len2snoc - - Expect.isTrue - "Deque.head, Deque.tail, and Deque.length" - (((Deque.length t1) = 1) - && ((Deque.length t1s) = 1) - && ((Deque.head t1) = "a") - && ((Deque.head t1s) = "a")) - } - - test "Deque.head, Deque.tail, and Deque.length work test 2" { - let t1 = Deque.tail len3 - let t1s = Deque.tail len3snoc - - let t1_1 = Deque.tail t1 - let t1_1s = Deque.tail t1s - - (((Deque.length t1) = 2) - && ((Deque.length t1s) = 2) - && ((Deque.head t1) = "b") - && ((Deque.head t1s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 3" { - let t1 = Deque.tail len4 - let t1s = Deque.tail len4snoc - - let t1_2 = Deque.tail t1 - let t1_2s = Deque.tail t1s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 3) - && ((Deque.length t1s) = 3) - && ((Deque.head t1) = "c") - && ((Deque.head t1s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 4" { - let t1 = Deque.tail len5 - let t1s = Deque.tail len5snoc - - let t1_3 = Deque.tail t1 - let t1_3s = Deque.tail t1s - - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 4) - && ((Deque.length t1s) = 4) - && ((Deque.head t1) = "d") - && ((Deque.head t1s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 5" { - let t1 = Deque.tail len6 - let t1s = Deque.tail len6snoc - - let t1_4 = Deque.tail t1 - let t1_4s = Deque.tail t1s - - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 5) - && ((Deque.length t1s) = 5) - && ((Deque.head t1) = "e") - && ((Deque.head t1s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 6" { - let t1 = Deque.tail len7 - let t1s = Deque.tail len7snoc - - let t1_5 = Deque.tail t1 - let t1_5s = Deque.tail t1s - - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 6) - && ((Deque.length t1s) = 6) - && ((Deque.head t1) = "f") - && ((Deque.head t1s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 7" { - let t1 = Deque.tail len8 - let t1s = Deque.tail len8snoc - let t1_6 = Deque.tail t1 - let t1_6s = Deque.tail t1s - let t1_5 = Deque.tail t1_6 - let t1_5s = Deque.tail t1_6s - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 7) - && ((Deque.length t1s) = 7) - && ((Deque.head t1) = "g") - && ((Deque.head t1s) = "g") - && ((Deque.length t1_6) = 6) - && ((Deque.length t1_6s) = 6) - && ((Deque.head t1_6) = "f") - && ((Deque.head t1_6s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 8" { - let t1 = Deque.tail len9 - let t1s = Deque.tail len9snoc - let t1_7 = Deque.tail t1 - let t1_7s = Deque.tail t1s - let t1_6 = Deque.tail t1_7 - let t1_6s = Deque.tail t1_7s - let t1_5 = Deque.tail t1_6 - let t1_5s = Deque.tail t1_6s - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 8) - && ((Deque.length t1s) = 8) - && ((Deque.head t1) = "h") - && ((Deque.head t1s) = "h") - && ((Deque.length t1_7) = 7) - && ((Deque.length t1_7s) = 7) - && ((Deque.head t1_7) = "g") - && ((Deque.head t1_7s) = "g") - && ((Deque.length t1_6) = 6) - && ((Deque.length t1_6s) = 6) - && ((Deque.head t1_6) = "f") - && ((Deque.head t1_6s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - test "Deque.head, Deque.tail, and Deque.length work test 9" { - let t1 = Deque.tail lena - let t1s = Deque.tail lenasnoc - let t1_8 = Deque.tail t1 - let t1_8s = Deque.tail t1s - let t1_7 = Deque.tail t1_8 - let t1_7s = Deque.tail t1_8s - let t1_6 = Deque.tail t1_7 - let t1_6s = Deque.tail t1_7s - let t1_5 = Deque.tail t1_6 - let t1_5s = Deque.tail t1_6s - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 9) - && ((Deque.length t1s) = 9) - && ((Deque.head t1) = "i") - && ((Deque.head t1s) = "i") - && ((Deque.length t1_8) = 8) - && ((Deque.length t1_8s) = 8) - && ((Deque.head t1_8) = "h") - && ((Deque.head t1_8s) = "h") - && ((Deque.length t1_7) = 7) - && ((Deque.length t1_7s) = 7) - && ((Deque.head t1_7) = "g") - && ((Deque.head t1_7s) = "g") - && ((Deque.length t1_6) = 6) - && ((Deque.length t1_6s) = 6) - && ((Deque.head t1_6) = "f") - && ((Deque.head t1_6s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" - } - - ////the previous series thoroughly tested construction by Deque.snoc, so we'll leave those out - - test "Deque.last, Deque.init, and Deque.length work test 1" { - let t1 = Deque.init len2 - - Expect.isTrue "Deque.last, Deque.init, and Deque.length" (((Deque.length t1) = 1) && ((Deque.last t1) = "b")) - } - - test "Deque.last, Deque.init, and Deque.length work test 2" { - let t1 = Deque.init len3 - let t1_1 = Deque.init t1 - - Expect.isTrue - "Deque.last, Deque.init, and Deque.length" - (((Deque.length t1) = 2) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.last t1_1) = "c")) - } - - test "Deque.last, Deque.init, and Deque.length work test 3" { - let t1 = Deque.init len4 - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - - (((Deque.length t1) = 3) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 2) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 1) - && ((Deque.last t1_2) = "d")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "Deque.last, Deque.init, and Deque.length work test 4" { - let t1 = Deque.init len5 - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - let t1_3 = Deque.init t1_2 - - (((Deque.length t1) = 4) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 3) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 1) - && ((Deque.last t1_3) = "e")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "Deque.last, Deque.init, and Deque.length work test 5" { - let t1 = Deque.init len6 - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - let t1_3 = Deque.init t1_2 - let t1_4 = Deque.init t1_3 - - (((Deque.length t1) = 5) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 4) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 3) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 2) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 1) - && ((Deque.last t1_4) = "f")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "Deque.last, Deque.init, and Deque.length work test 6" { - let t1 = Deque.init len7 - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - let t1_3 = Deque.init t1_2 - let t1_4 = Deque.init t1_3 - let t1_5 = Deque.init t1_4 - - (((Deque.length t1) = 6) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 5) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 4) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 2) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 1) - && ((Deque.last t1_5) = "g")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "Deque.last, Deque.init, and Deque.length work test 7" { - let t1 = Deque.init len8 - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - let t1_3 = Deque.init t1_2 - let t1_4 = Deque.init t1_3 - let t1_5 = Deque.init t1_4 - let t1_6 = Deque.init t1_5 - - (((Deque.length t1) = 7) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 6) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 5) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 4) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 3) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 2) - && ((Deque.last t1_5) = "g") - && ((Deque.length t1_6) = 1) - && ((Deque.last t1_6) = "h")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "Deque.last, Deque.init, and Deque.length work test 8" { - let t1 = Deque.init len9 - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - let t1_3 = Deque.init t1_2 - let t1_4 = Deque.init t1_3 - let t1_5 = Deque.init t1_4 - let t1_6 = Deque.init t1_5 - let t1_7 = Deque.init t1_6 - - (((Deque.length t1) = 8) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 7) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 6) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 5) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 3) - && ((Deque.last t1_5) = "g") - && ((Deque.length t1_6) = 2) - && ((Deque.last t1_6) = "h") - && ((Deque.length t1_7) = 1) - && ((Deque.last t1_7) = "i")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "Deque.last, Deque.init, and Deque.length work test 9" { - let t1 = Deque.init lena - let t1_1 = Deque.init t1 - let t1_2 = Deque.init t1_1 - let t1_3 = Deque.init t1_2 - let t1_4 = Deque.init t1_3 - let t1_5 = Deque.init t1_4 - let t1_6 = Deque.init t1_5 - let t1_7 = Deque.init t1_6 - let t1_8 = Deque.init t1_7 - - (((Deque.length t1) = 9) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 8) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 7) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 6) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 5) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 4) - && ((Deque.last t1_5) = "g") - && ((Deque.length t1_6) = 3) - && ((Deque.last t1_6) = "h") - && ((Deque.length t1_7) = 2) - && ((Deque.last t1_7) = "i") - && ((Deque.length t1_8) = 1) - && ((Deque.last t1_8) = "j")) - |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" - } - - test "IEnumerable Seq nth" { Expect.equal "IEnumerable nth" "e" (lena |> Seq.item 5) } - - test "IEnumerable Seq Deque.length" { Expect.equal "IEnumerable Deque.length" 10 (lena |> Seq.length) } - - test "type Deque.cons works" { Expect.equal "Deque.cons" "zz" (lena.Cons "zz" |> Deque.head) } - - test "IDeque Deque.cons works" { (lena :> IDeque).Cons("zz").Head |> Expect.equal "" "zz" } - - test "Deque.ofCatLists and Deque.uncons" { - let d = Deque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] - let h1, t1 = Deque.uncons d - let h2, t2 = Deque.uncons t1 - let h3, t3 = Deque.uncons t2 - let h4, t4 = Deque.uncons t3 - let h5, t5 = Deque.uncons t4 - let h6, t6 = Deque.uncons t5 - - Expect.isTrue - "Deque.ofCatLists and Deque.uncons" - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f") - && (Deque.isEmpty t6)) - } - - test "Deque.unsnoc works" { - let d = Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] - let i1, l1 = Deque.unsnoc d - let i2, l2 = Deque.unsnoc i1 - let i3, l3 = Deque.unsnoc i2 - let i4, l4 = Deque.unsnoc i3 - let i5, l5 = Deque.unsnoc i4 - let i6, l6 = Deque.unsnoc i5 - - Expect.isTrue - "Deque.unsnoc" - ((l1 = "a") - && (l2 = "b") - && (l3 = "c") - && (l4 = "d") - && (l5 = "e") - && (l6 = "f") - && (Deque.isEmpty i6)) - } - - test "Deque.snoc pattern discriminator" { - let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let i1, l1 = Deque.unsnoc d - - let i2, l2 = - match i1 with - | Deque.Snoc(i, l) -> i, l - | _ -> i1, "x" - - Expect.isTrue "Deque.snoc" ((l2 = "b") && ((Deque.length i2) = 4)) - } - - test "Deque.cons pattern discriminator" { - let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let h1, t1 = Deque.uncons d - - let h2, t2 = - match t1 with - | Deque.Cons(h, t) -> h, t - | _ -> "x", t1 - - Expect.isTrue "Deque.cons" ((h2 = "e") && ((Deque.length t2) = 4)) - } - - test "Deque.cons and Deque.snoc pattern discriminator" { - let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - - let mid1 = - match d with - | Deque.Cons(h, Deque.Snoc(i, l)) -> i - | _ -> d - - let head, last = - match mid1 with - | Deque.Cons(h, Deque.Snoc(i, l)) -> h, l - | _ -> "x", "x" - - Expect.isTrue "Deque.cons and Deque.snoc" ((head = "e") && (last = "b")) - } - - test "Deque.rev empty dqueue should be empty" { Deque.empty() |> Deque.rev |> Deque.isEmpty |> Expect.isTrue "" } - - test "Deque.rev deque Deque.length 1" { Expect.equal "Deque.length" "a" (Deque.rev len1 |> Deque.head) } - - test "Deque.rev deque Deque.length 2" { - let r1 = Deque.rev len2 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - - Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b")) - } - - test "Deque.rev deque Deque.length 3" { - let r1 = Deque.rev len3 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - - Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b") && (h3 = "c")) - } - - test "Deque.rev deque Deque.length 4" { - let r1 = Deque.rev len4 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - let t4 = Deque.tail t3 - let h4 = Deque.head t4 - - Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d")) - } - - test "Deque.rev deque Deque.length 5" { - let r1 = Deque.rev len5 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - let t4 = Deque.tail t3 - let h4 = Deque.head t4 - let t5 = Deque.tail t4 - let h5 = Deque.head t5 - - Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d") && (h5 = "e")) - } - - test "Deque.rev deque Deque.length 6" { - let r1 = Deque.rev len6 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - let t4 = Deque.tail t3 - let h4 = Deque.head t4 - let t5 = Deque.tail t4 - let h5 = Deque.head t5 - let t6 = Deque.tail t5 - let h6 = Deque.head t6 - - Expect.isTrue - "Deque.rev Deque.length" - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f")) - } - - test "Deque.lookup Deque.length 1" { Expect.equal "" "a" (len1 |> Deque.lookup 0) } - - test "Deque.lookup Deque.length 2" { - (((len2 |> Deque.lookup 0) = "b") && ((len2 |> Deque.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 3" { - (((len3 |> Deque.lookup 0) = "c") - && ((len3 |> Deque.lookup 1) = "b") - && ((len3 |> Deque.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 4" { - (((len4 |> Deque.lookup 0) = "d") - && ((len4 |> Deque.lookup 1) = "c") - && ((len4 |> Deque.lookup 2) = "b") - && ((len4 |> Deque.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 5" { - (((len5 |> Deque.lookup 0) = "e") - && ((len5 |> Deque.lookup 1) = "d") - && ((len5 |> Deque.lookup 2) = "c") - && ((len5 |> Deque.lookup 3) = "b") - && ((len5 |> Deque.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 6" { - (((len6 |> Deque.lookup 0) = "f") - && ((len6 |> Deque.lookup 1) = "e") - && ((len6 |> Deque.lookup 2) = "d") - && ((len6 |> Deque.lookup 3) = "c") - && ((len6 |> Deque.lookup 4) = "b") - && ((len6 |> Deque.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 7" { - (((len7 |> Deque.lookup 0) = "g") - && ((len7 |> Deque.lookup 1) = "f") - && ((len7 |> Deque.lookup 2) = "e") - && ((len7 |> Deque.lookup 3) = "d") - && ((len7 |> Deque.lookup 4) = "c") - && ((len7 |> Deque.lookup 5) = "b") - && ((len7 |> Deque.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 8" { - (((len8 |> Deque.lookup 0) = "h") - && ((len8 |> Deque.lookup 1) = "g") - && ((len8 |> Deque.lookup 2) = "f") - && ((len8 |> Deque.lookup 3) = "e") - && ((len8 |> Deque.lookup 4) = "d") - && ((len8 |> Deque.lookup 5) = "c") - && ((len8 |> Deque.lookup 6) = "b") - && ((len8 |> Deque.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 9" { - (((len9 |> Deque.lookup 0) = "i") - && ((len9 |> Deque.lookup 1) = "h") - && ((len9 |> Deque.lookup 2) = "g") - && ((len9 |> Deque.lookup 3) = "f") - && ((len9 |> Deque.lookup 4) = "e") - && ((len9 |> Deque.lookup 5) = "d") - && ((len9 |> Deque.lookup 6) = "c") - && ((len9 |> Deque.lookup 7) = "b") - && ((len9 |> Deque.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "Deque.lookup Deque.length 10" { - (((lena |> Deque.lookup 0) = "j") - && ((lena |> Deque.lookup 1) = "i") - && ((lena |> Deque.lookup 2) = "h") - && ((lena |> Deque.lookup 3) = "g") - && ((lena |> Deque.lookup 4) = "f") - && ((lena |> Deque.lookup 5) = "e") - && ((lena |> Deque.lookup 6) = "d") - && ((lena |> Deque.lookup 7) = "c") - && ((lena |> Deque.lookup 8) = "b") - && ((lena |> Deque.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 1" { - let a = len1 |> Deque.tryLookup 0 - (a.Value = "a") |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 2" { - let b = len2 |> Deque.tryLookup 0 - let a = len2 |> Deque.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 3" { - let c = len3 |> Deque.tryLookup 0 - let b = len3 |> Deque.tryLookup 1 - let a = len3 |> Deque.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 4" { - let d = len4 |> Deque.tryLookup 0 - let c = len4 |> Deque.tryLookup 1 - let b = len4 |> Deque.tryLookup 2 - let a = len4 |> Deque.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 5" { - let e = len5 |> Deque.tryLookup 0 - let d = len5 |> Deque.tryLookup 1 - let c = len5 |> Deque.tryLookup 2 - let b = len5 |> Deque.tryLookup 3 - let a = len5 |> Deque.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 6" { - let f = len6 |> Deque.tryLookup 0 - let e = len6 |> Deque.tryLookup 1 - let d = len6 |> Deque.tryLookup 2 - let c = len6 |> Deque.tryLookup 3 - let b = len6 |> Deque.tryLookup 4 - let a = len6 |> Deque.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 7" { - let g = len7 |> Deque.tryLookup 0 - let f = len7 |> Deque.tryLookup 1 - let e = len7 |> Deque.tryLookup 2 - let d = len7 |> Deque.tryLookup 3 - let c = len7 |> Deque.tryLookup 4 - let b = len7 |> Deque.tryLookup 5 - let a = len7 |> Deque.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 8" { - let h = len8 |> Deque.tryLookup 0 - let g = len8 |> Deque.tryLookup 1 - let f = len8 |> Deque.tryLookup 2 - let e = len8 |> Deque.tryLookup 3 - let d = len8 |> Deque.tryLookup 4 - let c = len8 |> Deque.tryLookup 5 - let b = len8 |> Deque.tryLookup 6 - let a = len8 |> Deque.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 9" { - let i = len9 |> Deque.tryLookup 0 - let h = len9 |> Deque.tryLookup 1 - let g = len9 |> Deque.tryLookup 2 - let f = len9 |> Deque.tryLookup 3 - let e = len9 |> Deque.tryLookup 4 - let d = len9 |> Deque.tryLookup 5 - let c = len9 |> Deque.tryLookup 6 - let b = len9 |> Deque.tryLookup 7 - let a = len9 |> Deque.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup Deque.length 10" { - let j = lena |> Deque.tryLookup 0 - let i = lena |> Deque.tryLookup 1 - let h = lena |> Deque.tryLookup 2 - let g = lena |> Deque.tryLookup 3 - let f = lena |> Deque.tryLookup 4 - let e = lena |> Deque.tryLookup 5 - let d = lena |> Deque.tryLookup 6 - let c = lena |> Deque.tryLookup 7 - let b = lena |> Deque.tryLookup 8 - let a = lena |> Deque.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "Deque.tryLookup not found" { lena |> Deque.tryLookup 10 |> Expect.isNone "" } - - test "Deque.remove elements Deque.length 1" { len1 |> Deque.remove 0 |> Deque.isEmpty |> Expect.isTrue "" } - - test "Deque.remove elements Deque.length 2" { - let a = len2 |> Deque.remove 0 |> Deque.head - let b = len2 |> Deque.remove 1 |> Deque.head - ((a = "a") && (b = "b")) |> Expect.isTrue "" - } - - test "Deque.remove elements Deque.length 3" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.remove 0 - let b0 = Deque.head r0 - let t0 = Deque.tail r0 - let c0 = Deque.head t0 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.remove 1 - let a1 = Deque.head r1 - let t1 = Deque.tail r1 - let c1 = Deque.head t1 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.remove 2 - let a2 = Deque.head r2 - let t2 = Deque.tail r2 - let b2 = Deque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "Deque.remove elements Deque.length 4" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 0 - let b0 = Deque.head r0 - let t0 = Deque.tail r0 - let c0 = Deque.head t0 - let t01 = Deque.tail t0 - let d0 = Deque.head t01 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 1 - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let c1 = Deque.head t11 - let t12 = Deque.tail t11 - let d1 = Deque.head t12 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 2 - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - - let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 3 - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "Deque.remove elements Deque.length 5" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 0 - let b0 = Deque.head r0 - let t01 = Deque.tail r0 - let c0 = Deque.head t01 - let t02 = Deque.tail t01 - let d0 = Deque.head t02 - let t03 = Deque.tail t02 - let e0 = Deque.head t03 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 1 - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let c1 = Deque.head t11 - let t12 = Deque.tail t11 - let d1 = Deque.head t12 - let t13 = Deque.tail t12 - let e1 = Deque.head t13 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 2 - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let e2 = Deque.head t23 - - let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 3 - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let e3 = Deque.head t33 - - let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 4 - let a4 = Deque.head r4 - let t41 = Deque.tail r4 - let b4 = Deque.head t41 - let t42 = Deque.tail t41 - let c4 = Deque.head t42 - let t43 = Deque.tail t42 - let d4 = Deque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "Deque.remove elements Deque.length 6" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 0 - let b0 = Deque.head r0 - let t01 = Deque.tail r0 - let c0 = Deque.head t01 - let t02 = Deque.tail t01 - let d0 = Deque.head t02 - let t03 = Deque.tail t02 - let e0 = Deque.head t03 - let t04 = Deque.tail t03 - let f0 = Deque.head t04 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 1 - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let c1 = Deque.head t11 - let t12 = Deque.tail t11 - let d1 = Deque.head t12 - let t13 = Deque.tail t12 - let e1 = Deque.head t13 - let t14 = Deque.tail t13 - let f1 = Deque.head t14 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 2 - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let e2 = Deque.head t23 - let t24 = Deque.tail t23 - let f2 = Deque.head t24 - - let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 3 - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let e3 = Deque.head t33 - let t34 = Deque.tail t33 - let f3 = Deque.head t34 - - let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 4 - let a4 = Deque.head r4 - let t41 = Deque.tail r4 - let b4 = Deque.head t41 - let t42 = Deque.tail t41 - let c4 = Deque.head t42 - let t43 = Deque.tail t42 - let d4 = Deque.head t43 - let t44 = Deque.tail t43 - let f4 = Deque.head t44 - - let r5 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 5 - let a5 = Deque.head r5 - let t51 = Deque.tail r5 - let b5 = Deque.head t51 - let t52 = Deque.tail t51 - let c5 = Deque.head t52 - let t53 = Deque.tail t52 - let d5 = Deque.head t53 - let t54 = Deque.tail t53 - let e5 = Deque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "tryRemoveempty" { Deque.empty() |> Deque.tryRemove 0 |> Expect.isNone "" } - - test "Deque.tryRemove elements Deque.length 1" { - let a = len1 |> Deque.tryRemove 0 - a.Value |> Deque.isEmpty |> Expect.isTrue "" - } - - test "Deque.tryRemove elements Deque.length 2" { - let a = len2 |> Deque.tryRemove 0 - let a1 = Deque.head a.Value - let b = len2 |> Deque.tryRemove 1 - let b1 = Deque.head b.Value - ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" - } - - test "Deque.tryRemove elements Deque.length 3" { - let x0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryRemove 0 - let r0 = x0.Value - let b0 = Deque.head r0 - let t0 = Deque.tail r0 - let c0 = Deque.head t0 - - let x1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryRemove 1 - let r1 = x1.Value - let a1 = Deque.head r1 - let t1 = Deque.tail r1 - let c1 = Deque.head t1 - - let x2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryRemove 2 - let r2 = x2.Value - let a2 = Deque.head r2 - let t2 = Deque.tail r2 - let b2 = Deque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "Deque.tryRemove elements Deque.length 4" { - let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 0 - let r0 = x0.Value - let b0 = Deque.head r0 - let t0 = Deque.tail r0 - let c0 = Deque.head t0 - let t01 = Deque.tail t0 - let d0 = Deque.head t01 - - let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 1 - let r1 = x1.Value - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let c1 = Deque.head t11 - let t12 = Deque.tail t11 - let d1 = Deque.head t12 - - let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 2 - let r2 = x2.Value - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - - let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 3 - let r3 = x3.Value - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "Deque.tryRemove elements Deque.length 5" { - let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 0 - let r0 = x0.Value - let b0 = Deque.head r0 - let t01 = Deque.tail r0 - let c0 = Deque.head t01 - let t02 = Deque.tail t01 - let d0 = Deque.head t02 - let t03 = Deque.tail t02 - let e0 = Deque.head t03 - - let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 1 - let r1 = x1.Value - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let c1 = Deque.head t11 - let t12 = Deque.tail t11 - let d1 = Deque.head t12 - let t13 = Deque.tail t12 - let e1 = Deque.head t13 - - let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 2 - let r2 = x2.Value - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let e2 = Deque.head t23 - - let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 3 - let r3 = x3.Value - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let e3 = Deque.head t33 - - let x4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 4 - let r4 = x4.Value - let a4 = Deque.head r4 - let t41 = Deque.tail r4 - let b4 = Deque.head t41 - let t42 = Deque.tail t41 - let c4 = Deque.head t42 - let t43 = Deque.tail t42 - let d4 = Deque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "Deque.tryRemove elements Deque.length 6" { - let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 0 - let r0 = x0.Value - let b0 = Deque.head r0 - let t01 = Deque.tail r0 - let c0 = Deque.head t01 - let t02 = Deque.tail t01 - let d0 = Deque.head t02 - let t03 = Deque.tail t02 - let e0 = Deque.head t03 - let t04 = Deque.tail t03 - let f0 = Deque.head t04 - - let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 1 - let r1 = x1.Value - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let c1 = Deque.head t11 - let t12 = Deque.tail t11 - let d1 = Deque.head t12 - let t13 = Deque.tail t12 - let e1 = Deque.head t13 - let t14 = Deque.tail t13 - let f1 = Deque.head t14 - - let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 2 - let r2 = x2.Value - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let e2 = Deque.head t23 - let t24 = Deque.tail t23 - let f2 = Deque.head t24 - - let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 3 - let r3 = x3.Value - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let e3 = Deque.head t33 - let t34 = Deque.tail t33 - let f3 = Deque.head t34 - - let x4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 4 - let r4 = x4.Value - let a4 = Deque.head r4 - let t41 = Deque.tail r4 - let b4 = Deque.head t41 - let t42 = Deque.tail t41 - let c4 = Deque.head t42 - let t43 = Deque.tail t42 - let d4 = Deque.head t43 - let t44 = Deque.tail t43 - let f4 = Deque.head t44 - - let x5 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 5 - let r5 = x5.Value - let a5 = Deque.head r5 - let t51 = Deque.tail r5 - let b5 = Deque.head t51 - let t52 = Deque.tail t51 - let c5 = Deque.head t52 - let t53 = Deque.tail t52 - let d5 = Deque.head t53 - let t54 = Deque.tail t53 - let e5 = Deque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "Deque.update elements Deque.length 1" { len1 |> Deque.update 0 "aa" |> Deque.head |> Expect.equal "" "aa" } - - test "Deque.update elements Deque.length 2" { - let r0 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.update 0 "zz" - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - - let r1 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.update 1 "zz" - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.update elements Deque.length 3" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.update 0 "zz" - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - let t02 = Deque.tail t01 - let c0 = Deque.head t02 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.update 1 "zz" - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - let t12 = Deque.tail t11 - let c1 = Deque.head t12 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.update 2 "zz" - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.update elements Deque.length 4" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 0 "zz" - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - let t02 = Deque.tail t01 - let c0 = Deque.head t02 - let t03 = Deque.tail t02 - let d0 = Deque.head t03 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 1 "zz" - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - let t12 = Deque.tail t11 - let c1 = Deque.head t12 - let t13 = Deque.tail t12 - let d1 = Deque.head t13 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 2 "zz" - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let d2 = Deque.head t23 - - let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 3 "zz" - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let d3 = Deque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.update elements Deque.length 5" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 0 "zz" - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - let t02 = Deque.tail t01 - let c0 = Deque.head t02 - let t03 = Deque.tail t02 - let d0 = Deque.head t03 - let t04 = Deque.tail t03 - let e0 = Deque.head t04 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 1 "zz" - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - let t12 = Deque.tail t11 - let c1 = Deque.head t12 - let t13 = Deque.tail t12 - let d1 = Deque.head t13 - let t14 = Deque.tail t13 - let e1 = Deque.head t14 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 2 "zz" - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let d2 = Deque.head t23 - let t24 = Deque.tail t23 - let e2 = Deque.head t24 - - let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 3 "zz" - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let d3 = Deque.head t33 - let t34 = Deque.tail t33 - let e3 = Deque.head t34 - - let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 4 "zz" - let a4 = Deque.head r4 - let t41 = Deque.tail r4 - let b4 = Deque.head t41 - let t42 = Deque.tail t41 - let c4 = Deque.head t42 - let t43 = Deque.tail t42 - let d4 = Deque.head t43 - let t44 = Deque.tail t43 - let e4 = Deque.head t44 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.update elements Deque.length 6" { - let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 0 "zz" - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - let t02 = Deque.tail t01 - let c0 = Deque.head t02 - let t03 = Deque.tail t02 - let d0 = Deque.head t03 - let t04 = Deque.tail t03 - let e0 = Deque.head t04 - let t05 = Deque.tail t04 - let f0 = Deque.head t05 - - let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 1 "zz" - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - let t12 = Deque.tail t11 - let c1 = Deque.head t12 - let t13 = Deque.tail t12 - let d1 = Deque.head t13 - let t14 = Deque.tail t13 - let e1 = Deque.head t14 - let t15 = Deque.tail t14 - let f1 = Deque.head t15 - - let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 2 "zz" - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let d2 = Deque.head t23 - let t24 = Deque.tail t23 - let e2 = Deque.head t24 - let t25 = Deque.tail t24 - let f2 = Deque.head t25 - - let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 3 "zz" - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let d3 = Deque.head t33 - let t34 = Deque.tail t33 - let e3 = Deque.head t34 - let t35 = Deque.tail t34 - let f3 = Deque.head t35 - - let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 4 "zz" - let a4 = Deque.head r4 - let t41 = Deque.tail r4 - let b4 = Deque.head t41 - let t42 = Deque.tail t41 - let c4 = Deque.head t42 - let t43 = Deque.tail t42 - let d4 = Deque.head t43 - let t44 = Deque.tail t43 - let e4 = Deque.head t44 - let t45 = Deque.tail t44 - let f4 = Deque.head t45 - - let r5 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 5 "zz" - let a5 = Deque.head r5 - let t51 = Deque.tail r5 - let b5 = Deque.head t51 - let t52 = Deque.tail t51 - let c5 = Deque.head t52 - let t53 = Deque.tail t52 - let d5 = Deque.head t53 - let t54 = Deque.tail t53 - let e5 = Deque.head t54 - let t55 = Deque.tail t54 - let f5 = Deque.head t55 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e") - && (f5 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.tryUpdate elements Deque.length 1" { - let a = len1 |> Deque.tryUpdate 0 "aa" - a.Value |> Deque.head |> Expect.equal "" "aa" - } - - test "Deque.tryUpdate elements Deque.length 2" { - let x0 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.tryUpdate 0 "zz" - let r0 = x0.Value - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - - let x1 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.tryUpdate 1 "zz" - let r1 = x1.Value - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.tryUpdate elements Deque.length 3" { - let x0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryUpdate 0 "zz" - let r0 = x0.Value - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - let t02 = Deque.tail t01 - let c0 = Deque.head t02 - - let x1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryUpdate 1 "zz" - let r1 = x1.Value - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - let t12 = Deque.tail t11 - let c1 = Deque.head t12 - - let x2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryUpdate 2 "zz" - let r2 = x2.Value - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.tryUpdate elements Deque.length 4" { - let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 0 "zz" - let r0 = x0.Value - let a0 = Deque.head r0 - let t01 = Deque.tail r0 - let b0 = Deque.head t01 - let t02 = Deque.tail t01 - let c0 = Deque.head t02 - let t03 = Deque.tail t02 - let d0 = Deque.head t03 - - let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 1 "zz" - let r1 = x1.Value - let a1 = Deque.head r1 - let t11 = Deque.tail r1 - let b1 = Deque.head t11 - let t12 = Deque.tail t11 - let c1 = Deque.head t12 - let t13 = Deque.tail t12 - let d1 = Deque.head t13 - - let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 2 "zz" - let r2 = x2.Value - let a2 = Deque.head r2 - let t21 = Deque.tail r2 - let b2 = Deque.head t21 - let t22 = Deque.tail t21 - let c2 = Deque.head t22 - let t23 = Deque.tail t22 - let d2 = Deque.head t23 - - let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 3 "zz" - let r3 = x3.Value - let a3 = Deque.head r3 - let t31 = Deque.tail r3 - let b3 = Deque.head t31 - let t32 = Deque.tail t31 - let c3 = Deque.head t32 - let t33 = Deque.tail t32 - let d3 = Deque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "Deque.tryUncons on empty" { - let q = Deque.empty() - Expect.isNone "Deque.tryUncons" <| Deque.tryUncons q - } - - test "Deque.tryUncons on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - let x, _ = (Deque.tryUncons q).Value - Expect.equal "Deque.tryUncons" "a" x - } - - test "Deque.tryUnsnoc on empty" { - let q = Deque.empty() - Expect.isNone "Deque.tryUnsnoc" <| Deque.tryUnsnoc q - } - - test "Deque.tryUnsnoc on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - let _, x = (Deque.tryUnsnoc q).Value - Expect.equal "Deque.tryUnsnoc" "d" x - } - - test "Deque.tryGetHead on empty" { - let q = Deque.empty() - Expect.isNone "tryHead" <| Deque.tryGetHead q - } - - test "Deque.tryGetHead on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - Expect.equal "tryHead" "a" (Deque.tryGetHead q).Value - } - - test "Deque.tryGetInit on empty" { - let q = Deque.empty() - Expect.isNone "tryInitial" <| Deque.tryGetInit q - } - - test "Deque.tryGetInit on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - let x = (Deque.tryGetInit q).Value - let x2 = x |> Deque.last - Expect.equal "tryinitial" "c" x2 - } - - test "Deque.tryGetLast on empty" { - let q = Deque.empty() - Expect.isNone "tryLast" <| Deque.tryGetLast q - } - - test "Deque.tryGetLast on deque" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - Expect.equal "tryLast" "d" (Deque.tryGetLast q).Value - Expect.equal "tryLast" "a" (len2 |> Deque.tryGetLast).Value - Expect.equal "tryLast" "a" (len2snoc |> Deque.tryGetLast).Value - } - - test "Deque.tryGetTail on empty" { - let q = Deque.empty() - Expect.isNone "tryTail" <| Deque.tryGetTail q - } - - test "Deque.tryGetTail on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - Expect.equal "tryTail" "b" ((Deque.tryGetTail q).Value |> Deque.head) - } - - test "deprecated structure still works" { - let q = Deque.empty() - (Deque.tryGetTail q = None) |> Expect.isTrue "" - } - ] + testList + "Experimental Deque" + [ test "empty dqueue should be empty" { Expect.isTrue "empty is empty" (Deque.empty() |> Deque.isEmpty) } + + test "Deque.cons works" { Expect.isFalse "not empty" (len2 |> Deque.isEmpty) } + + test "Deque.snoc works" { Expect.isFalse "" (len2snoc |> Deque.isEmpty) } + + test "Deque.singleton Deque.head works" { Expect.equal "Deque.singleton" "a" (len1 |> Deque.head) } + + test "Deque.singleton Deque.last works" { Expect.equal "" "a" (len1 |> Deque.last) } + + test "Deque.tail of Deque.singleton empty" { Expect.isTrue "Deque.isEmpty" (len1 |> Deque.tail |> Deque.isEmpty) } + + test "Deque.tail of Deque.tail of 2 empty" { + Expect.isTrue "Deque.isEmpty" (len2 |> Deque.tail |> Deque.tail |> Deque.isEmpty) + Expect.isTrue "Deque.isEmpty" (len2snoc |> Deque.tail |> Deque.tail |> Deque.isEmpty) + } + + test "initial of Deque.singleton empty" { Expect.isTrue "Deque.isEmpty" (len1 |> Deque.init |> Deque.isEmpty) } + + test "Deque.head, Deque.tail, and Deque.length work test 1" { + let t1 = Deque.tail len2 + let t1s = Deque.tail len2snoc + + Expect.isTrue + "Deque.head, Deque.tail, and Deque.length" + (((Deque.length t1) = 1) + && ((Deque.length t1s) = 1) + && ((Deque.head t1) = "a") + && ((Deque.head t1s) = "a")) + } + + test "Deque.head, Deque.tail, and Deque.length work test 2" { + let t1 = Deque.tail len3 + let t1s = Deque.tail len3snoc + + let t1_1 = Deque.tail t1 + let t1_1s = Deque.tail t1s + + (((Deque.length t1) = 2) + && ((Deque.length t1s) = 2) + && ((Deque.head t1) = "b") + && ((Deque.head t1s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 3" { + let t1 = Deque.tail len4 + let t1s = Deque.tail len4snoc + + let t1_2 = Deque.tail t1 + let t1_2s = Deque.tail t1s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 3) + && ((Deque.length t1s) = 3) + && ((Deque.head t1) = "c") + && ((Deque.head t1s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 4" { + let t1 = Deque.tail len5 + let t1s = Deque.tail len5snoc + + let t1_3 = Deque.tail t1 + let t1_3s = Deque.tail t1s + + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 4) + && ((Deque.length t1s) = 4) + && ((Deque.head t1) = "d") + && ((Deque.head t1s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 5" { + let t1 = Deque.tail len6 + let t1s = Deque.tail len6snoc + + let t1_4 = Deque.tail t1 + let t1_4s = Deque.tail t1s + + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 5) + && ((Deque.length t1s) = 5) + && ((Deque.head t1) = "e") + && ((Deque.head t1s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 6" { + let t1 = Deque.tail len7 + let t1s = Deque.tail len7snoc + + let t1_5 = Deque.tail t1 + let t1_5s = Deque.tail t1s + + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 6) + && ((Deque.length t1s) = 6) + && ((Deque.head t1) = "f") + && ((Deque.head t1s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 7" { + let t1 = Deque.tail len8 + let t1s = Deque.tail len8snoc + let t1_6 = Deque.tail t1 + let t1_6s = Deque.tail t1s + let t1_5 = Deque.tail t1_6 + let t1_5s = Deque.tail t1_6s + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 7) + && ((Deque.length t1s) = 7) + && ((Deque.head t1) = "g") + && ((Deque.head t1s) = "g") + && ((Deque.length t1_6) = 6) + && ((Deque.length t1_6s) = 6) + && ((Deque.head t1_6) = "f") + && ((Deque.head t1_6s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 8" { + let t1 = Deque.tail len9 + let t1s = Deque.tail len9snoc + let t1_7 = Deque.tail t1 + let t1_7s = Deque.tail t1s + let t1_6 = Deque.tail t1_7 + let t1_6s = Deque.tail t1_7s + let t1_5 = Deque.tail t1_6 + let t1_5s = Deque.tail t1_6s + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 8) + && ((Deque.length t1s) = 8) + && ((Deque.head t1) = "h") + && ((Deque.head t1s) = "h") + && ((Deque.length t1_7) = 7) + && ((Deque.length t1_7s) = 7) + && ((Deque.head t1_7) = "g") + && ((Deque.head t1_7s) = "g") + && ((Deque.length t1_6) = 6) + && ((Deque.length t1_6s) = 6) + && ((Deque.head t1_6) = "f") + && ((Deque.head t1_6s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + test "Deque.head, Deque.tail, and Deque.length work test 9" { + let t1 = Deque.tail lena + let t1s = Deque.tail lenasnoc + let t1_8 = Deque.tail t1 + let t1_8s = Deque.tail t1s + let t1_7 = Deque.tail t1_8 + let t1_7s = Deque.tail t1_8s + let t1_6 = Deque.tail t1_7 + let t1_6s = Deque.tail t1_7s + let t1_5 = Deque.tail t1_6 + let t1_5s = Deque.tail t1_6s + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 9) + && ((Deque.length t1s) = 9) + && ((Deque.head t1) = "i") + && ((Deque.head t1s) = "i") + && ((Deque.length t1_8) = 8) + && ((Deque.length t1_8s) = 8) + && ((Deque.head t1_8) = "h") + && ((Deque.head t1_8s) = "h") + && ((Deque.length t1_7) = 7) + && ((Deque.length t1_7s) = 7) + && ((Deque.head t1_7) = "g") + && ((Deque.head t1_7s) = "g") + && ((Deque.length t1_6) = 6) + && ((Deque.length t1_6s) = 6) + && ((Deque.head t1_6) = "f") + && ((Deque.head t1_6s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "Deque.head, Deque.tail, and Deque.length" + } + + ////the previous series thoroughly tested construction by Deque.snoc, so we'll leave those out + + test "Deque.last, Deque.init, and Deque.length work test 1" { + let t1 = Deque.init len2 + + Expect.isTrue "Deque.last, Deque.init, and Deque.length" (((Deque.length t1) = 1) && ((Deque.last t1) = "b")) + } + + test "Deque.last, Deque.init, and Deque.length work test 2" { + let t1 = Deque.init len3 + let t1_1 = Deque.init t1 + + Expect.isTrue + "Deque.last, Deque.init, and Deque.length" + (((Deque.length t1) = 2) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.last t1_1) = "c")) + } + + test "Deque.last, Deque.init, and Deque.length work test 3" { + let t1 = Deque.init len4 + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + + (((Deque.length t1) = 3) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 2) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 1) + && ((Deque.last t1_2) = "d")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "Deque.last, Deque.init, and Deque.length work test 4" { + let t1 = Deque.init len5 + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + let t1_3 = Deque.init t1_2 + + (((Deque.length t1) = 4) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 3) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 1) + && ((Deque.last t1_3) = "e")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "Deque.last, Deque.init, and Deque.length work test 5" { + let t1 = Deque.init len6 + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + let t1_3 = Deque.init t1_2 + let t1_4 = Deque.init t1_3 + + (((Deque.length t1) = 5) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 4) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 3) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 2) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 1) + && ((Deque.last t1_4) = "f")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "Deque.last, Deque.init, and Deque.length work test 6" { + let t1 = Deque.init len7 + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + let t1_3 = Deque.init t1_2 + let t1_4 = Deque.init t1_3 + let t1_5 = Deque.init t1_4 + + (((Deque.length t1) = 6) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 5) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 4) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 2) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 1) + && ((Deque.last t1_5) = "g")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "Deque.last, Deque.init, and Deque.length work test 7" { + let t1 = Deque.init len8 + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + let t1_3 = Deque.init t1_2 + let t1_4 = Deque.init t1_3 + let t1_5 = Deque.init t1_4 + let t1_6 = Deque.init t1_5 + + (((Deque.length t1) = 7) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 6) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 5) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 4) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 3) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 2) + && ((Deque.last t1_5) = "g") + && ((Deque.length t1_6) = 1) + && ((Deque.last t1_6) = "h")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "Deque.last, Deque.init, and Deque.length work test 8" { + let t1 = Deque.init len9 + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + let t1_3 = Deque.init t1_2 + let t1_4 = Deque.init t1_3 + let t1_5 = Deque.init t1_4 + let t1_6 = Deque.init t1_5 + let t1_7 = Deque.init t1_6 + + (((Deque.length t1) = 8) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 7) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 6) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 5) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 3) + && ((Deque.last t1_5) = "g") + && ((Deque.length t1_6) = 2) + && ((Deque.last t1_6) = "h") + && ((Deque.length t1_7) = 1) + && ((Deque.last t1_7) = "i")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "Deque.last, Deque.init, and Deque.length work test 9" { + let t1 = Deque.init lena + let t1_1 = Deque.init t1 + let t1_2 = Deque.init t1_1 + let t1_3 = Deque.init t1_2 + let t1_4 = Deque.init t1_3 + let t1_5 = Deque.init t1_4 + let t1_6 = Deque.init t1_5 + let t1_7 = Deque.init t1_6 + let t1_8 = Deque.init t1_7 + + (((Deque.length t1) = 9) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 8) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 7) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 6) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 5) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 4) + && ((Deque.last t1_5) = "g") + && ((Deque.length t1_6) = 3) + && ((Deque.last t1_6) = "h") + && ((Deque.length t1_7) = 2) + && ((Deque.last t1_7) = "i") + && ((Deque.length t1_8) = 1) + && ((Deque.last t1_8) = "j")) + |> Expect.isTrue "Deque.last, Deque.init, and Deque.length" + } + + test "IEnumerable Seq nth" { Expect.equal "IEnumerable nth" "e" (lena |> Seq.item 5) } + + test "IEnumerable Seq Deque.length" { Expect.equal "IEnumerable Deque.length" 10 (lena |> Seq.length) } + + test "type Deque.cons works" { Expect.equal "Deque.cons" "zz" (lena.Cons "zz" |> Deque.head) } + + test "IDeque Deque.cons works" { (lena :> IDeque).Cons("zz").Head |> Expect.equal "" "zz" } + + test "Deque.ofCatLists and Deque.uncons" { + let d = Deque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] + let h1, t1 = Deque.uncons d + let h2, t2 = Deque.uncons t1 + let h3, t3 = Deque.uncons t2 + let h4, t4 = Deque.uncons t3 + let h5, t5 = Deque.uncons t4 + let h6, t6 = Deque.uncons t5 + + Expect.isTrue + "Deque.ofCatLists and Deque.uncons" + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f") + && (Deque.isEmpty t6)) + } + + test "Deque.unsnoc works" { + let d = Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] + let i1, l1 = Deque.unsnoc d + let i2, l2 = Deque.unsnoc i1 + let i3, l3 = Deque.unsnoc i2 + let i4, l4 = Deque.unsnoc i3 + let i5, l5 = Deque.unsnoc i4 + let i6, l6 = Deque.unsnoc i5 + + Expect.isTrue + "Deque.unsnoc" + ((l1 = "a") + && (l2 = "b") + && (l3 = "c") + && (l4 = "d") + && (l5 = "e") + && (l6 = "f") + && (Deque.isEmpty i6)) + } + + test "Deque.snoc pattern discriminator" { + let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let i1, l1 = Deque.unsnoc d + + let i2, l2 = + match i1 with + | Deque.Snoc(i, l) -> i, l + | _ -> i1, "x" + + Expect.isTrue "Deque.snoc" ((l2 = "b") && ((Deque.length i2) = 4)) + } + + test "Deque.cons pattern discriminator" { + let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let h1, t1 = Deque.uncons d + + let h2, t2 = + match t1 with + | Deque.Cons(h, t) -> h, t + | _ -> "x", t1 + + Expect.isTrue "Deque.cons" ((h2 = "e") && ((Deque.length t2) = 4)) + } + + test "Deque.cons and Deque.snoc pattern discriminator" { + let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + + let mid1 = + match d with + | Deque.Cons(h, Deque.Snoc(i, l)) -> i + | _ -> d + + let head, last = + match mid1 with + | Deque.Cons(h, Deque.Snoc(i, l)) -> h, l + | _ -> "x", "x" + + Expect.isTrue "Deque.cons and Deque.snoc" ((head = "e") && (last = "b")) + } + + test "Deque.rev empty dqueue should be empty" { Deque.empty() |> Deque.rev |> Deque.isEmpty |> Expect.isTrue "" } + + test "Deque.rev deque Deque.length 1" { Expect.equal "Deque.length" "a" (Deque.rev len1 |> Deque.head) } + + test "Deque.rev deque Deque.length 2" { + let r1 = Deque.rev len2 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + + Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b")) + } + + test "Deque.rev deque Deque.length 3" { + let r1 = Deque.rev len3 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + + Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b") && (h3 = "c")) + } + + test "Deque.rev deque Deque.length 4" { + let r1 = Deque.rev len4 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + let t4 = Deque.tail t3 + let h4 = Deque.head t4 + + Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d")) + } + + test "Deque.rev deque Deque.length 5" { + let r1 = Deque.rev len5 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + let t4 = Deque.tail t3 + let h4 = Deque.head t4 + let t5 = Deque.tail t4 + let h5 = Deque.head t5 + + Expect.isTrue "Deque.length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d") && (h5 = "e")) + } + + test "Deque.rev deque Deque.length 6" { + let r1 = Deque.rev len6 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + let t4 = Deque.tail t3 + let h4 = Deque.head t4 + let t5 = Deque.tail t4 + let h5 = Deque.head t5 + let t6 = Deque.tail t5 + let h6 = Deque.head t6 + + Expect.isTrue + "Deque.rev Deque.length" + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f")) + } + + test "Deque.lookup Deque.length 1" { Expect.equal "" "a" (len1 |> Deque.lookup 0) } + + test "Deque.lookup Deque.length 2" { + (((len2 |> Deque.lookup 0) = "b") && ((len2 |> Deque.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 3" { + (((len3 |> Deque.lookup 0) = "c") + && ((len3 |> Deque.lookup 1) = "b") + && ((len3 |> Deque.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 4" { + (((len4 |> Deque.lookup 0) = "d") + && ((len4 |> Deque.lookup 1) = "c") + && ((len4 |> Deque.lookup 2) = "b") + && ((len4 |> Deque.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 5" { + (((len5 |> Deque.lookup 0) = "e") + && ((len5 |> Deque.lookup 1) = "d") + && ((len5 |> Deque.lookup 2) = "c") + && ((len5 |> Deque.lookup 3) = "b") + && ((len5 |> Deque.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 6" { + (((len6 |> Deque.lookup 0) = "f") + && ((len6 |> Deque.lookup 1) = "e") + && ((len6 |> Deque.lookup 2) = "d") + && ((len6 |> Deque.lookup 3) = "c") + && ((len6 |> Deque.lookup 4) = "b") + && ((len6 |> Deque.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 7" { + (((len7 |> Deque.lookup 0) = "g") + && ((len7 |> Deque.lookup 1) = "f") + && ((len7 |> Deque.lookup 2) = "e") + && ((len7 |> Deque.lookup 3) = "d") + && ((len7 |> Deque.lookup 4) = "c") + && ((len7 |> Deque.lookup 5) = "b") + && ((len7 |> Deque.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 8" { + (((len8 |> Deque.lookup 0) = "h") + && ((len8 |> Deque.lookup 1) = "g") + && ((len8 |> Deque.lookup 2) = "f") + && ((len8 |> Deque.lookup 3) = "e") + && ((len8 |> Deque.lookup 4) = "d") + && ((len8 |> Deque.lookup 5) = "c") + && ((len8 |> Deque.lookup 6) = "b") + && ((len8 |> Deque.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 9" { + (((len9 |> Deque.lookup 0) = "i") + && ((len9 |> Deque.lookup 1) = "h") + && ((len9 |> Deque.lookup 2) = "g") + && ((len9 |> Deque.lookup 3) = "f") + && ((len9 |> Deque.lookup 4) = "e") + && ((len9 |> Deque.lookup 5) = "d") + && ((len9 |> Deque.lookup 6) = "c") + && ((len9 |> Deque.lookup 7) = "b") + && ((len9 |> Deque.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "Deque.lookup Deque.length 10" { + (((lena |> Deque.lookup 0) = "j") + && ((lena |> Deque.lookup 1) = "i") + && ((lena |> Deque.lookup 2) = "h") + && ((lena |> Deque.lookup 3) = "g") + && ((lena |> Deque.lookup 4) = "f") + && ((lena |> Deque.lookup 5) = "e") + && ((lena |> Deque.lookup 6) = "d") + && ((lena |> Deque.lookup 7) = "c") + && ((lena |> Deque.lookup 8) = "b") + && ((lena |> Deque.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 1" { + let a = len1 |> Deque.tryLookup 0 + (a.Value = "a") |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 2" { + let b = len2 |> Deque.tryLookup 0 + let a = len2 |> Deque.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 3" { + let c = len3 |> Deque.tryLookup 0 + let b = len3 |> Deque.tryLookup 1 + let a = len3 |> Deque.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 4" { + let d = len4 |> Deque.tryLookup 0 + let c = len4 |> Deque.tryLookup 1 + let b = len4 |> Deque.tryLookup 2 + let a = len4 |> Deque.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 5" { + let e = len5 |> Deque.tryLookup 0 + let d = len5 |> Deque.tryLookup 1 + let c = len5 |> Deque.tryLookup 2 + let b = len5 |> Deque.tryLookup 3 + let a = len5 |> Deque.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 6" { + let f = len6 |> Deque.tryLookup 0 + let e = len6 |> Deque.tryLookup 1 + let d = len6 |> Deque.tryLookup 2 + let c = len6 |> Deque.tryLookup 3 + let b = len6 |> Deque.tryLookup 4 + let a = len6 |> Deque.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 7" { + let g = len7 |> Deque.tryLookup 0 + let f = len7 |> Deque.tryLookup 1 + let e = len7 |> Deque.tryLookup 2 + let d = len7 |> Deque.tryLookup 3 + let c = len7 |> Deque.tryLookup 4 + let b = len7 |> Deque.tryLookup 5 + let a = len7 |> Deque.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 8" { + let h = len8 |> Deque.tryLookup 0 + let g = len8 |> Deque.tryLookup 1 + let f = len8 |> Deque.tryLookup 2 + let e = len8 |> Deque.tryLookup 3 + let d = len8 |> Deque.tryLookup 4 + let c = len8 |> Deque.tryLookup 5 + let b = len8 |> Deque.tryLookup 6 + let a = len8 |> Deque.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 9" { + let i = len9 |> Deque.tryLookup 0 + let h = len9 |> Deque.tryLookup 1 + let g = len9 |> Deque.tryLookup 2 + let f = len9 |> Deque.tryLookup 3 + let e = len9 |> Deque.tryLookup 4 + let d = len9 |> Deque.tryLookup 5 + let c = len9 |> Deque.tryLookup 6 + let b = len9 |> Deque.tryLookup 7 + let a = len9 |> Deque.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup Deque.length 10" { + let j = lena |> Deque.tryLookup 0 + let i = lena |> Deque.tryLookup 1 + let h = lena |> Deque.tryLookup 2 + let g = lena |> Deque.tryLookup 3 + let f = lena |> Deque.tryLookup 4 + let e = lena |> Deque.tryLookup 5 + let d = lena |> Deque.tryLookup 6 + let c = lena |> Deque.tryLookup 7 + let b = lena |> Deque.tryLookup 8 + let a = lena |> Deque.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "Deque.tryLookup not found" { lena |> Deque.tryLookup 10 |> Expect.isNone "" } + + test "Deque.remove elements Deque.length 1" { len1 |> Deque.remove 0 |> Deque.isEmpty |> Expect.isTrue "" } + + test "Deque.remove elements Deque.length 2" { + let a = len2 |> Deque.remove 0 |> Deque.head + let b = len2 |> Deque.remove 1 |> Deque.head + ((a = "a") && (b = "b")) |> Expect.isTrue "" + } + + test "Deque.remove elements Deque.length 3" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.remove 0 + let b0 = Deque.head r0 + let t0 = Deque.tail r0 + let c0 = Deque.head t0 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.remove 1 + let a1 = Deque.head r1 + let t1 = Deque.tail r1 + let c1 = Deque.head t1 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.remove 2 + let a2 = Deque.head r2 + let t2 = Deque.tail r2 + let b2 = Deque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "Deque.remove elements Deque.length 4" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 0 + let b0 = Deque.head r0 + let t0 = Deque.tail r0 + let c0 = Deque.head t0 + let t01 = Deque.tail t0 + let d0 = Deque.head t01 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 1 + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let c1 = Deque.head t11 + let t12 = Deque.tail t11 + let d1 = Deque.head t12 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 2 + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + + let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.remove 3 + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "Deque.remove elements Deque.length 5" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 0 + let b0 = Deque.head r0 + let t01 = Deque.tail r0 + let c0 = Deque.head t01 + let t02 = Deque.tail t01 + let d0 = Deque.head t02 + let t03 = Deque.tail t02 + let e0 = Deque.head t03 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 1 + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let c1 = Deque.head t11 + let t12 = Deque.tail t11 + let d1 = Deque.head t12 + let t13 = Deque.tail t12 + let e1 = Deque.head t13 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 2 + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let e2 = Deque.head t23 + + let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 3 + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let e3 = Deque.head t33 + + let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.remove 4 + let a4 = Deque.head r4 + let t41 = Deque.tail r4 + let b4 = Deque.head t41 + let t42 = Deque.tail t41 + let c4 = Deque.head t42 + let t43 = Deque.tail t42 + let d4 = Deque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "Deque.remove elements Deque.length 6" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 0 + let b0 = Deque.head r0 + let t01 = Deque.tail r0 + let c0 = Deque.head t01 + let t02 = Deque.tail t01 + let d0 = Deque.head t02 + let t03 = Deque.tail t02 + let e0 = Deque.head t03 + let t04 = Deque.tail t03 + let f0 = Deque.head t04 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 1 + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let c1 = Deque.head t11 + let t12 = Deque.tail t11 + let d1 = Deque.head t12 + let t13 = Deque.tail t12 + let e1 = Deque.head t13 + let t14 = Deque.tail t13 + let f1 = Deque.head t14 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 2 + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let e2 = Deque.head t23 + let t24 = Deque.tail t23 + let f2 = Deque.head t24 + + let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 3 + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let e3 = Deque.head t33 + let t34 = Deque.tail t33 + let f3 = Deque.head t34 + + let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 4 + let a4 = Deque.head r4 + let t41 = Deque.tail r4 + let b4 = Deque.head t41 + let t42 = Deque.tail t41 + let c4 = Deque.head t42 + let t43 = Deque.tail t42 + let d4 = Deque.head t43 + let t44 = Deque.tail t43 + let f4 = Deque.head t44 + + let r5 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.remove 5 + let a5 = Deque.head r5 + let t51 = Deque.tail r5 + let b5 = Deque.head t51 + let t52 = Deque.tail t51 + let c5 = Deque.head t52 + let t53 = Deque.tail t52 + let d5 = Deque.head t53 + let t54 = Deque.tail t53 + let e5 = Deque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "tryRemoveempty" { Deque.empty() |> Deque.tryRemove 0 |> Expect.isNone "" } + + test "Deque.tryRemove elements Deque.length 1" { + let a = len1 |> Deque.tryRemove 0 + a.Value |> Deque.isEmpty |> Expect.isTrue "" + } + + test "Deque.tryRemove elements Deque.length 2" { + let a = len2 |> Deque.tryRemove 0 + let a1 = Deque.head a.Value + let b = len2 |> Deque.tryRemove 1 + let b1 = Deque.head b.Value + ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" + } + + test "Deque.tryRemove elements Deque.length 3" { + let x0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryRemove 0 + let r0 = x0.Value + let b0 = Deque.head r0 + let t0 = Deque.tail r0 + let c0 = Deque.head t0 + + let x1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryRemove 1 + let r1 = x1.Value + let a1 = Deque.head r1 + let t1 = Deque.tail r1 + let c1 = Deque.head t1 + + let x2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryRemove 2 + let r2 = x2.Value + let a2 = Deque.head r2 + let t2 = Deque.tail r2 + let b2 = Deque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "Deque.tryRemove elements Deque.length 4" { + let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 0 + let r0 = x0.Value + let b0 = Deque.head r0 + let t0 = Deque.tail r0 + let c0 = Deque.head t0 + let t01 = Deque.tail t0 + let d0 = Deque.head t01 + + let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 1 + let r1 = x1.Value + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let c1 = Deque.head t11 + let t12 = Deque.tail t11 + let d1 = Deque.head t12 + + let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 2 + let r2 = x2.Value + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + + let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryRemove 3 + let r3 = x3.Value + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "Deque.tryRemove elements Deque.length 5" { + let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 0 + let r0 = x0.Value + let b0 = Deque.head r0 + let t01 = Deque.tail r0 + let c0 = Deque.head t01 + let t02 = Deque.tail t01 + let d0 = Deque.head t02 + let t03 = Deque.tail t02 + let e0 = Deque.head t03 + + let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 1 + let r1 = x1.Value + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let c1 = Deque.head t11 + let t12 = Deque.tail t11 + let d1 = Deque.head t12 + let t13 = Deque.tail t12 + let e1 = Deque.head t13 + + let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 2 + let r2 = x2.Value + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let e2 = Deque.head t23 + + let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 3 + let r3 = x3.Value + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let e3 = Deque.head t33 + + let x4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.tryRemove 4 + let r4 = x4.Value + let a4 = Deque.head r4 + let t41 = Deque.tail r4 + let b4 = Deque.head t41 + let t42 = Deque.tail t41 + let c4 = Deque.head t42 + let t43 = Deque.tail t42 + let d4 = Deque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "Deque.tryRemove elements Deque.length 6" { + let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 0 + let r0 = x0.Value + let b0 = Deque.head r0 + let t01 = Deque.tail r0 + let c0 = Deque.head t01 + let t02 = Deque.tail t01 + let d0 = Deque.head t02 + let t03 = Deque.tail t02 + let e0 = Deque.head t03 + let t04 = Deque.tail t03 + let f0 = Deque.head t04 + + let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 1 + let r1 = x1.Value + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let c1 = Deque.head t11 + let t12 = Deque.tail t11 + let d1 = Deque.head t12 + let t13 = Deque.tail t12 + let e1 = Deque.head t13 + let t14 = Deque.tail t13 + let f1 = Deque.head t14 + + let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 2 + let r2 = x2.Value + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let e2 = Deque.head t23 + let t24 = Deque.tail t23 + let f2 = Deque.head t24 + + let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 3 + let r3 = x3.Value + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let e3 = Deque.head t33 + let t34 = Deque.tail t33 + let f3 = Deque.head t34 + + let x4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 4 + let r4 = x4.Value + let a4 = Deque.head r4 + let t41 = Deque.tail r4 + let b4 = Deque.head t41 + let t42 = Deque.tail t41 + let c4 = Deque.head t42 + let t43 = Deque.tail t42 + let d4 = Deque.head t43 + let t44 = Deque.tail t43 + let f4 = Deque.head t44 + + let x5 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.tryRemove 5 + let r5 = x5.Value + let a5 = Deque.head r5 + let t51 = Deque.tail r5 + let b5 = Deque.head t51 + let t52 = Deque.tail t51 + let c5 = Deque.head t52 + let t53 = Deque.tail t52 + let d5 = Deque.head t53 + let t54 = Deque.tail t53 + let e5 = Deque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "Deque.update elements Deque.length 1" { len1 |> Deque.update 0 "aa" |> Deque.head |> Expect.equal "" "aa" } + + test "Deque.update elements Deque.length 2" { + let r0 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.update 0 "zz" + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + + let r1 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.update 1 "zz" + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.update elements Deque.length 3" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.update 0 "zz" + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + let t02 = Deque.tail t01 + let c0 = Deque.head t02 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.update 1 "zz" + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + let t12 = Deque.tail t11 + let c1 = Deque.head t12 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.update 2 "zz" + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.update elements Deque.length 4" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 0 "zz" + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + let t02 = Deque.tail t01 + let c0 = Deque.head t02 + let t03 = Deque.tail t02 + let d0 = Deque.head t03 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 1 "zz" + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + let t12 = Deque.tail t11 + let c1 = Deque.head t12 + let t13 = Deque.tail t12 + let d1 = Deque.head t13 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 2 "zz" + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let d2 = Deque.head t23 + + let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.update 3 "zz" + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let d3 = Deque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.update elements Deque.length 5" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 0 "zz" + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + let t02 = Deque.tail t01 + let c0 = Deque.head t02 + let t03 = Deque.tail t02 + let d0 = Deque.head t03 + let t04 = Deque.tail t03 + let e0 = Deque.head t04 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 1 "zz" + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + let t12 = Deque.tail t11 + let c1 = Deque.head t12 + let t13 = Deque.tail t12 + let d1 = Deque.head t13 + let t14 = Deque.tail t13 + let e1 = Deque.head t14 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 2 "zz" + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let d2 = Deque.head t23 + let t24 = Deque.tail t23 + let e2 = Deque.head t24 + + let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 3 "zz" + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let d3 = Deque.head t33 + let t34 = Deque.tail t33 + let e3 = Deque.head t34 + + let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) |> Deque.update 4 "zz" + let a4 = Deque.head r4 + let t41 = Deque.tail r4 + let b4 = Deque.head t41 + let t42 = Deque.tail t41 + let c4 = Deque.head t42 + let t43 = Deque.tail t42 + let d4 = Deque.head t43 + let t44 = Deque.tail t43 + let e4 = Deque.head t44 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.update elements Deque.length 6" { + let r0 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 0 "zz" + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + let t02 = Deque.tail t01 + let c0 = Deque.head t02 + let t03 = Deque.tail t02 + let d0 = Deque.head t03 + let t04 = Deque.tail t03 + let e0 = Deque.head t04 + let t05 = Deque.tail t04 + let f0 = Deque.head t05 + + let r1 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 1 "zz" + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + let t12 = Deque.tail t11 + let c1 = Deque.head t12 + let t13 = Deque.tail t12 + let d1 = Deque.head t13 + let t14 = Deque.tail t13 + let e1 = Deque.head t14 + let t15 = Deque.tail t14 + let f1 = Deque.head t15 + + let r2 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 2 "zz" + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let d2 = Deque.head t23 + let t24 = Deque.tail t23 + let e2 = Deque.head t24 + let t25 = Deque.tail t24 + let f2 = Deque.head t25 + + let r3 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 3 "zz" + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let d3 = Deque.head t33 + let t34 = Deque.tail t33 + let e3 = Deque.head t34 + let t35 = Deque.tail t34 + let f3 = Deque.head t35 + + let r4 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 4 "zz" + let a4 = Deque.head r4 + let t41 = Deque.tail r4 + let b4 = Deque.head t41 + let t42 = Deque.tail t41 + let c4 = Deque.head t42 + let t43 = Deque.tail t42 + let d4 = Deque.head t43 + let t44 = Deque.tail t43 + let e4 = Deque.head t44 + let t45 = Deque.tail t44 + let f4 = Deque.head t45 + + let r5 = (Deque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) |> Deque.update 5 "zz" + let a5 = Deque.head r5 + let t51 = Deque.tail r5 + let b5 = Deque.head t51 + let t52 = Deque.tail t51 + let c5 = Deque.head t52 + let t53 = Deque.tail t52 + let d5 = Deque.head t53 + let t54 = Deque.tail t53 + let e5 = Deque.head t54 + let t55 = Deque.tail t54 + let f5 = Deque.head t55 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e") + && (f5 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.tryUpdate elements Deque.length 1" { + let a = len1 |> Deque.tryUpdate 0 "aa" + a.Value |> Deque.head |> Expect.equal "" "aa" + } + + test "Deque.tryUpdate elements Deque.length 2" { + let x0 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.tryUpdate 0 "zz" + let r0 = x0.Value + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + + let x1 = (Deque.ofSeq [ "a"; "b" ]) |> Deque.tryUpdate 1 "zz" + let r1 = x1.Value + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.tryUpdate elements Deque.length 3" { + let x0 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryUpdate 0 "zz" + let r0 = x0.Value + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + let t02 = Deque.tail t01 + let c0 = Deque.head t02 + + let x1 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryUpdate 1 "zz" + let r1 = x1.Value + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + let t12 = Deque.tail t11 + let c1 = Deque.head t12 + + let x2 = (Deque.ofSeq [ "a"; "b"; "c" ]) |> Deque.tryUpdate 2 "zz" + let r2 = x2.Value + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.tryUpdate elements Deque.length 4" { + let x0 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 0 "zz" + let r0 = x0.Value + let a0 = Deque.head r0 + let t01 = Deque.tail r0 + let b0 = Deque.head t01 + let t02 = Deque.tail t01 + let c0 = Deque.head t02 + let t03 = Deque.tail t02 + let d0 = Deque.head t03 + + let x1 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 1 "zz" + let r1 = x1.Value + let a1 = Deque.head r1 + let t11 = Deque.tail r1 + let b1 = Deque.head t11 + let t12 = Deque.tail t11 + let c1 = Deque.head t12 + let t13 = Deque.tail t12 + let d1 = Deque.head t13 + + let x2 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 2 "zz" + let r2 = x2.Value + let a2 = Deque.head r2 + let t21 = Deque.tail r2 + let b2 = Deque.head t21 + let t22 = Deque.tail t21 + let c2 = Deque.head t22 + let t23 = Deque.tail t22 + let d2 = Deque.head t23 + + let x3 = (Deque.ofSeq [ "a"; "b"; "c"; "d" ]) |> Deque.tryUpdate 3 "zz" + let r3 = x3.Value + let a3 = Deque.head r3 + let t31 = Deque.tail r3 + let b3 = Deque.head t31 + let t32 = Deque.tail t31 + let c3 = Deque.head t32 + let t33 = Deque.tail t32 + let d3 = Deque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "Deque.tryUncons on empty" { + let q = Deque.empty() + Expect.isNone "Deque.tryUncons" <| Deque.tryUncons q + } + + test "Deque.tryUncons on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + let x, _ = (Deque.tryUncons q).Value + Expect.equal "Deque.tryUncons" "a" x + } + + test "Deque.tryUnsnoc on empty" { + let q = Deque.empty() + Expect.isNone "Deque.tryUnsnoc" <| Deque.tryUnsnoc q + } + + test "Deque.tryUnsnoc on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + let _, x = (Deque.tryUnsnoc q).Value + Expect.equal "Deque.tryUnsnoc" "d" x + } + + test "Deque.tryGetHead on empty" { + let q = Deque.empty() + Expect.isNone "tryHead" <| Deque.tryGetHead q + } + + test "Deque.tryGetHead on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + Expect.equal "tryHead" "a" (Deque.tryGetHead q).Value + } + + test "Deque.tryGetInit on empty" { + let q = Deque.empty() + Expect.isNone "tryInitial" <| Deque.tryGetInit q + } + + test "Deque.tryGetInit on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + let x = (Deque.tryGetInit q).Value + let x2 = x |> Deque.last + Expect.equal "tryinitial" "c" x2 + } + + test "Deque.tryGetLast on empty" { + let q = Deque.empty() + Expect.isNone "tryLast" <| Deque.tryGetLast q + } + + test "Deque.tryGetLast on deque" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + Expect.equal "tryLast" "d" (Deque.tryGetLast q).Value + Expect.equal "tryLast" "a" (len2 |> Deque.tryGetLast).Value + Expect.equal "tryLast" "a" (len2snoc |> Deque.tryGetLast).Value + } + + test "Deque.tryGetTail on empty" { + let q = Deque.empty() + Expect.isNone "tryTail" <| Deque.tryGetTail q + } + + test "Deque.tryGetTail on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + Expect.equal "tryTail" "b" ((Deque.tryGetTail q).Value |> Deque.head) + } + + test "deprecated structure still works" { + let q = Deque.empty() + (Deque.tryGetTail q = None) |> Expect.isTrue "" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/EagerRoseTreeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/EagerRoseTreeTest.fs index 31c4fe55..8bd03c8a 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/EagerRoseTreeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/EagerRoseTreeTest.fs @@ -14,15 +14,14 @@ module EagerRoseTreeTest = let atree = tree 1 [ tree 2 [ tree 3 [] ]; tree 4 [ tree 5 [ tree 6 [] ] ] ] let ctree = - tree "f" [ - tree "b" [ tree "a" []; tree "d" [ tree "c" []; tree "e" [] ] ] - tree "g" [ tree "i" [ tree "h" [] ] ] - ] + tree + "f" + [ tree "b" [ tree "a" []; tree "d" [ tree "c" []; tree "e" [] ] ] + tree "g" [ tree "i" [ tree "h" [] ] ] ] - type HtmlElement = { - TagName: string - Attributes: (string * string) list - } + type HtmlElement = + { TagName: string + Attributes: (string * string) list } type HtmlNode = | Element of HtmlElement @@ -46,90 +45,91 @@ module EagerRoseTreeTest = [] let testEagerRoseTree = - testList "Experimental EagerRoseTree" [ - test "dfs pre" { - let actual = EagerRoseTree.dfsPre ctree |> Seq.toList - Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual - } - - test "dfs post" { - let actual = EagerRoseTree.dfsPost ctree |> Seq.toList - Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual - } - - test "map" { - let actual = EagerRoseTree.map ((+) 1) atree - let expected = tree 2 [ tree 3 [ tree 4 [] ]; tree 5 [ tree 6 [ tree 7 [] ] ] ] - Expect.equal "" expected actual - } - - test "fold via dfs" { - let actual = EagerRoseTree.dfsPre atree |> Seq.fold (*) 1 - Expect.equal "" 720 actual - } - - test "unfold" { - let a = EagerRoseTree.unfold (fun i -> i, List.ofSeq { i + 1 .. 3 }) 0 - - let expected = - tree 0 [ tree 1 [ tree 2 [ tree 3 [] ]; tree 3 [] ]; tree 2 [ tree 3 [] ]; tree 3 [] ] - - Expect.equal "" expected a - } - - // not the best example, as text nodes cannot have children - - test "mapAccum" { - let e, taggedHtmlDoc = - EagerRoseTree.mapAccum - (fun i -> - function - | Element x -> - i + 1, - Element - { x with - Attributes = ("data-i", i.ToString()) :: x.Attributes - } - | x -> i, x) - 0 - htmldoc - - let expected = - tree (elemA "body" [ "data-i", "0" ]) [ tree (elemA "div" [ "data-i", "1" ]) [ text "hello world" ] ] - - Expect.equal "" expected taggedHtmlDoc - Expect.equal "" 2 e - } - - test "bind" { - let wrapText = - function - | Text t -> tree (elem "span") [ text t ] - | x -> EagerRoseTree.singleton x - - let newDoc = htmldoc |> EagerRoseTree.bind wrapText - - let expected = - tree (elem "body") [ tree (elem "div") [ tree (elem "span") [ text "hello world" ] ] ] - - Expect.equal "" expected newDoc - } - ] - - let finiteEagerRoseTreeForest() = gen { - let! n = Gen.length1thru 5 - let! l = Gen.listOfLength n Arb.generate - return List.fold (fun (s: list>) (t: int) -> (EagerRoseTree.singleton t) :: s) [] l - } + testList + "Experimental EagerRoseTree" + [ test "dfs pre" { + let actual = EagerRoseTree.dfsPre ctree |> Seq.toList + Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual + } + + test "dfs post" { + let actual = EagerRoseTree.dfsPost ctree |> Seq.toList + Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual + } + + test "map" { + let actual = EagerRoseTree.map ((+) 1) atree + let expected = tree 2 [ tree 3 [ tree 4 [] ]; tree 5 [ tree 6 [ tree 7 [] ] ] ] + Expect.equal "" expected actual + } + + test "fold via dfs" { + let actual = EagerRoseTree.dfsPre atree |> Seq.fold (*) 1 + Expect.equal "" 720 actual + } + + test "unfold" { + let a = EagerRoseTree.unfold (fun i -> i, List.ofSeq { i + 1 .. 3 }) 0 + + let expected = + tree 0 [ tree 1 [ tree 2 [ tree 3 [] ]; tree 3 [] ]; tree 2 [ tree 3 [] ]; tree 3 [] ] + + Expect.equal "" expected a + } + + // not the best example, as text nodes cannot have children + + test "mapAccum" { + let e, taggedHtmlDoc = + EagerRoseTree.mapAccum + (fun i -> + function + | Element x -> + i + 1, + Element + { x with + Attributes = ("data-i", i.ToString()) :: x.Attributes } + | x -> i, x) + 0 + htmldoc + + let expected = + tree (elemA "body" [ "data-i", "0" ]) [ tree (elemA "div" [ "data-i", "1" ]) [ text "hello world" ] ] + + Expect.equal "" expected taggedHtmlDoc + Expect.equal "" 2 e + } + + test "bind" { + let wrapText = + function + | Text t -> tree (elem "span") [ text t ] + | x -> EagerRoseTree.singleton x + + let newDoc = htmldoc |> EagerRoseTree.bind wrapText + + let expected = + tree (elem "body") [ tree (elem "div") [ tree (elem "span") [ text "hello world" ] ] ] + + Expect.equal "" expected newDoc + } ] + + let finiteEagerRoseTreeForest() = + gen { + let! n = Gen.length1thru 5 + let! l = Gen.listOfLength n Arb.generate + return List.fold (fun (s: list>) (t: int) -> (EagerRoseTree.singleton t) :: s) [] l + } type EagerRoseTreeGen = static member EagerRoseTree() = - let rec EagerRoseTreeGen() = gen { - let! root = Arb.generate - // need to set these frequencies to avoid blowing the stack - let! children = Gen.frequency [ 70, gen.Return List.empty; 1, finiteEagerRoseTreeForest() ] - return EagerRoseTree.create root children - } + let rec EagerRoseTreeGen() = + gen { + let! root = Arb.generate + // need to set these frequencies to avoid blowing the stack + let! children = Gen.frequency [ 70, gen.Return List.empty; 1, finiteEagerRoseTreeForest() ] + return EagerRoseTree.create root children + } Arb.fromGen(EagerRoseTreeGen()) @@ -145,62 +145,63 @@ module EagerRoseTreeTest = let eRTF l = List.fold (fun (s: list>) (t: int) -> (EagerRoseTree.singleton t) :: s) [] l - let eRTF2 = [ - for i = 1 to 5 do - yield (EagerRoseTree.create 1 (eRTF [ 1..5 ])) - ] + let eRTF2 = + [ for i = 1 to 5 do + yield (EagerRoseTree.create 1 (eRTF [ 1..5 ])) ] let eRT = EagerRoseTree.create 1 eRTF2 let singleRT = EagerRoseTree.singleton 1 - testList "Experimental EagerRoseTree properties" [ + testList + "Experimental EagerRoseTree properties" + [ - test "functor laws" { - //fsCheck version of functor and monad laws stackoverflows - let map = EagerRoseTree.map + test "functor laws" { + //fsCheck version of functor and monad laws stackoverflows + let map = EagerRoseTree.map - //preserves identity - ((map id eRT) = eRT) |> Expect.isTrue "" - ((map id singleRT) = singleRT) |> Expect.isTrue "" + //preserves identity + ((map id eRT) = eRT) |> Expect.isTrue "" + ((map id singleRT) = singleRT) |> Expect.isTrue "" - let f = (fun x -> x + 5) - let g = (fun x -> x - 2) + let f = (fun x -> x + 5) + let g = (fun x -> x - 2) - //preserves composition - map (f << g) eRT = (map f << map g) eRT |> Expect.isTrue "" - map (f << g) singleRT = (map f << map g) singleRT |> Expect.isTrue "" - } + //preserves composition + map (f << g) eRT = (map f << map g) eRT |> Expect.isTrue "" + map (f << g) singleRT = (map f << map g) singleRT |> Expect.isTrue "" + } - test "monad laws" { - //fsCheck version of functor and monad laws stackoverflows - let inline (>>=) m f = - EagerRoseTree.bind f m + test "monad laws" { + //fsCheck version of functor and monad laws stackoverflows + let inline (>>=) m f = + EagerRoseTree.bind f m - let ret = EagerRoseTree.singleton + let ret = EagerRoseTree.singleton - let myF x = - EagerRoseTree.create x [ (EagerRoseTree.singleton x); (EagerRoseTree.singleton x) ] + let myF x = + EagerRoseTree.create x [ (EagerRoseTree.singleton x); (EagerRoseTree.singleton x) ] - let a = 1 + let a = 1 - //left identity - ret a >>= myF = myF a |> Expect.isTrue "" + //left identity + ret a >>= myF = myF a |> Expect.isTrue "" - //right identity - eRT >>= ret = eRT |> Expect.isTrue "" - singleRT >>= ret = singleRT |> Expect.isTrue "" + //right identity + eRT >>= ret = eRT |> Expect.isTrue "" + singleRT >>= ret = singleRT |> Expect.isTrue "" - //associativity - let myG x = - EagerRoseTree.create (x = x) [ (EagerRoseTree.singleton(x = x)); (EagerRoseTree.singleton(x = x)) ] + //associativity + let myG x = + EagerRoseTree.create (x = x) [ (EagerRoseTree.singleton(x = x)); (EagerRoseTree.singleton(x = x)) ] - let a' = (eRT >>= myF) >>= myG - let b' = eRT >>= (fun x -> myF x >>= myG) - a' = b' |> Expect.isTrue "" + let a' = (eRT >>= myF) >>= myG + let b' = eRT >>= (fun x -> myF x >>= myG) + a' = b' |> Expect.isTrue "" - let a'' = (singleRT >>= myF) >>= myG - let b'' = singleRT >>= (fun x -> myF x >>= myG) - a'' = b'' |> Expect.isTrue "" - } + let a'' = (singleRT >>= myF) >>= myG + let b'' = singleRT >>= (fun x -> myF x >>= myG) + a'' = b'' |> Expect.isTrue "" + } - ] + ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/EditDistanceTest.fs b/tests/FSharpx.Collections.Experimental.Tests/EditDistanceTest.fs index 923ce3f5..e85329e5 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/EditDistanceTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/EditDistanceTest.fs @@ -12,26 +12,26 @@ module EditDistanceTest = [] let testEditDistance = - testList "Experimental EditDistance" [ - test "distance example" { - BKTree.ByteString.distance (BS "kitten"B) (BS "sitting"B) - |> Expect.equal "" 3 - } - - test "toListDistance example" { - [ BS "kitten"B; BS "setting"B; BS "getting"B ] - |> BKTree.ByteString.ofList - |> BKTree.ByteString.toListDistance 2 (BS "sitting"B) - |> Expect.equal "" [ BS "setting"B; BS "getting"B ] - } - - test "String distance example" { - let inline toBS(text: string) = - ByteString(System.Text.Encoding.ASCII.GetBytes text) - - let calcEditDistance text1 text2 = - BKTree.ByteString.distance (toBS text1) (toBS text2) - - calcEditDistance "meilenstein" "levenshtein" |> Expect.equal "" 4 - } - ] + testList + "Experimental EditDistance" + [ test "distance example" { + BKTree.ByteString.distance (BS "kitten"B) (BS "sitting"B) + |> Expect.equal "" 3 + } + + test "toListDistance example" { + [ BS "kitten"B; BS "setting"B; BS "getting"B ] + |> BKTree.ByteString.ofList + |> BKTree.ByteString.toListDistance 2 (BS "sitting"B) + |> Expect.equal "" [ BS "setting"B; BS "getting"B ] + } + + test "String distance example" { + let inline toBS(text: string) = + ByteString(System.Text.Encoding.ASCII.GetBytes text) + + let calcEditDistance text1 text2 = + BKTree.ByteString.distance (toBS text1) (toBS text2) + + calcEditDistance "meilenstein" "levenshtein" |> Expect.equal "" 4 + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/FileSystemZipperTest.fs b/tests/FSharpx.Collections.Experimental.Tests/FileSystemZipperTest.fs index 50d3028c..ee7551e2 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/FileSystemZipperTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/FileSystemZipperTest.fs @@ -33,11 +33,8 @@ module FileSystemZipperTest = { zipper with Focus = Folder - { - Name = name - Items = ls @ [ zipper.Focus ] @ rs - } - } + { Name = name + Items = ls @ [ zipper.Focus ] @ rs } } let getName = function @@ -53,10 +50,8 @@ module FileSystemZipperTest = | Folder folder -> let (ls, item :: rs) = List.split (nameIs name) folder.Items - { - Focus = item - Path = Some(folder.Name, ls, rs) - } + { Focus = item + Path = Some(folder.Name, ls, rs) } /// Renames the given focus let rename newName zipper = @@ -64,8 +59,7 @@ module FileSystemZipperTest = | File name -> { zipper with Focus = File newName } | Folder folder -> { zipper with - Focus = Folder { folder with Name = newName } - } + Focus = Folder { folder with Name = newName } } /// Creates a new file in the current directory let newFile name zipper = @@ -75,9 +69,7 @@ module FileSystemZipperTest = Focus = Folder { folder with - Items = File name :: folder.Items - } - } + Items = File name :: folder.Items } } /// Creates a new folder in the current directory let newFolder name zipper = @@ -87,106 +79,99 @@ module FileSystemZipperTest = Focus = Folder { folder with - Items = Folder { Name = name; Items = [] } :: folder.Items - } - } + Items = Folder { Name = name; Items = [] } :: folder.Items } } - let zipper fileSystem : FSZipper = { Focus = fileSystem; Path = None } + let zipper fileSystem : FSZipper = + { Focus = fileSystem; Path = None } let disk = folder( "root", - [ - File "goat_yelling_like_man.wmv" - File "pope_time.avi" - folder( - "pics", - [ - File "ape_throwing_up.jpg" - File "watermelon_smash.gif" - File "skull_man(scary).bmp" - ] - ) - File "dijon_poupon.doc" - folder( - "programs", - [ - File "fartwizard.exe" - File "owl_bandit.dmg" - File "not_a_virus.exe" - folder("source code", [ File "best_hs_prog.hs"; File "random.hs" ]) - ] - ) - ] + [ File "goat_yelling_like_man.wmv" + File "pope_time.avi" + folder( + "pics", + [ File "ape_throwing_up.jpg" + File "watermelon_smash.gif" + File "skull_man(scary).bmp" ] + ) + File "dijon_poupon.doc" + folder( + "programs", + [ File "fartwizard.exe" + File "owl_bandit.dmg" + File "not_a_virus.exe" + folder("source code", [ File "best_hs_prog.hs"; File "random.hs" ]) ] + ) ] ) |> zipper [] let testFileSystemZipper = - testList "Experimental FileSystemZipper" [ - test "Can move to subdir" { - let z = disk |> moveTo "pics" |> moveTo "skull_man(scary).bmp" - Expect.equal "" (File "skull_man(scary).bmp") z.Focus - } - - test "Can move to subdir and up again" { - let z = disk |> moveTo "pics" |> moveTo "skull_man(scary).bmp" |> up - Expect.equal "" "pics" <| getName z.Focus - } - - test "Can rename a folder" { - let z = disk |> moveTo "pics" |> rename "photo" |> up |> moveTo "photo" - Expect.equal "" "photo" <| getName z.Focus - } - - test "Can rename a file" { - let z = - disk - |> moveTo "pics" - |> moveTo "skull_man(scary).bmp" - |> rename "scary.bmp" - |> up - |> moveTo "scary.bmp" - - Expect.equal "" "scary.bmp" <| getName z.Focus - } - - test "Can't access a renamed file with the old name" { - let ok = ref false - - let z1 = - disk - |> moveTo "pics" - |> moveTo "skull_man(scary).bmp" - |> rename "scary.bmp" - |> up - - try - z1 |> moveTo "skull_man(scary).bmp" |> ignore - with _ -> - ok := true - - Expect.isTrue "" !ok - } - - test "Can create a new file" { - let z = disk |> moveTo "pics" |> newFile "scary.bmp" |> moveTo "scary.bmp" - Expect.equal "" "scary.bmp" <| getName z.Focus - } - - test "Can still access old files if a new one is created" { - let z = - disk - |> moveTo "pics" - |> newFile "scary.bmp" - |> moveTo "skull_man(scary).bmp" - - Expect.equal "" "skull_man(scary).bmp" <| getName z.Focus - } - - test "Can create a new folder" { - let z = disk |> moveTo "pics" |> newFolder "wedding" |> moveTo "wedding" - Expect.equal "" (Folder { Name = "wedding"; Items = [] }) z.Focus - } - ] + testList + "Experimental FileSystemZipper" + [ test "Can move to subdir" { + let z = disk |> moveTo "pics" |> moveTo "skull_man(scary).bmp" + Expect.equal "" (File "skull_man(scary).bmp") z.Focus + } + + test "Can move to subdir and up again" { + let z = disk |> moveTo "pics" |> moveTo "skull_man(scary).bmp" |> up + Expect.equal "" "pics" <| getName z.Focus + } + + test "Can rename a folder" { + let z = disk |> moveTo "pics" |> rename "photo" |> up |> moveTo "photo" + Expect.equal "" "photo" <| getName z.Focus + } + + test "Can rename a file" { + let z = + disk + |> moveTo "pics" + |> moveTo "skull_man(scary).bmp" + |> rename "scary.bmp" + |> up + |> moveTo "scary.bmp" + + Expect.equal "" "scary.bmp" <| getName z.Focus + } + + test "Can't access a renamed file with the old name" { + let ok = ref false + + let z1 = + disk + |> moveTo "pics" + |> moveTo "skull_man(scary).bmp" + |> rename "scary.bmp" + |> up + + try + z1 |> moveTo "skull_man(scary).bmp" |> ignore + with _ -> + ok := true + + Expect.isTrue "" !ok + } + + test "Can create a new file" { + let z = disk |> moveTo "pics" |> newFile "scary.bmp" |> moveTo "scary.bmp" + Expect.equal "" "scary.bmp" <| getName z.Focus + } + + test "Can still access old files if a new one is created" { + let z = + disk + |> moveTo "pics" + |> newFile "scary.bmp" + |> moveTo "skull_man(scary).bmp" + + Expect.equal "" "skull_man(scary).bmp" <| getName z.Focus + } + + test "Can create a new folder" { + let z = disk |> moveTo "pics" |> newFolder "wedding" |> moveTo "wedding" + Expect.equal "" (Folder { Name = "wedding"; Items = [] }) z.Focus + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/FlatListTest.fs b/tests/FSharpx.Collections.Experimental.Tests/FlatListTest.fs index 2891950c..a416ee7c 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/FlatListTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/FlatListTest.fs @@ -12,23 +12,26 @@ FlatList generators from random FlatList.ofSeq and/or conj elements from random module FlatListTest = - let flatlistIntGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listInt n - return ((FlatList.ofSeq x), x) - } - - let flatlistObjGen = gen { - let! n = Gen.length2thru100 - let! x = Gen.listObj n - return ((FlatList.ofSeq x), x) - } - - let flatlistStringGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listString n - return ((FlatList.ofSeq x), x) - } + let flatlistIntGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listInt n + return ((FlatList.ofSeq x), x) + } + + let flatlistObjGen = + gen { + let! n = Gen.length2thru100 + let! x = Gen.listObj n + return ((FlatList.ofSeq x), x) + } + + let flatlistStringGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listString n + return ((FlatList.ofSeq x), x) + } // NUnit TestCaseSource does not understand array of tuples at runtime let intGens start = @@ -43,214 +46,217 @@ module FlatListTest = [] let testFlatList = - testList "Experimental FlatList" [ + testList + "Experimental FlatList" + [ - test "FlatList.append: multiple appends to an FlatList.empty flatlist should increase the FlatList.length" { - FlatList.empty - |> FlatList.append(FlatList.singleton 1) - |> FlatList.append(FlatList.singleton 4) - |> FlatList.append(FlatList.singleton 25) - |> FlatList.length - |> Expect.equal "" 3 - } + test "FlatList.append: multiple appends to an FlatList.empty flatlist should increase the FlatList.length" { + FlatList.empty + |> FlatList.append(FlatList.singleton 1) + |> FlatList.append(FlatList.singleton 4) + |> FlatList.append(FlatList.singleton 25) + |> FlatList.length + |> Expect.equal "" 3 + } - test "FlatList.append: multiple FlatList.append to an FlatList.empty flatlist should create a flatlist" { - let x = - (FlatList.empty - |> FlatList.append(FlatList.singleton 1) - |> FlatList.append(FlatList.singleton 4) - |> FlatList.append(FlatList.singleton 25)) + test "FlatList.append: multiple FlatList.append to an FlatList.empty flatlist should create a flatlist" { + let x = + (FlatList.empty + |> FlatList.append(FlatList.singleton 1) + |> FlatList.append(FlatList.singleton 4) + |> FlatList.append(FlatList.singleton 25)) - x.[0] |> Expect.equal "" 25 - x.[1] |> Expect.equal "" 4 - x.[2] |> Expect.equal "" 1 - } + x.[0] |> Expect.equal "" 25 + x.[1] |> Expect.equal "" 4 + x.[2] |> Expect.equal "" 1 + } - test "FlatList.append: to an FlatList.empty flatlist should create a FlatList.singleton flatlist" { - (FlatList.empty |> FlatList.append(FlatList.singleton 1)).[0] - |> Expect.equal "" 1 - } + test "FlatList.append: to an FlatList.empty flatlist should create a FlatList.singleton flatlist" { + (FlatList.empty |> FlatList.append(FlatList.singleton 1)).[0] + |> Expect.equal "" 1 + } - test "FlatList.concat: expected result" { + test "FlatList.concat: expected result" { - let aTable max = seq { for i in 1..max -> [| for j in 1..max -> (i, j, i * j) |] } - let a = Array.concat(aTable 3) + let aTable max = + seq { for i in 1..max -> [| for j in 1..max -> (i, j, i * j) |] } - let fTable max = - seq { for i in 1..max -> [| for j in 1..max -> (i, j, i * j) |] } - |> FlatList.ofSeq + let a = Array.concat(aTable 3) - let f = FlatList.concat(fTable 3) + let fTable max = + seq { for i in 1..max -> [| for j in 1..max -> (i, j, i * j) |] } + |> FlatList.ofSeq - Array.toList a |> Expect.equal "" (FlatList.toList f) - } + let f = FlatList.concat(fTable 3) - test "Equality: flatlist with 3 elements can be compared" { - let flatlist1 = ref FlatList.empty + Array.toList a |> Expect.equal "" (FlatList.toList f) + } - for i in 1..3 do - flatlist1 := FlatList.append (!flatlist1) (FlatList.singleton i) + test "Equality: flatlist with 3 elements can be compared" { + let flatlist1 = ref FlatList.empty - let flatlist2 = ref FlatList.empty + for i in 1..3 do + flatlist1 := FlatList.append (!flatlist1) (FlatList.singleton i) - for i in 1..3 do - flatlist2 := FlatList.append (!flatlist2) (FlatList.singleton i) + let flatlist2 = ref FlatList.empty - let flatlist3 = ref FlatList.empty + for i in 1..3 do + flatlist2 := FlatList.append (!flatlist2) (FlatList.singleton i) - for i in 1..3 do - flatlist3 := FlatList.append (!flatlist3) (FlatList.singleton(2 * i)) + let flatlist3 = ref FlatList.empty + for i in 1..3 do + flatlist3 := FlatList.append (!flatlist3) (FlatList.singleton(2 * i)) - flatlist1 = flatlist1 |> Expect.isTrue "" - flatlist1 = flatlist2 |> Expect.isTrue "" - flatlist1 = flatlist3 |> Expect.isFalse "" - } - test "Equality: structural equality" { + flatlist1 = flatlist1 |> Expect.isTrue "" + flatlist1 = flatlist2 |> Expect.isTrue "" + flatlist1 = flatlist3 |> Expect.isFalse "" + } - let l1 = FlatList.ofSeq [ 1..100 ] - let l2 = FlatList.ofSeq [ 1..100 ] + test "Equality: structural equality" { - l1 = l2 |> Expect.isTrue "" + let l1 = FlatList.ofSeq [ 1..100 ] + let l2 = FlatList.ofSeq [ 1..100 ] - let l3 = FlatList.append (FlatList.ofSeq [ 1..99 ]) (FlatList.singleton 99) + l1 = l2 |> Expect.isTrue "" - l1 = l3 |> Expect.isFalse "" - } + let l3 = FlatList.append (FlatList.ofSeq [ 1..99 ]) (FlatList.singleton 99) - test "FlatList.empty: flatlist should be FlatList.empty" { - let x = FlatList.empty - x |> FlatList.length |> Expect.equal "" 0 - } + l1 = l3 |> Expect.isFalse "" + } - test "GetHashCode: flatlist with 3 elements can compute hashcodes" { - let flatlist1 = ref FlatList.empty + test "FlatList.empty: flatlist should be FlatList.empty" { + let x = FlatList.empty + x |> FlatList.length |> Expect.equal "" 0 + } - for i in 1..3 do - flatlist1 := FlatList.append (!flatlist1) (FlatList.singleton i) + test "GetHashCode: flatlist with 3 elements can compute hashcodes" { + let flatlist1 = ref FlatList.empty - let flatlist2 = ref FlatList.empty + for i in 1..3 do + flatlist1 := FlatList.append (!flatlist1) (FlatList.singleton i) - for i in 1..3 do - flatlist2 := FlatList.append (!flatlist2) (FlatList.singleton i) + let flatlist2 = ref FlatList.empty - let flatlist3 = ref FlatList.empty + for i in 1..3 do + flatlist2 := FlatList.append (!flatlist2) (FlatList.singleton i) - for i in 1..3 do - flatlist3 := FlatList.append (!flatlist3) (FlatList.singleton(2 * i)) + let flatlist3 = ref FlatList.empty - flatlist1.GetHashCode() |> Expect.equal "" (flatlist2.GetHashCode()) + for i in 1..3 do + flatlist3 := FlatList.append (!flatlist3) (FlatList.singleton(2 * i)) - ((flatlist1.GetHashCode()) = (flatlist3.GetHashCode())) - |> Expect.isFalse "" - } + flatlist1.GetHashCode() |> Expect.equal "" (flatlist2.GetHashCode()) - test "FlatList.init: flatlist should allow FlatList.init" { - let flatlist = FlatList.init 5 (fun x -> x * 2) - let s = Seq.init 5 (fun x -> x * 2) + ((flatlist1.GetHashCode()) = (flatlist3.GetHashCode())) + |> Expect.isFalse "" + } - s |> Seq.toList |> Expect.equal "" [ 0; 2; 4; 6; 8 ] - flatlist |> Seq.toList |> Expect.equal "" [ 0; 2; 4; 6; 8 ] - } + test "FlatList.init: flatlist should allow FlatList.init" { + let flatlist = FlatList.init 5 (fun x -> x * 2) + let s = Seq.init 5 (fun x -> x * 2) - test "IEnumarable: flatlist with 300 elements should be convertable to a seq" { - let flatlist = ref FlatList.empty + s |> Seq.toList |> Expect.equal "" [ 0; 2; 4; 6; 8 ] + flatlist |> Seq.toList |> Expect.equal "" [ 0; 2; 4; 6; 8 ] + } - for i in 1..300 do - flatlist := FlatList.append (!flatlist) (FlatList.singleton i) + test "IEnumarable: flatlist with 300 elements should be convertable to a seq" { + let flatlist = ref FlatList.empty - !flatlist |> Seq.toList |> Expect.equal "" [ 1..300 ] - } + for i in 1..300 do + flatlist := FlatList.append (!flatlist) (FlatList.singleton i) - test "FlatList.iter: flatlist should allow FlatList.iter" { - let l' = ref [] + !flatlist |> Seq.toList |> Expect.equal "" [ 1..300 ] + } - let l2 = [ 1; 2; 3; 4 ] - let v = FlatList.ofSeq l2 + test "FlatList.iter: flatlist should allow FlatList.iter" { + let l' = ref [] - FlatList.iter (fun (elem: int) -> l' := elem :: !l') v + let l2 = [ 1; 2; 3; 4 ] + let v = FlatList.ofSeq l2 - !l' |> Expect.equal "" (List.rev l2) - } + FlatList.iter (fun (elem: int) -> l' := elem :: !l') v - test "FlatList.iter2: flatlist should allow FlatList.iter2" { - let l' = ref [] + !l' |> Expect.equal "" (List.rev l2) + } - let l2 = [ 1; 2; 3; 4 ] - let v = FlatList.ofSeq l2 + test "FlatList.iter2: flatlist should allow FlatList.iter2" { + let l' = ref [] - FlatList.iter2 (fun (elem1: int) (elem2: int) -> l' := elem1 :: elem2 :: !l') v v + let l2 = [ 1; 2; 3; 4 ] + let v = FlatList.ofSeq l2 - !l' |> Expect.equal "" (List.rev [ 1; 1; 2; 2; 3; 3; 4; 4 ]) - } + FlatList.iter2 (fun (elem1: int) (elem2: int) -> l' := elem1 :: elem2 :: !l') v v - test "FlatList.iteri: flatlist should allow FlatList.iteri" { - let l' = ref [] + !l' |> Expect.equal "" (List.rev [ 1; 1; 2; 2; 3; 3; 4; 4 ]) + } - let l2 = [ 1; 2; 3; 4 ] - let v = FlatList.ofSeq l2 + test "FlatList.iteri: flatlist should allow FlatList.iteri" { + let l' = ref [] - FlatList.iteri (fun i (elem: int) -> l' := (i * elem) :: !l') v + let l2 = [ 1; 2; 3; 4 ] + let v = FlatList.ofSeq l2 - !l' |> Expect.equal "" (List.rev [ 0; 2; 6; 12 ]) - } + FlatList.iteri (fun i (elem: int) -> l' := (i * elem) :: !l') v - test "FlatList.ofList: flatlist can be created" { - let xs = [ 7; 88; 1; 4; 25; 30 ] - FlatList.ofList xs |> Seq.toList |> Expect.equal "" xs - } + !l' |> Expect.equal "" (List.rev [ 0; 2; 6; 12 ]) + } - test "FlatList.ofSeq: flatlist can be created" { - let xs = [ 7; 88; 1; 4; 25; 30 ] - FlatList.ofSeq xs |> Seq.toList |> Expect.equal "" xs - } + test "FlatList.ofList: flatlist can be created" { + let xs = [ 7; 88; 1; 4; 25; 30 ] + FlatList.ofList xs |> Seq.toList |> Expect.equal "" xs + } - test "physicalEquality: works" { - let l1 = FlatList.ofSeq [ 1..100 ] - let l2 = l1 - let l3 = FlatList.ofSeq [ 1..100 ] + test "FlatList.ofSeq: flatlist can be created" { + let xs = [ 7; 88; 1; 4; 25; 30 ] + FlatList.ofSeq xs |> Seq.toList |> Expect.equal "" xs + } - FlatList.physicalEquality l1 l2 |> Expect.isTrue "" + test "physicalEquality: works" { + let l1 = FlatList.ofSeq [ 1..100 ] + let l2 = l1 + let l3 = FlatList.ofSeq [ 1..100 ] - FlatList.physicalEquality l1 l3 |> Expect.isFalse "" - } + FlatList.physicalEquality l1 l2 |> Expect.isTrue "" - test "FlatList.rev: FlatList.empty" { FlatList.isEmpty(FlatList.empty |> FlatList.rev) |> Expect.isTrue "" } + FlatList.physicalEquality l1 l3 |> Expect.isFalse "" + } - test "FlatList.toMap: works" { - let l2 = [ (1, "a"); (2, "b"); (3, "c"); (4, "d") ] - let v = FlatList.ofList l2 + test "FlatList.rev: FlatList.empty" { FlatList.isEmpty(FlatList.empty |> FlatList.rev) |> Expect.isTrue "" } - let m = FlatList.toMap v + test "FlatList.toMap: works" { + let l2 = [ (1, "a"); (2, "b"); (3, "c"); (4, "d") ] + let v = FlatList.ofList l2 - m.[1] |> Expect.equal "" "a" - m.[2] |> Expect.equal "" "b" - m.[3] |> Expect.equal "" "c" - m.[4] |> Expect.equal "" "d" - m.ContainsKey 5 |> Expect.isFalse "" - } + let m = FlatList.toMap v - test "FlatList.unzip: works" { - let l2 = [ (1, "a"); (2, "b"); (3, "c"); (4, "d") ] - let v = FlatList.ofList l2 - let x, y = FlatList.unzip v + m.[1] |> Expect.equal "" "a" + m.[2] |> Expect.equal "" "b" + m.[3] |> Expect.equal "" "c" + m.[4] |> Expect.equal "" "d" + m.ContainsKey 5 |> Expect.isFalse "" + } - FlatList.toList x |> Expect.equal "" [ 1; 2; 3; 4 ] - FlatList.toList y |> Expect.equal "" [ "a"; "b"; "c"; "d" ] - } + test "FlatList.unzip: works" { + let l2 = [ (1, "a"); (2, "b"); (3, "c"); (4, "d") ] + let v = FlatList.ofList l2 + let x, y = FlatList.unzip v - test "FlatList.zip: works" { - let l1 = [ 1; 2; 3; 4 ] - let l2 = [ "a"; "b"; "c"; "d" ] - let v1 = FlatList.ofList l1 - let v2 = FlatList.ofList l2 - let v = FlatList.zip v1 v2 + FlatList.toList x |> Expect.equal "" [ 1; 2; 3; 4 ] + FlatList.toList y |> Expect.equal "" [ "a"; "b"; "c"; "d" ] + } - FlatList.toList v - |> Expect.equal "" [ (1, "a"); (2, "b"); (3, "c"); (4, "d") ] - } - ] + test "FlatList.zip: works" { + let l1 = [ 1; 2; 3; 4 ] + let l2 = [ "a"; "b"; "c"; "d" ] + let v1 = FlatList.ofList l1 + let v2 = FlatList.ofList l2 + let v = FlatList.zip v1 v2 + + FlatList.toList v + |> Expect.equal "" [ (1, "a"); (2, "b"); (3, "c"); (4, "d") ] + } ] [] let testFlatListProperties = @@ -269,212 +275,212 @@ module FlatListTest = | 0 -> List.head l | _ -> nth (List.tail l) (i - 1) - testList "Experimental FlatList Properties" [ - testPropertyWithConfig - config10k - "FlatList.collect: expected result" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - v - |> FlatList.collect(fun elem -> FlatList.ofList [ 0..elem ]) - |> FlatList.toList = (l - |> Array.ofList - |> Array.collect(fun elem -> [| 0..elem |]) - |> Array.toList)) - - testPropertyWithConfig - config10k - "FlatList.exists: expected result" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> v |> FlatList.exists(fun elem -> elem = 6) = (l |> Array.ofList |> Array.exists(fun elem -> elem = 6))) - - testPropertyWithConfig - config10k - "filter: expected result" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - v |> FlatList.filter(fun elem -> elem % 2 = 0) |> FlatList.toList = (l - |> Array.ofList - |> Array.filter(fun elem -> elem % 2 = 0) - |> Array.toList)) - - testPropertyWithConfig - config10k - "fold: matches build list FlatList.rev int" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> v |> FlatList.fold (fun (l': int list) (elem: int) -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "fold: matches build list FlatList.rev obj" - (Prop.forAll(Arb.fromGen flatlistObjGen) - <| fun (v, l) -> v |> FlatList.fold (fun (l': obj list) (elem: obj) -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "fold: matches build list FlatList.rev string" - (Prop.forAll(Arb.fromGen flatlistStringGen) - <| fun (v, l) -> - v - |> FlatList.fold (fun (l': string list) (elem: string) -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "fold2: matches build list fold int" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> (v, v) ||> FlatList.fold2 listFun [] = List.fold2 listFun [] l l) - - testPropertyWithConfig - config10k - "fold2: matches build list fold obj" - (Prop.forAll(Arb.fromGen flatlistObjGen) - <| fun (v, l) -> (v, v) ||> FlatList.fold2 objFun [] = List.fold2 objFun [] l l) - - testPropertyWithConfig - config10k - "fold2: matches build list fold string" - (Prop.forAll(Arb.fromGen flatlistStringGen) - <| fun (v, l) -> (v, v) ||> FlatList.fold2 stringFun [] = List.fold2 stringFun [] l l) - - testPropertyWithConfig - config10k - "foldback: matches build list int" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> FlatList.foldBack (fun (elem: int) (l': int list) -> elem :: l') v [] = l) - - testPropertyWithConfig - config10k - "foldback: matches build list obj" - (Prop.forAll(Arb.fromGen flatlistObjGen) - <| fun (v, l) -> FlatList.foldBack (fun (elem: obj) (l': obj list) -> elem :: l') v [] = l) - - testPropertyWithConfig - config10k - "foldback: matches build list string" - (Prop.forAll(Arb.fromGen flatlistStringGen) - <| fun (v, l) -> FlatList.foldBack (fun (elem: string) (l': string list) -> elem :: l') v [] = l) - - testPropertyWithConfig - config10k - "foldback2: matches build FlatList" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let listFun = - fun (elem1: int) (elem2: int) (l': (int * int) list) -> (elem1, elem2) :: l' - - FlatList.foldBack2 listFun v v [] = List.foldBack2 listFun l l []) - - testPropertyWithConfig - config10k - "foldback2: matches build FlatList obj" - (Prop.forAll(Arb.fromGen flatlistObjGen) - <| fun (v, l) -> - let objFun = - fun (elem1: obj) (elem2: obj) (l': (obj * obj) list) -> (elem1, elem2) :: l' - - FlatList.foldBack2 objFun v v [] = List.foldBack2 objFun l l []) - - testPropertyWithConfig - config10k - "foldback2: matches build FlatList string" - (Prop.forAll(Arb.fromGen flatlistStringGen) - <| fun (v, l) -> - let stringFun = - fun (elem1: string) (elem2: string) (l': (string * string) list) -> (elem1, elem2) :: l' - - FlatList.foldBack2 stringFun v v [] = List.foldBack2 stringFun l l []) - - testPropertyWithConfig - config10k - "forall: works" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> FlatList.forall (fun (elem: int) -> elem < 1000) v = true) - - testPropertyWithConfig - config10k - "forall2: works" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> FlatList.forall2 (fun (elem1: int) (elem2: int) -> (elem1 < 1000 && elem2 < 1000)) v v = true) - - testPropertyWithConfig - config10k - "Item: get last from flatlist" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (v: FlatList, l: list) -> v.[l.Length - 1] = (nth l (l.Length - 1))) - - testPropertyWithConfig - config10k - "map: flatlist should allow map" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let funMap = (fun x -> x * 2) - FlatList.map funMap v |> FlatList.toList = List.map funMap l) - - testPropertyWithConfig - config10k - "map2: flatlist should allow map2" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let funMap2 = (fun x y -> ((x * 2), (y * 2))) - FlatList.map2 funMap2 v v |> FlatList.toList = List.map2 funMap2 l l) - - testPropertyWithConfig - config10k - "mapi: flatlist should allow mapi" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let funMapi = (fun i x -> i * x) - FlatList.mapi funMapi v |> FlatList.toList = List.mapi funMapi l) - - testPropertyWithConfig - config10k - "partition: works" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let funMapi = (fun x -> x % 2 = 0) - let x, y = FlatList.partition funMapi v - ((FlatList.toList x), (FlatList.toList y)) = List.partition funMapi l) - - testPropertyWithConfig - config10k - "FlatList.rev: matches build FlatList FlatList.rev" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (q, l) -> q |> FlatList.rev |> List.ofSeq = (List.rev l)) - - testPropertyWithConfig - config10k - "FlatList.rev: matches build FlatList obj FlatList.rev" - (Prop.forAll(Arb.fromGen flatlistObjGen) - <| fun (q, l) -> q |> FlatList.rev |> List.ofSeq = (List.rev l)) - - testPropertyWithConfig - config10k - "FlatList.rev: matches build FlatList string FlatList.rev" - (Prop.forAll(Arb.fromGen flatlistStringGen) - <| fun (q, l) -> q |> FlatList.rev |> List.ofSeq = (List.rev l)) - - testPropertyWithConfig - config10k - "sum: works" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> FlatList.sum v = List.sum l) - - testPropertyWithConfig - config10k - "sumBy: works" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let funSumBy = (fun x -> x * 2) - FlatList.sumBy funSumBy v = List.sumBy funSumBy l) - - testPropertyWithConfig - config10k - "tryFind: works" - (Prop.forAll(Arb.fromGen flatlistIntGen) - <| fun (v, l) -> - let funTryFind = (fun x -> x % 2 = 0) - - match FlatList.tryFind funTryFind v with - | None -> None = List.tryFind funTryFind l - | Some x -> x = (List.tryFind funTryFind l).Value) - ] + testList + "Experimental FlatList Properties" + [ testPropertyWithConfig + config10k + "FlatList.collect: expected result" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + v + |> FlatList.collect(fun elem -> FlatList.ofList [ 0..elem ]) + |> FlatList.toList = (l + |> Array.ofList + |> Array.collect(fun elem -> [| 0..elem |]) + |> Array.toList)) + + testPropertyWithConfig + config10k + "FlatList.exists: expected result" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> v |> FlatList.exists(fun elem -> elem = 6) = (l |> Array.ofList |> Array.exists(fun elem -> elem = 6))) + + testPropertyWithConfig + config10k + "filter: expected result" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + v |> FlatList.filter(fun elem -> elem % 2 = 0) |> FlatList.toList = (l + |> Array.ofList + |> Array.filter(fun elem -> elem % 2 = 0) + |> Array.toList)) + + testPropertyWithConfig + config10k + "fold: matches build list FlatList.rev int" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> v |> FlatList.fold (fun (l': int list) (elem: int) -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "fold: matches build list FlatList.rev obj" + (Prop.forAll(Arb.fromGen flatlistObjGen) + <| fun (v, l) -> v |> FlatList.fold (fun (l': obj list) (elem: obj) -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "fold: matches build list FlatList.rev string" + (Prop.forAll(Arb.fromGen flatlistStringGen) + <| fun (v, l) -> + v + |> FlatList.fold (fun (l': string list) (elem: string) -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "fold2: matches build list fold int" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> (v, v) ||> FlatList.fold2 listFun [] = List.fold2 listFun [] l l) + + testPropertyWithConfig + config10k + "fold2: matches build list fold obj" + (Prop.forAll(Arb.fromGen flatlistObjGen) + <| fun (v, l) -> (v, v) ||> FlatList.fold2 objFun [] = List.fold2 objFun [] l l) + + testPropertyWithConfig + config10k + "fold2: matches build list fold string" + (Prop.forAll(Arb.fromGen flatlistStringGen) + <| fun (v, l) -> (v, v) ||> FlatList.fold2 stringFun [] = List.fold2 stringFun [] l l) + + testPropertyWithConfig + config10k + "foldback: matches build list int" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> FlatList.foldBack (fun (elem: int) (l': int list) -> elem :: l') v [] = l) + + testPropertyWithConfig + config10k + "foldback: matches build list obj" + (Prop.forAll(Arb.fromGen flatlistObjGen) + <| fun (v, l) -> FlatList.foldBack (fun (elem: obj) (l': obj list) -> elem :: l') v [] = l) + + testPropertyWithConfig + config10k + "foldback: matches build list string" + (Prop.forAll(Arb.fromGen flatlistStringGen) + <| fun (v, l) -> FlatList.foldBack (fun (elem: string) (l': string list) -> elem :: l') v [] = l) + + testPropertyWithConfig + config10k + "foldback2: matches build FlatList" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let listFun = + fun (elem1: int) (elem2: int) (l': (int * int) list) -> (elem1, elem2) :: l' + + FlatList.foldBack2 listFun v v [] = List.foldBack2 listFun l l []) + + testPropertyWithConfig + config10k + "foldback2: matches build FlatList obj" + (Prop.forAll(Arb.fromGen flatlistObjGen) + <| fun (v, l) -> + let objFun = + fun (elem1: obj) (elem2: obj) (l': (obj * obj) list) -> (elem1, elem2) :: l' + + FlatList.foldBack2 objFun v v [] = List.foldBack2 objFun l l []) + + testPropertyWithConfig + config10k + "foldback2: matches build FlatList string" + (Prop.forAll(Arb.fromGen flatlistStringGen) + <| fun (v, l) -> + let stringFun = + fun (elem1: string) (elem2: string) (l': (string * string) list) -> (elem1, elem2) :: l' + + FlatList.foldBack2 stringFun v v [] = List.foldBack2 stringFun l l []) + + testPropertyWithConfig + config10k + "forall: works" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> FlatList.forall (fun (elem: int) -> elem < 1000) v = true) + + testPropertyWithConfig + config10k + "forall2: works" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> FlatList.forall2 (fun (elem1: int) (elem2: int) -> (elem1 < 1000 && elem2 < 1000)) v v = true) + + testPropertyWithConfig + config10k + "Item: get last from flatlist" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (v: FlatList, l: list) -> v.[l.Length - 1] = (nth l (l.Length - 1))) + + testPropertyWithConfig + config10k + "map: flatlist should allow map" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let funMap = (fun x -> x * 2) + FlatList.map funMap v |> FlatList.toList = List.map funMap l) + + testPropertyWithConfig + config10k + "map2: flatlist should allow map2" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let funMap2 = (fun x y -> ((x * 2), (y * 2))) + FlatList.map2 funMap2 v v |> FlatList.toList = List.map2 funMap2 l l) + + testPropertyWithConfig + config10k + "mapi: flatlist should allow mapi" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let funMapi = (fun i x -> i * x) + FlatList.mapi funMapi v |> FlatList.toList = List.mapi funMapi l) + + testPropertyWithConfig + config10k + "partition: works" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let funMapi = (fun x -> x % 2 = 0) + let x, y = FlatList.partition funMapi v + ((FlatList.toList x), (FlatList.toList y)) = List.partition funMapi l) + + testPropertyWithConfig + config10k + "FlatList.rev: matches build FlatList FlatList.rev" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (q, l) -> q |> FlatList.rev |> List.ofSeq = (List.rev l)) + + testPropertyWithConfig + config10k + "FlatList.rev: matches build FlatList obj FlatList.rev" + (Prop.forAll(Arb.fromGen flatlistObjGen) + <| fun (q, l) -> q |> FlatList.rev |> List.ofSeq = (List.rev l)) + + testPropertyWithConfig + config10k + "FlatList.rev: matches build FlatList string FlatList.rev" + (Prop.forAll(Arb.fromGen flatlistStringGen) + <| fun (q, l) -> q |> FlatList.rev |> List.ofSeq = (List.rev l)) + + testPropertyWithConfig + config10k + "sum: works" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> FlatList.sum v = List.sum l) + + testPropertyWithConfig + config10k + "sumBy: works" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let funSumBy = (fun x -> x * 2) + FlatList.sumBy funSumBy v = List.sumBy funSumBy l) + + testPropertyWithConfig + config10k + "tryFind: works" + (Prop.forAll(Arb.fromGen flatlistIntGen) + <| fun (v, l) -> + let funTryFind = (fun x -> x % 2 = 0) + + match FlatList.tryFind funTryFind v with + | None -> None = List.tryFind funTryFind l + | Some x -> x = (List.tryFind funTryFind l).Value) ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/FsCheckProperties.fs b/tests/FSharpx.Collections.Experimental.Tests/FsCheckProperties.fs index 78f12eaf..d90d480d 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/FsCheckProperties.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/FsCheckProperties.fs @@ -7,13 +7,11 @@ open FsCheck let configReplay = { FsCheckConfig.defaultConfig with maxTest = 10000 - replay = Some <| (1940624926, 296296394) - } + replay = Some <| (1940624926, 296296394) } let config10k = { FsCheckConfig.defaultConfig with - maxTest = 10000 - } + maxTest = 10000 } let fsCheck name testable = FsCheck.Check.One(name, FsCheck.Config.Default, testable) @@ -41,11 +39,12 @@ let classifyCollect xs (count: int) (y: bool) = |> Prop.classify (xs.GetType().FullName.Contains("System.Object")) "object" module Gen = - let rec infiniteSeq() = gen { - let! x = Arb.generate - let! xs = infiniteSeq() - return Seq.append (Seq.singleton x) xs - } + let rec infiniteSeq() = + gen { + let! x = Arb.generate + let! xs = infiniteSeq() + return Seq.append (Seq.singleton x) xs + } let infiniteLazyList() = Gen.map LazyList.ofSeq (infiniteSeq()) @@ -53,15 +52,17 @@ module Gen = let finiteLazyList() = Gen.map LazyList.ofList Arb.generate - let ArbitrarySeqGen() = gen { - let! len = Gen.choose(0, 10) - let! l = Gen.listOfLength len Arb.generate + let ArbitrarySeqGen() = + gen { + let! len = Gen.choose(0, 10) + let! l = Gen.listOfLength len Arb.generate - return seq { - for i = 0 to len - 1 do - yield l.[i] + return + seq { + for i = 0 to len - 1 do + yield l.[i] + } } - } let ArbitrarySeq() = ArbitrarySeqGen() |> Arb.fromGen diff --git a/tests/FSharpx.Collections.Experimental.Tests/HeapGen.fs b/tests/FSharpx.Collections.Experimental.Tests/HeapGen.fs index 3cb81e6d..b9c13389 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/HeapGen.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/HeapGen.fs @@ -13,176 +13,200 @@ module HeapGen = (* IHeap generators from random ofSeq and/or snoc elements from random list *) - let maxLeftistHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((LeftistHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let maxLeftistHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((LeftistHeap.ofSeq true x), (x |> List.sort |> List.rev)) - } - - let maxLeftistHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((LeftistHeap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) - } - - let maxLeftistHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((LeftistHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let minLeftistHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((LeftistHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } - - let minLeftistHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((LeftistHeap.ofSeq false x), (x |> List.sort)) - } - - let minLeftistHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((LeftistHeap.empty false |> insertThruList x), (x |> List.sort)) - } - - let minLeftistHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((LeftistHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } + let maxLeftistHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((LeftistHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let maxLeftistHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((LeftistHeap.ofSeq true x), (x |> List.sort |> List.rev)) + } + + let maxLeftistHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((LeftistHeap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) + } + + let maxLeftistHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((LeftistHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let minLeftistHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((LeftistHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } + + let minLeftistHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((LeftistHeap.ofSeq false x), (x |> List.sort)) + } + + let minLeftistHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((LeftistHeap.empty false |> insertThruList x), (x |> List.sort)) + } + + let minLeftistHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((LeftistHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } (* IHeap generators from random ofSeq and/or snoc elements from random list *) - let maxBinomialHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((BinomialHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let maxBinomialHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((BinomialHeap.ofSeq true x), (x |> List.sort |> List.rev)) - } - - let maxBinomialHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((BinomialHeap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) - } - - let maxBinomialHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((BinomialHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let minBinomialHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((BinomialHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } - - let minBinomialHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((BinomialHeap.ofSeq false x), (x |> List.sort)) - } - - let minBinomialHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((BinomialHeap.empty false |> insertThruList x), (x |> List.sort)) - } - - let minBinomialHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((BinomialHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } + let maxBinomialHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((BinomialHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let maxBinomialHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((BinomialHeap.ofSeq true x), (x |> List.sort |> List.rev)) + } + + let maxBinomialHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((BinomialHeap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) + } + + let maxBinomialHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((BinomialHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let minBinomialHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((BinomialHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } + + let minBinomialHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((BinomialHeap.ofSeq false x), (x |> List.sort)) + } + + let minBinomialHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((BinomialHeap.empty false |> insertThruList x), (x |> List.sort)) + } + + let minBinomialHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((BinomialHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } (* IHeap generators from random ofSeq and/or snoc elements from random list *) - let maxPairingHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((PairingHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let maxPairingHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((PairingHeap.ofSeq true x), (x |> List.sort |> List.rev)) - } - - let maxPairingHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((PairingHeap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) - } - - let maxPairingHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((PairingHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let minPairingHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((PairingHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } - - let minPairingHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((PairingHeap.ofSeq false x), (x |> List.sort)) - } - - let minPairingHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((PairingHeap.empty false |> insertThruList x), (x |> List.sort)) - } - - let minPairingHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((PairingHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } + let maxPairingHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((PairingHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let maxPairingHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((PairingHeap.ofSeq true x), (x |> List.sort |> List.rev)) + } + + let maxPairingHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((PairingHeap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) + } + + let maxPairingHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((PairingHeap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let minPairingHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((PairingHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } + + let minPairingHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((PairingHeap.ofSeq false x), (x |> List.sort)) + } + + let minPairingHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((PairingHeap.empty false |> insertThruList x), (x |> List.sort)) + } + + let minPairingHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((PairingHeap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } diff --git a/tests/FSharpx.Collections.Experimental.Tests/HeapPriorityQueueTest.fs b/tests/FSharpx.Collections.Experimental.Tests/HeapPriorityQueueTest.fs index 3bdcbae7..c75f315e 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/HeapPriorityQueueTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/HeapPriorityQueueTest.fs @@ -9,102 +9,102 @@ module HeapPriorityQueueTest = [] let testHeapPriorityQueue = - testList "Experimental HeapPriorityQueue" [ - test "HeapPriorityQueue.empty queue should be HeapPriorityQueue.empty" { - let pq = HeapPriorityQueue.empty false + testList + "Experimental HeapPriorityQueue" + [ test "HeapPriorityQueue.empty queue should be HeapPriorityQueue.empty" { + let pq = HeapPriorityQueue.empty false - HeapPriorityQueue.isEmpty pq |> Expect.isTrue "" - HeapPriorityQueue.tryPeek pq |> Expect.isNone "" - HeapPriorityQueue.tryPop pq |> Expect.isNone "" - } + HeapPriorityQueue.isEmpty pq |> Expect.isTrue "" + HeapPriorityQueue.tryPeek pq |> Expect.isNone "" + HeapPriorityQueue.tryPop pq |> Expect.isNone "" + } - test "After adding an element to the PQ it shouldn't be HeapPriorityQueue.empty" { - let pq = HeapPriorityQueue.empty false |> HeapPriorityQueue.insert 1 + test "After adding an element to the PQ it shouldn't be HeapPriorityQueue.empty" { + let pq = HeapPriorityQueue.empty false |> HeapPriorityQueue.insert 1 - HeapPriorityQueue.isEmpty pq |> Expect.isFalse "" - } + HeapPriorityQueue.isEmpty pq |> Expect.isFalse "" + } - test "After adding an element to the PQ the element should be the smallest" { - let pq = HeapPriorityQueue.empty false |> HeapPriorityQueue.insert 1 + test "After adding an element to the PQ the element should be the smallest" { + let pq = HeapPriorityQueue.empty false |> HeapPriorityQueue.insert 1 - HeapPriorityQueue.tryPeek pq |> Expect.equal "" (Some 1) - HeapPriorityQueue.peek pq |> Expect.equal "" 1 - } + HeapPriorityQueue.tryPeek pq |> Expect.equal "" (Some 1) + HeapPriorityQueue.peek pq |> Expect.equal "" 1 + } - test "After adding an element to the PQ and popping it the PQ should be HeapPriorityQueue.empty" { - let pq = HeapPriorityQueue.empty false |> HeapPriorityQueue.insert 1 + test "After adding an element to the PQ and popping it the PQ should be HeapPriorityQueue.empty" { + let pq = HeapPriorityQueue.empty false |> HeapPriorityQueue.insert 1 - let element, newPQ = HeapPriorityQueue.pop pq - element |> Expect.equal "" 1 - HeapPriorityQueue.isEmpty newPQ |> Expect.isTrue "" + let element, newPQ = HeapPriorityQueue.pop pq + element |> Expect.equal "" 1 + HeapPriorityQueue.isEmpty newPQ |> Expect.isTrue "" - let element, newPQ = (HeapPriorityQueue.tryPop pq).Value - element |> Expect.equal "" 1 - HeapPriorityQueue.isEmpty newPQ |> Expect.isTrue "" - } + let element, newPQ = (HeapPriorityQueue.tryPop pq).Value + element |> Expect.equal "" 1 + HeapPriorityQueue.isEmpty newPQ |> Expect.isTrue "" + } - test "Adding multiple elements to the PQ should allow to HeapPriorityQueue.pop the smallest" { - let pq = - HeapPriorityQueue.empty false - |> HeapPriorityQueue.insert 1 - |> HeapPriorityQueue.insert 3 - |> HeapPriorityQueue.insert 0 - |> HeapPriorityQueue.insert 4 - |> HeapPriorityQueue.insert -3 + test "Adding multiple elements to the PQ should allow to HeapPriorityQueue.pop the smallest" { + let pq = + HeapPriorityQueue.empty false + |> HeapPriorityQueue.insert 1 + |> HeapPriorityQueue.insert 3 + |> HeapPriorityQueue.insert 0 + |> HeapPriorityQueue.insert 4 + |> HeapPriorityQueue.insert -3 - let element, newPQ = HeapPriorityQueue.pop pq - element |> Expect.equal "" -3 + let element, newPQ = HeapPriorityQueue.pop pq + element |> Expect.equal "" -3 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 0 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 0 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 1 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 1 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 3 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 3 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 4 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 4 - HeapPriorityQueue.isEmpty newPQ |> Expect.isTrue "" - } + HeapPriorityQueue.isEmpty newPQ |> Expect.isTrue "" + } - test "Adding multiple elements to a MaxPriorityQueue should allow to HeapPriorityQueue.pop the smallest" { - let pq = - HeapPriorityQueue.empty true - |> HeapPriorityQueue.insert 1 - |> HeapPriorityQueue.insert 3 - |> HeapPriorityQueue.insert 0 - |> HeapPriorityQueue.insert 4 - |> HeapPriorityQueue.insert -3 + test "Adding multiple elements to a MaxPriorityQueue should allow to HeapPriorityQueue.pop the smallest" { + let pq = + HeapPriorityQueue.empty true + |> HeapPriorityQueue.insert 1 + |> HeapPriorityQueue.insert 3 + |> HeapPriorityQueue.insert 0 + |> HeapPriorityQueue.insert 4 + |> HeapPriorityQueue.insert -3 - let element, newPQ = HeapPriorityQueue.pop pq - element |> Expect.equal "" 4 + let element, newPQ = HeapPriorityQueue.pop pq + element |> Expect.equal "" 4 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 3 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 3 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 1 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 1 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" 0 + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" 0 - let element, newPQ = HeapPriorityQueue.pop newPQ - element |> Expect.equal "" -3 - } + let element, newPQ = HeapPriorityQueue.pop newPQ + element |> Expect.equal "" -3 + } - test "Can use a PQ as a seq" { - let pq = - HeapPriorityQueue.empty false - |> HeapPriorityQueue.insert 15 - |> HeapPriorityQueue.insert 3 - |> HeapPriorityQueue.insert 0 - |> HeapPriorityQueue.insert 4 - |> HeapPriorityQueue.insert -3 + test "Can use a PQ as a seq" { + let pq = + HeapPriorityQueue.empty false + |> HeapPriorityQueue.insert 15 + |> HeapPriorityQueue.insert 3 + |> HeapPriorityQueue.insert 0 + |> HeapPriorityQueue.insert 4 + |> HeapPriorityQueue.insert -3 - pq |> Seq.toList |> Expect.equal "" [ -3; 0; 3; 4; 15 ] - } - ] + pq |> Seq.toList |> Expect.equal "" [ -3; 0; 3; 4; 15 ] + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/IQueueTest.fs b/tests/FSharpx.Collections.Experimental.Tests/IQueueTest.fs index 6d17e614..6622f88e 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/IQueueTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/IQueueTest.fs @@ -81,119 +81,120 @@ module IQueueTest = [] let testIQueue = - testList "Experimental IQueue" [ + testList + "Experimental IQueue" + [ + + test "allow to dequeue" { + emptyIQueues + |> Array.iter(fun eIQ -> ((eIQ.Snoc 1).Tail).IsEmpty |> Expect.isTrue "") + } + + test "allow to enqueue" { + emptyIQueues + |> Array.iter(fun eIQ -> ((eIQ.Snoc 1).Snoc 2).IsEmpty |> Expect.isFalse "") + } + + test "cons pattern discriminator - BankersQueue" { + let q = BankersQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - test "allow to dequeue" { - emptyIQueues - |> Array.iter(fun eIQ -> ((eIQ.Snoc 1).Tail).IsEmpty |> Expect.isTrue "") - } + let h1, t1 = + match q with + | BankersQueue.Cons(h, t) -> h, t + | _ -> "x", q - test "allow to enqueue" { - emptyIQueues - |> Array.iter(fun eIQ -> ((eIQ.Snoc 1).Snoc 2).IsEmpty |> Expect.isFalse "") - } - - test "cons pattern discriminator - BankersQueue" { - let q = BankersQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" + } - let h1, t1 = - match q with - | BankersQueue.Cons(h, t) -> h, t - | _ -> "x", q + test "cons pattern discriminator - BatchedQueue" { + let q = BatchedQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" - } + let h1, t1 = + match q with + | BatchedQueue.Cons(h, t) -> h, t + | _ -> "x", q - test "cons pattern discriminator - BatchedQueue" { - let q = BatchedQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" + } - let h1, t1 = - match q with - | BatchedQueue.Cons(h, t) -> h, t - | _ -> "x", q + test "cons pattern discriminator - HoodMelvilleQueue" { + let q = HoodMelvilleQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" - } + let h1, t1 = + match q with + | HoodMelvilleQueue.Cons(h, t) -> h, t + | _ -> "x", q - test "cons pattern discriminator - HoodMelvilleQueue" { - let q = HoodMelvilleQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" + } - let h1, t1 = - match q with - | HoodMelvilleQueue.Cons(h, t) -> h, t - | _ -> "x", q + test "cons pattern discriminator - PhysicistQueue" { + let q = PhysicistQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" - } + let h1, t1 = + match q with + | PhysicistQueue.Cons(h, t) -> h, t + | _ -> "x", q - test "cons pattern discriminator - PhysicistQueue" { - let q = PhysicistQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" + } - let h1, t1 = - match q with - | PhysicistQueue.Cons(h, t) -> h, t - | _ -> "x", q + test "empty queue should be empty" { emptyIQueues |> Array.iter(fun eIQ -> eIQ.IsEmpty |> Expect.isTrue "") } - ((h1 = "f") && (t1.Length = 5)) |> Expect.isTrue "" - } + test "fail if there is no head in the queue" { + emptyIQueues + |> Array.iter(fun eIQ -> + let ok = ref false - test "empty queue should be empty" { emptyIQueues |> Array.iter(fun eIQ -> eIQ.IsEmpty |> Expect.isTrue "") } + try + eIQ.Head |> ignore + with x when x = Exceptions.Empty -> + ok := true - test "fail if there is no head in the queue" { - emptyIQueues - |> Array.iter(fun eIQ -> - let ok = ref false + !ok |> Expect.isTrue "") + } - try - eIQ.Head |> ignore - with x when x = Exceptions.Empty -> - ok := true + test "fail if there is no tail in the queue" { + emptyIQueues + |> Array.iter(fun eIQ -> + let ok = ref false - !ok |> Expect.isTrue "") - } + try + eIQ.Tail |> ignore + with x when x = Exceptions.Empty -> + ok := true - test "fail if there is no tail in the queue" { - emptyIQueues - |> Array.iter(fun eIQ -> - let ok = ref false + !ok |> Expect.isTrue "") + } - try - eIQ.Tail |> ignore - with x when x = Exceptions.Empty -> - ok := true + test "give None if there is no head in the queue" { + emptyIQueues + |> Array.iter(fun eIQ -> eIQ.TryGetHead |> Expect.isNone "") + } - !ok |> Expect.isTrue "") - } + test "give None if there is no tail in the queue" { + emptyIQueues + |> Array.iter(fun eIQ -> eIQ.TryGetTail |> Expect.isNone "") + } - test "give None if there is no head in the queue" { - emptyIQueues - |> Array.iter(fun eIQ -> eIQ.TryGetHead |> Expect.isNone "") - } + test "TryUncons wind-down to None" { + let qBn = BankersQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue + let qBt = BatchedQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue + let qH = HoodMelvilleQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue + let qP = PhysicistQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue - test "give None if there is no tail in the queue" { - emptyIQueues - |> Array.iter(fun eIQ -> eIQ.TryGetTail |> Expect.isNone "") - } + let rec loop(iq: IQueue) = + match (iq.TryUncons) with + | Some(hd, tl) -> loop tl + | None -> () - test "TryUncons wind-down to None" { - let qBn = BankersQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue - let qBt = BatchedQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue - let qH = HoodMelvilleQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue - let qP = PhysicistQueue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] :> IQueue + loop qBn + loop qBt + loop qH + loop qP - let rec loop(iq: IQueue) = - match (iq.TryUncons) with - | Some(hd, tl) -> loop tl - | None -> () - - loop qBn - loop qBt - loop qH - loop qP - - true |> Expect.isTrue "" - } - ] + true |> Expect.isTrue "" + } ] [] let testIQueueProperties = @@ -203,617 +204,618 @@ module IQueueTest = | 0 -> List.head l | _ -> nth (List.tail l) (i - 1) - testList "Experimental IQueue properties" [ - - testPropertyWithConfig - config10k - "fold matches build list rev" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntGen) - <| fun (q, l) -> - q :?> BatchedQueue - |> BatchedQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev OfSeq" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntOfSeqGen) - <| fun (q, l) -> - q :?> BatchedQueue - |> BatchedQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev Snoc" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntSnocGen) - <| fun (q, l) -> - q :?> BatchedQueue - |> BatchedQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev HoodMelvilleQueue" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntGen) - <| fun (q, l) -> - q :?> HoodMelvilleQueue - |> HoodMelvilleQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev HoodMelvilleQueue OfSeq" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntOfSeqGen) - <| fun (q, l) -> - q :?> HoodMelvilleQueue - |> HoodMelvilleQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev HoodMelvilleQueue Snoc" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntSnocGen) - <| fun (q, l) -> - q :?> HoodMelvilleQueue - |> HoodMelvilleQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev PhysicistQueue" - (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntGen) - <| fun (q, l) -> - q :?> PhysicistQueue - |> PhysicistQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev PhysicistQueue OfSeq" - (Prop.forAll(Arb.fromGen(QueueGen.physicistQueueIntOfSeqGen)) - <| fun (q, l) -> - q :?> PhysicistQueue - |> PhysicistQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "fold matches build list rev PhysicistQueue Snoc" - (Prop.forAll(Arb.fromGen(QueueGen.physicistQueueIntSnocGen)) - <| fun (q, l) -> - q :?> PhysicistQueue - |> PhysicistQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list BatchedQueue" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntGen) - <| fun (q, l) -> - BatchedQueue.foldBack (fun elem l' -> elem :: l') (q :?> BatchedQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list BatchedQueue OfSeq" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntOfSeqGen) - <| fun (q, l) -> - BatchedQueue.foldBack (fun elem l' -> elem :: l') (q :?> BatchedQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list BatchedQueue Snoc" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntSnocGen) - <| fun (q, l) -> - BatchedQueue.foldBack (fun elem l' -> elem :: l') (q :?> BatchedQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list HoodMelvilleQueue" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntGen) - <| fun (q, l) -> - HoodMelvilleQueue.foldBack (fun elem l' -> elem :: l') (q :?> HoodMelvilleQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list HoodMelvilleQueue OfSeq" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntOfSeqGen) - <| fun (q, l) -> - HoodMelvilleQueue.foldBack (fun elem l' -> elem :: l') (q :?> HoodMelvilleQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list HoodMelvilleQueue Snoc" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntSnocGen) - <| fun (q, l) -> - HoodMelvilleQueue.foldBack (fun elem l' -> elem :: l') (q :?> HoodMelvilleQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list PhysicistQueue" - (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntGen) - <| fun (q, l) -> - PhysicistQueue.foldBack (fun elem l' -> elem :: l') (q :?> PhysicistQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list PhysicistQueue OfSeq" - (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntOfSeqGen) - <| fun (q, l) -> - PhysicistQueue.foldBack (fun elem l' -> elem :: l') (q :?> PhysicistQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "foldback matches build list PhysicistQueue Snoc" - (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntSnocGen) - <| fun (q, l) -> - PhysicistQueue.foldBack (fun elem l' -> elem :: l') (q :?> PhysicistQueue) [] = l - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 3" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 4" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 5" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 6" - (Prop.forAll(Arb.fromGen intGensStart1.[6]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 7" - (Prop.forAll(Arb.fromGen intGensStart1.[7]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 8" - (Prop.forAll(Arb.fromGen intGensStart1.[8]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 9" - (Prop.forAll(Arb.fromGen intGensStart1.[9]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 10" - (Prop.forAll(Arb.fromGen intGensStart1.[10]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue 11" - (Prop.forAll(Arb.fromGen intGensStart1.[11]) - <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 3" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 4" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 5" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 6" - (Prop.forAll(Arb.fromGen intGensStart1.[6]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 7" - (Prop.forAll(Arb.fromGen intGensStart1.[7]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 8" - (Prop.forAll(Arb.fromGen intGensStart1.[8]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 9" - (Prop.forAll(Arb.fromGen intGensStart1.[9]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 10" - (Prop.forAll(Arb.fromGen intGensStart1.[10]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get head from queue safely 11" - (Prop.forAll(Arb.fromGen intGensStart1.[11]) - <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 6" - (Prop.forAll(Arb.fromGen intGensStart2.[6]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 7" - (Prop.forAll(Arb.fromGen intGensStart2.[7]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 8" - (Prop.forAll(Arb.fromGen intGensStart2.[8]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 9" - (Prop.forAll(Arb.fromGen intGensStart2.[9]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 10" - (Prop.forAll(Arb.fromGen intGensStart2.[10]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue 11" - (Prop.forAll(Arb.fromGen intGensStart2.[11]) - <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 6" - (Prop.forAll(Arb.fromGen intGensStart2.[6]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 7" - (Prop.forAll(Arb.fromGen intGensStart2.[7]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 8" - (Prop.forAll(Arb.fromGen intGensStart2.[8]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 9" - (Prop.forAll(Arb.fromGen intGensStart2.[9]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 10" - (Prop.forAll(Arb.fromGen intGensStart2.[10]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "get tail from queue safely 11" - (Prop.forAll(Arb.fromGen intGensStart2.[11]) - <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 3" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 4" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 5" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 6" - (Prop.forAll(Arb.fromGen intGensStart1.[6]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 7" - (Prop.forAll(Arb.fromGen intGensStart1.[7]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 8" - (Prop.forAll(Arb.fromGen intGensStart1.[8]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 9" - (Prop.forAll(Arb.fromGen intGensStart1.[9]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 10" - (Prop.forAll(Arb.fromGen intGensStart1.[10]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "int queue builds and serializes 11" - (Prop.forAll(Arb.fromGen intGensStart1.[11]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "obj queue builds and serializes 0" - (Prop.forAll(Arb.fromGen objGens.[0]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "obj queue builds and serializes 1" - (Prop.forAll(Arb.fromGen objGens.[1]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "obj queue builds and serializes 2" - (Prop.forAll(Arb.fromGen objGens.[2]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "obj queue builds and serializes 3" - (Prop.forAll(Arb.fromGen objGens.[3]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "string queue builds and serializes 0" - (Prop.forAll(Arb.fromGen stringGens.[0]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "string queue builds and serializes 1" - (Prop.forAll(Arb.fromGen stringGens.[1]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "string queue builds and serializes 2" - (Prop.forAll(Arb.fromGen stringGens.[2]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "string queue builds and serializes 3" - (Prop.forAll(Arb.fromGen stringGens.[3]) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "reverse . reverse = id BankersQueue" - (Prop.forAll(Arb.fromGen QueueGen.bankersQueueObjGen) - <| fun (q, l) -> - q :?> BankersQueue - |> BankersQueue.rev - |> BankersQueue.rev - |> Seq.toList = (q |> Seq.toList) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "reverse . reverse = id BatchedQueue" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueObjGen) - <| fun (q, l) -> - q :?> BatchedQueue - |> BatchedQueue.rev - |> BatchedQueue.rev - |> Seq.toList = (q |> Seq.toList) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "reverse . reverse = idPhysicistQueue" - (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntGen) - <| fun (q, l) -> - q :?> PhysicistQueue - |> PhysicistQueue.rev - |> PhysicistQueue.rev - |> Seq.toList = (q |> Seq.toList) - |> classifyCollect q (q.Length())) - - testPropertyWithConfig - config10k - "ofList build and serializeBatchedQueue" - (Prop.forAll(Arb.fromGen QueueGen.batchedQueueOfListGen) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q q.Length) - - testPropertyWithConfig - config10k - "ofList build and serialize HoodMelvilleQueue" - (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueOfListGen) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q q.Length) - - testPropertyWithConfig - config10k - "ofList build and serializePhysicistQueue" - (Prop.forAll(Arb.fromGen QueueGen.physicistQueueOfListqGen) - <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q q.Length) - ] + testList + "Experimental IQueue properties" + [ + + testPropertyWithConfig + config10k + "fold matches build list rev" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntGen) + <| fun (q, l) -> + q :?> BatchedQueue + |> BatchedQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev OfSeq" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntOfSeqGen) + <| fun (q, l) -> + q :?> BatchedQueue + |> BatchedQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev Snoc" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntSnocGen) + <| fun (q, l) -> + q :?> BatchedQueue + |> BatchedQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev HoodMelvilleQueue" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntGen) + <| fun (q, l) -> + q :?> HoodMelvilleQueue + |> HoodMelvilleQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev HoodMelvilleQueue OfSeq" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntOfSeqGen) + <| fun (q, l) -> + q :?> HoodMelvilleQueue + |> HoodMelvilleQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev HoodMelvilleQueue Snoc" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntSnocGen) + <| fun (q, l) -> + q :?> HoodMelvilleQueue + |> HoodMelvilleQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev PhysicistQueue" + (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntGen) + <| fun (q, l) -> + q :?> PhysicistQueue + |> PhysicistQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev PhysicistQueue OfSeq" + (Prop.forAll(Arb.fromGen(QueueGen.physicistQueueIntOfSeqGen)) + <| fun (q, l) -> + q :?> PhysicistQueue + |> PhysicistQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "fold matches build list rev PhysicistQueue Snoc" + (Prop.forAll(Arb.fromGen(QueueGen.physicistQueueIntSnocGen)) + <| fun (q, l) -> + q :?> PhysicistQueue + |> PhysicistQueue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list BatchedQueue" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntGen) + <| fun (q, l) -> + BatchedQueue.foldBack (fun elem l' -> elem :: l') (q :?> BatchedQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list BatchedQueue OfSeq" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntOfSeqGen) + <| fun (q, l) -> + BatchedQueue.foldBack (fun elem l' -> elem :: l') (q :?> BatchedQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list BatchedQueue Snoc" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueIntSnocGen) + <| fun (q, l) -> + BatchedQueue.foldBack (fun elem l' -> elem :: l') (q :?> BatchedQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list HoodMelvilleQueue" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntGen) + <| fun (q, l) -> + HoodMelvilleQueue.foldBack (fun elem l' -> elem :: l') (q :?> HoodMelvilleQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list HoodMelvilleQueue OfSeq" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntOfSeqGen) + <| fun (q, l) -> + HoodMelvilleQueue.foldBack (fun elem l' -> elem :: l') (q :?> HoodMelvilleQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list HoodMelvilleQueue Snoc" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueIntSnocGen) + <| fun (q, l) -> + HoodMelvilleQueue.foldBack (fun elem l' -> elem :: l') (q :?> HoodMelvilleQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list PhysicistQueue" + (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntGen) + <| fun (q, l) -> + PhysicistQueue.foldBack (fun elem l' -> elem :: l') (q :?> PhysicistQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list PhysicistQueue OfSeq" + (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntOfSeqGen) + <| fun (q, l) -> + PhysicistQueue.foldBack (fun elem l' -> elem :: l') (q :?> PhysicistQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "foldback matches build list PhysicistQueue Snoc" + (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntSnocGen) + <| fun (q, l) -> + PhysicistQueue.foldBack (fun elem l' -> elem :: l') (q :?> PhysicistQueue) [] = l + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 3" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 4" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 5" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 6" + (Prop.forAll(Arb.fromGen intGensStart1.[6]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 7" + (Prop.forAll(Arb.fromGen intGensStart1.[7]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 8" + (Prop.forAll(Arb.fromGen intGensStart1.[8]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 9" + (Prop.forAll(Arb.fromGen intGensStart1.[9]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 10" + (Prop.forAll(Arb.fromGen intGensStart1.[10]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue 11" + (Prop.forAll(Arb.fromGen intGensStart1.[11]) + <| fun (q, l) -> q.Head = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 3" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 4" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 5" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 6" + (Prop.forAll(Arb.fromGen intGensStart1.[6]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 7" + (Prop.forAll(Arb.fromGen intGensStart1.[7]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 8" + (Prop.forAll(Arb.fromGen intGensStart1.[8]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 9" + (Prop.forAll(Arb.fromGen intGensStart1.[9]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 10" + (Prop.forAll(Arb.fromGen intGensStart1.[10]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get head from queue safely 11" + (Prop.forAll(Arb.fromGen intGensStart1.[11]) + <| fun (q, l) -> q.TryGetHead.Value = (nth l 0) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 6" + (Prop.forAll(Arb.fromGen intGensStart2.[6]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 7" + (Prop.forAll(Arb.fromGen intGensStart2.[7]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 8" + (Prop.forAll(Arb.fromGen intGensStart2.[8]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 9" + (Prop.forAll(Arb.fromGen intGensStart2.[9]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 10" + (Prop.forAll(Arb.fromGen intGensStart2.[10]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue 11" + (Prop.forAll(Arb.fromGen intGensStart2.[11]) + <| fun (q, l) -> q.Tail.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 6" + (Prop.forAll(Arb.fromGen intGensStart2.[6]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 7" + (Prop.forAll(Arb.fromGen intGensStart2.[7]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 8" + (Prop.forAll(Arb.fromGen intGensStart2.[8]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 9" + (Prop.forAll(Arb.fromGen intGensStart2.[9]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 10" + (Prop.forAll(Arb.fromGen intGensStart2.[10]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "get tail from queue safely 11" + (Prop.forAll(Arb.fromGen intGensStart2.[11]) + <| fun (q, l) -> q.TryGetTail.Value.Head = (nth l 1) |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 3" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 4" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 5" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 6" + (Prop.forAll(Arb.fromGen intGensStart1.[6]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 7" + (Prop.forAll(Arb.fromGen intGensStart1.[7]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 8" + (Prop.forAll(Arb.fromGen intGensStart1.[8]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 9" + (Prop.forAll(Arb.fromGen intGensStart1.[9]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 10" + (Prop.forAll(Arb.fromGen intGensStart1.[10]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "int queue builds and serializes 11" + (Prop.forAll(Arb.fromGen intGensStart1.[11]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "obj queue builds and serializes 0" + (Prop.forAll(Arb.fromGen objGens.[0]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "obj queue builds and serializes 1" + (Prop.forAll(Arb.fromGen objGens.[1]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "obj queue builds and serializes 2" + (Prop.forAll(Arb.fromGen objGens.[2]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "obj queue builds and serializes 3" + (Prop.forAll(Arb.fromGen objGens.[3]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "string queue builds and serializes 0" + (Prop.forAll(Arb.fromGen stringGens.[0]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "string queue builds and serializes 1" + (Prop.forAll(Arb.fromGen stringGens.[1]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "string queue builds and serializes 2" + (Prop.forAll(Arb.fromGen stringGens.[2]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "string queue builds and serializes 3" + (Prop.forAll(Arb.fromGen stringGens.[3]) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "reverse . reverse = id BankersQueue" + (Prop.forAll(Arb.fromGen QueueGen.bankersQueueObjGen) + <| fun (q, l) -> + q :?> BankersQueue + |> BankersQueue.rev + |> BankersQueue.rev + |> Seq.toList = (q |> Seq.toList) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "reverse . reverse = id BatchedQueue" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueObjGen) + <| fun (q, l) -> + q :?> BatchedQueue + |> BatchedQueue.rev + |> BatchedQueue.rev + |> Seq.toList = (q |> Seq.toList) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "reverse . reverse = idPhysicistQueue" + (Prop.forAll(Arb.fromGen QueueGen.physicistQueueIntGen) + <| fun (q, l) -> + q :?> PhysicistQueue + |> PhysicistQueue.rev + |> PhysicistQueue.rev + |> Seq.toList = (q |> Seq.toList) + |> classifyCollect q (q.Length())) + + testPropertyWithConfig + config10k + "ofList build and serializeBatchedQueue" + (Prop.forAll(Arb.fromGen QueueGen.batchedQueueOfListGen) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q q.Length) + + testPropertyWithConfig + config10k + "ofList build and serialize HoodMelvilleQueue" + (Prop.forAll(Arb.fromGen QueueGen.hoodMelvilleQueueOfListGen) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q q.Length) + + testPropertyWithConfig + config10k + "ofList build and serializePhysicistQueue" + (Prop.forAll(Arb.fromGen QueueGen.physicistQueueOfListqGen) + <| fun (q, l) -> q |> Seq.toList = l |> classifyCollect q q.Length) ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/ImplicitQueueTest.fs b/tests/FSharpx.Collections.Experimental.Tests/ImplicitQueueTest.fs index fdda08ac..9912f0e3 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/ImplicitQueueTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/ImplicitQueueTest.fs @@ -10,88 +10,88 @@ module ImplicitQueueTest = [] let testImplicitQueue = - testList "Experimental ImplicitQueue" [ - test "ImplicitQueue.empty queue should be ImplicitQueue.empty" { ImplicitQueue.isEmpty ImplicitQueue.empty |> Expect.isTrue "" } - - test "it should allow to enqueue" { - ImplicitQueue.empty - |> ImplicitQueue.snoc 1 - |> ImplicitQueue.snoc 2 - |> ImplicitQueue.isEmpty - |> Expect.isFalse "" - } - - test "it should allow to dequeue" { - ImplicitQueue.empty - |> ImplicitQueue.snoc 1 - |> ImplicitQueue.tail - |> ImplicitQueue.isEmpty - |> Expect.isTrue "" - } - - test "it should fail if there is no ImplicitQueue.head in the queue" { - let ok = ref false - - try - ImplicitQueue.empty |> ImplicitQueue.head |> ignore - with x when x = Exceptions.Empty -> - ok := true - - !ok |> Expect.isTrue "" - } - - test "it should give None if there is no ImplicitQueue.head in the queue" { - ImplicitQueue.empty |> ImplicitQueue.tryGetHead |> Expect.isNone "" - } - - test "it should fail if there is no ImplicitQueue.tail the queue" { - let ok = ref false - - try - ImplicitQueue.empty |> ImplicitQueue.tail |> ignore - with x when x = Exceptions.Empty -> - ok := true - - !ok |> Expect.isTrue "" - } - - test "it should give None if there is no ImplicitQueue.tail in the queue" { - ImplicitQueue.empty |> ImplicitQueue.tryGetTail |> Expect.isNone "" - } - - test "it should allow to get the ImplicitQueue.head from a queue" { - ImplicitQueue.empty - |> ImplicitQueue.snoc 1 - |> ImplicitQueue.snoc 2 - |> ImplicitQueue.head - |> Expect.equal "" 1 - } - - test "it should allow to get the ImplicitQueue.head from a queue safely" { - ImplicitQueue.empty - |> ImplicitQueue.snoc 1 - |> ImplicitQueue.snoc 2 - |> ImplicitQueue.tryGetHead - |> Expect.equal "" (Some 1) - } - - test "it should allow to get the ImplicitQueue.tail from the queue" { - ImplicitQueue.empty - |> ImplicitQueue.snoc "a" - |> ImplicitQueue.snoc "b" - |> ImplicitQueue.snoc "c" - |> ImplicitQueue.tail - |> ImplicitQueue.head - |> Expect.equal "" "b" - } - - test "it should allow to get the ImplicitQueue.tail from a queue safely" { - let value = - ImplicitQueue.empty - |> ImplicitQueue.snoc 1 - |> ImplicitQueue.snoc 2 - |> ImplicitQueue.tryGetTail - - value.Value |> ImplicitQueue.head |> Expect.equal "" 2 - } - ] + testList + "Experimental ImplicitQueue" + [ test "ImplicitQueue.empty queue should be ImplicitQueue.empty" { ImplicitQueue.isEmpty ImplicitQueue.empty |> Expect.isTrue "" } + + test "it should allow to enqueue" { + ImplicitQueue.empty + |> ImplicitQueue.snoc 1 + |> ImplicitQueue.snoc 2 + |> ImplicitQueue.isEmpty + |> Expect.isFalse "" + } + + test "it should allow to dequeue" { + ImplicitQueue.empty + |> ImplicitQueue.snoc 1 + |> ImplicitQueue.tail + |> ImplicitQueue.isEmpty + |> Expect.isTrue "" + } + + test "it should fail if there is no ImplicitQueue.head in the queue" { + let ok = ref false + + try + ImplicitQueue.empty |> ImplicitQueue.head |> ignore + with x when x = Exceptions.Empty -> + ok := true + + !ok |> Expect.isTrue "" + } + + test "it should give None if there is no ImplicitQueue.head in the queue" { + ImplicitQueue.empty |> ImplicitQueue.tryGetHead |> Expect.isNone "" + } + + test "it should fail if there is no ImplicitQueue.tail the queue" { + let ok = ref false + + try + ImplicitQueue.empty |> ImplicitQueue.tail |> ignore + with x when x = Exceptions.Empty -> + ok := true + + !ok |> Expect.isTrue "" + } + + test "it should give None if there is no ImplicitQueue.tail in the queue" { + ImplicitQueue.empty |> ImplicitQueue.tryGetTail |> Expect.isNone "" + } + + test "it should allow to get the ImplicitQueue.head from a queue" { + ImplicitQueue.empty + |> ImplicitQueue.snoc 1 + |> ImplicitQueue.snoc 2 + |> ImplicitQueue.head + |> Expect.equal "" 1 + } + + test "it should allow to get the ImplicitQueue.head from a queue safely" { + ImplicitQueue.empty + |> ImplicitQueue.snoc 1 + |> ImplicitQueue.snoc 2 + |> ImplicitQueue.tryGetHead + |> Expect.equal "" (Some 1) + } + + test "it should allow to get the ImplicitQueue.tail from the queue" { + ImplicitQueue.empty + |> ImplicitQueue.snoc "a" + |> ImplicitQueue.snoc "b" + |> ImplicitQueue.snoc "c" + |> ImplicitQueue.tail + |> ImplicitQueue.head + |> Expect.equal "" "b" + } + + test "it should allow to get the ImplicitQueue.tail from a queue safely" { + let value = + ImplicitQueue.empty + |> ImplicitQueue.snoc 1 + |> ImplicitQueue.snoc 2 + |> ImplicitQueue.tryGetTail + + value.Value |> ImplicitQueue.head |> Expect.equal "" 2 + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/IndexedRoseTreeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/IndexedRoseTreeTest.fs index 3c374b29..5d2052e3 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/IndexedRoseTreeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/IndexedRoseTreeTest.fs @@ -13,15 +13,14 @@ module IndexedRoseTreeTest = let atree = tree 1 [ tree 2 [ tree 3 [] ]; tree 4 [ tree 5 [ tree 6 [] ] ] ] let ctree = - tree "f" [ - tree "b" [ tree "a" []; tree "d" [ tree "c" []; tree "e" [] ] ] - tree "g" [ tree "i" [ tree "h" [] ] ] - ] + tree + "f" + [ tree "b" [ tree "a" []; tree "d" [ tree "c" []; tree "e" [] ] ] + tree "g" [ tree "i" [ tree "h" [] ] ] ] - type HtmlElement = { - TagName: string - Attributes: (string * string) list - } + type HtmlElement = + { TagName: string + Attributes: (string * string) list } type HtmlNode = | Element of HtmlElement @@ -60,105 +59,105 @@ module IndexedRoseTreeTest = let htmldoc = tree (elem "body") [ tree (elem "div") [ text "hello world" ] ] - testList "Experimental IndexedRoseTree" [ - test "preOrder works" { - let actual = IndexedRoseTree.preOrder ctree |> Seq.toList - Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual - } + testList + "Experimental IndexedRoseTree" + [ test "preOrder works" { + let actual = IndexedRoseTree.preOrder ctree |> Seq.toList + Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual + } - test "postOrder works" { - let actual = IndexedRoseTree.postOrder ctree |> Seq.toList - Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual - } + test "postOrder works" { + let actual = IndexedRoseTree.postOrder ctree |> Seq.toList + Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual + } - test "map" { - let actual = IndexedRoseTree.map ((+) 1) atree - let expected = tree 2 [ tree 3 [ tree 4 [] ]; tree 5 [ tree 6 [ tree 7 [] ] ] ] - Expect.equal "" expected actual - } + test "map" { + let actual = IndexedRoseTree.map ((+) 1) atree + let expected = tree 2 [ tree 3 [ tree 4 [] ]; tree 5 [ tree 6 [ tree 7 [] ] ] ] + Expect.equal "" expected actual + } - test "fold via preOrder" { - let actual = IndexedRoseTree.preOrder atree |> Seq.fold (*) 1 - Expect.equal "" 720 actual - } + test "fold via preOrder" { + let actual = IndexedRoseTree.preOrder atree |> Seq.fold (*) 1 + Expect.equal "" 720 actual + } - test "bind" { - let wrapText = - function - | Text t -> tree (elem "span") [ text t ] - | x -> IndexedRoseTree.singleton x + test "bind" { + let wrapText = + function + | Text t -> tree (elem "span") [ text t ] + | x -> IndexedRoseTree.singleton x - let newDoc = htmldoc |> IndexedRoseTree.bind wrapText + let newDoc = htmldoc |> IndexedRoseTree.bind wrapText - let expected = - tree (elem "body") [ tree (elem "div") [ tree (elem "span") [ text "hello world" ] ] ] + let expected = + tree (elem "body") [ tree (elem "div") [ tree (elem "span") [ text "hello world" ] ] ] - Expect.equal "" expected newDoc - } + Expect.equal "" expected newDoc + } - test "unfold" { - let a = IndexedRoseTree.unfold (fun i -> i, PersistentVector.ofSeq { i + 1 .. 3 }) 0 + test "unfold" { + let a = IndexedRoseTree.unfold (fun i -> i, PersistentVector.ofSeq { i + 1 .. 3 }) 0 - let expected = - tree 0 [ tree 1 [ tree 2 [ tree 3 [] ]; tree 3 [] ]; tree 2 [ tree 3 [] ]; tree 3 [] ] + let expected = + tree 0 [ tree 1 [ tree 2 [ tree 3 [] ]; tree 3 [] ]; tree 2 [ tree 3 [] ]; tree 3 [] ] - Expect.equal "" expected a - } + Expect.equal "" expected a + } - test "functor laws" { - //fsCheck version of functor and monad laws stackoverflows - let map = IndexedRoseTree.map + test "functor laws" { + //fsCheck version of functor and monad laws stackoverflows + let map = IndexedRoseTree.map - //preserves identity - ((map id iRT) = iRT) |> Expect.isTrue "" - ((map id singleRT) = singleRT) |> Expect.isTrue "" + //preserves identity + ((map id iRT) = iRT) |> Expect.isTrue "" + ((map id singleRT) = singleRT) |> Expect.isTrue "" - let f = (fun x -> x + 5) - let g = (fun x -> x - 2) + let f = (fun x -> x + 5) + let g = (fun x -> x - 2) - //preserves composition - map (f << g) iRT = (map f << map g) iRT |> Expect.isTrue "" + //preserves composition + map (f << g) iRT = (map f << map g) iRT |> Expect.isTrue "" - map (f << g) singleRT = (map f << map g) singleRT |> Expect.isTrue "" - } + map (f << g) singleRT = (map f << map g) singleRT |> Expect.isTrue "" + } - test "monad laws" { - //fsCheck version of functor and monad laws stackoverflows - let inline (>>=) m f = - IndexedRoseTree.bind f m + test "monad laws" { + //fsCheck version of functor and monad laws stackoverflows + let inline (>>=) m f = + IndexedRoseTree.bind f m - let ret = IndexedRoseTree.singleton + let ret = IndexedRoseTree.singleton - let myF x = - IndexedRoseTree.create - x - (PersistentVector.empty - |> PersistentVector.conj(IndexedRoseTree.singleton x) - |> PersistentVector.conj(IndexedRoseTree.singleton x)) + let myF x = + IndexedRoseTree.create + x + (PersistentVector.empty + |> PersistentVector.conj(IndexedRoseTree.singleton x) + |> PersistentVector.conj(IndexedRoseTree.singleton x)) - let a = 1 + let a = 1 - //left identity - ret a >>= myF = myF a |> Expect.isTrue "" + //left identity + ret a >>= myF = myF a |> Expect.isTrue "" - //right identity - iRT >>= ret = iRT |> Expect.isTrue "" - singleRT >>= ret = singleRT |> Expect.isTrue "" + //right identity + iRT >>= ret = iRT |> Expect.isTrue "" + singleRT >>= ret = singleRT |> Expect.isTrue "" - //associativity - let myG x = - IndexedRoseTree.create - (x = x) - (PersistentVector.empty - |> PersistentVector.conj(IndexedRoseTree.singleton(x = x)) - |> PersistentVector.conj(IndexedRoseTree.singleton(x = x))) + //associativity + let myG x = + IndexedRoseTree.create + (x = x) + (PersistentVector.empty + |> PersistentVector.conj(IndexedRoseTree.singleton(x = x)) + |> PersistentVector.conj(IndexedRoseTree.singleton(x = x))) - let a' = (iRT >>= myF) >>= myG - let b' = iRT >>= (fun x -> myF x >>= myG) - a' = b' |> Expect.isTrue "" + let a' = (iRT >>= myF) >>= myG + let b' = iRT >>= (fun x -> myF x >>= myG) + a' = b' |> Expect.isTrue "" - let a'' = (singleRT >>= myF) >>= myG - let b'' = singleRT >>= (fun x -> myF x >>= myG) - a'' = b'' |> Expect.isTrue "" - } - ] + let a'' = (singleRT >>= myF) >>= myG + let b'' = singleRT >>= (fun x -> myF x >>= myG) + a'' = b'' |> Expect.isTrue "" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/IntMapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/IntMapTest.fs index 14935b5c..28d6094d 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/IntMapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/IntMapTest.fs @@ -16,787 +16,784 @@ module IntMapTest = let testPropertyWithConfig config = testPropertyWithConfig { config with - arbitrary = typeof :: config.arbitrary - } + arbitrary = typeof :: config.arbitrary } [] let testIntMap = let employeeDept = IntMap.ofList([ (1, 2); (3, 1) ]) - testList "Experimental IntMap" [ - test "test isEmpty" { - IntMap.isEmpty IntMap.empty |> Expect.isTrue "" - (1, 'a') ||> IntMap.singleton |> IntMap.isEmpty |> Expect.isFalse "" - } + testList + "Experimental IntMap" + [ test "test isEmpty" { + IntMap.isEmpty IntMap.empty |> Expect.isTrue "" + (1, 'a') ||> IntMap.singleton |> IntMap.isEmpty |> Expect.isFalse "" + } - test "test size" { - IntMap.size IntMap.empty |> Expect.equal "" 0 - IntMap.singleton 1 'a' |> IntMap.size |> Expect.equal "" 1 + test "test size" { + IntMap.size IntMap.empty |> Expect.equal "" 0 + IntMap.singleton 1 'a' |> IntMap.size |> Expect.equal "" 1 + + IntMap.ofList [ (1, 'a'); (2, 'b'); (3, 'c') ] + |> IntMap.size + |> Expect.equal "" 3 + } - IntMap.ofList [ (1, 'a'); (2, 'b'); (3, 'c') ] - |> IntMap.size - |> Expect.equal "" 3 - } + test "test member" { + IntMap.exists 5 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.isTrue "" - test "test member" { - IntMap.exists 5 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.isTrue "" + IntMap.exists 1 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.isFalse "" + } - IntMap.exists 1 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.isFalse "" - } + test "test notMember" { + IntMap.notExists 5 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.isFalse "" - test "test notMember" { - IntMap.notExists 5 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.isFalse "" + IntMap.notExists 1 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.isTrue "" + } - IntMap.notExists 1 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.isTrue "" - } + test "test tryFind" { + let deptCountry = IntMap.ofList([ (1, 1); (2, 2) ]) + let countryCurrency = IntMap.ofList([ (1, 2); (2, 1) ]) - test "test tryFind" { - let deptCountry = IntMap.ofList([ (1, 1); (2, 2) ]) - let countryCurrency = IntMap.ofList([ (1, 2); (2, 1) ]) + let employeeCurrency name = + match IntMap.tryFind name employeeDept with + | Some dept -> + match IntMap.tryFind dept deptCountry with + | Some country -> IntMap.tryFind country countryCurrency + | None -> None + | None -> None - let employeeCurrency name = - match IntMap.tryFind name employeeDept with - | Some dept -> - match IntMap.tryFind dept deptCountry with - | Some country -> IntMap.tryFind country countryCurrency - | None -> None - | None -> None + employeeCurrency 1 |> Expect.equal "" (Some 1) + employeeCurrency 2 |> Expect.isNone "" + } - employeeCurrency 1 |> Expect.equal "" (Some 1) - employeeCurrency 2 |> Expect.isNone "" - } + test "test find" { + let employeeDept = IntMap.ofList([ (1, 1); (2, 2) ]) + Expect.equal "" 2 <| IntMap.find 2 employeeDept + } - test "test find" { - let employeeDept = IntMap.ofList([ (1, 1); (2, 2) ]) - Expect.equal "" 2 <| IntMap.find 2 employeeDept - } + test "test findWithDefault" { + IntMap.findWithDefault 'x' 1 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.equal "" 'x' - test "test findWithDefault" { - IntMap.findWithDefault 'x' 1 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.equal "" 'x' + IntMap.findWithDefault 'x' 5 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.equal "" 'a' + } - IntMap.findWithDefault 'x' 5 (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.equal "" 'a' - } + test "test tryFindLT" { + IntMap.tryFindLT 3 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.isNone "" - test "test tryFindLT" { - IntMap.tryFindLT 3 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.isNone "" + IntMap.tryFindLT 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.equal "" (Some(3, 'a')) + } - IntMap.tryFindLT 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.equal "" (Some(3, 'a')) - } + test "test tryFindGT" { + IntMap.tryFindGT 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.equal "" (Some(5, 'b')) - test "test tryFindGT" { - IntMap.tryFindGT 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.equal "" (Some(5, 'b')) + IntMap.tryFindGT 5 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.isNone "" + } - IntMap.tryFindGT 5 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.isNone "" - } + test "test tryFindLE" { + IntMap.tryFindLE 2 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.isNone "" - test "test tryFindLE" { - IntMap.tryFindLE 2 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.isNone "" + IntMap.tryFindLE 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.equal "" (Some(3, 'a')) - IntMap.tryFindLE 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.equal "" (Some(3, 'a')) + IntMap.tryFindLE 5 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.equal "" (Some(5, 'b')) + } - IntMap.tryFindLE 5 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.equal "" (Some(5, 'b')) - } + test "test tryFindGE" { + IntMap.tryFindGE 3 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.equal "" (Some(3, 'a')) - test "test tryFindGE" { - IntMap.tryFindGE 3 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.equal "" (Some(3, 'a')) + IntMap.tryFindGE 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.equal "" (Some(5, 'b')) - IntMap.tryFindGE 4 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.equal "" (Some(5, 'b')) + IntMap.tryFindGE 6 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) + |> Expect.isNone "" + } - IntMap.tryFindGE 6 (IntMap.ofList [ (3, 'a'); (5, 'b') ]) - |> Expect.isNone "" - } + // Construction - // Construction + test "test empty" { + IntMap.empty |> Expect.equal "" (IntMap.ofList []) + IntMap.size IntMap.empty |> Expect.equal "" 0 + } - test "test empty" { - IntMap.empty |> Expect.equal "" (IntMap.ofList []) - IntMap.size IntMap.empty |> Expect.equal "" 0 - } + test "test singleton" { + IntMap.singleton 1 'a' |> Expect.equal "" (IntMap.ofList [ (1, 'a') ]) + IntMap.size(IntMap.singleton 1 'a') |> Expect.equal "" 1 + } - test "test singleton" { - IntMap.singleton 1 'a' |> Expect.equal "" (IntMap.ofList [ (1, 'a') ]) - IntMap.size(IntMap.singleton 1 'a') |> Expect.equal "" 1 - } + test "test insert" { + IntMap.insert 5 'x' (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.equal "" (IntMap.ofList [ (3, 'b'); (5, 'x') ]) - test "test insert" { - IntMap.insert 5 'x' (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.equal "" (IntMap.ofList [ (3, 'b'); (5, 'x') ]) + IntMap.insert 7 'x' (IntMap.ofList [ (5, 'a'); (3, 'b') ]) + |> Expect.equal "" (IntMap.ofList [ (3, 'b'); (5, 'a'); (7, 'x') ]) - IntMap.insert 7 'x' (IntMap.ofList [ (5, 'a'); (3, 'b') ]) - |> Expect.equal "" (IntMap.ofList [ (3, 'b'); (5, 'a'); (7, 'x') ]) + IntMap.insert 5 'x' IntMap.empty + |> Expect.equal "" (IntMap.singleton 5 'x') + } - IntMap.insert 5 'x' IntMap.empty - |> Expect.equal "" (IntMap.singleton 5 'x') - } + test "test insertWith" { + IntMap.insertWith (+) 5 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "xxxa") ]) - test "test insertWith" { - IntMap.insertWith (+) 5 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "xxxa") ]) + IntMap.insertWith (+) 7 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "xxx") ]) - IntMap.insertWith (+) 7 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "xxx") ]) + IntMap.insertWith (+) 5 "xxx" IntMap.empty + |> Expect.equal "" (IntMap.singleton 5 "xxx") + } - IntMap.insertWith (+) 5 "xxx" IntMap.empty - |> Expect.equal "" (IntMap.singleton 5 "xxx") - } + test "test insertWithKey" { + let f key new_value old_value = + string key + ":" + new_value + "|" + old_value - test "test insertWithKey" { - let f key new_value old_value = - string key + ":" + new_value + "|" + old_value + IntMap.insertWithKey f 5 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:xxx|a") ]) - IntMap.insertWithKey f 5 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:xxx|a") ]) + IntMap.insertWithKey f 7 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "xxx") ]) - IntMap.insertWithKey f 7 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "xxx") ]) + IntMap.insertWithKey f 5 "xxx" IntMap.empty + |> Expect.equal "" (IntMap.singleton 5 "xxx") + } - IntMap.insertWithKey f 5 "xxx" IntMap.empty - |> Expect.equal "" (IntMap.singleton 5 "xxx") - } + test "test insertTryFindWithKey" { + let f key new_value old_value = + string key + ":" + new_value + "|" + old_value - test "test insertTryFindWithKey" { - let f key new_value old_value = - string key + ":" + new_value + "|" + old_value + IntMap.insertTryFindWithKey f 5 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some "a", IntMap.ofList [ (3, "b"); (5, "5:xxx|a") ]) - IntMap.insertTryFindWithKey f 5 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some "a", IntMap.ofList [ (3, "b"); (5, "5:xxx|a") ]) + let fnd, map = + IntMap.insertTryFindWithKey f 2 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - let fnd, map = - IntMap.insertTryFindWithKey f 2 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + fnd |> Expect.isNone "" - fnd |> Expect.isNone "" + map + |> Expect.equal "" (IntMap.ofList [ (2, "xxx"); (3, "b"); (5, "a") ]) - map - |> Expect.equal "" (IntMap.ofList [ (2, "xxx"); (3, "b"); (5, "a") ]) + let fnd, map = + IntMap.insertTryFindWithKey f 7 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) - let fnd, map = - IntMap.insertTryFindWithKey f 7 "xxx" (IntMap.ofList [ (5, "a"); (3, "b") ]) + fnd |> Expect.isNone "" - fnd |> Expect.isNone "" + map + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "xxx") ]) - map - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "xxx") ]) + let fnd, map = IntMap.insertTryFindWithKey f 5 "xxx" IntMap.empty + fnd |> Expect.isNone "" + map |> Expect.equal "" (IntMap.singleton 5 "xxx") + } - let fnd, map = IntMap.insertTryFindWithKey f 5 "xxx" IntMap.empty - fnd |> Expect.isNone "" - map |> Expect.equal "" (IntMap.singleton 5 "xxx") - } + // Delete/Update - // Delete/Update + test "test delete" { + IntMap.delete 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 3 "b") - test "test delete" { - IntMap.delete 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 3 "b") + IntMap.delete 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.delete 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.delete 5 IntMap.empty |> Expect.equal "" IntMap.empty + } - IntMap.delete 5 IntMap.empty |> Expect.equal "" IntMap.empty - } + test "test adjust" { + IntMap.adjust ((+) "new ") 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "new a") ]) - test "test adjust" { - IntMap.adjust ((+) "new ") 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "new a") ]) + IntMap.adjust ((+) "new ") 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.adjust ((+) "new ") 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.adjust ((+) "new ") 7 IntMap.empty + |> Expect.equal "" IntMap.empty + } - IntMap.adjust ((+) "new ") 7 IntMap.empty - |> Expect.equal "" IntMap.empty - } + test "test adjustWithKey" { + let f key x = + (string key) + ":new " + x - test "test adjustWithKey" { - let f key x = - (string key) + ":new " + x + IntMap.adjustWithKey f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:new a") ]) - IntMap.adjustWithKey f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:new a") ]) + IntMap.adjustWithKey f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.adjustWithKey f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.adjustWithKey f 7 IntMap.empty |> Expect.equal "" IntMap.empty + } - IntMap.adjustWithKey f 7 IntMap.empty |> Expect.equal "" IntMap.empty - } + test "test update" { + let f x = + if x = "a" then Some "new a" else None - test "test update" { - let f x = - if x = "a" then Some "new a" else None + IntMap.update f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "new a") ]) - IntMap.update f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "new a") ]) + IntMap.update f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.update f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.update f 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 5 "a") + } - IntMap.update f 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 5 "a") - } + test "test updateWithKey" { + let f k x = + if x = "a" then Some((string k) + ":new a") else None - test "test updateWithKey" { - let f k x = - if x = "a" then Some((string k) + ":new a") else None + IntMap.updateWithKey f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:new a") ]) - IntMap.updateWithKey f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:new a") ]) + IntMap.updateWithKey f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.updateWithKey f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.updateWithKey f 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 5 "a") + } - IntMap.updateWithKey f 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 5 "a") - } + test "test updateTryFindWithKey" { + let f k x = + if x = "a" then Some((string k) + ":new a") else None - test "test updateTryFindWithKey" { - let f k x = - if x = "a" then Some((string k) + ":new a") else None + IntMap.updateTryFindWithKey f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some "a", IntMap.ofList [ (3, "b"); (5, "5:new a") ]) - IntMap.updateTryFindWithKey f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some "a", IntMap.ofList [ (3, "b"); (5, "5:new a") ]) + let fnd, map = + IntMap.updateTryFindWithKey f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - let fnd, map = - IntMap.updateTryFindWithKey f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + fnd |> Expect.isNone "" + map |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - fnd |> Expect.isNone "" - map |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.updateTryFindWithKey f 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some "b", IntMap.singleton 5 "a") + } - IntMap.updateTryFindWithKey f 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some "b", IntMap.singleton 5 "a") - } + test "test alter" { + let f _ = None + let g _ = Some "c" - test "test alter" { - let f _ = None - let g _ = Some "c" + IntMap.alter f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.alter f 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + IntMap.alter f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 3 "b") - IntMap.alter f 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 3 "b") + IntMap.alter g 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "c") ]) - IntMap.alter g 7 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "c") ]) + IntMap.alter g 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "c") ]) + } - IntMap.alter g 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "c") ]) - } + // Combine - // Combine + test "test append" { + IntMap.append (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "C") ]) + } - test "test append" { - IntMap.append (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "C") ]) - } + test "test appendWith" { + IntMap.appendWith (+) (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "aA"); (7, "C") ]) + } - test "test appendWith" { - IntMap.appendWith (+) (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "aA"); (7, "C") ]) - } - - test "test appendWithKey" { - let f key left_value right_value = - (string key) + ":" + left_value + "|" + right_value - - IntMap.appendWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:a|A"); (7, "C") ]) - } - - test "test concat" { - IntMap.concat [ - IntMap.ofList [ (5, "a"); (3, "b") ] - IntMap.ofList [ (5, "A"); (7, "C") ] - IntMap.ofList [ (5, "A3"); (3, "B3") ] - ] - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "C") ]) - - IntMap.concat [ - IntMap.ofList [ (5, "A3"); (3, "B3") ] - IntMap.ofList [ (5, "A"); (7, "C") ] - IntMap.ofList [ (5, "a"); (3, "b") ] - ] - |> Expect.equal "" (IntMap.ofList [ (3, "B3"); (5, "A3"); (7, "C") ]) - } - - test "test concatWith" { - IntMap.concatWith (+) [ - IntMap.ofList [ (5, "a"); (3, "b") ] - IntMap.ofList [ (5, "A"); (7, "C") ] - IntMap.ofList [ (5, "A3"); (3, "B3") ] - ] - |> Expect.equal "" (IntMap.ofList [ (3, "bB3"); (5, "aAA3"); (7, "C") ]) - } - - test "test difference" { - IntMap.difference (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.singleton 3 "b") - } - - test "test differenceWith" { - let f al ar = - if al = "b" then Some(al + ":" + ar) else None - - IntMap.differenceWith f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (3, "B"); (7, "C") ]) - |> Expect.equal "" (IntMap.singleton 3 "b:B") - } - - test "test differenceWithKey" { - let f k al ar = - if al = "b" then - Some((string k) + ":" + al + "|" + ar) - else - None + test "test appendWithKey" { + let f key left_value right_value = + (string key) + ":" + left_value + "|" + right_value - IntMap.differenceWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (3, "B"); (10, "C") ]) - |> Expect.equal "" (IntMap.singleton 3 "3:b|B") - } + IntMap.appendWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:a|A"); (7, "C") ]) + } - test "test intersection" { - IntMap.intersection (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.singleton 5 "a") - } - - test "test intersectionWith" { - IntMap.intersectionWith (+) (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.singleton 5 "aA") - } + test "test concat" { + IntMap.concat + [ IntMap.ofList [ (5, "a"); (3, "b") ] + IntMap.ofList [ (5, "A"); (7, "C") ] + IntMap.ofList [ (5, "A3"); (3, "B3") ] ] + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a"); (7, "C") ]) - test "test intersectionWithKey" { - let f k al ar = - (string k) + ":" + al + "|" + ar + IntMap.concat + [ IntMap.ofList [ (5, "A3"); (3, "B3") ] + IntMap.ofList [ (5, "A"); (7, "C") ] + IntMap.ofList [ (5, "a"); (3, "b") ] ] + |> Expect.equal "" (IntMap.ofList [ (3, "B3"); (5, "A3"); (7, "C") ]) + } + + test "test concatWith" { + IntMap.concatWith + (+) + [ IntMap.ofList [ (5, "a"); (3, "b") ] + IntMap.ofList [ (5, "A"); (7, "C") ] + IntMap.ofList [ (5, "A3"); (3, "B3") ] ] + |> Expect.equal "" (IntMap.ofList [ (3, "bB3"); (5, "aAA3"); (7, "C") ]) + } + + test "test difference" { + IntMap.difference (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.singleton 3 "b") + } - IntMap.intersectionWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) - |> Expect.equal "" (IntMap.singleton 5 "5:a|A") - } + test "test differenceWith" { + let f al ar = + if al = "b" then Some(al + ":" + ar) else None - // Traversal + IntMap.differenceWith f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (3, "B"); (7, "C") ]) + |> Expect.equal "" (IntMap.singleton 3 "b:B") + } - test "test map" { - IntMap.map ((fun f a b -> f b a) (+) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "bx"); (5, "ax") ]) - } - - test "test mapWithKey" { - let f key x = - (string key) + ":" + x + test "test differenceWithKey" { + let f k al ar = + if al = "b" then + Some((string k) + ":" + al + "|" + ar) + else + None - IntMap.mapWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "3:b"); (5, "5:a") ]) - } + IntMap.differenceWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (3, "B"); (10, "C") ]) + |> Expect.equal "" (IntMap.singleton 3 "3:b|B") + } - test "test mapAccum" { - let f a b = - (a + b, b + "X") - - IntMap.mapAccum f "Everything: " (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" ("Everything: ba", IntMap.ofList [ (3, "bX"); (5, "aX") ]) - } - - test "test mapAccumWithKey" { - let f a k b = - (a + " " + (string k) + "-" + b, b + "X") + test "test intersection" { + IntMap.intersection (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.singleton 5 "a") + } - IntMap.mapAccumWithKey f "Everything:" (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" ("Everything: 3-b 5-a", IntMap.ofList [ (3, "bX"); (5, "aX") ]) - } + test "test intersectionWith" { + IntMap.intersectionWith (+) (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.singleton 5 "aA") + } - test "test mapKeys" { - IntMap.mapKeys ((fun f a b -> f b a) (+) 1) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (4, "b"); (6, "a") ]) + test "test intersectionWithKey" { + let f k al ar = + (string k) + ":" + al + "|" + ar - IntMap.mapKeys (fun _ -> 1) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) - |> Expect.equal "" (IntMap.singleton 1 "c") + IntMap.intersectionWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) (IntMap.ofList [ (5, "A"); (7, "C") ]) + |> Expect.equal "" (IntMap.singleton 5 "5:a|A") + } - IntMap.mapKeys (fun _ -> 3) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) - |> Expect.equal "" (IntMap.singleton 3 "c") - } + // Traversal - test "test mapKeysWith" { - IntMap.mapKeysWith (+) (fun _ -> 1) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) - |> Expect.equal "" (IntMap.singleton 1 "cdab") + test "test map" { + IntMap.map ((fun f a b -> f b a) (+) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "bx"); (5, "ax") ]) + } - IntMap.mapKeysWith (+) (fun _ -> 3) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) - |> Expect.equal "" (IntMap.singleton 3 "cdab") - } + test "test mapWithKey" { + let f key x = + (string key) + ":" + x - // Conversion + IntMap.mapWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "3:b"); (5, "5:a") ]) + } - test "test values" { - IntMap.values(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" [ "b"; "a" ] + test "test mapAccum" { + let f a b = + (a + b, b + "X") + + IntMap.mapAccum f "Everything: " (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" ("Everything: ba", IntMap.ofList [ (3, "bX"); (5, "aX") ]) + } + + test "test mapAccumWithKey" { + let f a k b = + (a + " " + (string k) + "-" + b, b + "X") - IntMap.values IntMap.empty |> Expect.equal "" [] - } + IntMap.mapAccumWithKey f "Everything:" (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" ("Everything: 3-b 5-a", IntMap.ofList [ (3, "bX"); (5, "aX") ]) + } - test "test keys" { - IntMap.keys(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" [ 3; 5 ] + test "test mapKeys" { + IntMap.mapKeys ((fun f a b -> f b a) (+) 1) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (4, "b"); (6, "a") ]) - IntMap.keys IntMap.empty |> Expect.equal "" [] - } + IntMap.mapKeys (fun _ -> 1) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) + |> Expect.equal "" (IntMap.singleton 1 "c") - // Lists + IntMap.mapKeys (fun _ -> 3) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) + |> Expect.equal "" (IntMap.singleton 3 "c") + } - test "test toList" { - IntMap.toList(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" [ (3, "b"); (5, "a") ] + test "test mapKeysWith" { + IntMap.mapKeysWith (+) (fun _ -> 1) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) + |> Expect.equal "" (IntMap.singleton 1 "cdab") - IntMap.toList IntMap.empty |> Expect.equal "" [] - } + IntMap.mapKeysWith (+) (fun _ -> 3) (IntMap.ofList [ (1, "b"); (2, "a"); (3, "d"); (4, "c") ]) + |> Expect.equal "" (IntMap.singleton 3 "cdab") + } - test "test ofList" { - IntMap.ofList [] |> Expect.equal "" IntMap.empty + // Conversion - IntMap.ofList [ (5, "a"); (3, "b"); (5, "c") ] - |> Expect.equal "" (IntMap.ofList [ (5, "c"); (3, "b") ]) + test "test values" { + IntMap.values(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" [ "b"; "a" ] - IntMap.ofList [ (5, "c"); (3, "b"); (5, "a") ] - |> Expect.equal "" (IntMap.ofList [ (5, "a"); (3, "b") ]) - } + IntMap.values IntMap.empty |> Expect.equal "" [] + } - test "test ofListWith" { - IntMap.ofListWith (+) [ (5, "a"); (5, "b"); (3, "b"); (3, "a"); (5, "a") ] - |> Expect.equal "" (IntMap.ofList [ (3, "ab"); (5, "aba") ]) + test "test keys" { + IntMap.keys(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" [ 3; 5 ] - IntMap.ofListWith (+) [] |> Expect.equal "" IntMap.empty - } + IntMap.keys IntMap.empty |> Expect.equal "" [] + } - test "test ofListWithKey" { - let f k a1 a2 = - (string k) + a1 + a2 + // Lists - IntMap.ofListWithKey f [ (5, "a"); (5, "b"); (3, "b"); (3, "a"); (5, "a") ] - |> Expect.equal "" (IntMap.ofList [ (3, "3ab"); (5, "5a5ba") ]) + test "test toList" { + IntMap.toList(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" [ (3, "b"); (5, "a") ] - IntMap.ofListWithKey f [] |> Expect.equal "" IntMap.empty - } + IntMap.toList IntMap.empty |> Expect.equal "" [] + } - // Filter + test "test ofList" { + IntMap.ofList [] |> Expect.equal "" IntMap.empty - test "test filter" { - IntMap.filter ((fun f a b -> f b a) (>) "a") (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 3 "b") + IntMap.ofList [ (5, "a"); (3, "b"); (5, "c") ] + |> Expect.equal "" (IntMap.ofList [ (5, "c"); (3, "b") ]) - IntMap.filter ((fun f a b -> f b a) (>) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" IntMap.empty + IntMap.ofList [ (5, "c"); (3, "b"); (5, "a") ] + |> Expect.equal "" (IntMap.ofList [ (5, "a"); (3, "b") ]) + } - IntMap.filter ((fun f a b -> f b a) (<) "a") (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" IntMap.empty - } + test "test ofListWith" { + IntMap.ofListWith (+) [ (5, "a"); (5, "b"); (3, "b"); (3, "a"); (5, "a") ] + |> Expect.equal "" (IntMap.ofList [ (3, "ab"); (5, "aba") ]) - test "test filteWithKey" { - IntMap.filterWithKey (fun k _ -> k > 4) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 5 "a") - } + IntMap.ofListWith (+) [] |> Expect.equal "" IntMap.empty + } - test "test partition" { - let left, right = - IntMap.partition ((fun f a b -> f b a) (>) "a") (IntMap.ofList [ (5, "a"); (3, "b") ]) + test "test ofListWithKey" { + let f k a1 a2 = + (string k) + a1 + a2 - left |> Expect.equal "" (IntMap.singleton 3 "b") - right |> Expect.equal "" (IntMap.singleton 5 "a") + IntMap.ofListWithKey f [ (5, "a"); (5, "b"); (3, "b"); (3, "a"); (5, "a") ] + |> Expect.equal "" (IntMap.ofList [ (3, "3ab"); (5, "5a5ba") ]) - let left, right = - IntMap.partition ((fun f a b -> f b a) (<) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) + IntMap.ofListWithKey f [] |> Expect.equal "" IntMap.empty + } - left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - right |> Expect.equal "" IntMap.empty + // Filter - let left, right = - IntMap.partition ((fun f a b -> f b a) (>) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) + test "test filter" { + IntMap.filter ((fun f a b -> f b a) (>) "a") (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 3 "b") - left |> Expect.equal "" IntMap.empty - right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - } + IntMap.filter ((fun f a b -> f b a) (>) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" IntMap.empty - test "test partitionWithKey" { - let left, right = - IntMap.partitionWithKey (fun k _ -> k > 3) (IntMap.ofList [ (5, "a"); (3, "b") ]) + IntMap.filter ((fun f a b -> f b a) (<) "a") (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" IntMap.empty + } - left |> Expect.equal "" (IntMap.singleton 5 "a") - right |> Expect.equal "" (IntMap.singleton 3 "b") + test "test filteWithKey" { + IntMap.filterWithKey (fun k _ -> k > 4) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 5 "a") + } - let left, right = - IntMap.partitionWithKey (fun k _ -> k < 7) (IntMap.ofList [ (5, "a"); (3, "b") ]) + test "test partition" { + let left, right = + IntMap.partition ((fun f a b -> f b a) (>) "a") (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - right |> Expect.equal "" IntMap.empty + left |> Expect.equal "" (IntMap.singleton 3 "b") + right |> Expect.equal "" (IntMap.singleton 5 "a") - let left, right = - IntMap.partitionWithKey (fun k _ -> k > 7) (IntMap.ofList [ (5, "a"); (3, "b") ]) + let left, right = + IntMap.partition ((fun f a b -> f b a) (<) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" IntMap.empty - right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - } + left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + right |> Expect.equal "" IntMap.empty - test "test mapOption" { - let f x = - if x = "a" then Some "new a" else None + let left, right = + IntMap.partition ((fun f a b -> f b a) (>) "x") (IntMap.ofList [ (5, "a"); (3, "b") ]) - IntMap.mapOption f (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 5 "new a") - } + left |> Expect.equal "" IntMap.empty + right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + } - test "test mapOptionWithKey" { - let f k _ = - if k < 5 then Some("key : " + (string k)) else None + test "test partitionWithKey" { + let left, right = + IntMap.partitionWithKey (fun k _ -> k > 3) (IntMap.ofList [ (5, "a"); (3, "b") ]) - IntMap.mapOptionWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 3 "key : 3") - } + left |> Expect.equal "" (IntMap.singleton 5 "a") + right |> Expect.equal "" (IntMap.singleton 3 "b") - test "test mapChoice" { - let f a = - if a < "c" then Choice1Of2 a else Choice2Of2 a + let left, right = + IntMap.partitionWithKey (fun k _ -> k < 7) (IntMap.ofList [ (5, "a"); (3, "b") ]) - IntMap.mapChoice f (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ], IntMap.ofList [ (1, "x"); (7, "z") ]) + left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + right |> Expect.equal "" IntMap.empty - IntMap.mapChoice (fun a -> Choice2Of2 a) (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) - |> Expect.equal "" (IntMap.empty, IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) - } + let left, right = + IntMap.partitionWithKey (fun k _ -> k > 7) (IntMap.ofList [ (5, "a"); (3, "b") ]) - test "test mapChoiceWithKey" { - let f k a = - if k < 5 then Choice1Of2(k * 2) else Choice2Of2(a + a) + left |> Expect.equal "" IntMap.empty + right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + } - IntMap.mapChoiceWithKey f (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) - |> Expect.equal "" (IntMap.ofList [ (1, 2); (3, 6) ], IntMap.ofList [ (5, "aa"); (7, "zz") ]) + test "test mapOption" { + let f x = + if x = "a" then Some "new a" else None - IntMap.mapChoiceWithKey (fun _ a -> Choice2Of2 a) (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) - |> Expect.equal "" (IntMap.empty, IntMap.ofList [ (1, "x"); (3, "b"); (5, "a"); (7, "z") ]) - } + IntMap.mapOption f (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 5 "new a") + } - test "test split" { - let left, right = IntMap.split 2 (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" IntMap.empty - right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - let left, right = IntMap.split 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" IntMap.empty - right |> Expect.equal "" (IntMap.singleton 5 "a") - let left, right = IntMap.split 4 (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" (IntMap.singleton 3 "b") - right |> Expect.equal "" (IntMap.singleton 5 "a") - let left, right = IntMap.split 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" (IntMap.singleton 3 "b") - right |> Expect.equal "" IntMap.empty - let left, right = IntMap.split 6 (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - right |> Expect.equal "" IntMap.empty - } + test "test mapOptionWithKey" { + let f k _ = + if k < 5 then Some("key : " + (string k)) else None - test "test splitTryFind" { - let left, center, right = - IntMap.splitTryFind 2 (IntMap.ofList [ (5, "a"); (3, "b") ]) + IntMap.mapOptionWithKey f (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 3 "key : 3") + } - left |> Expect.equal "" IntMap.empty - center |> Expect.isNone "" - right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + test "test mapChoice" { + let f a = + if a < "c" then Choice1Of2 a else Choice2Of2 a - let left, center, right = - IntMap.splitTryFind 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) + IntMap.mapChoice f (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ], IntMap.ofList [ (1, "x"); (7, "z") ]) - left |> Expect.equal "" IntMap.empty - center |> Expect.equal "" (Some "b") - right |> Expect.equal "" (IntMap.singleton 5 "a") + IntMap.mapChoice (fun a -> Choice2Of2 a) (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) + |> Expect.equal "" (IntMap.empty, IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) + } - let left, center, right = - IntMap.splitTryFind 4 (IntMap.ofList [ (5, "a"); (3, "b") ]) + test "test mapChoiceWithKey" { + let f k a = + if k < 5 then Choice1Of2(k * 2) else Choice2Of2(a + a) - left |> Expect.equal "" (IntMap.singleton 3 "b") - center |> Expect.isNone "" - right |> Expect.equal "" (IntMap.singleton 5 "a") + IntMap.mapChoiceWithKey f (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) + |> Expect.equal "" (IntMap.ofList [ (1, 2); (3, 6) ], IntMap.ofList [ (5, "aa"); (7, "zz") ]) - let left, center, right = - IntMap.splitTryFind 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + IntMap.mapChoiceWithKey (fun _ a -> Choice2Of2 a) (IntMap.ofList [ (5, "a"); (3, "b"); (1, "x"); (7, "z") ]) + |> Expect.equal "" (IntMap.empty, IntMap.ofList [ (1, "x"); (3, "b"); (5, "a"); (7, "z") ]) + } - left |> Expect.equal "" (IntMap.singleton 3 "b") - center |> Expect.equal "" (Some "a") - right |> Expect.equal "" IntMap.empty + test "test split" { + let left, right = IntMap.split 2 (IntMap.ofList [ (5, "a"); (3, "b") ]) + left |> Expect.equal "" IntMap.empty + right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + let left, right = IntMap.split 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) + left |> Expect.equal "" IntMap.empty + right |> Expect.equal "" (IntMap.singleton 5 "a") + let left, right = IntMap.split 4 (IntMap.ofList [ (5, "a"); (3, "b") ]) + left |> Expect.equal "" (IntMap.singleton 3 "b") + right |> Expect.equal "" (IntMap.singleton 5 "a") + let left, right = IntMap.split 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) + left |> Expect.equal "" (IntMap.singleton 3 "b") + right |> Expect.equal "" IntMap.empty + let left, right = IntMap.split 6 (IntMap.ofList [ (5, "a"); (3, "b") ]) + left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + right |> Expect.equal "" IntMap.empty + } - let left, center, right = - IntMap.splitTryFind 6 (IntMap.ofList [ (5, "a"); (3, "b") ]) + test "test splitTryFind" { + let left, center, right = + IntMap.splitTryFind 2 (IntMap.ofList [ (5, "a"); (3, "b") ]) - left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - center |> Expect.isNone "" - right |> Expect.equal "" IntMap.empty - } + left |> Expect.equal "" IntMap.empty + center |> Expect.isNone "" + right |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - // Submap + let left, center, right = + IntMap.splitTryFind 3 (IntMap.ofList [ (5, "a"); (3, "b") ]) - test "test isSubmapOfBy" { - IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isTrue "" + left |> Expect.equal "" IntMap.empty + center |> Expect.equal "" (Some "b") + right |> Expect.equal "" (IntMap.singleton 5 "a") - IntMap.isSubmapOfBy (<=) (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isTrue "" + let left, center, right = + IntMap.splitTryFind 4 (IntMap.ofList [ (5, "a"); (3, "b") ]) - IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isTrue "" + left |> Expect.equal "" (IntMap.singleton 3 "b") + center |> Expect.isNone "" + right |> Expect.equal "" (IntMap.singleton 5 "a") - IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isFalse "" + let left, center, right = + IntMap.splitTryFind 5 (IntMap.ofList [ (5, "a"); (3, "b") ]) - IntMap.isSubmapOfBy (<) (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isFalse "" + left |> Expect.equal "" (IntMap.singleton 3 "b") + center |> Expect.equal "" (Some "a") + right |> Expect.equal "" IntMap.empty - IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1) ]) - |> Expect.isFalse "" - } + let left, center, right = + IntMap.splitTryFind 6 (IntMap.ofList [ (5, "a"); (3, "b") ]) - test "test isSubmapOf" { - IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isTrue "" + left |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + center |> Expect.isNone "" + right |> Expect.equal "" IntMap.empty + } - IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isTrue "" + // Submap - IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) - |> Expect.isFalse "" + test "test isSubmapOfBy" { + IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isTrue "" - IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1) ]) - |> Expect.isFalse "" - } + IntMap.isSubmapOfBy (<=) (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isTrue "" - test "test isProperSubmapOfBy" { - IntMap.isProperSubmapOfBy (=) (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) - |> Expect.isTrue "" + IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isTrue "" - IntMap.isProperSubmapOfBy (<=) (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) - |> Expect.isTrue "" + IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isFalse "" - IntMap.isProperSubmapOfBy (=) (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) - |> Expect.isFalse "" + IntMap.isSubmapOfBy (<) (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isFalse "" - IntMap.isProperSubmapOfBy (=) (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1) ]) - |> Expect.isFalse "" + IntMap.isSubmapOfBy (=) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1) ]) + |> Expect.isFalse "" + } - IntMap.isProperSubmapOfBy (<) (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) - |> Expect.isFalse "" - } + test "test isSubmapOf" { + IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 1) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isTrue "" - test "test isProperSubmapOf" { - IntMap.isProperSubmapOf (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) - |> Expect.isTrue "" + IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isTrue "" - IntMap.isProperSubmapOf (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) - |> Expect.isFalse "" + IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 2) ]) (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) + |> Expect.isFalse "" - IntMap.isProperSubmapOf (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1) ]) - |> Expect.isFalse "" - } + IntMap.isSubmapOf (IntMap.ofList [ (int 'a', 1); (int 'b', 2) ]) (IntMap.ofList [ (int 'a', 1) ]) + |> Expect.isFalse "" + } - // Min/Max + test "test isProperSubmapOfBy" { + IntMap.isProperSubmapOfBy (=) (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) + |> Expect.isTrue "" - test "test findMin" { - IntMap.findMin(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (3, "b") - } + IntMap.isProperSubmapOfBy (<=) (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) + |> Expect.isTrue "" - test "test findMax" { - IntMap.findMax(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (5, "a") - } + IntMap.isProperSubmapOfBy (=) (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) + |> Expect.isFalse "" - test "test deleteMin" { - IntMap.deleteMin(IntMap.ofList [ (5, "a"); (3, "b"); (7, "c") ]) - |> Expect.equal "" (IntMap.ofList [ (5, "a"); (7, "c") ]) + IntMap.isProperSubmapOfBy (=) (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1) ]) + |> Expect.isFalse "" - IntMap.deleteMin IntMap.empty |> Expect.equal "" IntMap.empty - } + IntMap.isProperSubmapOfBy (<) (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) + |> Expect.isFalse "" + } - test "test deleteMax" { - IntMap.deleteMax(IntMap.ofList [ (5, "a"); (3, "b"); (7, "c") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) + test "test isProperSubmapOf" { + IntMap.isProperSubmapOf (IntMap.ofList [ (1, 1) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) + |> Expect.isTrue "" - IntMap.deleteMax IntMap.empty |> Expect.equal "" IntMap.empty - } + IntMap.isProperSubmapOf (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1); (2, 2) ]) + |> Expect.isFalse "" - test "test deleteFindMin" { - IntMap.deleteFindMin(IntMap.ofList [ (5, "a"); (3, "b"); (10, "c") ]) - |> Expect.equal "" ((3, "b"), IntMap.ofList [ (5, "a"); (10, "c") ]) - } + IntMap.isProperSubmapOf (IntMap.ofList [ (1, 1); (2, 2) ]) (IntMap.ofList [ (1, 1) ]) + |> Expect.isFalse "" + } - test "test deleteFindMax" { - IntMap.deleteFindMax(IntMap.ofList [ (5, "a"); (3, "b"); (10, "c") ]) - |> Expect.equal "" ((10, "c"), IntMap.ofList [ (3, "b"); (5, "a") ]) - } + // Min/Max - test "test updateMin" { - IntMap.updateMin (fun a -> Some("X" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "Xb"); (5, "a") ]) + test "test findMin" { + IntMap.findMin(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (3, "b") + } - IntMap.updateMin (fun _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 5 "a") - } + test "test findMax" { + IntMap.findMax(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (5, "a") + } - test "test updateMax" { - IntMap.updateMax (fun a -> Some("X" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "Xa") ]) + test "test deleteMin" { + IntMap.deleteMin(IntMap.ofList [ (5, "a"); (3, "b"); (7, "c") ]) + |> Expect.equal "" (IntMap.ofList [ (5, "a"); (7, "c") ]) - IntMap.updateMax (fun _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 3 "b") - } + IntMap.deleteMin IntMap.empty |> Expect.equal "" IntMap.empty + } - test "test updateMinWithKey" { - IntMap.updateMinWithKey (fun k a -> Some((string k) + ":" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "3:b"); (5, "a") ]) + test "test deleteMax" { + IntMap.deleteMax(IntMap.ofList [ (5, "a"); (3, "b"); (7, "c") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "a") ]) - IntMap.updateMinWithKey (fun _ _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 5 "a") - } + IntMap.deleteMax IntMap.empty |> Expect.equal "" IntMap.empty + } - test "test updateMaxWithKey" { - IntMap.updateMaxWithKey (fun k a -> Some((string k) + ":" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:a") ]) + test "test deleteFindMin" { + IntMap.deleteFindMin(IntMap.ofList [ (5, "a"); (3, "b"); (10, "c") ]) + |> Expect.equal "" ((3, "b"), IntMap.ofList [ (5, "a"); (10, "c") ]) + } - IntMap.updateMaxWithKey (fun _ _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (IntMap.singleton 3 "b") - } + test "test deleteFindMax" { + IntMap.deleteFindMax(IntMap.ofList [ (5, "a"); (3, "b"); (10, "c") ]) + |> Expect.equal "" ((10, "c"), IntMap.ofList [ (3, "b"); (5, "a") ]) + } - test "test minView" { - IntMap.minView(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some("b", IntMap.singleton 5 "a")) + test "test updateMin" { + IntMap.updateMin (fun a -> Some("X" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "Xb"); (5, "a") ]) - IntMap.minView IntMap.empty |> Expect.isNone "" - } + IntMap.updateMin (fun _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 5 "a") + } - test "test maxView" { - IntMap.maxView(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some("a", IntMap.singleton 3 "b")) + test "test updateMax" { + IntMap.updateMax (fun a -> Some("X" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "Xa") ]) - IntMap.maxView IntMap.empty |> Expect.isNone "" - } + IntMap.updateMax (fun _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 3 "b") + } - test "test minViewWithKey" { - IntMap.minViewWithKey(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some((3, "b"), IntMap.singleton 5 "a")) + test "test updateMinWithKey" { + IntMap.updateMinWithKey (fun k a -> Some((string k) + ":" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "3:b"); (5, "a") ]) - IntMap.minViewWithKey IntMap.empty |> Expect.isNone "" - } + IntMap.updateMinWithKey (fun _ _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 5 "a") + } - test "test maxViewWithKey" { - IntMap.maxViewWithKey(IntMap.ofList [ (5, "a"); (3, "b") ]) - |> Expect.equal "" (Some((5, "a"), IntMap.singleton 3 "b")) + test "test updateMaxWithKey" { + IntMap.updateMaxWithKey (fun k a -> Some((string k) + ":" + a)) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.ofList [ (3, "b"); (5, "5:a") ]) - IntMap.maxViewWithKey IntMap.empty |> Expect.isNone "" - } - ] + IntMap.updateMaxWithKey (fun _ _ -> None) (IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (IntMap.singleton 3 "b") + } + + test "test minView" { + IntMap.minView(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some("b", IntMap.singleton 5 "a")) + + IntMap.minView IntMap.empty |> Expect.isNone "" + } + + test "test maxView" { + IntMap.maxView(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some("a", IntMap.singleton 3 "b")) + + IntMap.maxView IntMap.empty |> Expect.isNone "" + } + + test "test minViewWithKey" { + IntMap.minViewWithKey(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some((3, "b"), IntMap.singleton 5 "a")) + + IntMap.minViewWithKey IntMap.empty |> Expect.isNone "" + } + + test "test maxViewWithKey" { + IntMap.maxViewWithKey(IntMap.ofList [ (5, "a"); (3, "b") ]) + |> Expect.equal "" (Some((5, "a"), IntMap.singleton 3 "b")) + + IntMap.maxViewWithKey IntMap.empty |> Expect.isNone "" + } ] [] let testIntMapProperties = @@ -816,170 +813,162 @@ module IntMapTest = l [] - testList "Experimental IntMap Properties" [ - - testPropertyWithConfig config10k "prop singleton" - <| fun k x -> IntMap.insert k x IntMap.empty = IntMap.singleton k x - - testPropertyWithConfig config10k "prop insert and tryFind" - <| fun k t -> IntMap.tryFind k (IntMap.insert k () t) <> None - - testPropertyWithConfig config10k "prop insert and delete" - <| fun k t -> - IntMap.tryFind k t = None - ==> (IntMap.delete k (IntMap.insert k () t) = t) - - testPropertyWithConfig config10k "prop delete non member" - <| fun k t -> IntMap.tryFind k t = None ==> (IntMap.delete k t = t) - - testPropertyWithConfig config10k "prop append" - <| fun xs ys -> - List.sort(IntMap.keys(IntMap.append (IntMap.ofList xs) (IntMap.ofList ys))) = List.sort( - List.ofSeq(Seq.distinct(List.append (List.map fst xs) (List.map fst ys))) - ) - - testPropertyWithConfig config10k "prop append and singleton" - <| fun t k x -> IntMap.append (IntMap.singleton k x) t = IntMap.insert k x t - - testPropertyWithConfig config10k "prop append and sum" - <| fun xs ys -> - List.sum(IntMap.values(IntMap.appendWith (+) (IntMap.ofListWith (+) xs) (IntMap.ofListWith (+) ys))) = List.sum(List.map snd xs) - + List.sum(List.map snd ys) - - testPropertyWithConfig config10k "prop difference" - <| fun xs ys -> - List.sort(IntMap.keys(IntMap.difference (IntMap.ofListWith (+) xs) (IntMap.ofListWith (+) ys))) = List.sort( - List.ofSeq(except (Seq.distinct(List.map fst xs)) (Seq.distinct(List.map fst ys))) - ) - - testPropertyWithConfig config10k "prop intersection" - <| fun xs ys -> - List.sort(IntMap.keys(IntMap.intersection (IntMap.ofListWith (+) xs) (IntMap.ofListWith (+) ys))) = List.sort( - List.ofSeq(Seq.distinct(intersect (List.map fst xs) (List.map fst ys))) - ) - - testPropertyWithConfig config10k "prop intersectionWith" - <| fun (xs: (int * int) list) (ys: (int * int) list) -> - let xs' = Seq.distinctBy fst xs |> Seq.toList - let ys' = Seq.distinctBy fst ys |> Seq.toList - let f l r = l + 2 * r - - IntMap.toList(IntMap.intersectionWith f (IntMap.ofList xs') (IntMap.ofList ys')) = [ - for (kx, vx) in List.sort xs' do - for (ky, vy) in ys' do - if kx = ky then - yield (kx, f vx vy) - ] - - testPropertyWithConfig config10k "prop intersectionWithKey" - <| fun (xs: (int * int) list) (ys: (int * int) list) -> - let xs' = Seq.distinctBy fst xs |> Seq.toList - let ys' = Seq.distinctBy fst ys |> Seq.toList - - let f k l r = - k + 2 * l + 3 * r - - IntMap.toList(IntMap.intersectionWithKey f (IntMap.ofList xs') (IntMap.ofList ys')) = [ - for (kx, vx) in List.sort xs' do - for (ky, vy) in ys' do - if kx = ky then - yield (kx, f kx vx vy) - ] - - testPropertyWithConfig config10k "prop mergeWithKey" - <| fun (xs: (int * int) list) (ys: (int * int) list) -> - let xs' = Seq.distinctBy fst xs |> Seq.toList - let ys' = Seq.distinctBy fst ys |> Seq.toList - let xm = IntMap.ofList xs' - let ym = IntMap.ofList ys' - - let emulateMergeWithKey f keep_x keep_y = - let combine k = - match (List.tryFind (fst >> (=) k) xs', List.tryFind (fst >> (=) k) ys') with - | (None, Some(_, y)) -> if keep_y then Some(k, y) else None - | (Some(_, x), None) -> if keep_x then Some(k, x) else None - | (Some(_, x), Some(_, y)) -> f k x y |> Option.map(fun v -> (k, v)) - | _ -> failwith "emulateMergeWithKey: combine" - - mapOption combine (List.sort(List.ofSeq(Seq.distinct(List.append (List.map fst xs') (List.map fst ys'))))) - - let testMergeWithKey f keep_x keep_y = - let keep b m = - match b with - | false -> IntMap.empty - | true -> m - - IntMap.toList(IntMap.mergeWithKey f (keep keep_x) (keep keep_y) xm ym) = emulateMergeWithKey f keep_x keep_y - - List.forall id [ - for f in - [ - (fun _ x1 _ -> Some x1) - (fun _ _ x2 -> Some x2) - (fun _ _ _ -> None) - (fun k x1 x2 -> if k % 2 = 0 then None else Some(2 * x1 + 3 * x2)) - ] do - for keep_x in [ true; false ] do - for keep_y in [ true; false ] do - yield testMergeWithKey f keep_x keep_y - ] - - testPropertyWithConfig config10k "prop list" - <| fun (xs: int list) -> - List.sort(List.ofSeq(Seq.distinct xs)) = [ - for (x, ()) in - IntMap.toList( - IntMap.ofList [ - for x in xs do - yield (x, ()) - ] - ) do - yield x - ] - - testPropertyWithConfig config10k "prop alter" - <| fun t k -> - let f = - function - | Some() -> None - | None -> Some() - - let t' = IntMap.alter f k t - - match IntMap.tryFind k t with - | Some _ -> IntMap.size t - 1 = IntMap.size t' && IntMap.tryFind k t' = None - | None -> IntMap.size t + 1 = IntMap.size t' && IntMap.tryFind k t' <> None - - testPropertyWithConfig config10k "prop isEmpty" - <| fun m -> IntMap.isEmpty m = (IntMap.size m = 0) - - testPropertyWithConfig config10k "prop exists" - <| fun xs n -> - let m = IntMap.ofList(List.zip xs xs) - List.forall (fun k -> IntMap.exists k m = List.exists ((=) k) xs) (n :: xs) - - testPropertyWithConfig config10k "prop notExists" - <| fun xs n -> - let m = IntMap.ofList(List.zip xs xs) - List.forall (fun k -> IntMap.notExists k m = not(List.exists ((=) k) xs)) (n :: xs) - - testPropertyWithConfig config10k "implements IEnumerable 1" - <| fun xs -> - let xs = List.zip xs xs - let map = IntMap.ofList xs - let a = map :> _ seq |> Seq.toList - set xs = set a - - testPropertyWithConfig config10k "implements IEnumerable 2" - <| fun xs -> - let xs = List.zip xs xs - let map = IntMap.ofList xs - let a = map :> _ seq |> Seq.toList - a.Length = (List.length(List.ofSeq(Seq.distinct xs))) - - testPropertyWithConfig config10k "functor laws: preserves identity" - <| fun value -> IntMap.map id value = value - - testPropertyWithConfig config10k "functor laws: preserves composition" - <| fun f g value -> IntMap.map (f << g) value = (IntMap.map f << IntMap.map g) value - ] + testList + "Experimental IntMap Properties" + [ + + testPropertyWithConfig config10k "prop singleton" + <| fun k x -> IntMap.insert k x IntMap.empty = IntMap.singleton k x + + testPropertyWithConfig config10k "prop insert and tryFind" + <| fun k t -> IntMap.tryFind k (IntMap.insert k () t) <> None + + testPropertyWithConfig config10k "prop insert and delete" + <| fun k t -> + IntMap.tryFind k t = None + ==> (IntMap.delete k (IntMap.insert k () t) = t) + + testPropertyWithConfig config10k "prop delete non member" + <| fun k t -> IntMap.tryFind k t = None ==> (IntMap.delete k t = t) + + testPropertyWithConfig config10k "prop append" + <| fun xs ys -> + List.sort(IntMap.keys(IntMap.append (IntMap.ofList xs) (IntMap.ofList ys))) = List.sort( + List.ofSeq(Seq.distinct(List.append (List.map fst xs) (List.map fst ys))) + ) + + testPropertyWithConfig config10k "prop append and singleton" + <| fun t k x -> IntMap.append (IntMap.singleton k x) t = IntMap.insert k x t + + testPropertyWithConfig config10k "prop append and sum" + <| fun xs ys -> + List.sum(IntMap.values(IntMap.appendWith (+) (IntMap.ofListWith (+) xs) (IntMap.ofListWith (+) ys))) = List.sum(List.map snd xs) + + List.sum(List.map snd ys) + + testPropertyWithConfig config10k "prop difference" + <| fun xs ys -> + List.sort(IntMap.keys(IntMap.difference (IntMap.ofListWith (+) xs) (IntMap.ofListWith (+) ys))) = List.sort( + List.ofSeq(except (Seq.distinct(List.map fst xs)) (Seq.distinct(List.map fst ys))) + ) + + testPropertyWithConfig config10k "prop intersection" + <| fun xs ys -> + List.sort(IntMap.keys(IntMap.intersection (IntMap.ofListWith (+) xs) (IntMap.ofListWith (+) ys))) = List.sort( + List.ofSeq(Seq.distinct(intersect (List.map fst xs) (List.map fst ys))) + ) + + testPropertyWithConfig config10k "prop intersectionWith" + <| fun (xs: (int * int) list) (ys: (int * int) list) -> + let xs' = Seq.distinctBy fst xs |> Seq.toList + let ys' = Seq.distinctBy fst ys |> Seq.toList + let f l r = l + 2 * r + + IntMap.toList(IntMap.intersectionWith f (IntMap.ofList xs') (IntMap.ofList ys')) = [ for (kx, vx) in List.sort xs' do + for (ky, vy) in ys' do + if kx = ky then + yield (kx, f vx vy) ] + + testPropertyWithConfig config10k "prop intersectionWithKey" + <| fun (xs: (int * int) list) (ys: (int * int) list) -> + let xs' = Seq.distinctBy fst xs |> Seq.toList + let ys' = Seq.distinctBy fst ys |> Seq.toList + + let f k l r = + k + 2 * l + 3 * r + + IntMap.toList(IntMap.intersectionWithKey f (IntMap.ofList xs') (IntMap.ofList ys')) = [ for (kx, vx) in List.sort xs' do + for (ky, vy) in ys' do + if kx = ky then + yield (kx, f kx vx vy) ] + + testPropertyWithConfig config10k "prop mergeWithKey" + <| fun (xs: (int * int) list) (ys: (int * int) list) -> + let xs' = Seq.distinctBy fst xs |> Seq.toList + let ys' = Seq.distinctBy fst ys |> Seq.toList + let xm = IntMap.ofList xs' + let ym = IntMap.ofList ys' + + let emulateMergeWithKey f keep_x keep_y = + let combine k = + match (List.tryFind (fst >> (=) k) xs', List.tryFind (fst >> (=) k) ys') with + | (None, Some(_, y)) -> if keep_y then Some(k, y) else None + | (Some(_, x), None) -> if keep_x then Some(k, x) else None + | (Some(_, x), Some(_, y)) -> f k x y |> Option.map(fun v -> (k, v)) + | _ -> failwith "emulateMergeWithKey: combine" + + mapOption combine (List.sort(List.ofSeq(Seq.distinct(List.append (List.map fst xs') (List.map fst ys'))))) + + let testMergeWithKey f keep_x keep_y = + let keep b m = + match b with + | false -> IntMap.empty + | true -> m + + IntMap.toList(IntMap.mergeWithKey f (keep keep_x) (keep keep_y) xm ym) = emulateMergeWithKey f keep_x keep_y + + List.forall + id + [ for f in + [ (fun _ x1 _ -> Some x1) + (fun _ _ x2 -> Some x2) + (fun _ _ _ -> None) + (fun k x1 x2 -> if k % 2 = 0 then None else Some(2 * x1 + 3 * x2)) ] do + for keep_x in [ true; false ] do + for keep_y in [ true; false ] do + yield testMergeWithKey f keep_x keep_y ] + + testPropertyWithConfig config10k "prop list" + <| fun (xs: int list) -> + List.sort(List.ofSeq(Seq.distinct xs)) = [ for (x, ()) in + IntMap.toList( + IntMap.ofList + [ for x in xs do + yield (x, ()) ] + ) do + yield x ] + + testPropertyWithConfig config10k "prop alter" + <| fun t k -> + let f = + function + | Some() -> None + | None -> Some() + + let t' = IntMap.alter f k t + + match IntMap.tryFind k t with + | Some _ -> IntMap.size t - 1 = IntMap.size t' && IntMap.tryFind k t' = None + | None -> IntMap.size t + 1 = IntMap.size t' && IntMap.tryFind k t' <> None + + testPropertyWithConfig config10k "prop isEmpty" + <| fun m -> IntMap.isEmpty m = (IntMap.size m = 0) + + testPropertyWithConfig config10k "prop exists" + <| fun xs n -> + let m = IntMap.ofList(List.zip xs xs) + List.forall (fun k -> IntMap.exists k m = List.exists ((=) k) xs) (n :: xs) + + testPropertyWithConfig config10k "prop notExists" + <| fun xs n -> + let m = IntMap.ofList(List.zip xs xs) + List.forall (fun k -> IntMap.notExists k m = not(List.exists ((=) k) xs)) (n :: xs) + + testPropertyWithConfig config10k "implements IEnumerable 1" + <| fun xs -> + let xs = List.zip xs xs + let map = IntMap.ofList xs + let a = map :> _ seq |> Seq.toList + set xs = set a + + testPropertyWithConfig config10k "implements IEnumerable 2" + <| fun xs -> + let xs = List.zip xs xs + let map = IntMap.ofList xs + let a = map :> _ seq |> Seq.toList + a.Length = (List.length(List.ofSeq(Seq.distinct xs))) + + testPropertyWithConfig config10k "functor laws: preserves identity" + <| fun value -> IntMap.map id value = value + + testPropertyWithConfig config10k "functor laws: preserves composition" + <| fun f g value -> IntMap.map (f << g) value = (IntMap.map f << IntMap.map g) value ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/LeftistHeapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/LeftistHeapTest.fs index 4707be8b..933a00ac 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/LeftistHeapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/LeftistHeapTest.fs @@ -47,406 +47,408 @@ module LeftistHeapTest = [] let testLeftistHeap = - testList "Experimental LeftistHeap" [ + testList + "Experimental LeftistHeap" + [ - test "cons pattern discriminator" { - let h = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h1, t1 = LeftistHeap.uncons h + test "cons pattern discriminator" { + let h = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h1, t1 = LeftistHeap.uncons h - let h2, t2 = - match t1 with - | LeftistHeap.Cons(h, t) -> h, t - | _ -> "x", t1 + let h2, t2 = + match t1 with + | LeftistHeap.Cons(h, t) -> h, t + | _ -> "x", t1 - ((h2 = "e") && ((LeftistHeap.length t2) = 4)) |> Expect.isTrue "" - } + ((h2 = "e") && ((LeftistHeap.length t2) = 4)) |> Expect.isTrue "" + } - test "cons pattern discriminator 2" { - let h = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "cons pattern discriminator 2" { + let h = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let t2 = - match h with - | LeftistHeap.Cons("f", LeftistHeap.Cons(_, t)) -> t - | _ -> h + let t2 = + match h with + | LeftistHeap.Cons("f", LeftistHeap.Cons(_, t)) -> t + | _ -> h - let h1, t3 = LeftistHeap.uncons t2 + let h1, t3 = LeftistHeap.uncons t2 - ((h1 = "d") && ((LeftistHeap.length t2) = 4)) |> Expect.isTrue "" - } + ((h1 = "d") && ((LeftistHeap.length t2) = 4)) |> Expect.isTrue "" + } - test "empty list should be empty" { (LeftistHeap.empty true).IsEmpty |> Expect.isTrue "" } + test "empty list should be empty" { (LeftistHeap.empty true).IsEmpty |> Expect.isTrue "" } - test "IHeap insert works" { - let h = - LeftistHeap.empty true - |> LeftistHeap.insert "a" - |> LeftistHeap.insert "b" - |> LeftistHeap.insert "c" - |> LeftistHeap.insert "d" - |> LeftistHeap.insert "e" - |> LeftistHeap.insert "f" - |> LeftistHeap.insert "g" - |> LeftistHeap.insert "h" - |> LeftistHeap.insert "i" - |> LeftistHeap.insert "j" + test "IHeap insert works" { + let h = + LeftistHeap.empty true + |> LeftistHeap.insert "a" + |> LeftistHeap.insert "b" + |> LeftistHeap.insert "c" + |> LeftistHeap.insert "d" + |> LeftistHeap.insert "e" + |> LeftistHeap.insert "f" + |> LeftistHeap.insert "g" + |> LeftistHeap.insert "h" + |> LeftistHeap.insert "i" + |> LeftistHeap.insert "j" - ((h :> IHeap<_, string>).Insert "zz").Head |> Expect.equal "" "zz" - } + ((h :> IHeap<_, string>).Insert "zz").Head |> Expect.equal "" "zz" + } - test "insert works" { - (((LeftistHeap.empty true).Insert 1).Insert 2).IsEmpty - |> Expect.isFalse "" - } + test "insert works" { + (((LeftistHeap.empty true).Insert 1).Insert 2).IsEmpty + |> Expect.isFalse "" + } - test "length of empty is 0" { (LeftistHeap.empty true).Length |> Expect.equal "" 0 } + test "length of empty is 0" { (LeftistHeap.empty true).Length |> Expect.equal "" 0 } - test "structure pattern match and merge" { - let h = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "structure pattern match and merge" { + let h = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let x, h1, h2 = - match h with - | LeftistHeap.T(_, _, _, x', h1', h2') -> x', h1', h2' - | _ -> "zz", h, h + let x, h1, h2 = + match h with + | LeftistHeap.T(_, _, _, x', h1', h2') -> x', h1', h2' + | _ -> "zz", h, h - let h3 = LeftistHeap.merge h1 h2 + let h3 = LeftistHeap.merge h1 h2 - let x2, t3 = LeftistHeap.uncons h3 + let x2, t3 = LeftistHeap.uncons h3 - ((x = "f") && (x2 = "e") && ((LeftistHeap.length t3) = 4)) - |> Expect.isTrue "" - } + ((x = "f") && (x2 = "e") && ((LeftistHeap.length t3) = 4)) + |> Expect.isTrue "" + } - test "tryGetHead on empty should return None" { (LeftistHeap.empty true).TryGetHead |> Expect.isNone "" } + test "tryGetHead on empty should return None" { (LeftistHeap.empty true).TryGetHead |> Expect.isNone "" } - test "tryGetTail on empty should return None" { (LeftistHeap.empty true).TryGetTail() |> Expect.isNone "" } + test "tryGetTail on empty should return None" { (LeftistHeap.empty true).TryGetTail() |> Expect.isNone "" } - test "tryGetTail on len 1 should return Some empty" { - (LeftistHeap.empty true - |> LeftistHeap.insert 1 - |> LeftistHeap.tryGetTail) - .Value - |> LeftistHeap.isEmpty - |> Expect.isTrue "" - } + test "tryGetTail on len 1 should return Some empty" { + (LeftistHeap.empty true + |> LeftistHeap.insert 1 + |> LeftistHeap.tryGetTail) + .Value + |> LeftistHeap.isEmpty + |> Expect.isTrue "" + } - test "tryMerge max and mis should be None" { - let h1 = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h2 = LeftistHeap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] + test "tryMerge max and mis should be None" { + let h1 = LeftistHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h2 = LeftistHeap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] - LeftistHeap.tryMerge h1 h2 |> Expect.isNone "" - } + LeftistHeap.tryMerge h1 h2 |> Expect.isNone "" + } - test "tryUncons empty" { (LeftistHeap.empty true).TryUncons() |> Expect.isNone "" } - ] + test "tryUncons empty" { (LeftistHeap.empty true).TryUncons() |> Expect.isNone "" } ] [] let testLeftistHeapProperties = - testList "Experimental LeftistHeap properties" [ - - testPropertyWithConfig - config10k - "max LeftistHeap int head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap OfSeq head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap from Insert head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap int head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap OfSeq head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap from Insert head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "seq enumerate matches build list maxLeftistHeap" - (Prop.forAll(Arb.fromGen maxLeftistHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "seq enumerate matches build list minLeftistHeap" - (Prop.forAll(Arb.fromGen minLeftistHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap int seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap OfSeq seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap from Insert seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap int seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap OfSeq seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap from Insert seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - - testPropertyWithConfig - config10k - "max LeftistHeap string seq enumerate matches build list string" - (Prop.forAll(Arb.fromGen stringGens.[0]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap string seq enumerate matches build list string" - (Prop.forAll(Arb.fromGen stringGens.[1]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap int tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true - (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap OfSeq tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true - (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap from Insert tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true - (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap int tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true - (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap OfSeq tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true - (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap from Insert tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true - (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap int tryGetHead should return`" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap OfSeq tryGetHead should return`" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap from Insert tryGetHead should return`" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap int tryGetHead should return`" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap OfSeq tryGetHead should return`" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap from Insert tryGetHead should return`" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap int tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - testPropertyWithConfig - config10k - "max LeftistHeap OfSeq tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap from Insert tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap int tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap OfSeq tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap from Insert tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap int uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap OfSeq uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "max LeftistHeap from Insert uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap int uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap OfSeq uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "min LeftistHeap from Insert uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length = (l.Length - 1))) - |> classifyCollect h h.Length) - ] + testList + "Experimental LeftistHeap properties" + [ + + testPropertyWithConfig + config10k + "max LeftistHeap int head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap OfSeq head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap from Insert head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap int head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap OfSeq head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap from Insert head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> (h.Head = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "seq enumerate matches build list maxLeftistHeap" + (Prop.forAll(Arb.fromGen maxLeftistHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "seq enumerate matches build list minLeftistHeap" + (Prop.forAll(Arb.fromGen minLeftistHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap int seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap OfSeq seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap from Insert seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap int seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap OfSeq seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap from Insert seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + + testPropertyWithConfig + config10k + "max LeftistHeap string seq enumerate matches build list string" + (Prop.forAll(Arb.fromGen stringGens.[0]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap string seq enumerate matches build list string" + (Prop.forAll(Arb.fromGen stringGens.[1]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap int tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true + (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap OfSeq tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true + (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap from Insert tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true + (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap int tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true + (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap OfSeq tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true + (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap from Insert tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then (tl.Head = l.Item(1)) else true + (tlHead && (tl.Length = (l.Length - 1))) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap int tryGetHead should return`" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap OfSeq tryGetHead should return`" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap from Insert tryGetHead should return`" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap int tryGetHead should return`" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap OfSeq tryGetHead should return`" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap from Insert tryGetHead should return`" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> (h.TryGetHead.Value = l.Head) |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap int tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + testPropertyWithConfig + config10k + "max LeftistHeap OfSeq tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap from Insert tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap int tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap OfSeq tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap from Insert tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap int uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap OfSeq uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "max LeftistHeap from Insert uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap int uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap OfSeq uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "min LeftistHeap from Insert uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length = (l.Length - 1))) + |> classifyCollect h h.Length) ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/ListZipperTest.fs b/tests/FSharpx.Collections.Experimental.Tests/ListZipperTest.fs index c175d281..20ce823e 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/ListZipperTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/ListZipperTest.fs @@ -12,44 +12,44 @@ module ListZipperTest = [] let testListZipper = - testList "Experimental ListZipper" [ - test "Can move forward" { - let z = chars |> ListZipper.zipper |> ListZipper.forward |> ListZipper.forward - Expect.equal "" 'c' <| ListZipper.focus z - } - - test "Can move back" { - let z = - chars - |> ListZipper.zipper - |> ListZipper.forward - |> ListZipper.forward - |> ListZipper.back - - Expect.equal "" 'b' <| ListZipper.focus z - } - - test "Can move to the front" { - let z = - chars - |> ListZipper.zipper - |> ListZipper.forward - |> ListZipper.forward - |> ListZipper.front - - Expect.equal "" 'a' <| ListZipper.focus z - } - - test "Can modify an element" { - let z = - chars - |> ListZipper.zipper - |> ListZipper.forward - |> ListZipper.forward - |> ListZipper.modify 'e' - |> ListZipper.back - |> ListZipper.forward - - Expect.equal "" 'e' <| ListZipper.focus z - } - ] + testList + "Experimental ListZipper" + [ test "Can move forward" { + let z = chars |> ListZipper.zipper |> ListZipper.forward |> ListZipper.forward + Expect.equal "" 'c' <| ListZipper.focus z + } + + test "Can move back" { + let z = + chars + |> ListZipper.zipper + |> ListZipper.forward + |> ListZipper.forward + |> ListZipper.back + + Expect.equal "" 'b' <| ListZipper.focus z + } + + test "Can move to the front" { + let z = + chars + |> ListZipper.zipper + |> ListZipper.forward + |> ListZipper.forward + |> ListZipper.front + + Expect.equal "" 'a' <| ListZipper.focus z + } + + test "Can modify an element" { + let z = + chars + |> ListZipper.zipper + |> ListZipper.forward + |> ListZipper.forward + |> ListZipper.modify 'e' + |> ListZipper.back + |> ListZipper.forward + + Expect.equal "" 'e' <| ListZipper.focus z + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/PairingHeapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/PairingHeapTest.fs index 01aa9604..04e3bddb 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/PairingHeapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/PairingHeapTest.fs @@ -56,384 +56,385 @@ module PairingHeapTest = [] let testPairingHeap = - testList "Experimental PairingHeap" [ - test "cons pattern discriminator" { - let h = PairingHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h1, t1 = PairingHeap.uncons h + testList + "Experimental PairingHeap" + [ test "cons pattern discriminator" { + let h = PairingHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h1, t1 = PairingHeap.uncons h - let h2, t2 = - match t1 with - | PairingHeap.Cons(h, t) -> h, t - | _ -> "x", t1 + let h2, t2 = + match t1 with + | PairingHeap.Cons(h, t) -> h, t + | _ -> "x", t1 - ((h2 = "e") && ((PairingHeap.length t2) = 4)) |> Expect.isTrue "" - } + ((h2 = "e") && ((PairingHeap.length t2) = 4)) |> Expect.isTrue "" + } - test "cons pattern discriminator 2" { - let h = PairingHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "cons pattern discriminator 2" { + let h = PairingHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let t2 = - match h with - | PairingHeap.Cons("f", PairingHeap.Cons(_, t)) -> t - | _ -> h + let t2 = + match h with + | PairingHeap.Cons("f", PairingHeap.Cons(_, t)) -> t + | _ -> h - let h1, t3 = PairingHeap.uncons t2 + let h1, t3 = PairingHeap.uncons t2 - ((h1 = "d") && ((PairingHeap.length t2) = 4)) |> Expect.isTrue "" - } + ((h1 = "d") && ((PairingHeap.length t2) = 4)) |> Expect.isTrue "" + } - test "empty list should be empty" { (PairingHeap.empty true).IsEmpty |> Expect.isTrue "" } + test "empty list should be empty" { (PairingHeap.empty true).IsEmpty |> Expect.isTrue "" } - test "insert works" { - (((PairingHeap.empty true).Insert 1).Insert 2).IsEmpty - |> Expect.isFalse "" - } + test "insert works" { + (((PairingHeap.empty true).Insert 1).Insert 2).IsEmpty + |> Expect.isFalse "" + } - test "length of empty is 0" { (PairingHeap.empty true).Length() |> Expect.equal "" 0 } + test "length of empty is 0" { (PairingHeap.empty true).Length() |> Expect.equal "" 0 } - test "tryGetHead on empty should return None" { (PairingHeap.empty true).TryGetHead() |> Expect.isNone "" } + test "tryGetHead on empty should return None" { (PairingHeap.empty true).TryGetHead() |> Expect.isNone "" } - test "tryGetTail on empty should return None" { (PairingHeap.empty true).TryGetTail() |> Expect.isNone "" } + test "tryGetTail on empty should return None" { (PairingHeap.empty true).TryGetTail() |> Expect.isNone "" } - test "tryGetTail on len 1 should return Some empty" { - let h = - PairingHeap.empty true - |> PairingHeap.insert 1 - |> PairingHeap.tryGetTail + test "tryGetTail on len 1 should return Some empty" { + let h = + PairingHeap.empty true + |> PairingHeap.insert 1 + |> PairingHeap.tryGetTail - h.Value |> PairingHeap.isEmpty |> Expect.isTrue "" - } + h.Value |> PairingHeap.isEmpty |> Expect.isTrue "" + } - test "tryMerge max and mis should be None" { - let h1 = PairingHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h2 = PairingHeap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] + test "tryMerge max and mis should be None" { + let h1 = PairingHeap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h2 = PairingHeap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] - PairingHeap.tryMerge h1 h2 |> Expect.isNone "" - } + PairingHeap.tryMerge h1 h2 |> Expect.isNone "" + } - test "tryUncons empty" { (PairingHeap.empty true).TryUncons() |> Expect.isNone "" } - ] + test "tryUncons empty" { (PairingHeap.empty true).TryUncons() |> Expect.isNone "" } ] [] let testPairingHeapProperties = - testList "Experimental PairingHeap properties" [ - - testPropertyWithConfig - config10k - "max PairingHeap int head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap OfSeq head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap from Insert head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap int head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap OfSeq head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap from Insert head should return" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "maxPairingHeap seq enumerate matches build list" - (Prop.forAll(Arb.fromGen maxPairingHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "minPairingHeap seq enumerate matches build list" - (Prop.forAll(Arb.fromGen minPairingHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap int seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap OfSeq seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap from Insert seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap int seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap OfSeq seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap from Insert seq enumerate matches build list int" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap string seq enumerate matches build list string" - (Prop.forAll(Arb.fromGen stringGens.[0]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap string seq enumerate matches build list string" - (Prop.forAll(Arb.fromGen stringGens.[1]) - <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap int tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap OfSeq tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap from Insert tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap int tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap OfSeq tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap from Insert tail should return" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true - - (tlHead && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap int tryGetHead should return" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap OfSeq tryGetHead should return" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap from Insert tryGetHead should return" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap int tryGetHead should return" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap OfSeq tryGetHead should return" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap from Insert tryGetHead should return" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap int tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap OfSeq tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap from Insert tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap int tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap OfSeq tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap from Insert tryUncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap int uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap OfSeq uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "max PairingHeap from Insert uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap int uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap OfSeq uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - - testPropertyWithConfig - config10k - "min PairingHeap from Insert uncons 1 element" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - - ((x = l.Head) && (tl.Length() = (l.Length - 1))) - |> classifyCollect h (h.Length())) - ] + testList + "Experimental PairingHeap properties" + [ + + testPropertyWithConfig + config10k + "max PairingHeap int head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap OfSeq head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap from Insert head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap int head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap OfSeq head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap from Insert head should return" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> (h.Head() = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "maxPairingHeap seq enumerate matches build list" + (Prop.forAll(Arb.fromGen maxPairingHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "minPairingHeap seq enumerate matches build list" + (Prop.forAll(Arb.fromGen minPairingHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap int seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap OfSeq seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap from Insert seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap int seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap OfSeq seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap from Insert seq enumerate matches build list int" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap string seq enumerate matches build list string" + (Prop.forAll(Arb.fromGen stringGens.[0]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap string seq enumerate matches build list string" + (Prop.forAll(Arb.fromGen stringGens.[1]) + <| fun (h, l) -> h |> Seq.toList = l |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap int tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap OfSeq tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap from Insert tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap int tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap OfSeq tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap from Insert tail should return" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length() > 0) then (tl.Head() = l.Item(1)) else true + + (tlHead && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap int tryGetHead should return" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap OfSeq tryGetHead should return" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap from Insert tryGetHead should return" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap int tryGetHead should return" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap OfSeq tryGetHead should return" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap from Insert tryGetHead should return" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> (h.TryGetHead().Value = l.Head) |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap int tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap OfSeq tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap from Insert tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap int tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap OfSeq tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap from Insert tryUncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap int uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap OfSeq uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "max PairingHeap from Insert uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap int uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap OfSeq uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) + + testPropertyWithConfig + config10k + "min PairingHeap from Insert uncons 1 element" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + + ((x = l.Head) && (tl.Length() = (l.Length - 1))) + |> classifyCollect h (h.Length())) ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/QueueGen.fs b/tests/FSharpx.Collections.Experimental.Tests/QueueGen.fs index 5425b38f..5b938583 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/QueueGen.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/QueueGen.fs @@ -19,183 +19,206 @@ module QueueGen = (* IQueue generators from random ofSeq and/or snoc elements from random list *) - let bankersQueueIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((BankersQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let bankersQueueIntOfSeqGen = gen { - let! n = Gen.length2thru12 - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((BankersQueue.ofSeq x) :> IQueue, x) - } - - let bankersQueueIntSnocGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((BankersQueue.empty() |> snocThruList x), x) - } - - let bankersQueueObjGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((BankersQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let bankersQueueStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((BankersQueue.ofSeq x |> snocThruList y), (x @ y)) - } + let bankersQueueIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((BankersQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let bankersQueueIntOfSeqGen = + gen { + let! n = Gen.length2thru12 + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((BankersQueue.ofSeq x) :> IQueue, x) + } + + let bankersQueueIntSnocGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((BankersQueue.empty() |> snocThruList x), x) + } + + let bankersQueueObjGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((BankersQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let bankersQueueStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((BankersQueue.ofSeq x |> snocThruList y), (x @ y)) + } (* non-IQueue generators from random ofList *) - let batchedQueueOfListGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((BatchedQueue.ofList x), x) - } + let batchedQueueOfListGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((BatchedQueue.ofList x), x) + } (* IQueue generators from random ofSeq and/or snoc elements from random list *) - let batchedQueueIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((BatchedQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let batchedQueueIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((BatchedQueue.ofSeq x) :> IQueue, x) - } - - let batchedQueueIntSnocGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((BatchedQueue.empty() |> snocThruList x), x) - } - - let batchedQueueObjGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((BatchedQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let batchedQueueStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((BatchedQueue.ofSeq x |> snocThruList y), (x @ y)) - } + let batchedQueueIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((BatchedQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let batchedQueueIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((BatchedQueue.ofSeq x) :> IQueue, x) + } + + let batchedQueueIntSnocGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((BatchedQueue.empty() |> snocThruList x), x) + } + + let batchedQueueObjGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((BatchedQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let batchedQueueStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((BatchedQueue.ofSeq x |> snocThruList y), (x @ y)) + } (* non-IQueue generators from random ofList *) - let hoodMelvilleQueueOfListGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((HoodMelvilleQueue.ofList x), x) - } + let hoodMelvilleQueueOfListGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((HoodMelvilleQueue.ofList x), x) + } (* IQueue generators from random ofSeq and/or snoc elements from random list *) - let hoodMelvilleQueueIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((HoodMelvilleQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let hoodMelvilleQueueIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((HoodMelvilleQueue.ofSeq x) :> IQueue, x) - } - - let hoodMelvilleQueueIntSnocGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((HoodMelvilleQueue.empty() |> snocThruList x), x) - } - - let hoodMelvilleQueueObjGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((HoodMelvilleQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let hoodMelvilleQueueStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((HoodMelvilleQueue.ofSeq x |> snocThruList y), (x @ y)) - } + let hoodMelvilleQueueIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((HoodMelvilleQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let hoodMelvilleQueueIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((HoodMelvilleQueue.ofSeq x) :> IQueue, x) + } + + let hoodMelvilleQueueIntSnocGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((HoodMelvilleQueue.empty() |> snocThruList x), x) + } + + let hoodMelvilleQueueObjGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((HoodMelvilleQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let hoodMelvilleQueueStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((HoodMelvilleQueue.ofSeq x |> snocThruList y), (x @ y)) + } (* non-IQueue generators from random ofList *) - let physicistQueueOfListqGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((PhysicistQueue.ofList x), x) - } + let physicistQueueOfListqGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((PhysicistQueue.ofList x), x) + } (* IQueue generators from random ofSeq and/or snoc elements from random list *) - let physicistQueueIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((PhysicistQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let physicistQueueIntOfSeqGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((PhysicistQueue.ofSeq x) :> IQueue, x) - } - - let physicistQueueIntSnocGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((PhysicistQueue.empty() |> snocThruList x), x) - } - - let physicistQueueObjGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((PhysicistQueue.ofSeq x |> snocThruList y), (x @ y)) - } - - let physicistQueueStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((PhysicistQueue.ofSeq x |> snocThruList y), (x @ y)) - } + let physicistQueueIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((PhysicistQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let physicistQueueIntOfSeqGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((PhysicistQueue.ofSeq x) :> IQueue, x) + } + + let physicistQueueIntSnocGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((PhysicistQueue.empty() |> snocThruList x), x) + } + + let physicistQueueObjGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((PhysicistQueue.ofSeq x |> snocThruList y), (x @ y)) + } + + let physicistQueueStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((PhysicistQueue.ofSeq x |> snocThruList y), (x @ y)) + } diff --git a/tests/FSharpx.Collections.Experimental.Tests/RealTimeDequeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/RealTimeDequeTest.fs index 09815490..4a9e581c 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/RealTimeDequeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/RealTimeDequeTest.fs @@ -324,3695 +324,3695 @@ module RealTimeDequeTest = [] let testRealTimeDeque = - testList "Experimental RealTimeDeque" [ - test "RealTimeDeque.empty dqueue should be RealTimeDeque.empty" { RealTimeDeque.isEmpty(RealTimeDeque.empty 2) |> Expect.isTrue "" } - - test "RealTimeDeque.cons works" { - ((len2 |> RealTimeDeque.isEmpty) && (len2C3 |> RealTimeDeque.isEmpty)) - |> Expect.isFalse "" - } - - test "RealTimeDeque.snoc works" { - ((len2snoc |> RealTimeDeque.isEmpty) - && (len2C3snoc |> RealTimeDeque.isEmpty)) - |> Expect.isFalse "" - } - - test "RealTimeDeque.singleton RealTimeDeque.head works" { - (((RealTimeDeque.head len1) = "a") - && ((len1C3 |> RealTimeDeque.isEmpty)) = false) - |> Expect.isTrue "" - } - - test "RealTimeDeque.singleton RealTimeDeque.last works" { len1 |> RealTimeDeque.last |> Expect.equal "" "a" } - - test "RealTimeDeque.tail of RealTimeDeque.singleton RealTimeDeque.empty" { - len1 - |> RealTimeDeque.tail - |> RealTimeDeque.isEmpty - |> Expect.isTrue "" - } - - test "RealTimeDeque.tail of RealTimeDeque.tail of 2 RealTimeDeque.empty" { - (len2 - |> RealTimeDeque.tail - |> RealTimeDeque.tail - |> RealTimeDeque.isEmpty) - |> Expect.isTrue "" - } - - test "RealTimeDeque.init of RealTimeDeque.singleton RealTimeDeque.empty" { - ((RealTimeDeque.init len1) |> RealTimeDeque.isEmpty) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 1" { - let t1 = RealTimeDeque.tail len2 - let t1C = RealTimeDeque.tail len2C3 - let t1s = RealTimeDeque.tail len2snoc - let t1Cs = RealTimeDeque.tail len2C3snoc - let ht1 = RealTimeDeque.head t1 - let ht1C = RealTimeDeque.head t1C - let ht1s = RealTimeDeque.head t1s - let ht1Cs = RealTimeDeque.head t1Cs - - (((RealTimeDeque.length t1) = 1) - && ((RealTimeDeque.length t1C) = 1) - && ((RealTimeDeque.length t1s) = 1) - && ((RealTimeDeque.length t1Cs) = 1) - && (ht1 = "a") - && (ht1C = "a") - && (ht1s = "a") - && (ht1Cs = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 2" { - let t1 = RealTimeDeque.tail len3 - let t1C = RealTimeDeque.tail len3C3 - let t1s = RealTimeDeque.tail len3snoc - let t1Cs = RealTimeDeque.tail len3C3snoc - - let t1_1 = RealTimeDeque.tail t1 - let t1C_1 = RealTimeDeque.tail t1C - let t1_1s = RealTimeDeque.tail t1s - let t1C_1s = RealTimeDeque.tail t1Cs - - (((RealTimeDeque.length t1) = 2) - && ((RealTimeDeque.length t1C) = 2) - && ((RealTimeDeque.length t1s) = 2) - && ((RealTimeDeque.length t1Cs) = 2) - && ((RealTimeDeque.head t1) = "b") - && ((RealTimeDeque.head t1C) = "b") - && ((RealTimeDeque.head t1s) = "b") - && ((RealTimeDeque.head t1Cs) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 3" { - let t1 = RealTimeDeque.tail len4 - let t1C = RealTimeDeque.tail len4C3 - let t1s = RealTimeDeque.tail len4snoc - let t1Cs = RealTimeDeque.tail len4C3snoc - - let t1_2 = RealTimeDeque.tail t1 - let t1C_2 = RealTimeDeque.tail t1C - let t1_2s = RealTimeDeque.tail t1s - let t1C_2s = RealTimeDeque.tail t1Cs - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 3) - && ((RealTimeDeque.length t1C) = 3) - && ((RealTimeDeque.length t1s) = 3) - && ((RealTimeDeque.length t1Cs) = 3) - && ((RealTimeDeque.head t1) = "c") - && ((RealTimeDeque.head t1C) = "c") - && ((RealTimeDeque.head t1s) = "c") - && ((RealTimeDeque.head t1Cs) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 4" { - let t1 = RealTimeDeque.tail len5 - let t1C = RealTimeDeque.tail len5C3 - let t1s = RealTimeDeque.tail len5snoc - let t1Cs = RealTimeDeque.tail len5C3snoc - - let t1_3 = RealTimeDeque.tail t1 - let t1C_3 = RealTimeDeque.tail t1C - let t1_3s = RealTimeDeque.tail t1s - let t1C_3s = RealTimeDeque.tail t1Cs - - let t1_2 = RealTimeDeque.tail t1_3 - let t1C_2 = RealTimeDeque.tail t1C_3 - let t1_2s = RealTimeDeque.tail t1_3s - let t1C_2s = RealTimeDeque.tail t1C_3s - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 4) - && ((RealTimeDeque.length t1C) = 4) - && ((RealTimeDeque.length t1s) = 4) - && ((RealTimeDeque.length t1Cs) = 4) - && ((RealTimeDeque.head t1) = "d") - && ((RealTimeDeque.head t1C) = "d") - && ((RealTimeDeque.head t1s) = "d") - && ((RealTimeDeque.head t1Cs) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.length t1_3s) = 3) - && ((RealTimeDeque.length t1C_3s) = 3) - && ((RealTimeDeque.head t1_3) = "c") - && ((RealTimeDeque.head t1C_3) = "c") - && ((RealTimeDeque.head t1_3s) = "c") - && ((RealTimeDeque.head t1C_3s) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 5" { - let t1 = RealTimeDeque.tail len6 - let t1C = RealTimeDeque.tail len6C3 - let t1s = RealTimeDeque.tail len6snoc - let t1Cs = RealTimeDeque.tail len6C3snoc - - let t1_4 = RealTimeDeque.tail t1 - let t1C_4 = RealTimeDeque.tail t1C - let t1_4s = RealTimeDeque.tail t1s - let t1C_4s = RealTimeDeque.tail t1Cs - - let t1_3 = RealTimeDeque.tail t1_4 - let t1C_3 = RealTimeDeque.tail t1C_4 - let t1_3s = RealTimeDeque.tail t1_4s - let t1C_3s = RealTimeDeque.tail t1C_4s - - let t1_2 = RealTimeDeque.tail t1_3 - let t1C_2 = RealTimeDeque.tail t1C_3 - let t1_2s = RealTimeDeque.tail t1_3s - let t1C_2s = RealTimeDeque.tail t1C_3s - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 5) - && ((RealTimeDeque.length t1C) = 5) - && ((RealTimeDeque.length t1s) = 5) - && ((RealTimeDeque.length t1Cs) = 5) - && ((RealTimeDeque.head t1) = "e") - && ((RealTimeDeque.head t1C) = "e") - && ((RealTimeDeque.head t1s) = "e") - && ((RealTimeDeque.head t1Cs) = "e") - && ((RealTimeDeque.length t1_4) = 4) - && ((RealTimeDeque.length t1C_4) = 4) - && ((RealTimeDeque.length t1_4s) = 4) - && ((RealTimeDeque.length t1C_4s) = 4) - && ((RealTimeDeque.head t1_4) = "d") - && ((RealTimeDeque.head t1C_4) = "d") - && ((RealTimeDeque.head t1_4s) = "d") - && ((RealTimeDeque.head t1C_4s) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.length t1_3s) = 3) - && ((RealTimeDeque.length t1C_3s) = 3) - && ((RealTimeDeque.head t1_3) = "c") - && ((RealTimeDeque.head t1C_3) = "c") - && ((RealTimeDeque.head t1_3s) = "c") - && ((RealTimeDeque.head t1C_3s) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 6" { - let t1 = RealTimeDeque.tail len7 - let t1C = RealTimeDeque.tail len7C3 - let t1s = RealTimeDeque.tail len7snoc - let t1Cs = RealTimeDeque.tail len7C3snoc - - let t1_5 = RealTimeDeque.tail t1 - let t1C_5 = RealTimeDeque.tail t1C - let t1_5s = RealTimeDeque.tail t1s - let t1C_5s = RealTimeDeque.tail t1Cs - - let t1_4 = RealTimeDeque.tail t1_5 - let t1C_4 = RealTimeDeque.tail t1C_5 - let t1_4s = RealTimeDeque.tail t1_5s - let t1C_4s = RealTimeDeque.tail t1C_5s - - let t1_3 = RealTimeDeque.tail t1_4 - let t1C_3 = RealTimeDeque.tail t1C_4 - let t1_3s = RealTimeDeque.tail t1_4s - let t1C_3s = RealTimeDeque.tail t1C_4s - - let t1_2 = RealTimeDeque.tail t1_3 - let t1C_2 = RealTimeDeque.tail t1C_3 - let t1_2s = RealTimeDeque.tail t1_3s - let t1C_2s = RealTimeDeque.tail t1C_3s - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 6) - && ((RealTimeDeque.length t1C) = 6) - && ((RealTimeDeque.length t1s) = 6) - && ((RealTimeDeque.length t1Cs) = 6) - && ((RealTimeDeque.head t1) = "f") - && ((RealTimeDeque.head t1C) = "f") - && ((RealTimeDeque.head t1s) = "f") - && ((RealTimeDeque.head t1Cs) = "f") - && ((RealTimeDeque.length t1_5) = 5) - && ((RealTimeDeque.length t1C_5) = 5) - && ((RealTimeDeque.length t1_5s) = 5) - && ((RealTimeDeque.length t1C_5s) = 5) - && ((RealTimeDeque.head t1_5) = "e") - && ((RealTimeDeque.head t1C_5) = "e") - && ((RealTimeDeque.head t1_5s) = "e") - && ((RealTimeDeque.head t1C_5s) = "e") - && ((RealTimeDeque.length t1_4) = 4) - && ((RealTimeDeque.length t1C_4) = 4) - && ((RealTimeDeque.length t1_4s) = 4) - && ((RealTimeDeque.length t1C_4s) = 4) - && ((RealTimeDeque.head t1_4) = "d") - && ((RealTimeDeque.head t1C_4) = "d") - && ((RealTimeDeque.head t1_4s) = "d") - && ((RealTimeDeque.head t1C_4s) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.length t1_3s) = 3) - && ((RealTimeDeque.length t1C_3s) = 3) - && ((RealTimeDeque.head t1_3) = "c") - && ((RealTimeDeque.head t1C_3) = "c") - && ((RealTimeDeque.head t1_3s) = "c") - && ((RealTimeDeque.head t1C_3s) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 7" { - let t1 = RealTimeDeque.tail len8 - let t1C = RealTimeDeque.tail len8C3 - let t1s = RealTimeDeque.tail len8snoc - let t1Cs = RealTimeDeque.tail len8C3snoc - - let t1_6 = RealTimeDeque.tail t1 - let t1C_6 = RealTimeDeque.tail t1C - let t1_6s = RealTimeDeque.tail t1s - let t1C_6s = RealTimeDeque.tail t1Cs - - let t1_5 = RealTimeDeque.tail t1_6 - let t1C_5 = RealTimeDeque.tail t1C_6 - let t1_5s = RealTimeDeque.tail t1_6s - let t1C_5s = RealTimeDeque.tail t1C_6s - - let t1_4 = RealTimeDeque.tail t1_5 - let t1C_4 = RealTimeDeque.tail t1C_5 - let t1_4s = RealTimeDeque.tail t1_5s - let t1C_4s = RealTimeDeque.tail t1C_5s - - let t1_3 = RealTimeDeque.tail t1_4 - let t1C_3 = RealTimeDeque.tail t1C_4 - let t1_3s = RealTimeDeque.tail t1_4s - let t1C_3s = RealTimeDeque.tail t1C_4s - - let t1_2 = RealTimeDeque.tail t1_3 - let t1C_2 = RealTimeDeque.tail t1C_3 - let t1_2s = RealTimeDeque.tail t1_3s - let t1C_2s = RealTimeDeque.tail t1C_3s - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 7) - && ((RealTimeDeque.length t1C) = 7) - && ((RealTimeDeque.length t1s) = 7) - && ((RealTimeDeque.length t1Cs) = 7) - && ((RealTimeDeque.head t1) = "g") - && ((RealTimeDeque.head t1C) = "g") - && ((RealTimeDeque.head t1s) = "g") - && ((RealTimeDeque.head t1Cs) = "g") - && ((RealTimeDeque.length t1_6) = 6) - && ((RealTimeDeque.length t1C_6) = 6) - && ((RealTimeDeque.length t1_6s) = 6) - && ((RealTimeDeque.length t1C_6s) = 6) - && ((RealTimeDeque.head t1_6) = "f") - && ((RealTimeDeque.head t1C_6) = "f") - && ((RealTimeDeque.head t1_6s) = "f") - && ((RealTimeDeque.head t1C_6s) = "f") - && ((RealTimeDeque.length t1_5) = 5) - && ((RealTimeDeque.length t1C_5) = 5) - && ((RealTimeDeque.length t1_5s) = 5) - && ((RealTimeDeque.length t1C_5s) = 5) - && ((RealTimeDeque.head t1_5) = "e") - && ((RealTimeDeque.head t1C_5) = "e") - && ((RealTimeDeque.head t1_5s) = "e") - && ((RealTimeDeque.head t1C_5s) = "e") - && ((RealTimeDeque.length t1_4) = 4) - && ((RealTimeDeque.length t1C_4) = 4) - && ((RealTimeDeque.length t1_4s) = 4) - && ((RealTimeDeque.length t1C_4s) = 4) - && ((RealTimeDeque.head t1_4) = "d") - && ((RealTimeDeque.head t1C_4) = "d") - && ((RealTimeDeque.head t1_4s) = "d") - && ((RealTimeDeque.head t1C_4s) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.length t1_3s) = 3) - && ((RealTimeDeque.length t1C_3s) = 3) - && ((RealTimeDeque.head t1_3) = "c") - && ((RealTimeDeque.head t1C_3) = "c") - && ((RealTimeDeque.head t1_3s) = "c") - && ((RealTimeDeque.head t1C_3s) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 8" { - let t1 = RealTimeDeque.tail len9 - let t1C = RealTimeDeque.tail len9C3 - let t1s = RealTimeDeque.tail len9snoc - let t1Cs = RealTimeDeque.tail len9C3snoc - - let t1_7 = RealTimeDeque.tail t1 - let t1C_7 = RealTimeDeque.tail t1C - let t1_7s = RealTimeDeque.tail t1s - let t1C_7s = RealTimeDeque.tail t1Cs - - let t1_6 = RealTimeDeque.tail t1_7 - let t1C_6 = RealTimeDeque.tail t1C_7 - let t1_6s = RealTimeDeque.tail t1_7s - let t1C_6s = RealTimeDeque.tail t1C_7s - - let t1_5 = RealTimeDeque.tail t1_6 - let t1C_5 = RealTimeDeque.tail t1C_6 - let t1_5s = RealTimeDeque.tail t1_6s - let t1C_5s = RealTimeDeque.tail t1C_6s - - let t1_4 = RealTimeDeque.tail t1_5 - let t1C_4 = RealTimeDeque.tail t1C_5 - let t1_4s = RealTimeDeque.tail t1_5s - let t1C_4s = RealTimeDeque.tail t1C_5s - - let t1_3 = RealTimeDeque.tail t1_4 - let t1C_3 = RealTimeDeque.tail t1C_4 - let t1_3s = RealTimeDeque.tail t1_4s - let t1C_3s = RealTimeDeque.tail t1C_4s - - let t1_2 = RealTimeDeque.tail t1_3 - let t1C_2 = RealTimeDeque.tail t1C_3 - let t1_2s = RealTimeDeque.tail t1_3s - let t1C_2s = RealTimeDeque.tail t1C_3s - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 8) - && ((RealTimeDeque.length t1C) = 8) - && ((RealTimeDeque.length t1s) = 8) - && ((RealTimeDeque.length t1Cs) = 8) - && ((RealTimeDeque.head t1) = "h") - && ((RealTimeDeque.head t1C) = "h") - && ((RealTimeDeque.head t1s) = "h") - && ((RealTimeDeque.head t1Cs) = "h") - && ((RealTimeDeque.length t1_7) = 7) - && ((RealTimeDeque.length t1C_7) = 7) - && ((RealTimeDeque.length t1_7s) = 7) - && ((RealTimeDeque.length t1C_7s) = 7) - && ((RealTimeDeque.head t1_7) = "g") - && ((RealTimeDeque.head t1C_7) = "g") - && ((RealTimeDeque.head t1_7s) = "g") - && ((RealTimeDeque.head t1C_7s) = "g") - && ((RealTimeDeque.length t1_6) = 6) - && ((RealTimeDeque.length t1C_6) = 6) - && ((RealTimeDeque.length t1_6s) = 6) - && ((RealTimeDeque.length t1C_6s) = 6) - && ((RealTimeDeque.head t1_6) = "f") - && ((RealTimeDeque.head t1C_6) = "f") - && ((RealTimeDeque.head t1_6s) = "f") - && ((RealTimeDeque.head t1C_6s) = "f") - && ((RealTimeDeque.length t1_5) = 5) - && ((RealTimeDeque.length t1C_5) = 5) - && ((RealTimeDeque.length t1_5s) = 5) - && ((RealTimeDeque.length t1C_5s) = 5) - && ((RealTimeDeque.head t1_5) = "e") - && ((RealTimeDeque.head t1C_5) = "e") - && ((RealTimeDeque.head t1_5s) = "e") - && ((RealTimeDeque.head t1C_5s) = "e") - && ((RealTimeDeque.length t1_4) = 4) - && ((RealTimeDeque.length t1C_4) = 4) - && ((RealTimeDeque.length t1_4s) = 4) - && ((RealTimeDeque.length t1C_4s) = 4) - && ((RealTimeDeque.head t1_4) = "d") - && ((RealTimeDeque.head t1C_4) = "d") - && ((RealTimeDeque.head t1_4s) = "d") - && ((RealTimeDeque.head t1C_4s) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.length t1_3s) = 3) - && ((RealTimeDeque.length t1C_3s) = 3) - && ((RealTimeDeque.head t1_3) = "c") - && ((RealTimeDeque.head t1C_3) = "c") - && ((RealTimeDeque.head t1_3s) = "c") - && ((RealTimeDeque.head t1C_3s) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 9" { - let t1 = RealTimeDeque.tail lena - let t1C = RealTimeDeque.tail lenaC3 - let t1s = RealTimeDeque.tail lenasnoc - let t1Cs = RealTimeDeque.tail lenaC3snoc - - let t1_8 = RealTimeDeque.tail t1 - let t1C_8 = RealTimeDeque.tail t1C - let t1_8s = RealTimeDeque.tail t1s - let t1C_8s = RealTimeDeque.tail t1Cs - - let t1_7 = RealTimeDeque.tail t1_8 - let t1C_7 = RealTimeDeque.tail t1C_8 - let t1_7s = RealTimeDeque.tail t1_8s - let t1C_7s = RealTimeDeque.tail t1C_8s - - let t1_6 = RealTimeDeque.tail t1_7 - let t1C_6 = RealTimeDeque.tail t1C_7 - let t1_6s = RealTimeDeque.tail t1_7s - let t1C_6s = RealTimeDeque.tail t1C_7s - - let t1_5 = RealTimeDeque.tail t1_6 - let t1C_5 = RealTimeDeque.tail t1C_6 - let t1_5s = RealTimeDeque.tail t1_6s - let t1C_5s = RealTimeDeque.tail t1C_6s - - let t1_4 = RealTimeDeque.tail t1_5 - let t1C_4 = RealTimeDeque.tail t1C_5 - let t1_4s = RealTimeDeque.tail t1_5s - let t1C_4s = RealTimeDeque.tail t1C_5s - - let t1_3 = RealTimeDeque.tail t1_4 - let t1C_3 = RealTimeDeque.tail t1C_4 - let t1_3s = RealTimeDeque.tail t1_4s - let t1C_3s = RealTimeDeque.tail t1C_4s - - let t1_2 = RealTimeDeque.tail t1_3 - let t1C_2 = RealTimeDeque.tail t1C_3 - let t1_2s = RealTimeDeque.tail t1_3s - let t1C_2s = RealTimeDeque.tail t1C_3s - - let t1_1 = RealTimeDeque.tail t1_2 - let t1C_1 = RealTimeDeque.tail t1C_2 - let t1_1s = RealTimeDeque.tail t1_2s - let t1C_1s = RealTimeDeque.tail t1C_2s - - (((RealTimeDeque.length t1) = 9) - && ((RealTimeDeque.length t1C) = 9) - && ((RealTimeDeque.length t1s) = 9) - && ((RealTimeDeque.length t1Cs) = 9) - && ((RealTimeDeque.head t1) = "i") - && ((RealTimeDeque.head t1C) = "i") - && ((RealTimeDeque.head t1s) = "i") - && ((RealTimeDeque.head t1Cs) = "i") - && ((RealTimeDeque.length t1_8) = 8) - && ((RealTimeDeque.length t1C_8) = 8) - && ((RealTimeDeque.length t1_8s) = 8) - && ((RealTimeDeque.length t1C_8s) = 8) - && ((RealTimeDeque.head t1_8) = "h") - && ((RealTimeDeque.head t1C_8) = "h") - && ((RealTimeDeque.head t1_8s) = "h") - && ((RealTimeDeque.head t1C_8s) = "h") - && ((RealTimeDeque.length t1_7) = 7) - && ((RealTimeDeque.length t1C_7) = 7) - && ((RealTimeDeque.length t1_7s) = 7) - && ((RealTimeDeque.length t1C_7s) = 7) - && ((RealTimeDeque.head t1_7) = "g") - && ((RealTimeDeque.head t1C_7) = "g") - && ((RealTimeDeque.head t1_7s) = "g") - && ((RealTimeDeque.head t1C_7s) = "g") - && ((RealTimeDeque.length t1_6) = 6) - && ((RealTimeDeque.length t1C_6) = 6) - && ((RealTimeDeque.length t1_6s) = 6) - && ((RealTimeDeque.length t1C_6s) = 6) - && ((RealTimeDeque.head t1_6) = "f") - && ((RealTimeDeque.head t1C_6) = "f") - && ((RealTimeDeque.head t1_6s) = "f") - && ((RealTimeDeque.head t1C_6s) = "f") - && ((RealTimeDeque.length t1_5) = 5) - && ((RealTimeDeque.length t1C_5) = 5) - && ((RealTimeDeque.length t1_5s) = 5) - && ((RealTimeDeque.length t1C_5s) = 5) - && ((RealTimeDeque.head t1_5) = "e") - && ((RealTimeDeque.head t1C_5) = "e") - && ((RealTimeDeque.head t1_5s) = "e") - && ((RealTimeDeque.head t1C_5s) = "e") - && ((RealTimeDeque.length t1_4) = 4) - && ((RealTimeDeque.length t1C_4) = 4) - && ((RealTimeDeque.length t1_4s) = 4) - && ((RealTimeDeque.length t1C_4s) = 4) - && ((RealTimeDeque.head t1_4) = "d") - && ((RealTimeDeque.head t1C_4) = "d") - && ((RealTimeDeque.head t1_4s) = "d") - && ((RealTimeDeque.head t1C_4s) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.length t1_3s) = 3) - && ((RealTimeDeque.length t1C_3s) = 3) - && ((RealTimeDeque.head t1_3) = "c") - && ((RealTimeDeque.head t1C_3) = "c") - && ((RealTimeDeque.head t1_3s) = "c") - && ((RealTimeDeque.head t1C_3s) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.length t1_2s) = 2) - && ((RealTimeDeque.length t1C_2s) = 2) - && ((RealTimeDeque.head t1_2) = "b") - && ((RealTimeDeque.head t1C_2) = "b") - && ((RealTimeDeque.head t1_2s) = "b") - && ((RealTimeDeque.head t1C_2s) = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && ((RealTimeDeque.length t1_1s) = 1) - && ((RealTimeDeque.length t1C_1s) = 1) - && ((RealTimeDeque.head t1_1) = "a") - && ((RealTimeDeque.head t1C_1) = "a") - && ((RealTimeDeque.head t1_1s) = "a") - && ((RealTimeDeque.head t1C_1s) = "a")) - |> Expect.isTrue "" - } - - //the previous series thoroughly tested construction by RealTimeDeque.snoc, so we'll leave those out - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 1" { - let t1 = RealTimeDeque.init len2 - let t1C = RealTimeDeque.init len2C3 - - (((RealTimeDeque.length t1) = 1) - && ((RealTimeDeque.length t1C) = 1) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 2" { - let t1 = RealTimeDeque.init len3 - let t1C = RealTimeDeque.init len3C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - - let lt1 = (RealTimeDeque.last t1) - let lt1C = (RealTimeDeque.last t1C) - let lt1_1 = (RealTimeDeque.last t1_1) - let lt1C_1 = (RealTimeDeque.last t1C_1) - - (((RealTimeDeque.length t1) = 2) - && ((RealTimeDeque.length t1C) = 2) - && (lt1 = "b") - && (lt1C = "b") - && ((RealTimeDeque.length t1_1) = 1) - && ((RealTimeDeque.length t1C_1) = 1) - && (lt1_1 = "c") - && (lt1C_1 = "c")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 3" { - let t1 = RealTimeDeque.init len4 - let t1C = RealTimeDeque.init len4C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - - (((RealTimeDeque.length t1) = 3) - && ((RealTimeDeque.length t1C) = 3) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 2) - && ((RealTimeDeque.length t1C_1) = 2) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 1) - && ((RealTimeDeque.length t1C_2) = 1) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 4" { - let t1 = RealTimeDeque.init len5 - let t1C = RealTimeDeque.init len5C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - let t1_3 = RealTimeDeque.init t1_2 - let t1C_3 = RealTimeDeque.init t1C_2 - - (((RealTimeDeque.length t1) = 4) - && ((RealTimeDeque.length t1C) = 4) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 3) - && ((RealTimeDeque.length t1C_1) = 3) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 2) - && ((RealTimeDeque.length t1C_2) = 2) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d") - && ((RealTimeDeque.length t1_3) = 1) - && ((RealTimeDeque.length t1C_3) = 1) - && ((RealTimeDeque.last t1_3) = "e") - && ((RealTimeDeque.last t1C_3) = "e")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 5" { - let t1 = RealTimeDeque.init len6 - let t1C = RealTimeDeque.init len6C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - let t1_3 = RealTimeDeque.init t1_2 - let t1C_3 = RealTimeDeque.init t1C_2 - let t1_4 = RealTimeDeque.init t1_3 - let t1C_4 = RealTimeDeque.init t1C_3 - - (((RealTimeDeque.length t1) = 5) - && ((RealTimeDeque.length t1C) = 5) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 4) - && ((RealTimeDeque.length t1C_1) = 4) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 3) - && ((RealTimeDeque.length t1C_2) = 3) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d") - && ((RealTimeDeque.length t1_3) = 2) - && ((RealTimeDeque.length t1C_3) = 2) - && ((RealTimeDeque.last t1_3) = "e") - && ((RealTimeDeque.last t1C_3) = "e") - && ((RealTimeDeque.length t1_4) = 1) - && ((RealTimeDeque.length t1C_4) = 1) - && ((RealTimeDeque.last t1_4) = "f") - && ((RealTimeDeque.last t1C_4) = "f")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 6" { - let t1 = RealTimeDeque.init len7 - let t1C = RealTimeDeque.init len7C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - let t1_3 = RealTimeDeque.init t1_2 - let t1C_3 = RealTimeDeque.init t1C_2 - let t1_4 = RealTimeDeque.init t1_3 - let t1C_4 = RealTimeDeque.init t1C_3 - let t1_5 = RealTimeDeque.init t1_4 - let t1C_5 = RealTimeDeque.init t1C_4 - - (((RealTimeDeque.length t1) = 6) - && ((RealTimeDeque.length t1C) = 6) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 5) - && ((RealTimeDeque.length t1C_1) = 5) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 4) - && ((RealTimeDeque.length t1C_2) = 4) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d") - && ((RealTimeDeque.length t1_3) = 3) - && ((RealTimeDeque.length t1C_3) = 3) - && ((RealTimeDeque.last t1_3) = "e") - && ((RealTimeDeque.last t1C_3) = "e") - && ((RealTimeDeque.length t1_4) = 2) - && ((RealTimeDeque.length t1C_4) = 2) - && ((RealTimeDeque.last t1_4) = "f") - && ((RealTimeDeque.last t1C_4) = "f") - && ((RealTimeDeque.length t1_5) = 1) - && ((RealTimeDeque.length t1C_5) = 1) - && ((RealTimeDeque.last t1_5) = "g") - && ((RealTimeDeque.last t1C_5) = "g")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 7" { - let t1 = RealTimeDeque.init len8 - let t1C = RealTimeDeque.init len8C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - let t1_3 = RealTimeDeque.init t1_2 - let t1C_3 = RealTimeDeque.init t1C_2 - let t1_4 = RealTimeDeque.init t1_3 - let t1C_4 = RealTimeDeque.init t1C_3 - let t1_5 = RealTimeDeque.init t1_4 - let t1C_5 = RealTimeDeque.init t1C_4 - let t1_6 = RealTimeDeque.init t1_5 - let t1C_6 = RealTimeDeque.init t1C_5 - - (((RealTimeDeque.length t1) = 7) - && ((RealTimeDeque.length t1C) = 7) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 6) - && ((RealTimeDeque.length t1C_1) = 6) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 5) - && ((RealTimeDeque.length t1C_2) = 5) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d") - && ((RealTimeDeque.length t1_3) = 4) - && ((RealTimeDeque.length t1C_3) = 4) - && ((RealTimeDeque.last t1_3) = "e") - && ((RealTimeDeque.last t1C_3) = "e") - && ((RealTimeDeque.length t1_4) = 3) - && ((RealTimeDeque.length t1C_4) = 3) - && ((RealTimeDeque.last t1_4) = "f") - && ((RealTimeDeque.last t1C_4) = "f") - && ((RealTimeDeque.length t1_5) = 2) - && ((RealTimeDeque.length t1C_5) = 2) - && ((RealTimeDeque.last t1_5) = "g") - && ((RealTimeDeque.last t1C_5) = "g") - && ((RealTimeDeque.length t1_6) = 1) - && ((RealTimeDeque.length t1C_6) = 1) - && ((RealTimeDeque.last t1_6) = "h") - && ((RealTimeDeque.last t1C_6) = "h")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 8" { - let t1 = RealTimeDeque.init len9 - let t1C = RealTimeDeque.init len9C3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - let t1_3 = RealTimeDeque.init t1_2 - let t1C_3 = RealTimeDeque.init t1C_2 - let t1_4 = RealTimeDeque.init t1_3 - let t1C_4 = RealTimeDeque.init t1C_3 - let t1_5 = RealTimeDeque.init t1_4 - let t1C_5 = RealTimeDeque.init t1C_4 - let t1_6 = RealTimeDeque.init t1_5 - let t1C_6 = RealTimeDeque.init t1C_5 - let t1_7 = RealTimeDeque.init t1_6 - let t1C_7 = RealTimeDeque.init t1C_6 - - (((RealTimeDeque.length t1) = 8) - && ((RealTimeDeque.length t1C) = 8) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 7) - && ((RealTimeDeque.length t1C_1) = 7) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 6) - && ((RealTimeDeque.length t1C_2) = 6) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d") - && ((RealTimeDeque.length t1_3) = 5) - && ((RealTimeDeque.length t1C_3) = 5) - && ((RealTimeDeque.last t1_3) = "e") - && ((RealTimeDeque.last t1C_3) = "e") - && ((RealTimeDeque.length t1_4) = 4) - && ((RealTimeDeque.length t1C_4) = 4) - && ((RealTimeDeque.last t1_4) = "f") - && ((RealTimeDeque.last t1C_4) = "f") - && ((RealTimeDeque.length t1_5) = 3) - && ((RealTimeDeque.length t1C_5) = 3) - && ((RealTimeDeque.last t1_5) = "g") - && ((RealTimeDeque.last t1C_5) = "g") - && ((RealTimeDeque.length t1_6) = 2) - && ((RealTimeDeque.length t1C_6) = 2) - && ((RealTimeDeque.last t1_6) = "h") - && ((RealTimeDeque.last t1C_6) = "h") - && ((RealTimeDeque.length t1_7) = 1) - && ((RealTimeDeque.length t1C_7) = 1) - && ((RealTimeDeque.last t1_7) = "i") - && ((RealTimeDeque.last t1C_7) = "i")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 9" { - let t1 = RealTimeDeque.init lena - let t1C = RealTimeDeque.init lenaC3 - let t1_1 = RealTimeDeque.init t1 - let t1C_1 = RealTimeDeque.init t1C - let t1_2 = RealTimeDeque.init t1_1 - let t1C_2 = RealTimeDeque.init t1C_1 - let t1_3 = RealTimeDeque.init t1_2 - let t1C_3 = RealTimeDeque.init t1C_2 - let t1_4 = RealTimeDeque.init t1_3 - let t1C_4 = RealTimeDeque.init t1C_3 - let t1_5 = RealTimeDeque.init t1_4 - let t1C_5 = RealTimeDeque.init t1C_4 - let t1_6 = RealTimeDeque.init t1_5 - let t1C_6 = RealTimeDeque.init t1C_5 - let t1_7 = RealTimeDeque.init t1_6 - let t1C_7 = RealTimeDeque.init t1C_6 - let t1_8 = RealTimeDeque.init t1_7 - let t1C_8 = RealTimeDeque.init t1C_7 - - (((RealTimeDeque.length t1) = 9) - && ((RealTimeDeque.length t1C) = 9) - && ((RealTimeDeque.last t1) = "b") - && ((RealTimeDeque.last t1C) = "b") - && ((RealTimeDeque.length t1_1) = 8) - && ((RealTimeDeque.length t1C_1) = 8) - && ((RealTimeDeque.last t1_1) = "c") - && ((RealTimeDeque.last t1C_1) = "c") - && ((RealTimeDeque.length t1_2) = 7) - && ((RealTimeDeque.length t1C_2) = 7) - && ((RealTimeDeque.last t1_2) = "d") - && ((RealTimeDeque.last t1C_2) = "d") - && ((RealTimeDeque.length t1_3) = 6) - && ((RealTimeDeque.length t1C_3) = 6) - && ((RealTimeDeque.last t1_3) = "e") - && ((RealTimeDeque.last t1C_3) = "e") - && ((RealTimeDeque.length t1_4) = 5) - && ((RealTimeDeque.length t1C_4) = 5) - && ((RealTimeDeque.last t1_4) = "f") - && ((RealTimeDeque.last t1C_4) = "f") - && ((RealTimeDeque.length t1_5) = 4) - && ((RealTimeDeque.length t1C_5) = 4) - && ((RealTimeDeque.last t1_5) = "g") - && ((RealTimeDeque.last t1C_5) = "g") - && ((RealTimeDeque.length t1_6) = 3) - && ((RealTimeDeque.length t1C_6) = 3) - && ((RealTimeDeque.last t1_6) = "h") - && ((RealTimeDeque.last t1C_6) = "h") - && ((RealTimeDeque.length t1_7) = 2) - && ((RealTimeDeque.length t1C_7) = 2) - && ((RealTimeDeque.last t1_7) = "i") - && ((RealTimeDeque.last t1C_7) = "i") - && ((RealTimeDeque.length t1_8) = 1) - && ((RealTimeDeque.length t1C_8) = 1) - && ((RealTimeDeque.last t1_8) = "j") - && ((RealTimeDeque.last t1C_8) = "j")) - |> Expect.isTrue "" - } - - test "IEnumerable Seq" { (lena |> Seq.toArray).[5] |> Expect.equal "" "e" } - - test "IEnumerable Seq RealTimeDeque.length" { lena |> Seq.length |> Expect.equal "" 10 } - - test "type RealTimeDeque.cons works" { lena.Cons "zz" |> RealTimeDeque.head |> Expect.equal "" "zz" } - - test "IDeque RealTimeDeque.cons works" { ((lena :> IDeque).Cons "zz").Head |> Expect.equal "" "zz" } - - test "RealTimeDeque.ofCatLists and RealTimeDeque.uncons" { - let d = RealTimeDeque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] - let h1, t1 = RealTimeDeque.uncons d - let h2, t2 = RealTimeDeque.uncons t1 - let h3, t3 = RealTimeDeque.uncons t2 - let h4, t4 = RealTimeDeque.uncons t3 - let h5, t5 = RealTimeDeque.uncons t4 - let h6, t6 = RealTimeDeque.uncons t5 - - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f") - && (RealTimeDeque.isEmpty t6)) - |> Expect.isTrue "" - } - - test "ofCatSeqs and RealTimeDeque.uncons" { - let d = RealTimeDeque.ofCatSeqs (seq { 'a' .. 'c' }) (seq { 'd' .. 'f' }) - let h1, t1 = RealTimeDeque.uncons d - let h2, t2 = RealTimeDeque.uncons t1 - let h3, t3 = RealTimeDeque.uncons t2 - let h4, t4 = RealTimeDeque.uncons t3 - let h5, t5 = RealTimeDeque.uncons t4 - let h6, t6 = RealTimeDeque.uncons t5 - - ((h1 = 'a') - && (h2 = 'b') - && (h3 = 'c') - && (h4 = 'd') - && (h5 = 'e') - && (h6 = 'f') - && (RealTimeDeque.isEmpty t6)) - |> Expect.isTrue "" - } - - test "unsnoc works" { - let d = RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] - let i1, l1 = RealTimeDeque.unsnoc d - let i2, l2 = RealTimeDeque.unsnoc i1 - let i3, l3 = RealTimeDeque.unsnoc i2 - let i4, l4 = RealTimeDeque.unsnoc i3 - let i5, l5 = RealTimeDeque.unsnoc i4 - let i6, l6 = RealTimeDeque.unsnoc i5 - - ((l1 = "a") - && (l2 = "b") - && (l3 = "c") - && (l4 = "d") - && (l5 = "e") - && (l6 = "f") - && (RealTimeDeque.isEmpty i6)) - |> Expect.isTrue "" - } - - test "RealTimeDeque.snoc pattern discriminator" { - let d = (RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let i1, l1 = RealTimeDeque.unsnoc d - - let i2, l2 = - match i1 with - | RealTimeDeque.Snoc(i, l) -> i, l - | _ -> i1, "x" - - ((l2 = "b") && ((RealTimeDeque.length i2) = 4)) |> Expect.isTrue "" - } - - test "RealTimeDeque.cons pattern discriminator" { - let d = (RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let h1, t1 = RealTimeDeque.uncons d - - let h2, t2 = - match t1 with - | RealTimeDeque.Cons(h, t) -> h, t - | _ -> "x", t1 - - ((h2 = "e") && ((RealTimeDeque.length t2) = 4)) |> Expect.isTrue "" - } - - test "RealTimeDeque.cons and RealTimeDeque.snoc pattern discriminator" { - let d = (RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - - let mid1 = - match d with - | RealTimeDeque.Cons(h, RealTimeDeque.Snoc(i, l)) -> i - | _ -> d - - let head, last = - match mid1 with - | RealTimeDeque.Cons(h, RealTimeDeque.Snoc(i, l)) -> h, l - | _ -> "x", "x" - - ((head = "e") && (last = "b")) |> Expect.isTrue "" - } - - test "RealTimeDeque.rev RealTimeDeque.empty dqueue should be RealTimeDeque.empty" { - RealTimeDeque.isEmpty(RealTimeDeque.rev(RealTimeDeque.empty 2)) - |> Expect.isTrue "" - } - - test "RealTimeDeque.rev dqueue RealTimeDeque.length 1" { - ((RealTimeDeque.head(RealTimeDeque.rev len1) = "a") - && (RealTimeDeque.head(RealTimeDeque.rev len1C3) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.rev dqueue RealTimeDeque.length 2" { - let r1 = RealTimeDeque.rev len2 - let r1c = RealTimeDeque.rev len2C3 - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - - ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.rev dqueue RealTimeDeque.length 3" { - let r1 = RealTimeDeque.rev len3 - let r1c = RealTimeDeque.rev len3C3 - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.rev dqueue RealTimeDeque.length 4" { - let r1 = RealTimeDeque.rev len4 - let r1c = RealTimeDeque.rev len4C3 - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.rev dqueue RealTimeDeque.length 5" { - let r1 = RealTimeDeque.rev len5 - let r1c = RealTimeDeque.rev len5C3 - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e")) - |> Expect.isTrue "" - } - - //RealTimeDeque.length 6 more than sufficient to test RealTimeDeque.rev - test "RealTimeDeque.rev dqueue RealTimeDeque.length 6" { - let r1 = RealTimeDeque.rev len6 - let r1c = RealTimeDeque.rev len6C3 - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.empty" { - ((RealTimeDeque.isEmpty(RealTimeDeque.ofSeq [])) - && (RealTimeDeque.isEmpty(RealTimeDeque.ofSeqC 3 []))) - |> Expect.isTrue "" - } - - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 1" { - ((RealTimeDeque.head(RealTimeDeque.ofSeq [ "a" ]) = "a") - && (RealTimeDeque.head(RealTimeDeque.ofSeqC 3 [ "a" ]) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 2" { - let r1 = RealTimeDeque.ofSeq [ "a"; "b" ] - let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b" ] - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - - ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 3" { - let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c" ] - let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ] - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 4" { - let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ] - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d")) - |> Expect.isTrue "" - } - - //RealTimeDeque.length 5 more than sufficient to test RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 5" { - let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ] - let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ] - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e")) - |> Expect.isTrue "" - } - - //RealTimeDeque.length 5 more than sufficient to test RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC - test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 6" { - let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ] - let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ] - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.empty dqueus" { - ((RealTimeDeque.isEmpty(RealTimeDeque.append (RealTimeDeque.ofSeq []) (RealTimeDeque.ofSeq []))) - && (RealTimeDeque.isEmpty(RealTimeDeque.append (RealTimeDeque.empty 3) (RealTimeDeque.empty 3)))) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.empty and RealTimeDeque.length 1" { - ((RealTimeDeque.head(RealTimeDeque.append (RealTimeDeque.ofSeq []) len1) = "a") - && (RealTimeDeque.head(RealTimeDeque.append len1 (RealTimeDeque.empty 3)) = "a")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.empty and RealTimeDeque.length 2" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq []) (RealTimeDeque.ofSeq [ "a"; "b" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.empty 3) (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq []) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.empty 3) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 1 and RealTimeDeque.length 2" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 1 and RealTimeDeque.length 3" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c"; "d" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c"; "d" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeq [ "d" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeqC 3 [ "d" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 1 and RealTimeDeque.length 4" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c"; "d"; "e" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c"; "d"; "e" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeq [ "e" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeqC 3 [ "e" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - - let t5r = RealTimeDeque.tail t4r - let t5cr = RealTimeDeque.tail t4cr - let h5r = RealTimeDeque.head t5r - let h5cr = RealTimeDeque.head t5cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 1 and RealTimeDeque.length 5" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c"; "d"; "e"; "f" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c"; "d"; "e"; "f" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeq [ "f" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeqC 3 [ "f" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - let t5r = RealTimeDeque.tail t4r - let t5cr = RealTimeDeque.tail t4cr - let h5r = RealTimeDeque.head t5r - let h5cr = RealTimeDeque.head t5cr - let t6r = RealTimeDeque.tail t5r - let t6cr = RealTimeDeque.tail t5cr - let h6r = RealTimeDeque.head t6r - let h6cr = RealTimeDeque.head t6cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 2 and RealTimeDeque.length 2" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 2 and RealTimeDeque.length 3" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d"; "e" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d"; "e" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeq [ "d"; "e" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeqC 3 [ "d"; "e" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - - let t5r = RealTimeDeque.tail t4r - let t5cr = RealTimeDeque.tail t4cr - let h5r = RealTimeDeque.head t5r - let h5cr = RealTimeDeque.head t5cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 2 and RealTimeDeque.length 4" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d"; "e"; "f" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d"; "e"; "f" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeq [ "e"; "f" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeqC 3 [ "e"; "f" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - let t5r = RealTimeDeque.tail t4r - let t5cr = RealTimeDeque.tail t4cr - let h5r = RealTimeDeque.head t5r - let h5cr = RealTimeDeque.head t5cr - let t6r = RealTimeDeque.tail t5r - let t6cr = RealTimeDeque.tail t5cr - let h6r = RealTimeDeque.head t6r - let h6cr = RealTimeDeque.head t6cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 2 and RealTimeDeque.length 5" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d"; "e"; "f"; "g" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d"; "e"; "f"; "g" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - let t7 = RealTimeDeque.tail t6 - let t7c = RealTimeDeque.tail t6c - let h7 = RealTimeDeque.head t7 - let h7c = RealTimeDeque.head t7c - - let r1r = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeq [ "f"; "g" ]) - - let r1cr = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeqC 3 [ "f"; "g" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - let t5r = RealTimeDeque.tail t4r - let t5cr = RealTimeDeque.tail t4cr - let h5r = RealTimeDeque.head t5r - let h5cr = RealTimeDeque.head t5cr - let t6r = RealTimeDeque.tail t5r - let t6cr = RealTimeDeque.tail t5cr - let h6r = RealTimeDeque.head t6r - let h6cr = RealTimeDeque.head t6cr - let t7r = RealTimeDeque.tail t6r - let t7cr = RealTimeDeque.tail t6cr - let h7r = RealTimeDeque.head t7r - let h7cr = RealTimeDeque.head t7cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h7 = "g") - && (h7c = "g") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f") - && (h7r = "g") - && (h7cr = "g")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 3 and RealTimeDeque.length 3" { - let r1 = - RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeq [ "d"; "e"; "f" ]) - - let r1c = - RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeqC 3 [ "d"; "e"; "f" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f")) - |> Expect.isTrue "" - } - - test "appending RealTimeDeque.length 6 and RealTimeDeque.length 7" { - let r1 = - RealTimeDeque.append - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - (RealTimeDeque.ofSeq [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) - - let r1c = - RealTimeDeque.append - (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ]) - (RealTimeDeque.ofSeqC 3 [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) - - let h1 = RealTimeDeque.head r1 - let h1c = RealTimeDeque.head r1c - let t2 = RealTimeDeque.tail r1 - let t2c = RealTimeDeque.tail r1c - let h2 = RealTimeDeque.head t2 - let h2c = RealTimeDeque.head t2c - let t3 = RealTimeDeque.tail t2 - let t3c = RealTimeDeque.tail t2c - let h3 = RealTimeDeque.head t3 - let h3c = RealTimeDeque.head t3c - let t4 = RealTimeDeque.tail t3 - let t4c = RealTimeDeque.tail t3c - let h4 = RealTimeDeque.head t4 - let h4c = RealTimeDeque.head t4c - let t5 = RealTimeDeque.tail t4 - let t5c = RealTimeDeque.tail t4c - let h5 = RealTimeDeque.head t5 - let h5c = RealTimeDeque.head t5c - let t6 = RealTimeDeque.tail t5 - let t6c = RealTimeDeque.tail t5c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - let h6 = RealTimeDeque.head t6 - let h6c = RealTimeDeque.head t6c - let t7 = RealTimeDeque.tail t6 - let t7c = RealTimeDeque.tail t6c - let h7 = RealTimeDeque.head t7 - let h7c = RealTimeDeque.head t7c - let h7 = RealTimeDeque.head t7 - let h7c = RealTimeDeque.head t7c - let t8 = RealTimeDeque.tail t7 - let t8c = RealTimeDeque.tail t7c - let h8 = RealTimeDeque.head t8 - let h8c = RealTimeDeque.head t8c - let h8 = RealTimeDeque.head t8 - let h8c = RealTimeDeque.head t8c - let t9 = RealTimeDeque.tail t8 - let t9c = RealTimeDeque.tail t8c - let h9 = RealTimeDeque.head t9 - let h9c = RealTimeDeque.head t9c - let h9 = RealTimeDeque.head t9 - let h9c = RealTimeDeque.head t9c - let t10 = RealTimeDeque.tail t9 - let t10c = RealTimeDeque.tail t9c - let h10 = RealTimeDeque.head t10 - let h10c = RealTimeDeque.head t10c - let h10 = RealTimeDeque.head t10 - let h10c = RealTimeDeque.head t10c - let t11 = RealTimeDeque.tail t10 - let t11c = RealTimeDeque.tail t10c - let h11 = RealTimeDeque.head t11 - let h11c = RealTimeDeque.head t11c - let h11 = RealTimeDeque.head t11 - let h11c = RealTimeDeque.head t11c - let t12 = RealTimeDeque.tail t11 - let t12c = RealTimeDeque.tail t11c - let h12 = RealTimeDeque.head t12 - let h12c = RealTimeDeque.head t12c - let h12 = RealTimeDeque.head t12 - let h12c = RealTimeDeque.head t12c - let t13 = RealTimeDeque.tail t12 - let t13c = RealTimeDeque.tail t12c - let h13 = RealTimeDeque.head t13 - let h13c = RealTimeDeque.head t13c - let h13 = RealTimeDeque.head t13 - let h13c = RealTimeDeque.head t13c - - let r1r = - RealTimeDeque.append - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) - (RealTimeDeque.ofSeq [ "h"; "i"; "j"; "k"; "l"; "m" ]) - - let r1cr = - RealTimeDeque.append - (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) - (RealTimeDeque.ofSeqC 3 [ "h"; "i"; "j"; "k"; "l"; "m" ]) - - let h1r = RealTimeDeque.head r1r - let h1cr = RealTimeDeque.head r1cr - let t2r = RealTimeDeque.tail r1r - let t2cr = RealTimeDeque.tail r1cr - let h2r = RealTimeDeque.head t2r - let h2cr = RealTimeDeque.head t2cr - let t3r = RealTimeDeque.tail t2r - let t3cr = RealTimeDeque.tail t2cr - let h3r = RealTimeDeque.head t3r - let h3cr = RealTimeDeque.head t3cr - let t4r = RealTimeDeque.tail t3r - let t4cr = RealTimeDeque.tail t3cr - let h4r = RealTimeDeque.head t4r - let h4cr = RealTimeDeque.head t4cr - let t5r = RealTimeDeque.tail t4r - let t5cr = RealTimeDeque.tail t4cr - let h5r = RealTimeDeque.head t5r - let h5cr = RealTimeDeque.head t5cr - let t6r = RealTimeDeque.tail t5r - let t6cr = RealTimeDeque.tail t5cr - let h6r = RealTimeDeque.head t6r - let h6cr = RealTimeDeque.head t6cr - let t7r = RealTimeDeque.tail t6r - let t7cr = RealTimeDeque.tail t6cr - let h7r = RealTimeDeque.head t7r - let h7cr = RealTimeDeque.head t7cr - let h7r = RealTimeDeque.head t7r - let h7cr = RealTimeDeque.head t7cr - let t8r = RealTimeDeque.tail t7r - let t8cr = RealTimeDeque.tail t7cr - let h8r = RealTimeDeque.head t8r - let h8cr = RealTimeDeque.head t8cr - let h8r = RealTimeDeque.head t8r - let h8cr = RealTimeDeque.head t8cr - let t9r = RealTimeDeque.tail t8r - let t9cr = RealTimeDeque.tail t8cr - let h9r = RealTimeDeque.head t9r - let h9cr = RealTimeDeque.head t9cr - let h9r = RealTimeDeque.head t9r - let h9cr = RealTimeDeque.head t9cr - let t10r = RealTimeDeque.tail t9r - let t10cr = RealTimeDeque.tail t9cr - let h10r = RealTimeDeque.head t10r - let h10cr = RealTimeDeque.head t10cr - let h10r = RealTimeDeque.head t10r - let h10cr = RealTimeDeque.head t10cr - let t11r = RealTimeDeque.tail t10r - let t11cr = RealTimeDeque.tail t10cr - let h11r = RealTimeDeque.head t11r - let h11cr = RealTimeDeque.head t11cr - let h11r = RealTimeDeque.head t11r - let h11cr = RealTimeDeque.head t11cr - let t12r = RealTimeDeque.tail t11r - let t12cr = RealTimeDeque.tail t11cr - let h12r = RealTimeDeque.head t12r - let h12cr = RealTimeDeque.head t12cr - let h12r = RealTimeDeque.head t12r - let h12cr = RealTimeDeque.head t12cr - let t13r = RealTimeDeque.tail t12r - let t13cr = RealTimeDeque.tail t12cr - let h13r = RealTimeDeque.head t13r - let h13cr = RealTimeDeque.head t13cr - let h13r = RealTimeDeque.head t13r - let h13cr = RealTimeDeque.head t13cr - - ((h1 = "a") - && (h1c = "a") - && (h2 = "b") - && (h2c = "b") - && (h3 = "c") - && (h3c = "c") - && (h4 = "d") - && (h4c = "d") - && (h5 = "e") - && (h5c = "e") - && (h6 = "f") - && (h6c = "f") - && (h7 = "g") - && (h7c = "g") - && (h8 = "h") - && (h8c = "h") - && (h9 = "i") - && (h9c = "i") - && (h10 = "j") - && (h10c = "j") - && (h11 = "k") - && (h11c = "k") - && (h12 = "l") - && (h12c = "l") - && (h13 = "m") - && (h13c = "m") - && (h1r = "a") - && (h1cr = "a") - && (h2r = "b") - && (h2cr = "b") - && (h3r = "c") - && (h3cr = "c") - && (h4r = "d") - && (h4cr = "d") - && (h5r = "e") - && (h5cr = "e") - && (h6r = "f") - && (h6cr = "f") - && (h7r = "g") - && (h7cr = "g") - && (h8r = "h") - && (h8cr = "h") - && (h9r = "i") - && (h9cr = "i") - && (h10r = "j") - && (h10cr = "j") - && (h11r = "k") - && (h11cr = "k") - && (h12r = "l") - && (h12cr = "l") - && (h13r = "m") - && (h13cr = "m")) - |> Expect.isTrue "" - } - - - test "RealTimeDeque.lookup RealTimeDeque.length 1" { len1 |> RealTimeDeque.lookup 0 |> Expect.equal "" "a" } - - test "RealTimeDeque.lookup RealTimeDeque.length 2" { - (((len2 |> RealTimeDeque.lookup 0) = "b") - && ((len2 |> RealTimeDeque.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 3" { - (((len3 |> RealTimeDeque.lookup 0) = "c") - && ((len3 |> RealTimeDeque.lookup 1) = "b") - && ((len3 |> RealTimeDeque.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 4" { - (((len4 |> RealTimeDeque.lookup 0) = "d") - && ((len4 |> RealTimeDeque.lookup 1) = "c") - && ((len4 |> RealTimeDeque.lookup 2) = "b") - && ((len4 |> RealTimeDeque.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 5" { - (((len5 |> RealTimeDeque.lookup 0) = "e") - && ((len5 |> RealTimeDeque.lookup 1) = "d") - && ((len5 |> RealTimeDeque.lookup 2) = "c") - && ((len5 |> RealTimeDeque.lookup 3) = "b") - && ((len5 |> RealTimeDeque.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 6" { - (((len6 |> RealTimeDeque.lookup 0) = "f") - && ((len6 |> RealTimeDeque.lookup 1) = "e") - && ((len6 |> RealTimeDeque.lookup 2) = "d") - && ((len6 |> RealTimeDeque.lookup 3) = "c") - && ((len6 |> RealTimeDeque.lookup 4) = "b") - && ((len6 |> RealTimeDeque.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 7" { - (((len7 |> RealTimeDeque.lookup 0) = "g") - && ((len7 |> RealTimeDeque.lookup 1) = "f") - && ((len7 |> RealTimeDeque.lookup 2) = "e") - && ((len7 |> RealTimeDeque.lookup 3) = "d") - && ((len7 |> RealTimeDeque.lookup 4) = "c") - && ((len7 |> RealTimeDeque.lookup 5) = "b") - && ((len7 |> RealTimeDeque.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 8" { - (((len8 |> RealTimeDeque.lookup 0) = "h") - && ((len8 |> RealTimeDeque.lookup 1) = "g") - && ((len8 |> RealTimeDeque.lookup 2) = "f") - && ((len8 |> RealTimeDeque.lookup 3) = "e") - && ((len8 |> RealTimeDeque.lookup 4) = "d") - && ((len8 |> RealTimeDeque.lookup 5) = "c") - && ((len8 |> RealTimeDeque.lookup 6) = "b") - && ((len8 |> RealTimeDeque.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 9" { - (((len9 |> RealTimeDeque.lookup 0) = "i") - && ((len9 |> RealTimeDeque.lookup 1) = "h") - && ((len9 |> RealTimeDeque.lookup 2) = "g") - && ((len9 |> RealTimeDeque.lookup 3) = "f") - && ((len9 |> RealTimeDeque.lookup 4) = "e") - && ((len9 |> RealTimeDeque.lookup 5) = "d") - && ((len9 |> RealTimeDeque.lookup 6) = "c") - && ((len9 |> RealTimeDeque.lookup 7) = "b") - && ((len9 |> RealTimeDeque.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.lookup RealTimeDeque.length 10" { - (((lena |> RealTimeDeque.lookup 0) = "j") - && ((lena |> RealTimeDeque.lookup 1) = "i") - && ((lena |> RealTimeDeque.lookup 2) = "h") - && ((lena |> RealTimeDeque.lookup 3) = "g") - && ((lena |> RealTimeDeque.lookup 4) = "f") - && ((lena |> RealTimeDeque.lookup 5) = "e") - && ((lena |> RealTimeDeque.lookup 6) = "d") - && ((lena |> RealTimeDeque.lookup 7) = "c") - && ((lena |> RealTimeDeque.lookup 8) = "b") - && ((lena |> RealTimeDeque.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 1" { - let a = len1 |> RealTimeDeque.tryLookup 0 - (a.Value = "a") |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 2" { - let b = len2 |> RealTimeDeque.tryLookup 0 - let a = len2 |> RealTimeDeque.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 3" { - let c = len3 |> RealTimeDeque.tryLookup 0 - let b = len3 |> RealTimeDeque.tryLookup 1 - let a = len3 |> RealTimeDeque.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 4" { - let d = len4 |> RealTimeDeque.tryLookup 0 - let c = len4 |> RealTimeDeque.tryLookup 1 - let b = len4 |> RealTimeDeque.tryLookup 2 - let a = len4 |> RealTimeDeque.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 5" { - let e = len5 |> RealTimeDeque.tryLookup 0 - let d = len5 |> RealTimeDeque.tryLookup 1 - let c = len5 |> RealTimeDeque.tryLookup 2 - let b = len5 |> RealTimeDeque.tryLookup 3 - let a = len5 |> RealTimeDeque.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 6" { - let f = len6 |> RealTimeDeque.tryLookup 0 - let e = len6 |> RealTimeDeque.tryLookup 1 - let d = len6 |> RealTimeDeque.tryLookup 2 - let c = len6 |> RealTimeDeque.tryLookup 3 - let b = len6 |> RealTimeDeque.tryLookup 4 - let a = len6 |> RealTimeDeque.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 7" { - let g = len7 |> RealTimeDeque.tryLookup 0 - let f = len7 |> RealTimeDeque.tryLookup 1 - let e = len7 |> RealTimeDeque.tryLookup 2 - let d = len7 |> RealTimeDeque.tryLookup 3 - let c = len7 |> RealTimeDeque.tryLookup 4 - let b = len7 |> RealTimeDeque.tryLookup 5 - let a = len7 |> RealTimeDeque.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 8" { - let h = len8 |> RealTimeDeque.tryLookup 0 - let g = len8 |> RealTimeDeque.tryLookup 1 - let f = len8 |> RealTimeDeque.tryLookup 2 - let e = len8 |> RealTimeDeque.tryLookup 3 - let d = len8 |> RealTimeDeque.tryLookup 4 - let c = len8 |> RealTimeDeque.tryLookup 5 - let b = len8 |> RealTimeDeque.tryLookup 6 - let a = len8 |> RealTimeDeque.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 9" { - let i = len9 |> RealTimeDeque.tryLookup 0 - let h = len9 |> RealTimeDeque.tryLookup 1 - let g = len9 |> RealTimeDeque.tryLookup 2 - let f = len9 |> RealTimeDeque.tryLookup 3 - let e = len9 |> RealTimeDeque.tryLookup 4 - let d = len9 |> RealTimeDeque.tryLookup 5 - let c = len9 |> RealTimeDeque.tryLookup 6 - let b = len9 |> RealTimeDeque.tryLookup 7 - let a = len9 |> RealTimeDeque.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup RealTimeDeque.length 10" { - let j = lena |> RealTimeDeque.tryLookup 0 - let i = lena |> RealTimeDeque.tryLookup 1 - let h = lena |> RealTimeDeque.tryLookup 2 - let g = lena |> RealTimeDeque.tryLookup 3 - let f = lena |> RealTimeDeque.tryLookup 4 - let e = lena |> RealTimeDeque.tryLookup 5 - let d = lena |> RealTimeDeque.tryLookup 6 - let c = lena |> RealTimeDeque.tryLookup 7 - let b = lena |> RealTimeDeque.tryLookup 8 - let a = lena |> RealTimeDeque.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryLookup not found" { lena |> RealTimeDeque.tryLookup 10 |> Expect.isNone "" } - - test "RealTimeDeque.remove elements RealTimeDeque.length 1" { - len1 - |> RealTimeDeque.remove 0 - |> RealTimeDeque.isEmpty - |> Expect.isTrue "" - } - - test "RealTimeDeque.remove elements RealTimeDeque.length 2" { - let a = len2 |> RealTimeDeque.remove 0 |> RealTimeDeque.head - let b = len2 |> RealTimeDeque.remove 1 |> RealTimeDeque.head - ((a = "a") && (b = "b")) |> Expect.isTrue "" - } - - test "RealTimeDeque.remove elements RealTimeDeque.length 3" { - let r0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.remove 0 - let b0 = RealTimeDeque.head r0 - let t0 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t0 - - let r1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.remove 1 - let a1 = RealTimeDeque.head r1 - let t1 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t1 - - let r2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.remove 2 - let a2 = RealTimeDeque.head r2 - let t2 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.remove elements RealTimeDeque.length 4" { - let r0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 0 - let b0 = RealTimeDeque.head r0 - let t0 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t0 - let t01 = RealTimeDeque.tail t0 - let d0 = RealTimeDeque.head t01 - - let r1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 1 - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let d1 = RealTimeDeque.head t12 - - let r2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 2 - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - - let r3 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 3 - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.remove elements RealTimeDeque.length 5" { - let r0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.remove 0 - - let b0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let d0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let e0 = RealTimeDeque.head t03 - - let r1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.remove 1 - - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let d1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let e1 = RealTimeDeque.head t13 - - let r2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.remove 2 - - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let e2 = RealTimeDeque.head t23 - - let r3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.remove 3 - - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let e3 = RealTimeDeque.head t33 - - let r4 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.remove 4 - - let a4 = RealTimeDeque.head r4 - let t41 = RealTimeDeque.tail r4 - let b4 = RealTimeDeque.head t41 - let t42 = RealTimeDeque.tail t41 - let c4 = RealTimeDeque.head t42 - let t43 = RealTimeDeque.tail t42 - let d4 = RealTimeDeque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.remove elements RealTimeDeque.length 6" { - let r0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.remove 0 - - let b0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let d0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let e0 = RealTimeDeque.head t03 - let t04 = RealTimeDeque.tail t03 - let f0 = RealTimeDeque.head t04 - - let r1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.remove 1 - - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let d1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let e1 = RealTimeDeque.head t13 - let t14 = RealTimeDeque.tail t13 - let f1 = RealTimeDeque.head t14 - - let r2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.remove 2 - - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let e2 = RealTimeDeque.head t23 - let t24 = RealTimeDeque.tail t23 - let f2 = RealTimeDeque.head t24 - - let r3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.remove 3 - - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let e3 = RealTimeDeque.head t33 - let t34 = RealTimeDeque.tail t33 - let f3 = RealTimeDeque.head t34 - - let r4 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.remove 4 - - let a4 = RealTimeDeque.head r4 - let t41 = RealTimeDeque.tail r4 - let b4 = RealTimeDeque.head t41 - let t42 = RealTimeDeque.tail t41 - let c4 = RealTimeDeque.head t42 - let t43 = RealTimeDeque.tail t42 - let d4 = RealTimeDeque.head t43 - let t44 = RealTimeDeque.tail t43 - let f4 = RealTimeDeque.head t44 - - let r5 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.remove 5 - - let a5 = RealTimeDeque.head r5 - let t51 = RealTimeDeque.tail r5 - let b5 = RealTimeDeque.head t51 - let t52 = RealTimeDeque.tail t51 - let c5 = RealTimeDeque.head t52 - let t53 = RealTimeDeque.tail t52 - let d5 = RealTimeDeque.head t53 - let t54 = RealTimeDeque.tail t53 - let e5 = RealTimeDeque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "tryRemoveempty" { - (RealTimeDeque.empty 3) - |> RealTimeDeque.tryRemove 0 - |> Expect.isNone "" - } - - test "RealTimeDeque.tryRemove elements RealTimeDeque.length 1" { - let a = len1 |> RealTimeDeque.tryRemove 0 - a.Value |> RealTimeDeque.isEmpty |> Expect.isTrue "" - } - - test "RealTimeDeque.tryRemove elements RealTimeDeque.length 2" { - let a = len2 |> RealTimeDeque.tryRemove 0 - let a1 = RealTimeDeque.head a.Value - let b = len2 |> RealTimeDeque.tryRemove 1 - let b1 = RealTimeDeque.head b.Value - ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" - } - - test "RealTimeDeque.tryRemove elements RealTimeDeque.length 3" { - let x0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.tryRemove 0 - let r0 = x0.Value - let b0 = RealTimeDeque.head r0 - let t0 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t0 - - let x1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.tryRemove 1 - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t1 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t1 - - let x2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.tryRemove 2 - let r2 = x2.Value - let a2 = RealTimeDeque.head r2 - let t2 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t2 - - ((b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryRemove elements RealTimeDeque.length 4" { - let x0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = RealTimeDeque.head r0 - let t0 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t0 - let t01 = RealTimeDeque.tail t0 - let d0 = RealTimeDeque.head t01 - - let x1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let d1 = RealTimeDeque.head t12 - - let x2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - - let x3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryRemove elements RealTimeDeque.length 5" { - let x0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let d0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let e0 = RealTimeDeque.head t03 - - let x1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let d1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let e1 = RealTimeDeque.head t13 - - let x2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let e2 = RealTimeDeque.head t23 - - let x3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let e3 = RealTimeDeque.head t33 - - let x4 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.tryRemove 4 - - let r4 = x4.Value - let a4 = RealTimeDeque.head r4 - let t41 = RealTimeDeque.tail r4 - let b4 = RealTimeDeque.head t41 - let t42 = RealTimeDeque.tail t41 - let c4 = RealTimeDeque.head t42 - let t43 = RealTimeDeque.tail t42 - let d4 = RealTimeDeque.head t43 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryRemove elements RealTimeDeque.length 6" { - let x0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.tryRemove 0 - - let r0 = x0.Value - let b0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let c0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let d0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let e0 = RealTimeDeque.head t03 - let t04 = RealTimeDeque.tail t03 - let f0 = RealTimeDeque.head t04 - - let x1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.tryRemove 1 - - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let c1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let d1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let e1 = RealTimeDeque.head t13 - let t14 = RealTimeDeque.tail t13 - let f1 = RealTimeDeque.head t14 - - let x2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.tryRemove 2 - - let r2 = x2.Value - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let e2 = RealTimeDeque.head t23 - let t24 = RealTimeDeque.tail t23 - let f2 = RealTimeDeque.head t24 - - let x3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.tryRemove 3 - - let r3 = x3.Value - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let e3 = RealTimeDeque.head t33 - let t34 = RealTimeDeque.tail t33 - let f3 = RealTimeDeque.head t34 - - let x4 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.tryRemove 4 - - let r4 = x4.Value - let a4 = RealTimeDeque.head r4 - let t41 = RealTimeDeque.tail r4 - let b4 = RealTimeDeque.head t41 - let t42 = RealTimeDeque.tail t41 - let c4 = RealTimeDeque.head t42 - let t43 = RealTimeDeque.tail t42 - let d4 = RealTimeDeque.head t43 - let t44 = RealTimeDeque.tail t43 - let f4 = RealTimeDeque.head t44 - - let x5 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.tryRemove 5 - - let r5 = x5.Value - let a5 = RealTimeDeque.head r5 - let t51 = RealTimeDeque.tail r5 - let b5 = RealTimeDeque.head t51 - let t52 = RealTimeDeque.tail t51 - let c5 = RealTimeDeque.head t52 - let t53 = RealTimeDeque.tail t52 - let d5 = RealTimeDeque.head t53 - let t54 = RealTimeDeque.tail t53 - let e5 = RealTimeDeque.head t54 - - ((b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.update elements RealTimeDeque.length 1" { - len1 - |> RealTimeDeque.update 0 "aa" - |> RealTimeDeque.head - |> Expect.equal "" "aa" - } - - test "RealTimeDeque.update elements RealTimeDeque.length 2" { - let r0 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.update 0 "zz" - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - - let r1 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.update 1 "zz" - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.update elements RealTimeDeque.length 3" { - let r0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.update 0 "zz" - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let c0 = RealTimeDeque.head t02 - - let r1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.update 1 "zz" - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let c1 = RealTimeDeque.head t12 - - let r2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.update 2 "zz" - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.update elements RealTimeDeque.length 4" { - let r0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.update 0 "zz" - - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let c0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let d0 = RealTimeDeque.head t03 - - let r1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.update 1 "zz" - - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let c1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let d1 = RealTimeDeque.head t13 - - let r2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.update 2 "zz" - - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let d2 = RealTimeDeque.head t23 - - let r3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.update 3 "zz" - - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let d3 = RealTimeDeque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.update elements RealTimeDeque.length 5" { - let r0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.update 0 "zz" - - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let c0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let d0 = RealTimeDeque.head t03 - let t04 = RealTimeDeque.tail t03 - let e0 = RealTimeDeque.head t04 - - let r1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.update 1 "zz" - - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let c1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let d1 = RealTimeDeque.head t13 - let t14 = RealTimeDeque.tail t13 - let e1 = RealTimeDeque.head t14 - - let r2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.update 2 "zz" - - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let d2 = RealTimeDeque.head t23 - let t24 = RealTimeDeque.tail t23 - let e2 = RealTimeDeque.head t24 - - let r3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.update 3 "zz" - - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let d3 = RealTimeDeque.head t33 - let t34 = RealTimeDeque.tail t33 - let e3 = RealTimeDeque.head t34 - - let r4 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) - |> RealTimeDeque.update 4 "zz" - - let a4 = RealTimeDeque.head r4 - let t41 = RealTimeDeque.tail r4 - let b4 = RealTimeDeque.head t41 - let t42 = RealTimeDeque.tail t41 - let c4 = RealTimeDeque.head t42 - let t43 = RealTimeDeque.tail t42 - let d4 = RealTimeDeque.head t43 - let t44 = RealTimeDeque.tail t43 - let e4 = RealTimeDeque.head t44 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.update elements RealTimeDeque.length 6" { - let r0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.update 0 "zz" - - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let c0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let d0 = RealTimeDeque.head t03 - let t04 = RealTimeDeque.tail t03 - let e0 = RealTimeDeque.head t04 - let t05 = RealTimeDeque.tail t04 - let f0 = RealTimeDeque.head t05 - - let r1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.update 1 "zz" - - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let c1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let d1 = RealTimeDeque.head t13 - let t14 = RealTimeDeque.tail t13 - let e1 = RealTimeDeque.head t14 - let t15 = RealTimeDeque.tail t14 - let f1 = RealTimeDeque.head t15 - - let r2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.update 2 "zz" - - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let d2 = RealTimeDeque.head t23 - let t24 = RealTimeDeque.tail t23 - let e2 = RealTimeDeque.head t24 - let t25 = RealTimeDeque.tail t24 - let f2 = RealTimeDeque.head t25 - - let r3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.update 3 "zz" - - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let d3 = RealTimeDeque.head t33 - let t34 = RealTimeDeque.tail t33 - let e3 = RealTimeDeque.head t34 - let t35 = RealTimeDeque.tail t34 - let f3 = RealTimeDeque.head t35 - - let r4 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.update 4 "zz" - - let a4 = RealTimeDeque.head r4 - let t41 = RealTimeDeque.tail r4 - let b4 = RealTimeDeque.head t41 - let t42 = RealTimeDeque.tail t41 - let c4 = RealTimeDeque.head t42 - let t43 = RealTimeDeque.tail t42 - let d4 = RealTimeDeque.head t43 - let t44 = RealTimeDeque.tail t43 - let e4 = RealTimeDeque.head t44 - let t45 = RealTimeDeque.tail t44 - let f4 = RealTimeDeque.head t45 - - let r5 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) - |> RealTimeDeque.update 5 "zz" - - let a5 = RealTimeDeque.head r5 - let t51 = RealTimeDeque.tail r5 - let b5 = RealTimeDeque.head t51 - let t52 = RealTimeDeque.tail t51 - let c5 = RealTimeDeque.head t52 - let t53 = RealTimeDeque.tail t52 - let d5 = RealTimeDeque.head t53 - let t54 = RealTimeDeque.tail t53 - let e5 = RealTimeDeque.head t54 - let t55 = RealTimeDeque.tail t54 - let f5 = RealTimeDeque.head t55 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (e0 = "e") - && (f0 = "f") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (e1 = "e") - && (f1 = "f") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (e2 = "e") - && (f2 = "f") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz") - && (e3 = "e") - && (f3 = "f") - && (a4 = "a") - && (b4 = "b") - && (c4 = "c") - && (d4 = "d") - && (e4 = "zz") - && (f4 = "f") - && (a5 = "a") - && (b5 = "b") - && (c5 = "c") - && (d5 = "d") - && (e5 = "e") - && (f5 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 1" { - let a = len1 |> RealTimeDeque.tryUpdate 0 "aa" - a.Value |> RealTimeDeque.head |> Expect.equal "" "aa" - } - - test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 2" { - let x0 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.tryUpdate 0 "zz" - let r0 = x0.Value - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - - let x1 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.tryUpdate 1 "zz" - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - - ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 3" { - let x0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) - |> RealTimeDeque.tryUpdate 0 "zz" - - let r0 = x0.Value - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let c0 = RealTimeDeque.head t02 - - let x1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) - |> RealTimeDeque.tryUpdate 1 "zz" - - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let c1 = RealTimeDeque.head t12 - - let x2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) - |> RealTimeDeque.tryUpdate 2 "zz" - - let r2 = x2.Value - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 4" { - let x0 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryUpdate 0 "zz" - - let r0 = x0.Value - let a0 = RealTimeDeque.head r0 - let t01 = RealTimeDeque.tail r0 - let b0 = RealTimeDeque.head t01 - let t02 = RealTimeDeque.tail t01 - let c0 = RealTimeDeque.head t02 - let t03 = RealTimeDeque.tail t02 - let d0 = RealTimeDeque.head t03 - - let x1 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryUpdate 1 "zz" - - let r1 = x1.Value - let a1 = RealTimeDeque.head r1 - let t11 = RealTimeDeque.tail r1 - let b1 = RealTimeDeque.head t11 - let t12 = RealTimeDeque.tail t11 - let c1 = RealTimeDeque.head t12 - let t13 = RealTimeDeque.tail t12 - let d1 = RealTimeDeque.head t13 - - let x2 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryUpdate 2 "zz" - - let r2 = x2.Value - let a2 = RealTimeDeque.head r2 - let t21 = RealTimeDeque.tail r2 - let b2 = RealTimeDeque.head t21 - let t22 = RealTimeDeque.tail t21 - let c2 = RealTimeDeque.head t22 - let t23 = RealTimeDeque.tail t22 - let d2 = RealTimeDeque.head t23 - - let x3 = - (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) - |> RealTimeDeque.tryUpdate 3 "zz" - - let r3 = x3.Value - let a3 = RealTimeDeque.head r3 - let t31 = RealTimeDeque.tail r3 - let b3 = RealTimeDeque.head t31 - let t32 = RealTimeDeque.tail t31 - let c3 = RealTimeDeque.head t32 - let t33 = RealTimeDeque.tail t32 - let d3 = RealTimeDeque.head t33 - - ((a0 = "zz") - && (b0 = "b") - && (c0 = "c") - && (d0 = "d") - && (a1 = "a") - && (b1 = "zz") - && (c1 = "c") - && (d1 = "d") - && (a2 = "a") - && (b2 = "b") - && (c2 = "zz") - && (d2 = "d") - && (a3 = "a") - && (b3 = "b") - && (c3 = "c") - && (d3 = "zz")) - |> Expect.isTrue "" - } - - test "RealTimeDeque.tryUncons on RealTimeDeque.empty" { - let q = RealTimeDeque.empty 2 - (RealTimeDeque.tryUncons q = None) |> Expect.isTrue "" - } - - test "RealTimeDeque.tryUncons on q" { - let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let x, xs = (RealTimeDeque.tryUncons q).Value - x |> Expect.equal "" "a" - } - - test "RealTimeDeque.tryUnsnoc on RealTimeDeque.empty" { - let q = RealTimeDeque.empty 2 - (RealTimeDeque.tryUnsnoc q = None) |> Expect.isTrue "" - } - - test "RealTimeDeque.tryUnsnoc on q" { - let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let xs, x = (RealTimeDeque.tryUnsnoc q).Value - x |> Expect.equal "" "d" - } - - test "RealTimeDeque.tryGetHead on RealTimeDeque.empty" { - let q = RealTimeDeque.empty 2 - (RealTimeDeque.tryGetHead q = None) |> Expect.isTrue "" - } - - test "RealTimeDeque.tryGetHead on q" { - let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - (RealTimeDeque.tryGetHead q).Value |> Expect.equal "" "a" - } - - test "tryGetInit on RealTimeDeque.empty" { - let q = RealTimeDeque.empty 2 - (RealTimeDeque.tryGetInit q = None) |> Expect.isTrue "" - } - - test "tryGetInit on q" { - let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - let x = (RealTimeDeque.tryGetInit q).Value - let x2 = x |> RealTimeDeque.last - x2 |> Expect.equal "" "c" - } - - test "tryGetLast on RealTimeDeque.empty" { - let q = RealTimeDeque.empty 2 - (RealTimeDeque.tryGetLast q = None) |> Expect.isTrue "" - } - - test "tryGetLast on q" { - let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - (RealTimeDeque.tryGetLast q).Value |> Expect.equal "" "d" - } - - - test "tryGetTail on RealTimeDeque.empty" { - let q = RealTimeDeque.empty 2 - (RealTimeDeque.tryGetTail q = None) |> Expect.isTrue "" - } - - test "tryGetTail on q" { - let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] - - (RealTimeDeque.tryGetTail q).Value - |> RealTimeDeque.head - |> Expect.equal "" "b" - } - ] + testList + "Experimental RealTimeDeque" + [ test "RealTimeDeque.empty dqueue should be RealTimeDeque.empty" { RealTimeDeque.isEmpty(RealTimeDeque.empty 2) |> Expect.isTrue "" } + + test "RealTimeDeque.cons works" { + ((len2 |> RealTimeDeque.isEmpty) && (len2C3 |> RealTimeDeque.isEmpty)) + |> Expect.isFalse "" + } + + test "RealTimeDeque.snoc works" { + ((len2snoc |> RealTimeDeque.isEmpty) + && (len2C3snoc |> RealTimeDeque.isEmpty)) + |> Expect.isFalse "" + } + + test "RealTimeDeque.singleton RealTimeDeque.head works" { + (((RealTimeDeque.head len1) = "a") + && ((len1C3 |> RealTimeDeque.isEmpty)) = false) + |> Expect.isTrue "" + } + + test "RealTimeDeque.singleton RealTimeDeque.last works" { len1 |> RealTimeDeque.last |> Expect.equal "" "a" } + + test "RealTimeDeque.tail of RealTimeDeque.singleton RealTimeDeque.empty" { + len1 + |> RealTimeDeque.tail + |> RealTimeDeque.isEmpty + |> Expect.isTrue "" + } + + test "RealTimeDeque.tail of RealTimeDeque.tail of 2 RealTimeDeque.empty" { + (len2 + |> RealTimeDeque.tail + |> RealTimeDeque.tail + |> RealTimeDeque.isEmpty) + |> Expect.isTrue "" + } + + test "RealTimeDeque.init of RealTimeDeque.singleton RealTimeDeque.empty" { + ((RealTimeDeque.init len1) |> RealTimeDeque.isEmpty) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 1" { + let t1 = RealTimeDeque.tail len2 + let t1C = RealTimeDeque.tail len2C3 + let t1s = RealTimeDeque.tail len2snoc + let t1Cs = RealTimeDeque.tail len2C3snoc + let ht1 = RealTimeDeque.head t1 + let ht1C = RealTimeDeque.head t1C + let ht1s = RealTimeDeque.head t1s + let ht1Cs = RealTimeDeque.head t1Cs + + (((RealTimeDeque.length t1) = 1) + && ((RealTimeDeque.length t1C) = 1) + && ((RealTimeDeque.length t1s) = 1) + && ((RealTimeDeque.length t1Cs) = 1) + && (ht1 = "a") + && (ht1C = "a") + && (ht1s = "a") + && (ht1Cs = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 2" { + let t1 = RealTimeDeque.tail len3 + let t1C = RealTimeDeque.tail len3C3 + let t1s = RealTimeDeque.tail len3snoc + let t1Cs = RealTimeDeque.tail len3C3snoc + + let t1_1 = RealTimeDeque.tail t1 + let t1C_1 = RealTimeDeque.tail t1C + let t1_1s = RealTimeDeque.tail t1s + let t1C_1s = RealTimeDeque.tail t1Cs + + (((RealTimeDeque.length t1) = 2) + && ((RealTimeDeque.length t1C) = 2) + && ((RealTimeDeque.length t1s) = 2) + && ((RealTimeDeque.length t1Cs) = 2) + && ((RealTimeDeque.head t1) = "b") + && ((RealTimeDeque.head t1C) = "b") + && ((RealTimeDeque.head t1s) = "b") + && ((RealTimeDeque.head t1Cs) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 3" { + let t1 = RealTimeDeque.tail len4 + let t1C = RealTimeDeque.tail len4C3 + let t1s = RealTimeDeque.tail len4snoc + let t1Cs = RealTimeDeque.tail len4C3snoc + + let t1_2 = RealTimeDeque.tail t1 + let t1C_2 = RealTimeDeque.tail t1C + let t1_2s = RealTimeDeque.tail t1s + let t1C_2s = RealTimeDeque.tail t1Cs + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 3) + && ((RealTimeDeque.length t1C) = 3) + && ((RealTimeDeque.length t1s) = 3) + && ((RealTimeDeque.length t1Cs) = 3) + && ((RealTimeDeque.head t1) = "c") + && ((RealTimeDeque.head t1C) = "c") + && ((RealTimeDeque.head t1s) = "c") + && ((RealTimeDeque.head t1Cs) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 4" { + let t1 = RealTimeDeque.tail len5 + let t1C = RealTimeDeque.tail len5C3 + let t1s = RealTimeDeque.tail len5snoc + let t1Cs = RealTimeDeque.tail len5C3snoc + + let t1_3 = RealTimeDeque.tail t1 + let t1C_3 = RealTimeDeque.tail t1C + let t1_3s = RealTimeDeque.tail t1s + let t1C_3s = RealTimeDeque.tail t1Cs + + let t1_2 = RealTimeDeque.tail t1_3 + let t1C_2 = RealTimeDeque.tail t1C_3 + let t1_2s = RealTimeDeque.tail t1_3s + let t1C_2s = RealTimeDeque.tail t1C_3s + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 4) + && ((RealTimeDeque.length t1C) = 4) + && ((RealTimeDeque.length t1s) = 4) + && ((RealTimeDeque.length t1Cs) = 4) + && ((RealTimeDeque.head t1) = "d") + && ((RealTimeDeque.head t1C) = "d") + && ((RealTimeDeque.head t1s) = "d") + && ((RealTimeDeque.head t1Cs) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.length t1_3s) = 3) + && ((RealTimeDeque.length t1C_3s) = 3) + && ((RealTimeDeque.head t1_3) = "c") + && ((RealTimeDeque.head t1C_3) = "c") + && ((RealTimeDeque.head t1_3s) = "c") + && ((RealTimeDeque.head t1C_3s) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 5" { + let t1 = RealTimeDeque.tail len6 + let t1C = RealTimeDeque.tail len6C3 + let t1s = RealTimeDeque.tail len6snoc + let t1Cs = RealTimeDeque.tail len6C3snoc + + let t1_4 = RealTimeDeque.tail t1 + let t1C_4 = RealTimeDeque.tail t1C + let t1_4s = RealTimeDeque.tail t1s + let t1C_4s = RealTimeDeque.tail t1Cs + + let t1_3 = RealTimeDeque.tail t1_4 + let t1C_3 = RealTimeDeque.tail t1C_4 + let t1_3s = RealTimeDeque.tail t1_4s + let t1C_3s = RealTimeDeque.tail t1C_4s + + let t1_2 = RealTimeDeque.tail t1_3 + let t1C_2 = RealTimeDeque.tail t1C_3 + let t1_2s = RealTimeDeque.tail t1_3s + let t1C_2s = RealTimeDeque.tail t1C_3s + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 5) + && ((RealTimeDeque.length t1C) = 5) + && ((RealTimeDeque.length t1s) = 5) + && ((RealTimeDeque.length t1Cs) = 5) + && ((RealTimeDeque.head t1) = "e") + && ((RealTimeDeque.head t1C) = "e") + && ((RealTimeDeque.head t1s) = "e") + && ((RealTimeDeque.head t1Cs) = "e") + && ((RealTimeDeque.length t1_4) = 4) + && ((RealTimeDeque.length t1C_4) = 4) + && ((RealTimeDeque.length t1_4s) = 4) + && ((RealTimeDeque.length t1C_4s) = 4) + && ((RealTimeDeque.head t1_4) = "d") + && ((RealTimeDeque.head t1C_4) = "d") + && ((RealTimeDeque.head t1_4s) = "d") + && ((RealTimeDeque.head t1C_4s) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.length t1_3s) = 3) + && ((RealTimeDeque.length t1C_3s) = 3) + && ((RealTimeDeque.head t1_3) = "c") + && ((RealTimeDeque.head t1C_3) = "c") + && ((RealTimeDeque.head t1_3s) = "c") + && ((RealTimeDeque.head t1C_3s) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 6" { + let t1 = RealTimeDeque.tail len7 + let t1C = RealTimeDeque.tail len7C3 + let t1s = RealTimeDeque.tail len7snoc + let t1Cs = RealTimeDeque.tail len7C3snoc + + let t1_5 = RealTimeDeque.tail t1 + let t1C_5 = RealTimeDeque.tail t1C + let t1_5s = RealTimeDeque.tail t1s + let t1C_5s = RealTimeDeque.tail t1Cs + + let t1_4 = RealTimeDeque.tail t1_5 + let t1C_4 = RealTimeDeque.tail t1C_5 + let t1_4s = RealTimeDeque.tail t1_5s + let t1C_4s = RealTimeDeque.tail t1C_5s + + let t1_3 = RealTimeDeque.tail t1_4 + let t1C_3 = RealTimeDeque.tail t1C_4 + let t1_3s = RealTimeDeque.tail t1_4s + let t1C_3s = RealTimeDeque.tail t1C_4s + + let t1_2 = RealTimeDeque.tail t1_3 + let t1C_2 = RealTimeDeque.tail t1C_3 + let t1_2s = RealTimeDeque.tail t1_3s + let t1C_2s = RealTimeDeque.tail t1C_3s + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 6) + && ((RealTimeDeque.length t1C) = 6) + && ((RealTimeDeque.length t1s) = 6) + && ((RealTimeDeque.length t1Cs) = 6) + && ((RealTimeDeque.head t1) = "f") + && ((RealTimeDeque.head t1C) = "f") + && ((RealTimeDeque.head t1s) = "f") + && ((RealTimeDeque.head t1Cs) = "f") + && ((RealTimeDeque.length t1_5) = 5) + && ((RealTimeDeque.length t1C_5) = 5) + && ((RealTimeDeque.length t1_5s) = 5) + && ((RealTimeDeque.length t1C_5s) = 5) + && ((RealTimeDeque.head t1_5) = "e") + && ((RealTimeDeque.head t1C_5) = "e") + && ((RealTimeDeque.head t1_5s) = "e") + && ((RealTimeDeque.head t1C_5s) = "e") + && ((RealTimeDeque.length t1_4) = 4) + && ((RealTimeDeque.length t1C_4) = 4) + && ((RealTimeDeque.length t1_4s) = 4) + && ((RealTimeDeque.length t1C_4s) = 4) + && ((RealTimeDeque.head t1_4) = "d") + && ((RealTimeDeque.head t1C_4) = "d") + && ((RealTimeDeque.head t1_4s) = "d") + && ((RealTimeDeque.head t1C_4s) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.length t1_3s) = 3) + && ((RealTimeDeque.length t1C_3s) = 3) + && ((RealTimeDeque.head t1_3) = "c") + && ((RealTimeDeque.head t1C_3) = "c") + && ((RealTimeDeque.head t1_3s) = "c") + && ((RealTimeDeque.head t1C_3s) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 7" { + let t1 = RealTimeDeque.tail len8 + let t1C = RealTimeDeque.tail len8C3 + let t1s = RealTimeDeque.tail len8snoc + let t1Cs = RealTimeDeque.tail len8C3snoc + + let t1_6 = RealTimeDeque.tail t1 + let t1C_6 = RealTimeDeque.tail t1C + let t1_6s = RealTimeDeque.tail t1s + let t1C_6s = RealTimeDeque.tail t1Cs + + let t1_5 = RealTimeDeque.tail t1_6 + let t1C_5 = RealTimeDeque.tail t1C_6 + let t1_5s = RealTimeDeque.tail t1_6s + let t1C_5s = RealTimeDeque.tail t1C_6s + + let t1_4 = RealTimeDeque.tail t1_5 + let t1C_4 = RealTimeDeque.tail t1C_5 + let t1_4s = RealTimeDeque.tail t1_5s + let t1C_4s = RealTimeDeque.tail t1C_5s + + let t1_3 = RealTimeDeque.tail t1_4 + let t1C_3 = RealTimeDeque.tail t1C_4 + let t1_3s = RealTimeDeque.tail t1_4s + let t1C_3s = RealTimeDeque.tail t1C_4s + + let t1_2 = RealTimeDeque.tail t1_3 + let t1C_2 = RealTimeDeque.tail t1C_3 + let t1_2s = RealTimeDeque.tail t1_3s + let t1C_2s = RealTimeDeque.tail t1C_3s + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 7) + && ((RealTimeDeque.length t1C) = 7) + && ((RealTimeDeque.length t1s) = 7) + && ((RealTimeDeque.length t1Cs) = 7) + && ((RealTimeDeque.head t1) = "g") + && ((RealTimeDeque.head t1C) = "g") + && ((RealTimeDeque.head t1s) = "g") + && ((RealTimeDeque.head t1Cs) = "g") + && ((RealTimeDeque.length t1_6) = 6) + && ((RealTimeDeque.length t1C_6) = 6) + && ((RealTimeDeque.length t1_6s) = 6) + && ((RealTimeDeque.length t1C_6s) = 6) + && ((RealTimeDeque.head t1_6) = "f") + && ((RealTimeDeque.head t1C_6) = "f") + && ((RealTimeDeque.head t1_6s) = "f") + && ((RealTimeDeque.head t1C_6s) = "f") + && ((RealTimeDeque.length t1_5) = 5) + && ((RealTimeDeque.length t1C_5) = 5) + && ((RealTimeDeque.length t1_5s) = 5) + && ((RealTimeDeque.length t1C_5s) = 5) + && ((RealTimeDeque.head t1_5) = "e") + && ((RealTimeDeque.head t1C_5) = "e") + && ((RealTimeDeque.head t1_5s) = "e") + && ((RealTimeDeque.head t1C_5s) = "e") + && ((RealTimeDeque.length t1_4) = 4) + && ((RealTimeDeque.length t1C_4) = 4) + && ((RealTimeDeque.length t1_4s) = 4) + && ((RealTimeDeque.length t1C_4s) = 4) + && ((RealTimeDeque.head t1_4) = "d") + && ((RealTimeDeque.head t1C_4) = "d") + && ((RealTimeDeque.head t1_4s) = "d") + && ((RealTimeDeque.head t1C_4s) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.length t1_3s) = 3) + && ((RealTimeDeque.length t1C_3s) = 3) + && ((RealTimeDeque.head t1_3) = "c") + && ((RealTimeDeque.head t1C_3) = "c") + && ((RealTimeDeque.head t1_3s) = "c") + && ((RealTimeDeque.head t1C_3s) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 8" { + let t1 = RealTimeDeque.tail len9 + let t1C = RealTimeDeque.tail len9C3 + let t1s = RealTimeDeque.tail len9snoc + let t1Cs = RealTimeDeque.tail len9C3snoc + + let t1_7 = RealTimeDeque.tail t1 + let t1C_7 = RealTimeDeque.tail t1C + let t1_7s = RealTimeDeque.tail t1s + let t1C_7s = RealTimeDeque.tail t1Cs + + let t1_6 = RealTimeDeque.tail t1_7 + let t1C_6 = RealTimeDeque.tail t1C_7 + let t1_6s = RealTimeDeque.tail t1_7s + let t1C_6s = RealTimeDeque.tail t1C_7s + + let t1_5 = RealTimeDeque.tail t1_6 + let t1C_5 = RealTimeDeque.tail t1C_6 + let t1_5s = RealTimeDeque.tail t1_6s + let t1C_5s = RealTimeDeque.tail t1C_6s + + let t1_4 = RealTimeDeque.tail t1_5 + let t1C_4 = RealTimeDeque.tail t1C_5 + let t1_4s = RealTimeDeque.tail t1_5s + let t1C_4s = RealTimeDeque.tail t1C_5s + + let t1_3 = RealTimeDeque.tail t1_4 + let t1C_3 = RealTimeDeque.tail t1C_4 + let t1_3s = RealTimeDeque.tail t1_4s + let t1C_3s = RealTimeDeque.tail t1C_4s + + let t1_2 = RealTimeDeque.tail t1_3 + let t1C_2 = RealTimeDeque.tail t1C_3 + let t1_2s = RealTimeDeque.tail t1_3s + let t1C_2s = RealTimeDeque.tail t1C_3s + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 8) + && ((RealTimeDeque.length t1C) = 8) + && ((RealTimeDeque.length t1s) = 8) + && ((RealTimeDeque.length t1Cs) = 8) + && ((RealTimeDeque.head t1) = "h") + && ((RealTimeDeque.head t1C) = "h") + && ((RealTimeDeque.head t1s) = "h") + && ((RealTimeDeque.head t1Cs) = "h") + && ((RealTimeDeque.length t1_7) = 7) + && ((RealTimeDeque.length t1C_7) = 7) + && ((RealTimeDeque.length t1_7s) = 7) + && ((RealTimeDeque.length t1C_7s) = 7) + && ((RealTimeDeque.head t1_7) = "g") + && ((RealTimeDeque.head t1C_7) = "g") + && ((RealTimeDeque.head t1_7s) = "g") + && ((RealTimeDeque.head t1C_7s) = "g") + && ((RealTimeDeque.length t1_6) = 6) + && ((RealTimeDeque.length t1C_6) = 6) + && ((RealTimeDeque.length t1_6s) = 6) + && ((RealTimeDeque.length t1C_6s) = 6) + && ((RealTimeDeque.head t1_6) = "f") + && ((RealTimeDeque.head t1C_6) = "f") + && ((RealTimeDeque.head t1_6s) = "f") + && ((RealTimeDeque.head t1C_6s) = "f") + && ((RealTimeDeque.length t1_5) = 5) + && ((RealTimeDeque.length t1C_5) = 5) + && ((RealTimeDeque.length t1_5s) = 5) + && ((RealTimeDeque.length t1C_5s) = 5) + && ((RealTimeDeque.head t1_5) = "e") + && ((RealTimeDeque.head t1C_5) = "e") + && ((RealTimeDeque.head t1_5s) = "e") + && ((RealTimeDeque.head t1C_5s) = "e") + && ((RealTimeDeque.length t1_4) = 4) + && ((RealTimeDeque.length t1C_4) = 4) + && ((RealTimeDeque.length t1_4s) = 4) + && ((RealTimeDeque.length t1C_4s) = 4) + && ((RealTimeDeque.head t1_4) = "d") + && ((RealTimeDeque.head t1C_4) = "d") + && ((RealTimeDeque.head t1_4s) = "d") + && ((RealTimeDeque.head t1C_4s) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.length t1_3s) = 3) + && ((RealTimeDeque.length t1C_3s) = 3) + && ((RealTimeDeque.head t1_3) = "c") + && ((RealTimeDeque.head t1C_3) = "c") + && ((RealTimeDeque.head t1_3s) = "c") + && ((RealTimeDeque.head t1C_3s) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.head, RealTimeDeque.tail, and RealTimeDeque.length work test 9" { + let t1 = RealTimeDeque.tail lena + let t1C = RealTimeDeque.tail lenaC3 + let t1s = RealTimeDeque.tail lenasnoc + let t1Cs = RealTimeDeque.tail lenaC3snoc + + let t1_8 = RealTimeDeque.tail t1 + let t1C_8 = RealTimeDeque.tail t1C + let t1_8s = RealTimeDeque.tail t1s + let t1C_8s = RealTimeDeque.tail t1Cs + + let t1_7 = RealTimeDeque.tail t1_8 + let t1C_7 = RealTimeDeque.tail t1C_8 + let t1_7s = RealTimeDeque.tail t1_8s + let t1C_7s = RealTimeDeque.tail t1C_8s + + let t1_6 = RealTimeDeque.tail t1_7 + let t1C_6 = RealTimeDeque.tail t1C_7 + let t1_6s = RealTimeDeque.tail t1_7s + let t1C_6s = RealTimeDeque.tail t1C_7s + + let t1_5 = RealTimeDeque.tail t1_6 + let t1C_5 = RealTimeDeque.tail t1C_6 + let t1_5s = RealTimeDeque.tail t1_6s + let t1C_5s = RealTimeDeque.tail t1C_6s + + let t1_4 = RealTimeDeque.tail t1_5 + let t1C_4 = RealTimeDeque.tail t1C_5 + let t1_4s = RealTimeDeque.tail t1_5s + let t1C_4s = RealTimeDeque.tail t1C_5s + + let t1_3 = RealTimeDeque.tail t1_4 + let t1C_3 = RealTimeDeque.tail t1C_4 + let t1_3s = RealTimeDeque.tail t1_4s + let t1C_3s = RealTimeDeque.tail t1C_4s + + let t1_2 = RealTimeDeque.tail t1_3 + let t1C_2 = RealTimeDeque.tail t1C_3 + let t1_2s = RealTimeDeque.tail t1_3s + let t1C_2s = RealTimeDeque.tail t1C_3s + + let t1_1 = RealTimeDeque.tail t1_2 + let t1C_1 = RealTimeDeque.tail t1C_2 + let t1_1s = RealTimeDeque.tail t1_2s + let t1C_1s = RealTimeDeque.tail t1C_2s + + (((RealTimeDeque.length t1) = 9) + && ((RealTimeDeque.length t1C) = 9) + && ((RealTimeDeque.length t1s) = 9) + && ((RealTimeDeque.length t1Cs) = 9) + && ((RealTimeDeque.head t1) = "i") + && ((RealTimeDeque.head t1C) = "i") + && ((RealTimeDeque.head t1s) = "i") + && ((RealTimeDeque.head t1Cs) = "i") + && ((RealTimeDeque.length t1_8) = 8) + && ((RealTimeDeque.length t1C_8) = 8) + && ((RealTimeDeque.length t1_8s) = 8) + && ((RealTimeDeque.length t1C_8s) = 8) + && ((RealTimeDeque.head t1_8) = "h") + && ((RealTimeDeque.head t1C_8) = "h") + && ((RealTimeDeque.head t1_8s) = "h") + && ((RealTimeDeque.head t1C_8s) = "h") + && ((RealTimeDeque.length t1_7) = 7) + && ((RealTimeDeque.length t1C_7) = 7) + && ((RealTimeDeque.length t1_7s) = 7) + && ((RealTimeDeque.length t1C_7s) = 7) + && ((RealTimeDeque.head t1_7) = "g") + && ((RealTimeDeque.head t1C_7) = "g") + && ((RealTimeDeque.head t1_7s) = "g") + && ((RealTimeDeque.head t1C_7s) = "g") + && ((RealTimeDeque.length t1_6) = 6) + && ((RealTimeDeque.length t1C_6) = 6) + && ((RealTimeDeque.length t1_6s) = 6) + && ((RealTimeDeque.length t1C_6s) = 6) + && ((RealTimeDeque.head t1_6) = "f") + && ((RealTimeDeque.head t1C_6) = "f") + && ((RealTimeDeque.head t1_6s) = "f") + && ((RealTimeDeque.head t1C_6s) = "f") + && ((RealTimeDeque.length t1_5) = 5) + && ((RealTimeDeque.length t1C_5) = 5) + && ((RealTimeDeque.length t1_5s) = 5) + && ((RealTimeDeque.length t1C_5s) = 5) + && ((RealTimeDeque.head t1_5) = "e") + && ((RealTimeDeque.head t1C_5) = "e") + && ((RealTimeDeque.head t1_5s) = "e") + && ((RealTimeDeque.head t1C_5s) = "e") + && ((RealTimeDeque.length t1_4) = 4) + && ((RealTimeDeque.length t1C_4) = 4) + && ((RealTimeDeque.length t1_4s) = 4) + && ((RealTimeDeque.length t1C_4s) = 4) + && ((RealTimeDeque.head t1_4) = "d") + && ((RealTimeDeque.head t1C_4) = "d") + && ((RealTimeDeque.head t1_4s) = "d") + && ((RealTimeDeque.head t1C_4s) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.length t1_3s) = 3) + && ((RealTimeDeque.length t1C_3s) = 3) + && ((RealTimeDeque.head t1_3) = "c") + && ((RealTimeDeque.head t1C_3) = "c") + && ((RealTimeDeque.head t1_3s) = "c") + && ((RealTimeDeque.head t1C_3s) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.length t1_2s) = 2) + && ((RealTimeDeque.length t1C_2s) = 2) + && ((RealTimeDeque.head t1_2) = "b") + && ((RealTimeDeque.head t1C_2) = "b") + && ((RealTimeDeque.head t1_2s) = "b") + && ((RealTimeDeque.head t1C_2s) = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && ((RealTimeDeque.length t1_1s) = 1) + && ((RealTimeDeque.length t1C_1s) = 1) + && ((RealTimeDeque.head t1_1) = "a") + && ((RealTimeDeque.head t1C_1) = "a") + && ((RealTimeDeque.head t1_1s) = "a") + && ((RealTimeDeque.head t1C_1s) = "a")) + |> Expect.isTrue "" + } + + //the previous series thoroughly tested construction by RealTimeDeque.snoc, so we'll leave those out + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 1" { + let t1 = RealTimeDeque.init len2 + let t1C = RealTimeDeque.init len2C3 + + (((RealTimeDeque.length t1) = 1) + && ((RealTimeDeque.length t1C) = 1) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 2" { + let t1 = RealTimeDeque.init len3 + let t1C = RealTimeDeque.init len3C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + + let lt1 = (RealTimeDeque.last t1) + let lt1C = (RealTimeDeque.last t1C) + let lt1_1 = (RealTimeDeque.last t1_1) + let lt1C_1 = (RealTimeDeque.last t1C_1) + + (((RealTimeDeque.length t1) = 2) + && ((RealTimeDeque.length t1C) = 2) + && (lt1 = "b") + && (lt1C = "b") + && ((RealTimeDeque.length t1_1) = 1) + && ((RealTimeDeque.length t1C_1) = 1) + && (lt1_1 = "c") + && (lt1C_1 = "c")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 3" { + let t1 = RealTimeDeque.init len4 + let t1C = RealTimeDeque.init len4C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + + (((RealTimeDeque.length t1) = 3) + && ((RealTimeDeque.length t1C) = 3) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 2) + && ((RealTimeDeque.length t1C_1) = 2) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 1) + && ((RealTimeDeque.length t1C_2) = 1) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 4" { + let t1 = RealTimeDeque.init len5 + let t1C = RealTimeDeque.init len5C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + let t1_3 = RealTimeDeque.init t1_2 + let t1C_3 = RealTimeDeque.init t1C_2 + + (((RealTimeDeque.length t1) = 4) + && ((RealTimeDeque.length t1C) = 4) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 3) + && ((RealTimeDeque.length t1C_1) = 3) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 2) + && ((RealTimeDeque.length t1C_2) = 2) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d") + && ((RealTimeDeque.length t1_3) = 1) + && ((RealTimeDeque.length t1C_3) = 1) + && ((RealTimeDeque.last t1_3) = "e") + && ((RealTimeDeque.last t1C_3) = "e")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 5" { + let t1 = RealTimeDeque.init len6 + let t1C = RealTimeDeque.init len6C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + let t1_3 = RealTimeDeque.init t1_2 + let t1C_3 = RealTimeDeque.init t1C_2 + let t1_4 = RealTimeDeque.init t1_3 + let t1C_4 = RealTimeDeque.init t1C_3 + + (((RealTimeDeque.length t1) = 5) + && ((RealTimeDeque.length t1C) = 5) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 4) + && ((RealTimeDeque.length t1C_1) = 4) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 3) + && ((RealTimeDeque.length t1C_2) = 3) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d") + && ((RealTimeDeque.length t1_3) = 2) + && ((RealTimeDeque.length t1C_3) = 2) + && ((RealTimeDeque.last t1_3) = "e") + && ((RealTimeDeque.last t1C_3) = "e") + && ((RealTimeDeque.length t1_4) = 1) + && ((RealTimeDeque.length t1C_4) = 1) + && ((RealTimeDeque.last t1_4) = "f") + && ((RealTimeDeque.last t1C_4) = "f")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 6" { + let t1 = RealTimeDeque.init len7 + let t1C = RealTimeDeque.init len7C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + let t1_3 = RealTimeDeque.init t1_2 + let t1C_3 = RealTimeDeque.init t1C_2 + let t1_4 = RealTimeDeque.init t1_3 + let t1C_4 = RealTimeDeque.init t1C_3 + let t1_5 = RealTimeDeque.init t1_4 + let t1C_5 = RealTimeDeque.init t1C_4 + + (((RealTimeDeque.length t1) = 6) + && ((RealTimeDeque.length t1C) = 6) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 5) + && ((RealTimeDeque.length t1C_1) = 5) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 4) + && ((RealTimeDeque.length t1C_2) = 4) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d") + && ((RealTimeDeque.length t1_3) = 3) + && ((RealTimeDeque.length t1C_3) = 3) + && ((RealTimeDeque.last t1_3) = "e") + && ((RealTimeDeque.last t1C_3) = "e") + && ((RealTimeDeque.length t1_4) = 2) + && ((RealTimeDeque.length t1C_4) = 2) + && ((RealTimeDeque.last t1_4) = "f") + && ((RealTimeDeque.last t1C_4) = "f") + && ((RealTimeDeque.length t1_5) = 1) + && ((RealTimeDeque.length t1C_5) = 1) + && ((RealTimeDeque.last t1_5) = "g") + && ((RealTimeDeque.last t1C_5) = "g")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 7" { + let t1 = RealTimeDeque.init len8 + let t1C = RealTimeDeque.init len8C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + let t1_3 = RealTimeDeque.init t1_2 + let t1C_3 = RealTimeDeque.init t1C_2 + let t1_4 = RealTimeDeque.init t1_3 + let t1C_4 = RealTimeDeque.init t1C_3 + let t1_5 = RealTimeDeque.init t1_4 + let t1C_5 = RealTimeDeque.init t1C_4 + let t1_6 = RealTimeDeque.init t1_5 + let t1C_6 = RealTimeDeque.init t1C_5 + + (((RealTimeDeque.length t1) = 7) + && ((RealTimeDeque.length t1C) = 7) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 6) + && ((RealTimeDeque.length t1C_1) = 6) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 5) + && ((RealTimeDeque.length t1C_2) = 5) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d") + && ((RealTimeDeque.length t1_3) = 4) + && ((RealTimeDeque.length t1C_3) = 4) + && ((RealTimeDeque.last t1_3) = "e") + && ((RealTimeDeque.last t1C_3) = "e") + && ((RealTimeDeque.length t1_4) = 3) + && ((RealTimeDeque.length t1C_4) = 3) + && ((RealTimeDeque.last t1_4) = "f") + && ((RealTimeDeque.last t1C_4) = "f") + && ((RealTimeDeque.length t1_5) = 2) + && ((RealTimeDeque.length t1C_5) = 2) + && ((RealTimeDeque.last t1_5) = "g") + && ((RealTimeDeque.last t1C_5) = "g") + && ((RealTimeDeque.length t1_6) = 1) + && ((RealTimeDeque.length t1C_6) = 1) + && ((RealTimeDeque.last t1_6) = "h") + && ((RealTimeDeque.last t1C_6) = "h")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 8" { + let t1 = RealTimeDeque.init len9 + let t1C = RealTimeDeque.init len9C3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + let t1_3 = RealTimeDeque.init t1_2 + let t1C_3 = RealTimeDeque.init t1C_2 + let t1_4 = RealTimeDeque.init t1_3 + let t1C_4 = RealTimeDeque.init t1C_3 + let t1_5 = RealTimeDeque.init t1_4 + let t1C_5 = RealTimeDeque.init t1C_4 + let t1_6 = RealTimeDeque.init t1_5 + let t1C_6 = RealTimeDeque.init t1C_5 + let t1_7 = RealTimeDeque.init t1_6 + let t1C_7 = RealTimeDeque.init t1C_6 + + (((RealTimeDeque.length t1) = 8) + && ((RealTimeDeque.length t1C) = 8) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 7) + && ((RealTimeDeque.length t1C_1) = 7) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 6) + && ((RealTimeDeque.length t1C_2) = 6) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d") + && ((RealTimeDeque.length t1_3) = 5) + && ((RealTimeDeque.length t1C_3) = 5) + && ((RealTimeDeque.last t1_3) = "e") + && ((RealTimeDeque.last t1C_3) = "e") + && ((RealTimeDeque.length t1_4) = 4) + && ((RealTimeDeque.length t1C_4) = 4) + && ((RealTimeDeque.last t1_4) = "f") + && ((RealTimeDeque.last t1C_4) = "f") + && ((RealTimeDeque.length t1_5) = 3) + && ((RealTimeDeque.length t1C_5) = 3) + && ((RealTimeDeque.last t1_5) = "g") + && ((RealTimeDeque.last t1C_5) = "g") + && ((RealTimeDeque.length t1_6) = 2) + && ((RealTimeDeque.length t1C_6) = 2) + && ((RealTimeDeque.last t1_6) = "h") + && ((RealTimeDeque.last t1C_6) = "h") + && ((RealTimeDeque.length t1_7) = 1) + && ((RealTimeDeque.length t1C_7) = 1) + && ((RealTimeDeque.last t1_7) = "i") + && ((RealTimeDeque.last t1C_7) = "i")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.last, RealTimeDeque.init, and RealTimeDeque.length work test 9" { + let t1 = RealTimeDeque.init lena + let t1C = RealTimeDeque.init lenaC3 + let t1_1 = RealTimeDeque.init t1 + let t1C_1 = RealTimeDeque.init t1C + let t1_2 = RealTimeDeque.init t1_1 + let t1C_2 = RealTimeDeque.init t1C_1 + let t1_3 = RealTimeDeque.init t1_2 + let t1C_3 = RealTimeDeque.init t1C_2 + let t1_4 = RealTimeDeque.init t1_3 + let t1C_4 = RealTimeDeque.init t1C_3 + let t1_5 = RealTimeDeque.init t1_4 + let t1C_5 = RealTimeDeque.init t1C_4 + let t1_6 = RealTimeDeque.init t1_5 + let t1C_6 = RealTimeDeque.init t1C_5 + let t1_7 = RealTimeDeque.init t1_6 + let t1C_7 = RealTimeDeque.init t1C_6 + let t1_8 = RealTimeDeque.init t1_7 + let t1C_8 = RealTimeDeque.init t1C_7 + + (((RealTimeDeque.length t1) = 9) + && ((RealTimeDeque.length t1C) = 9) + && ((RealTimeDeque.last t1) = "b") + && ((RealTimeDeque.last t1C) = "b") + && ((RealTimeDeque.length t1_1) = 8) + && ((RealTimeDeque.length t1C_1) = 8) + && ((RealTimeDeque.last t1_1) = "c") + && ((RealTimeDeque.last t1C_1) = "c") + && ((RealTimeDeque.length t1_2) = 7) + && ((RealTimeDeque.length t1C_2) = 7) + && ((RealTimeDeque.last t1_2) = "d") + && ((RealTimeDeque.last t1C_2) = "d") + && ((RealTimeDeque.length t1_3) = 6) + && ((RealTimeDeque.length t1C_3) = 6) + && ((RealTimeDeque.last t1_3) = "e") + && ((RealTimeDeque.last t1C_3) = "e") + && ((RealTimeDeque.length t1_4) = 5) + && ((RealTimeDeque.length t1C_4) = 5) + && ((RealTimeDeque.last t1_4) = "f") + && ((RealTimeDeque.last t1C_4) = "f") + && ((RealTimeDeque.length t1_5) = 4) + && ((RealTimeDeque.length t1C_5) = 4) + && ((RealTimeDeque.last t1_5) = "g") + && ((RealTimeDeque.last t1C_5) = "g") + && ((RealTimeDeque.length t1_6) = 3) + && ((RealTimeDeque.length t1C_6) = 3) + && ((RealTimeDeque.last t1_6) = "h") + && ((RealTimeDeque.last t1C_6) = "h") + && ((RealTimeDeque.length t1_7) = 2) + && ((RealTimeDeque.length t1C_7) = 2) + && ((RealTimeDeque.last t1_7) = "i") + && ((RealTimeDeque.last t1C_7) = "i") + && ((RealTimeDeque.length t1_8) = 1) + && ((RealTimeDeque.length t1C_8) = 1) + && ((RealTimeDeque.last t1_8) = "j") + && ((RealTimeDeque.last t1C_8) = "j")) + |> Expect.isTrue "" + } + + test "IEnumerable Seq" { (lena |> Seq.toArray).[5] |> Expect.equal "" "e" } + + test "IEnumerable Seq RealTimeDeque.length" { lena |> Seq.length |> Expect.equal "" 10 } + + test "type RealTimeDeque.cons works" { lena.Cons "zz" |> RealTimeDeque.head |> Expect.equal "" "zz" } + + test "IDeque RealTimeDeque.cons works" { ((lena :> IDeque).Cons "zz").Head |> Expect.equal "" "zz" } + + test "RealTimeDeque.ofCatLists and RealTimeDeque.uncons" { + let d = RealTimeDeque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] + let h1, t1 = RealTimeDeque.uncons d + let h2, t2 = RealTimeDeque.uncons t1 + let h3, t3 = RealTimeDeque.uncons t2 + let h4, t4 = RealTimeDeque.uncons t3 + let h5, t5 = RealTimeDeque.uncons t4 + let h6, t6 = RealTimeDeque.uncons t5 + + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f") + && (RealTimeDeque.isEmpty t6)) + |> Expect.isTrue "" + } + + test "ofCatSeqs and RealTimeDeque.uncons" { + let d = RealTimeDeque.ofCatSeqs (seq { 'a' .. 'c' }) (seq { 'd' .. 'f' }) + let h1, t1 = RealTimeDeque.uncons d + let h2, t2 = RealTimeDeque.uncons t1 + let h3, t3 = RealTimeDeque.uncons t2 + let h4, t4 = RealTimeDeque.uncons t3 + let h5, t5 = RealTimeDeque.uncons t4 + let h6, t6 = RealTimeDeque.uncons t5 + + ((h1 = 'a') + && (h2 = 'b') + && (h3 = 'c') + && (h4 = 'd') + && (h5 = 'e') + && (h6 = 'f') + && (RealTimeDeque.isEmpty t6)) + |> Expect.isTrue "" + } + + test "unsnoc works" { + let d = RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] + let i1, l1 = RealTimeDeque.unsnoc d + let i2, l2 = RealTimeDeque.unsnoc i1 + let i3, l3 = RealTimeDeque.unsnoc i2 + let i4, l4 = RealTimeDeque.unsnoc i3 + let i5, l5 = RealTimeDeque.unsnoc i4 + let i6, l6 = RealTimeDeque.unsnoc i5 + + ((l1 = "a") + && (l2 = "b") + && (l3 = "c") + && (l4 = "d") + && (l5 = "e") + && (l6 = "f") + && (RealTimeDeque.isEmpty i6)) + |> Expect.isTrue "" + } + + test "RealTimeDeque.snoc pattern discriminator" { + let d = (RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let i1, l1 = RealTimeDeque.unsnoc d + + let i2, l2 = + match i1 with + | RealTimeDeque.Snoc(i, l) -> i, l + | _ -> i1, "x" + + ((l2 = "b") && ((RealTimeDeque.length i2) = 4)) |> Expect.isTrue "" + } + + test "RealTimeDeque.cons pattern discriminator" { + let d = (RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let h1, t1 = RealTimeDeque.uncons d + + let h2, t2 = + match t1 with + | RealTimeDeque.Cons(h, t) -> h, t + | _ -> "x", t1 + + ((h2 = "e") && ((RealTimeDeque.length t2) = 4)) |> Expect.isTrue "" + } + + test "RealTimeDeque.cons and RealTimeDeque.snoc pattern discriminator" { + let d = (RealTimeDeque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + + let mid1 = + match d with + | RealTimeDeque.Cons(h, RealTimeDeque.Snoc(i, l)) -> i + | _ -> d + + let head, last = + match mid1 with + | RealTimeDeque.Cons(h, RealTimeDeque.Snoc(i, l)) -> h, l + | _ -> "x", "x" + + ((head = "e") && (last = "b")) |> Expect.isTrue "" + } + + test "RealTimeDeque.rev RealTimeDeque.empty dqueue should be RealTimeDeque.empty" { + RealTimeDeque.isEmpty(RealTimeDeque.rev(RealTimeDeque.empty 2)) + |> Expect.isTrue "" + } + + test "RealTimeDeque.rev dqueue RealTimeDeque.length 1" { + ((RealTimeDeque.head(RealTimeDeque.rev len1) = "a") + && (RealTimeDeque.head(RealTimeDeque.rev len1C3) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.rev dqueue RealTimeDeque.length 2" { + let r1 = RealTimeDeque.rev len2 + let r1c = RealTimeDeque.rev len2C3 + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + + ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.rev dqueue RealTimeDeque.length 3" { + let r1 = RealTimeDeque.rev len3 + let r1c = RealTimeDeque.rev len3C3 + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.rev dqueue RealTimeDeque.length 4" { + let r1 = RealTimeDeque.rev len4 + let r1c = RealTimeDeque.rev len4C3 + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.rev dqueue RealTimeDeque.length 5" { + let r1 = RealTimeDeque.rev len5 + let r1c = RealTimeDeque.rev len5C3 + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e")) + |> Expect.isTrue "" + } + + //RealTimeDeque.length 6 more than sufficient to test RealTimeDeque.rev + test "RealTimeDeque.rev dqueue RealTimeDeque.length 6" { + let r1 = RealTimeDeque.rev len6 + let r1c = RealTimeDeque.rev len6C3 + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.empty" { + ((RealTimeDeque.isEmpty(RealTimeDeque.ofSeq [])) + && (RealTimeDeque.isEmpty(RealTimeDeque.ofSeqC 3 []))) + |> Expect.isTrue "" + } + + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 1" { + ((RealTimeDeque.head(RealTimeDeque.ofSeq [ "a" ]) = "a") + && (RealTimeDeque.head(RealTimeDeque.ofSeqC 3 [ "a" ]) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 2" { + let r1 = RealTimeDeque.ofSeq [ "a"; "b" ] + let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b" ] + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + + ((h1 = "a") && (h1c = "a") && (h2 = "b") && (h2c = "b")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 3" { + let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c" ] + let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ] + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 4" { + let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ] + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d")) + |> Expect.isTrue "" + } + + //RealTimeDeque.length 5 more than sufficient to test RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 5" { + let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ] + let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ] + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e")) + |> Expect.isTrue "" + } + + //RealTimeDeque.length 5 more than sufficient to test RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC + test "RealTimeDeque.ofSeq and RealTimeDeque.ofSeqC RealTimeDeque.length 6" { + let r1 = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ] + let r1c = RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ] + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.empty dqueus" { + ((RealTimeDeque.isEmpty(RealTimeDeque.append (RealTimeDeque.ofSeq []) (RealTimeDeque.ofSeq []))) + && (RealTimeDeque.isEmpty(RealTimeDeque.append (RealTimeDeque.empty 3) (RealTimeDeque.empty 3)))) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.empty and RealTimeDeque.length 1" { + ((RealTimeDeque.head(RealTimeDeque.append (RealTimeDeque.ofSeq []) len1) = "a") + && (RealTimeDeque.head(RealTimeDeque.append len1 (RealTimeDeque.empty 3)) = "a")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.empty and RealTimeDeque.length 2" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq []) (RealTimeDeque.ofSeq [ "a"; "b" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.empty 3) (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq []) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.empty 3) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 1 and RealTimeDeque.length 2" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 1 and RealTimeDeque.length 3" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c"; "d" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c"; "d" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeq [ "d" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeqC 3 [ "d" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 1 and RealTimeDeque.length 4" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c"; "d"; "e" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c"; "d"; "e" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeq [ "e" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeqC 3 [ "e" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + + let t5r = RealTimeDeque.tail t4r + let t5cr = RealTimeDeque.tail t4cr + let h5r = RealTimeDeque.head t5r + let h5cr = RealTimeDeque.head t5cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 1 and RealTimeDeque.length 5" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a" ]) (RealTimeDeque.ofSeq [ "b"; "c"; "d"; "e"; "f" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a" ]) (RealTimeDeque.ofSeqC 3 [ "b"; "c"; "d"; "e"; "f" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeq [ "f" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeqC 3 [ "f" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + let t5r = RealTimeDeque.tail t4r + let t5cr = RealTimeDeque.tail t4cr + let h5r = RealTimeDeque.head t5r + let h5cr = RealTimeDeque.head t5cr + let t6r = RealTimeDeque.tail t5r + let t6cr = RealTimeDeque.tail t5cr + let h6r = RealTimeDeque.head t6r + let h6cr = RealTimeDeque.head t6cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 2 and RealTimeDeque.length 2" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 2 and RealTimeDeque.length 3" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d"; "e" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d"; "e" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeq [ "d"; "e" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeqC 3 [ "d"; "e" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + + let t5r = RealTimeDeque.tail t4r + let t5cr = RealTimeDeque.tail t4cr + let h5r = RealTimeDeque.head t5r + let h5cr = RealTimeDeque.head t5cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 2 and RealTimeDeque.length 4" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d"; "e"; "f" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d"; "e"; "f" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeq [ "e"; "f" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d" ]) (RealTimeDeque.ofSeqC 3 [ "e"; "f" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + let t5r = RealTimeDeque.tail t4r + let t5cr = RealTimeDeque.tail t4cr + let h5r = RealTimeDeque.head t5r + let h5cr = RealTimeDeque.head t5cr + let t6r = RealTimeDeque.tail t5r + let t6cr = RealTimeDeque.tail t5cr + let h6r = RealTimeDeque.head t6r + let h6cr = RealTimeDeque.head t6cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 2 and RealTimeDeque.length 5" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b" ]) (RealTimeDeque.ofSeq [ "c"; "d"; "e"; "f"; "g" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b" ]) (RealTimeDeque.ofSeqC 3 [ "c"; "d"; "e"; "f"; "g" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + let t7 = RealTimeDeque.tail t6 + let t7c = RealTimeDeque.tail t6c + let h7 = RealTimeDeque.head t7 + let h7c = RealTimeDeque.head t7c + + let r1r = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeq [ "f"; "g" ]) + + let r1cr = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e" ]) (RealTimeDeque.ofSeqC 3 [ "f"; "g" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + let t5r = RealTimeDeque.tail t4r + let t5cr = RealTimeDeque.tail t4cr + let h5r = RealTimeDeque.head t5r + let h5cr = RealTimeDeque.head t5cr + let t6r = RealTimeDeque.tail t5r + let t6cr = RealTimeDeque.tail t5cr + let h6r = RealTimeDeque.head t6r + let h6cr = RealTimeDeque.head t6cr + let t7r = RealTimeDeque.tail t6r + let t7cr = RealTimeDeque.tail t6cr + let h7r = RealTimeDeque.head t7r + let h7cr = RealTimeDeque.head t7cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h7 = "g") + && (h7c = "g") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f") + && (h7r = "g") + && (h7cr = "g")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 3 and RealTimeDeque.length 3" { + let r1 = + RealTimeDeque.append (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeq [ "d"; "e"; "f" ]) + + let r1c = + RealTimeDeque.append (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c" ]) (RealTimeDeque.ofSeqC 3 [ "d"; "e"; "f" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f")) + |> Expect.isTrue "" + } + + test "appending RealTimeDeque.length 6 and RealTimeDeque.length 7" { + let r1 = + RealTimeDeque.append + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + (RealTimeDeque.ofSeq [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) + + let r1c = + RealTimeDeque.append + (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f" ]) + (RealTimeDeque.ofSeqC 3 [ "g"; "h"; "i"; "j"; "k"; "l"; "m" ]) + + let h1 = RealTimeDeque.head r1 + let h1c = RealTimeDeque.head r1c + let t2 = RealTimeDeque.tail r1 + let t2c = RealTimeDeque.tail r1c + let h2 = RealTimeDeque.head t2 + let h2c = RealTimeDeque.head t2c + let t3 = RealTimeDeque.tail t2 + let t3c = RealTimeDeque.tail t2c + let h3 = RealTimeDeque.head t3 + let h3c = RealTimeDeque.head t3c + let t4 = RealTimeDeque.tail t3 + let t4c = RealTimeDeque.tail t3c + let h4 = RealTimeDeque.head t4 + let h4c = RealTimeDeque.head t4c + let t5 = RealTimeDeque.tail t4 + let t5c = RealTimeDeque.tail t4c + let h5 = RealTimeDeque.head t5 + let h5c = RealTimeDeque.head t5c + let t6 = RealTimeDeque.tail t5 + let t6c = RealTimeDeque.tail t5c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + let h6 = RealTimeDeque.head t6 + let h6c = RealTimeDeque.head t6c + let t7 = RealTimeDeque.tail t6 + let t7c = RealTimeDeque.tail t6c + let h7 = RealTimeDeque.head t7 + let h7c = RealTimeDeque.head t7c + let h7 = RealTimeDeque.head t7 + let h7c = RealTimeDeque.head t7c + let t8 = RealTimeDeque.tail t7 + let t8c = RealTimeDeque.tail t7c + let h8 = RealTimeDeque.head t8 + let h8c = RealTimeDeque.head t8c + let h8 = RealTimeDeque.head t8 + let h8c = RealTimeDeque.head t8c + let t9 = RealTimeDeque.tail t8 + let t9c = RealTimeDeque.tail t8c + let h9 = RealTimeDeque.head t9 + let h9c = RealTimeDeque.head t9c + let h9 = RealTimeDeque.head t9 + let h9c = RealTimeDeque.head t9c + let t10 = RealTimeDeque.tail t9 + let t10c = RealTimeDeque.tail t9c + let h10 = RealTimeDeque.head t10 + let h10c = RealTimeDeque.head t10c + let h10 = RealTimeDeque.head t10 + let h10c = RealTimeDeque.head t10c + let t11 = RealTimeDeque.tail t10 + let t11c = RealTimeDeque.tail t10c + let h11 = RealTimeDeque.head t11 + let h11c = RealTimeDeque.head t11c + let h11 = RealTimeDeque.head t11 + let h11c = RealTimeDeque.head t11c + let t12 = RealTimeDeque.tail t11 + let t12c = RealTimeDeque.tail t11c + let h12 = RealTimeDeque.head t12 + let h12c = RealTimeDeque.head t12c + let h12 = RealTimeDeque.head t12 + let h12c = RealTimeDeque.head t12c + let t13 = RealTimeDeque.tail t12 + let t13c = RealTimeDeque.tail t12c + let h13 = RealTimeDeque.head t13 + let h13c = RealTimeDeque.head t13c + let h13 = RealTimeDeque.head t13 + let h13c = RealTimeDeque.head t13c + + let r1r = + RealTimeDeque.append + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) + (RealTimeDeque.ofSeq [ "h"; "i"; "j"; "k"; "l"; "m" ]) + + let r1cr = + RealTimeDeque.append + (RealTimeDeque.ofSeqC 3 [ "a"; "b"; "c"; "d"; "e"; "f"; "g" ]) + (RealTimeDeque.ofSeqC 3 [ "h"; "i"; "j"; "k"; "l"; "m" ]) + + let h1r = RealTimeDeque.head r1r + let h1cr = RealTimeDeque.head r1cr + let t2r = RealTimeDeque.tail r1r + let t2cr = RealTimeDeque.tail r1cr + let h2r = RealTimeDeque.head t2r + let h2cr = RealTimeDeque.head t2cr + let t3r = RealTimeDeque.tail t2r + let t3cr = RealTimeDeque.tail t2cr + let h3r = RealTimeDeque.head t3r + let h3cr = RealTimeDeque.head t3cr + let t4r = RealTimeDeque.tail t3r + let t4cr = RealTimeDeque.tail t3cr + let h4r = RealTimeDeque.head t4r + let h4cr = RealTimeDeque.head t4cr + let t5r = RealTimeDeque.tail t4r + let t5cr = RealTimeDeque.tail t4cr + let h5r = RealTimeDeque.head t5r + let h5cr = RealTimeDeque.head t5cr + let t6r = RealTimeDeque.tail t5r + let t6cr = RealTimeDeque.tail t5cr + let h6r = RealTimeDeque.head t6r + let h6cr = RealTimeDeque.head t6cr + let t7r = RealTimeDeque.tail t6r + let t7cr = RealTimeDeque.tail t6cr + let h7r = RealTimeDeque.head t7r + let h7cr = RealTimeDeque.head t7cr + let h7r = RealTimeDeque.head t7r + let h7cr = RealTimeDeque.head t7cr + let t8r = RealTimeDeque.tail t7r + let t8cr = RealTimeDeque.tail t7cr + let h8r = RealTimeDeque.head t8r + let h8cr = RealTimeDeque.head t8cr + let h8r = RealTimeDeque.head t8r + let h8cr = RealTimeDeque.head t8cr + let t9r = RealTimeDeque.tail t8r + let t9cr = RealTimeDeque.tail t8cr + let h9r = RealTimeDeque.head t9r + let h9cr = RealTimeDeque.head t9cr + let h9r = RealTimeDeque.head t9r + let h9cr = RealTimeDeque.head t9cr + let t10r = RealTimeDeque.tail t9r + let t10cr = RealTimeDeque.tail t9cr + let h10r = RealTimeDeque.head t10r + let h10cr = RealTimeDeque.head t10cr + let h10r = RealTimeDeque.head t10r + let h10cr = RealTimeDeque.head t10cr + let t11r = RealTimeDeque.tail t10r + let t11cr = RealTimeDeque.tail t10cr + let h11r = RealTimeDeque.head t11r + let h11cr = RealTimeDeque.head t11cr + let h11r = RealTimeDeque.head t11r + let h11cr = RealTimeDeque.head t11cr + let t12r = RealTimeDeque.tail t11r + let t12cr = RealTimeDeque.tail t11cr + let h12r = RealTimeDeque.head t12r + let h12cr = RealTimeDeque.head t12cr + let h12r = RealTimeDeque.head t12r + let h12cr = RealTimeDeque.head t12cr + let t13r = RealTimeDeque.tail t12r + let t13cr = RealTimeDeque.tail t12cr + let h13r = RealTimeDeque.head t13r + let h13cr = RealTimeDeque.head t13cr + let h13r = RealTimeDeque.head t13r + let h13cr = RealTimeDeque.head t13cr + + ((h1 = "a") + && (h1c = "a") + && (h2 = "b") + && (h2c = "b") + && (h3 = "c") + && (h3c = "c") + && (h4 = "d") + && (h4c = "d") + && (h5 = "e") + && (h5c = "e") + && (h6 = "f") + && (h6c = "f") + && (h7 = "g") + && (h7c = "g") + && (h8 = "h") + && (h8c = "h") + && (h9 = "i") + && (h9c = "i") + && (h10 = "j") + && (h10c = "j") + && (h11 = "k") + && (h11c = "k") + && (h12 = "l") + && (h12c = "l") + && (h13 = "m") + && (h13c = "m") + && (h1r = "a") + && (h1cr = "a") + && (h2r = "b") + && (h2cr = "b") + && (h3r = "c") + && (h3cr = "c") + && (h4r = "d") + && (h4cr = "d") + && (h5r = "e") + && (h5cr = "e") + && (h6r = "f") + && (h6cr = "f") + && (h7r = "g") + && (h7cr = "g") + && (h8r = "h") + && (h8cr = "h") + && (h9r = "i") + && (h9cr = "i") + && (h10r = "j") + && (h10cr = "j") + && (h11r = "k") + && (h11cr = "k") + && (h12r = "l") + && (h12cr = "l") + && (h13r = "m") + && (h13cr = "m")) + |> Expect.isTrue "" + } + + + test "RealTimeDeque.lookup RealTimeDeque.length 1" { len1 |> RealTimeDeque.lookup 0 |> Expect.equal "" "a" } + + test "RealTimeDeque.lookup RealTimeDeque.length 2" { + (((len2 |> RealTimeDeque.lookup 0) = "b") + && ((len2 |> RealTimeDeque.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 3" { + (((len3 |> RealTimeDeque.lookup 0) = "c") + && ((len3 |> RealTimeDeque.lookup 1) = "b") + && ((len3 |> RealTimeDeque.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 4" { + (((len4 |> RealTimeDeque.lookup 0) = "d") + && ((len4 |> RealTimeDeque.lookup 1) = "c") + && ((len4 |> RealTimeDeque.lookup 2) = "b") + && ((len4 |> RealTimeDeque.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 5" { + (((len5 |> RealTimeDeque.lookup 0) = "e") + && ((len5 |> RealTimeDeque.lookup 1) = "d") + && ((len5 |> RealTimeDeque.lookup 2) = "c") + && ((len5 |> RealTimeDeque.lookup 3) = "b") + && ((len5 |> RealTimeDeque.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 6" { + (((len6 |> RealTimeDeque.lookup 0) = "f") + && ((len6 |> RealTimeDeque.lookup 1) = "e") + && ((len6 |> RealTimeDeque.lookup 2) = "d") + && ((len6 |> RealTimeDeque.lookup 3) = "c") + && ((len6 |> RealTimeDeque.lookup 4) = "b") + && ((len6 |> RealTimeDeque.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 7" { + (((len7 |> RealTimeDeque.lookup 0) = "g") + && ((len7 |> RealTimeDeque.lookup 1) = "f") + && ((len7 |> RealTimeDeque.lookup 2) = "e") + && ((len7 |> RealTimeDeque.lookup 3) = "d") + && ((len7 |> RealTimeDeque.lookup 4) = "c") + && ((len7 |> RealTimeDeque.lookup 5) = "b") + && ((len7 |> RealTimeDeque.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 8" { + (((len8 |> RealTimeDeque.lookup 0) = "h") + && ((len8 |> RealTimeDeque.lookup 1) = "g") + && ((len8 |> RealTimeDeque.lookup 2) = "f") + && ((len8 |> RealTimeDeque.lookup 3) = "e") + && ((len8 |> RealTimeDeque.lookup 4) = "d") + && ((len8 |> RealTimeDeque.lookup 5) = "c") + && ((len8 |> RealTimeDeque.lookup 6) = "b") + && ((len8 |> RealTimeDeque.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 9" { + (((len9 |> RealTimeDeque.lookup 0) = "i") + && ((len9 |> RealTimeDeque.lookup 1) = "h") + && ((len9 |> RealTimeDeque.lookup 2) = "g") + && ((len9 |> RealTimeDeque.lookup 3) = "f") + && ((len9 |> RealTimeDeque.lookup 4) = "e") + && ((len9 |> RealTimeDeque.lookup 5) = "d") + && ((len9 |> RealTimeDeque.lookup 6) = "c") + && ((len9 |> RealTimeDeque.lookup 7) = "b") + && ((len9 |> RealTimeDeque.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.lookup RealTimeDeque.length 10" { + (((lena |> RealTimeDeque.lookup 0) = "j") + && ((lena |> RealTimeDeque.lookup 1) = "i") + && ((lena |> RealTimeDeque.lookup 2) = "h") + && ((lena |> RealTimeDeque.lookup 3) = "g") + && ((lena |> RealTimeDeque.lookup 4) = "f") + && ((lena |> RealTimeDeque.lookup 5) = "e") + && ((lena |> RealTimeDeque.lookup 6) = "d") + && ((lena |> RealTimeDeque.lookup 7) = "c") + && ((lena |> RealTimeDeque.lookup 8) = "b") + && ((lena |> RealTimeDeque.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 1" { + let a = len1 |> RealTimeDeque.tryLookup 0 + (a.Value = "a") |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 2" { + let b = len2 |> RealTimeDeque.tryLookup 0 + let a = len2 |> RealTimeDeque.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 3" { + let c = len3 |> RealTimeDeque.tryLookup 0 + let b = len3 |> RealTimeDeque.tryLookup 1 + let a = len3 |> RealTimeDeque.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 4" { + let d = len4 |> RealTimeDeque.tryLookup 0 + let c = len4 |> RealTimeDeque.tryLookup 1 + let b = len4 |> RealTimeDeque.tryLookup 2 + let a = len4 |> RealTimeDeque.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 5" { + let e = len5 |> RealTimeDeque.tryLookup 0 + let d = len5 |> RealTimeDeque.tryLookup 1 + let c = len5 |> RealTimeDeque.tryLookup 2 + let b = len5 |> RealTimeDeque.tryLookup 3 + let a = len5 |> RealTimeDeque.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 6" { + let f = len6 |> RealTimeDeque.tryLookup 0 + let e = len6 |> RealTimeDeque.tryLookup 1 + let d = len6 |> RealTimeDeque.tryLookup 2 + let c = len6 |> RealTimeDeque.tryLookup 3 + let b = len6 |> RealTimeDeque.tryLookup 4 + let a = len6 |> RealTimeDeque.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 7" { + let g = len7 |> RealTimeDeque.tryLookup 0 + let f = len7 |> RealTimeDeque.tryLookup 1 + let e = len7 |> RealTimeDeque.tryLookup 2 + let d = len7 |> RealTimeDeque.tryLookup 3 + let c = len7 |> RealTimeDeque.tryLookup 4 + let b = len7 |> RealTimeDeque.tryLookup 5 + let a = len7 |> RealTimeDeque.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 8" { + let h = len8 |> RealTimeDeque.tryLookup 0 + let g = len8 |> RealTimeDeque.tryLookup 1 + let f = len8 |> RealTimeDeque.tryLookup 2 + let e = len8 |> RealTimeDeque.tryLookup 3 + let d = len8 |> RealTimeDeque.tryLookup 4 + let c = len8 |> RealTimeDeque.tryLookup 5 + let b = len8 |> RealTimeDeque.tryLookup 6 + let a = len8 |> RealTimeDeque.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 9" { + let i = len9 |> RealTimeDeque.tryLookup 0 + let h = len9 |> RealTimeDeque.tryLookup 1 + let g = len9 |> RealTimeDeque.tryLookup 2 + let f = len9 |> RealTimeDeque.tryLookup 3 + let e = len9 |> RealTimeDeque.tryLookup 4 + let d = len9 |> RealTimeDeque.tryLookup 5 + let c = len9 |> RealTimeDeque.tryLookup 6 + let b = len9 |> RealTimeDeque.tryLookup 7 + let a = len9 |> RealTimeDeque.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup RealTimeDeque.length 10" { + let j = lena |> RealTimeDeque.tryLookup 0 + let i = lena |> RealTimeDeque.tryLookup 1 + let h = lena |> RealTimeDeque.tryLookup 2 + let g = lena |> RealTimeDeque.tryLookup 3 + let f = lena |> RealTimeDeque.tryLookup 4 + let e = lena |> RealTimeDeque.tryLookup 5 + let d = lena |> RealTimeDeque.tryLookup 6 + let c = lena |> RealTimeDeque.tryLookup 7 + let b = lena |> RealTimeDeque.tryLookup 8 + let a = lena |> RealTimeDeque.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryLookup not found" { lena |> RealTimeDeque.tryLookup 10 |> Expect.isNone "" } + + test "RealTimeDeque.remove elements RealTimeDeque.length 1" { + len1 + |> RealTimeDeque.remove 0 + |> RealTimeDeque.isEmpty + |> Expect.isTrue "" + } + + test "RealTimeDeque.remove elements RealTimeDeque.length 2" { + let a = len2 |> RealTimeDeque.remove 0 |> RealTimeDeque.head + let b = len2 |> RealTimeDeque.remove 1 |> RealTimeDeque.head + ((a = "a") && (b = "b")) |> Expect.isTrue "" + } + + test "RealTimeDeque.remove elements RealTimeDeque.length 3" { + let r0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.remove 0 + let b0 = RealTimeDeque.head r0 + let t0 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t0 + + let r1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.remove 1 + let a1 = RealTimeDeque.head r1 + let t1 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t1 + + let r2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.remove 2 + let a2 = RealTimeDeque.head r2 + let t2 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.remove elements RealTimeDeque.length 4" { + let r0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 0 + let b0 = RealTimeDeque.head r0 + let t0 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t0 + let t01 = RealTimeDeque.tail t0 + let d0 = RealTimeDeque.head t01 + + let r1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 1 + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let d1 = RealTimeDeque.head t12 + + let r2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 2 + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + + let r3 = (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) |> RealTimeDeque.remove 3 + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.remove elements RealTimeDeque.length 5" { + let r0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.remove 0 + + let b0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let d0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let e0 = RealTimeDeque.head t03 + + let r1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.remove 1 + + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let d1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let e1 = RealTimeDeque.head t13 + + let r2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.remove 2 + + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let e2 = RealTimeDeque.head t23 + + let r3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.remove 3 + + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let e3 = RealTimeDeque.head t33 + + let r4 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.remove 4 + + let a4 = RealTimeDeque.head r4 + let t41 = RealTimeDeque.tail r4 + let b4 = RealTimeDeque.head t41 + let t42 = RealTimeDeque.tail t41 + let c4 = RealTimeDeque.head t42 + let t43 = RealTimeDeque.tail t42 + let d4 = RealTimeDeque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.remove elements RealTimeDeque.length 6" { + let r0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.remove 0 + + let b0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let d0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let e0 = RealTimeDeque.head t03 + let t04 = RealTimeDeque.tail t03 + let f0 = RealTimeDeque.head t04 + + let r1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.remove 1 + + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let d1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let e1 = RealTimeDeque.head t13 + let t14 = RealTimeDeque.tail t13 + let f1 = RealTimeDeque.head t14 + + let r2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.remove 2 + + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let e2 = RealTimeDeque.head t23 + let t24 = RealTimeDeque.tail t23 + let f2 = RealTimeDeque.head t24 + + let r3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.remove 3 + + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let e3 = RealTimeDeque.head t33 + let t34 = RealTimeDeque.tail t33 + let f3 = RealTimeDeque.head t34 + + let r4 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.remove 4 + + let a4 = RealTimeDeque.head r4 + let t41 = RealTimeDeque.tail r4 + let b4 = RealTimeDeque.head t41 + let t42 = RealTimeDeque.tail t41 + let c4 = RealTimeDeque.head t42 + let t43 = RealTimeDeque.tail t42 + let d4 = RealTimeDeque.head t43 + let t44 = RealTimeDeque.tail t43 + let f4 = RealTimeDeque.head t44 + + let r5 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.remove 5 + + let a5 = RealTimeDeque.head r5 + let t51 = RealTimeDeque.tail r5 + let b5 = RealTimeDeque.head t51 + let t52 = RealTimeDeque.tail t51 + let c5 = RealTimeDeque.head t52 + let t53 = RealTimeDeque.tail t52 + let d5 = RealTimeDeque.head t53 + let t54 = RealTimeDeque.tail t53 + let e5 = RealTimeDeque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "tryRemoveempty" { + (RealTimeDeque.empty 3) + |> RealTimeDeque.tryRemove 0 + |> Expect.isNone "" + } + + test "RealTimeDeque.tryRemove elements RealTimeDeque.length 1" { + let a = len1 |> RealTimeDeque.tryRemove 0 + a.Value |> RealTimeDeque.isEmpty |> Expect.isTrue "" + } + + test "RealTimeDeque.tryRemove elements RealTimeDeque.length 2" { + let a = len2 |> RealTimeDeque.tryRemove 0 + let a1 = RealTimeDeque.head a.Value + let b = len2 |> RealTimeDeque.tryRemove 1 + let b1 = RealTimeDeque.head b.Value + ((a1 = "a") && (b1 = "b")) |> Expect.isTrue "" + } + + test "RealTimeDeque.tryRemove elements RealTimeDeque.length 3" { + let x0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.tryRemove 0 + let r0 = x0.Value + let b0 = RealTimeDeque.head r0 + let t0 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t0 + + let x1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.tryRemove 1 + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t1 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t1 + + let x2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.tryRemove 2 + let r2 = x2.Value + let a2 = RealTimeDeque.head r2 + let t2 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t2 + + ((b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryRemove elements RealTimeDeque.length 4" { + let x0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = RealTimeDeque.head r0 + let t0 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t0 + let t01 = RealTimeDeque.tail t0 + let d0 = RealTimeDeque.head t01 + + let x1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let d1 = RealTimeDeque.head t12 + + let x2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + + let x3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryRemove elements RealTimeDeque.length 5" { + let x0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let d0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let e0 = RealTimeDeque.head t03 + + let x1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let d1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let e1 = RealTimeDeque.head t13 + + let x2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let e2 = RealTimeDeque.head t23 + + let x3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let e3 = RealTimeDeque.head t33 + + let x4 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.tryRemove 4 + + let r4 = x4.Value + let a4 = RealTimeDeque.head r4 + let t41 = RealTimeDeque.tail r4 + let b4 = RealTimeDeque.head t41 + let t42 = RealTimeDeque.tail t41 + let c4 = RealTimeDeque.head t42 + let t43 = RealTimeDeque.tail t42 + let d4 = RealTimeDeque.head t43 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryRemove elements RealTimeDeque.length 6" { + let x0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.tryRemove 0 + + let r0 = x0.Value + let b0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let c0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let d0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let e0 = RealTimeDeque.head t03 + let t04 = RealTimeDeque.tail t03 + let f0 = RealTimeDeque.head t04 + + let x1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.tryRemove 1 + + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let c1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let d1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let e1 = RealTimeDeque.head t13 + let t14 = RealTimeDeque.tail t13 + let f1 = RealTimeDeque.head t14 + + let x2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.tryRemove 2 + + let r2 = x2.Value + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let e2 = RealTimeDeque.head t23 + let t24 = RealTimeDeque.tail t23 + let f2 = RealTimeDeque.head t24 + + let x3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.tryRemove 3 + + let r3 = x3.Value + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let e3 = RealTimeDeque.head t33 + let t34 = RealTimeDeque.tail t33 + let f3 = RealTimeDeque.head t34 + + let x4 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.tryRemove 4 + + let r4 = x4.Value + let a4 = RealTimeDeque.head r4 + let t41 = RealTimeDeque.tail r4 + let b4 = RealTimeDeque.head t41 + let t42 = RealTimeDeque.tail t41 + let c4 = RealTimeDeque.head t42 + let t43 = RealTimeDeque.tail t42 + let d4 = RealTimeDeque.head t43 + let t44 = RealTimeDeque.tail t43 + let f4 = RealTimeDeque.head t44 + + let x5 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.tryRemove 5 + + let r5 = x5.Value + let a5 = RealTimeDeque.head r5 + let t51 = RealTimeDeque.tail r5 + let b5 = RealTimeDeque.head t51 + let t52 = RealTimeDeque.tail t51 + let c5 = RealTimeDeque.head t52 + let t53 = RealTimeDeque.tail t52 + let d5 = RealTimeDeque.head t53 + let t54 = RealTimeDeque.tail t53 + let e5 = RealTimeDeque.head t54 + + ((b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.update elements RealTimeDeque.length 1" { + len1 + |> RealTimeDeque.update 0 "aa" + |> RealTimeDeque.head + |> Expect.equal "" "aa" + } + + test "RealTimeDeque.update elements RealTimeDeque.length 2" { + let r0 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.update 0 "zz" + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + + let r1 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.update 1 "zz" + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.update elements RealTimeDeque.length 3" { + let r0 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.update 0 "zz" + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let c0 = RealTimeDeque.head t02 + + let r1 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.update 1 "zz" + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let c1 = RealTimeDeque.head t12 + + let r2 = (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) |> RealTimeDeque.update 2 "zz" + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.update elements RealTimeDeque.length 4" { + let r0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.update 0 "zz" + + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let c0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let d0 = RealTimeDeque.head t03 + + let r1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.update 1 "zz" + + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let c1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let d1 = RealTimeDeque.head t13 + + let r2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.update 2 "zz" + + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let d2 = RealTimeDeque.head t23 + + let r3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.update 3 "zz" + + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let d3 = RealTimeDeque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.update elements RealTimeDeque.length 5" { + let r0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.update 0 "zz" + + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let c0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let d0 = RealTimeDeque.head t03 + let t04 = RealTimeDeque.tail t03 + let e0 = RealTimeDeque.head t04 + + let r1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.update 1 "zz" + + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let c1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let d1 = RealTimeDeque.head t13 + let t14 = RealTimeDeque.tail t13 + let e1 = RealTimeDeque.head t14 + + let r2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.update 2 "zz" + + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let d2 = RealTimeDeque.head t23 + let t24 = RealTimeDeque.tail t23 + let e2 = RealTimeDeque.head t24 + + let r3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.update 3 "zz" + + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let d3 = RealTimeDeque.head t33 + let t34 = RealTimeDeque.tail t33 + let e3 = RealTimeDeque.head t34 + + let r4 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e" ]) + |> RealTimeDeque.update 4 "zz" + + let a4 = RealTimeDeque.head r4 + let t41 = RealTimeDeque.tail r4 + let b4 = RealTimeDeque.head t41 + let t42 = RealTimeDeque.tail t41 + let c4 = RealTimeDeque.head t42 + let t43 = RealTimeDeque.tail t42 + let d4 = RealTimeDeque.head t43 + let t44 = RealTimeDeque.tail t43 + let e4 = RealTimeDeque.head t44 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.update elements RealTimeDeque.length 6" { + let r0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.update 0 "zz" + + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let c0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let d0 = RealTimeDeque.head t03 + let t04 = RealTimeDeque.tail t03 + let e0 = RealTimeDeque.head t04 + let t05 = RealTimeDeque.tail t04 + let f0 = RealTimeDeque.head t05 + + let r1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.update 1 "zz" + + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let c1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let d1 = RealTimeDeque.head t13 + let t14 = RealTimeDeque.tail t13 + let e1 = RealTimeDeque.head t14 + let t15 = RealTimeDeque.tail t14 + let f1 = RealTimeDeque.head t15 + + let r2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.update 2 "zz" + + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let d2 = RealTimeDeque.head t23 + let t24 = RealTimeDeque.tail t23 + let e2 = RealTimeDeque.head t24 + let t25 = RealTimeDeque.tail t24 + let f2 = RealTimeDeque.head t25 + + let r3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.update 3 "zz" + + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let d3 = RealTimeDeque.head t33 + let t34 = RealTimeDeque.tail t33 + let e3 = RealTimeDeque.head t34 + let t35 = RealTimeDeque.tail t34 + let f3 = RealTimeDeque.head t35 + + let r4 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.update 4 "zz" + + let a4 = RealTimeDeque.head r4 + let t41 = RealTimeDeque.tail r4 + let b4 = RealTimeDeque.head t41 + let t42 = RealTimeDeque.tail t41 + let c4 = RealTimeDeque.head t42 + let t43 = RealTimeDeque.tail t42 + let d4 = RealTimeDeque.head t43 + let t44 = RealTimeDeque.tail t43 + let e4 = RealTimeDeque.head t44 + let t45 = RealTimeDeque.tail t44 + let f4 = RealTimeDeque.head t45 + + let r5 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f" ]) + |> RealTimeDeque.update 5 "zz" + + let a5 = RealTimeDeque.head r5 + let t51 = RealTimeDeque.tail r5 + let b5 = RealTimeDeque.head t51 + let t52 = RealTimeDeque.tail t51 + let c5 = RealTimeDeque.head t52 + let t53 = RealTimeDeque.tail t52 + let d5 = RealTimeDeque.head t53 + let t54 = RealTimeDeque.tail t53 + let e5 = RealTimeDeque.head t54 + let t55 = RealTimeDeque.tail t54 + let f5 = RealTimeDeque.head t55 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (e0 = "e") + && (f0 = "f") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (e1 = "e") + && (f1 = "f") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (e2 = "e") + && (f2 = "f") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz") + && (e3 = "e") + && (f3 = "f") + && (a4 = "a") + && (b4 = "b") + && (c4 = "c") + && (d4 = "d") + && (e4 = "zz") + && (f4 = "f") + && (a5 = "a") + && (b5 = "b") + && (c5 = "c") + && (d5 = "d") + && (e5 = "e") + && (f5 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 1" { + let a = len1 |> RealTimeDeque.tryUpdate 0 "aa" + a.Value |> RealTimeDeque.head |> Expect.equal "" "aa" + } + + test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 2" { + let x0 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.tryUpdate 0 "zz" + let r0 = x0.Value + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + + let x1 = (RealTimeDeque.ofSeq [ "a"; "b" ]) |> RealTimeDeque.tryUpdate 1 "zz" + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + + ((a0 = "zz") && (b0 = "b") && (a1 = "a") && (b1 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 3" { + let x0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) + |> RealTimeDeque.tryUpdate 0 "zz" + + let r0 = x0.Value + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let c0 = RealTimeDeque.head t02 + + let x1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) + |> RealTimeDeque.tryUpdate 1 "zz" + + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let c1 = RealTimeDeque.head t12 + + let x2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c" ]) + |> RealTimeDeque.tryUpdate 2 "zz" + + let r2 = x2.Value + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryUpdate elements RealTimeDeque.length 4" { + let x0 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryUpdate 0 "zz" + + let r0 = x0.Value + let a0 = RealTimeDeque.head r0 + let t01 = RealTimeDeque.tail r0 + let b0 = RealTimeDeque.head t01 + let t02 = RealTimeDeque.tail t01 + let c0 = RealTimeDeque.head t02 + let t03 = RealTimeDeque.tail t02 + let d0 = RealTimeDeque.head t03 + + let x1 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryUpdate 1 "zz" + + let r1 = x1.Value + let a1 = RealTimeDeque.head r1 + let t11 = RealTimeDeque.tail r1 + let b1 = RealTimeDeque.head t11 + let t12 = RealTimeDeque.tail t11 + let c1 = RealTimeDeque.head t12 + let t13 = RealTimeDeque.tail t12 + let d1 = RealTimeDeque.head t13 + + let x2 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryUpdate 2 "zz" + + let r2 = x2.Value + let a2 = RealTimeDeque.head r2 + let t21 = RealTimeDeque.tail r2 + let b2 = RealTimeDeque.head t21 + let t22 = RealTimeDeque.tail t21 + let c2 = RealTimeDeque.head t22 + let t23 = RealTimeDeque.tail t22 + let d2 = RealTimeDeque.head t23 + + let x3 = + (RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ]) + |> RealTimeDeque.tryUpdate 3 "zz" + + let r3 = x3.Value + let a3 = RealTimeDeque.head r3 + let t31 = RealTimeDeque.tail r3 + let b3 = RealTimeDeque.head t31 + let t32 = RealTimeDeque.tail t31 + let c3 = RealTimeDeque.head t32 + let t33 = RealTimeDeque.tail t32 + let d3 = RealTimeDeque.head t33 + + ((a0 = "zz") + && (b0 = "b") + && (c0 = "c") + && (d0 = "d") + && (a1 = "a") + && (b1 = "zz") + && (c1 = "c") + && (d1 = "d") + && (a2 = "a") + && (b2 = "b") + && (c2 = "zz") + && (d2 = "d") + && (a3 = "a") + && (b3 = "b") + && (c3 = "c") + && (d3 = "zz")) + |> Expect.isTrue "" + } + + test "RealTimeDeque.tryUncons on RealTimeDeque.empty" { + let q = RealTimeDeque.empty 2 + (RealTimeDeque.tryUncons q = None) |> Expect.isTrue "" + } + + test "RealTimeDeque.tryUncons on q" { + let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let x, xs = (RealTimeDeque.tryUncons q).Value + x |> Expect.equal "" "a" + } + + test "RealTimeDeque.tryUnsnoc on RealTimeDeque.empty" { + let q = RealTimeDeque.empty 2 + (RealTimeDeque.tryUnsnoc q = None) |> Expect.isTrue "" + } + + test "RealTimeDeque.tryUnsnoc on q" { + let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let xs, x = (RealTimeDeque.tryUnsnoc q).Value + x |> Expect.equal "" "d" + } + + test "RealTimeDeque.tryGetHead on RealTimeDeque.empty" { + let q = RealTimeDeque.empty 2 + (RealTimeDeque.tryGetHead q = None) |> Expect.isTrue "" + } + + test "RealTimeDeque.tryGetHead on q" { + let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + (RealTimeDeque.tryGetHead q).Value |> Expect.equal "" "a" + } + + test "tryGetInit on RealTimeDeque.empty" { + let q = RealTimeDeque.empty 2 + (RealTimeDeque.tryGetInit q = None) |> Expect.isTrue "" + } + + test "tryGetInit on q" { + let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + let x = (RealTimeDeque.tryGetInit q).Value + let x2 = x |> RealTimeDeque.last + x2 |> Expect.equal "" "c" + } + + test "tryGetLast on RealTimeDeque.empty" { + let q = RealTimeDeque.empty 2 + (RealTimeDeque.tryGetLast q = None) |> Expect.isTrue "" + } + + test "tryGetLast on q" { + let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + (RealTimeDeque.tryGetLast q).Value |> Expect.equal "" "d" + } + + + test "tryGetTail on RealTimeDeque.empty" { + let q = RealTimeDeque.empty 2 + (RealTimeDeque.tryGetTail q = None) |> Expect.isTrue "" + } + + test "tryGetTail on q" { + let q = RealTimeDeque.ofSeq [ "a"; "b"; "c"; "d" ] + + (RealTimeDeque.tryGetTail q).Value + |> RealTimeDeque.head + |> Expect.equal "" "b" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/RealTimeQueueTest.fs b/tests/FSharpx.Collections.Experimental.Tests/RealTimeQueueTest.fs index 4ba7fa9c..b296c9bc 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/RealTimeQueueTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/RealTimeQueueTest.fs @@ -10,88 +10,88 @@ module RealTimeQueueTest = [] let testRealTimeQueue = - testList "Experimental RealTimeQueue" [ - test "RealTimeQueue.empty queue should be RealTimeQueue.empty" { RealTimeQueue.isEmpty RealTimeQueue.empty |> Expect.isTrue "" } - - test "it should allow to enqueue" { - RealTimeQueue.empty - |> RealTimeQueue.snoc 1 - |> RealTimeQueue.snoc 2 - |> RealTimeQueue.isEmpty - |> Expect.isFalse "" - } - - test "it should allow to dequeue" { - RealTimeQueue.empty - |> RealTimeQueue.snoc 1 - |> RealTimeQueue.tail - |> RealTimeQueue.isEmpty - |> Expect.isTrue "" - } - - test "it should fail if there is no RealTimeQueue.head in the queue" { - let ok = ref false - - try - RealTimeQueue.empty |> RealTimeQueue.head |> ignore - with x when x = Exceptions.Empty -> - ok := true - - !ok |> Expect.isTrue "" - } - - test "it should give None if there is no RealTimeQueue.head in the queue" { - RealTimeQueue.empty |> RealTimeQueue.tryGetHead |> Expect.isNone "" - } - - test "it should fail if there is no RealTimeQueue.tail the queue" { - let ok = ref false - - try - RealTimeQueue.empty |> RealTimeQueue.tail |> ignore - with x when x = Exceptions.Empty -> - ok := true - - !ok |> Expect.isTrue "" - } - - test "it should give None if there is no RealTimeQueue.tail in the queue" { - RealTimeQueue.empty |> RealTimeQueue.tryGetTail |> Expect.isNone "" - } - - test "it should allow to get the RealTimeQueue.head from a queue" { - RealTimeQueue.empty - |> RealTimeQueue.snoc 1 - |> RealTimeQueue.snoc 2 - |> RealTimeQueue.head - |> Expect.equal "" 1 - } - - test "it should allow to get the RealTimeQueue.head from a queue safely" { - RealTimeQueue.empty - |> RealTimeQueue.snoc 1 - |> RealTimeQueue.snoc 2 - |> RealTimeQueue.tryGetHead - |> Expect.equal "" (Some 1) - } - - test "it should allow to get the RealTimeQueue.tail from the queue" { - RealTimeQueue.empty - |> RealTimeQueue.snoc "a" - |> RealTimeQueue.snoc "b" - |> RealTimeQueue.snoc "c" - |> RealTimeQueue.tail - |> RealTimeQueue.head - |> Expect.equal "" "b" - } - - test "it should allow to get the RealTimeQueue.tail from a queue safely" { - let value = - RealTimeQueue.empty - |> RealTimeQueue.snoc 1 - |> RealTimeQueue.snoc 2 - |> RealTimeQueue.tryGetTail - - value.Value |> RealTimeQueue.head |> Expect.equal "" 2 - } - ] + testList + "Experimental RealTimeQueue" + [ test "RealTimeQueue.empty queue should be RealTimeQueue.empty" { RealTimeQueue.isEmpty RealTimeQueue.empty |> Expect.isTrue "" } + + test "it should allow to enqueue" { + RealTimeQueue.empty + |> RealTimeQueue.snoc 1 + |> RealTimeQueue.snoc 2 + |> RealTimeQueue.isEmpty + |> Expect.isFalse "" + } + + test "it should allow to dequeue" { + RealTimeQueue.empty + |> RealTimeQueue.snoc 1 + |> RealTimeQueue.tail + |> RealTimeQueue.isEmpty + |> Expect.isTrue "" + } + + test "it should fail if there is no RealTimeQueue.head in the queue" { + let ok = ref false + + try + RealTimeQueue.empty |> RealTimeQueue.head |> ignore + with x when x = Exceptions.Empty -> + ok := true + + !ok |> Expect.isTrue "" + } + + test "it should give None if there is no RealTimeQueue.head in the queue" { + RealTimeQueue.empty |> RealTimeQueue.tryGetHead |> Expect.isNone "" + } + + test "it should fail if there is no RealTimeQueue.tail the queue" { + let ok = ref false + + try + RealTimeQueue.empty |> RealTimeQueue.tail |> ignore + with x when x = Exceptions.Empty -> + ok := true + + !ok |> Expect.isTrue "" + } + + test "it should give None if there is no RealTimeQueue.tail in the queue" { + RealTimeQueue.empty |> RealTimeQueue.tryGetTail |> Expect.isNone "" + } + + test "it should allow to get the RealTimeQueue.head from a queue" { + RealTimeQueue.empty + |> RealTimeQueue.snoc 1 + |> RealTimeQueue.snoc 2 + |> RealTimeQueue.head + |> Expect.equal "" 1 + } + + test "it should allow to get the RealTimeQueue.head from a queue safely" { + RealTimeQueue.empty + |> RealTimeQueue.snoc 1 + |> RealTimeQueue.snoc 2 + |> RealTimeQueue.tryGetHead + |> Expect.equal "" (Some 1) + } + + test "it should allow to get the RealTimeQueue.tail from the queue" { + RealTimeQueue.empty + |> RealTimeQueue.snoc "a" + |> RealTimeQueue.snoc "b" + |> RealTimeQueue.snoc "c" + |> RealTimeQueue.tail + |> RealTimeQueue.head + |> Expect.equal "" "b" + } + + test "it should allow to get the RealTimeQueue.tail from a queue safely" { + let value = + RealTimeQueue.empty + |> RealTimeQueue.snoc 1 + |> RealTimeQueue.snoc 2 + |> RealTimeQueue.tryGetTail + + value.Value |> RealTimeQueue.head |> Expect.equal "" 2 + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/RingBufferTest.fs b/tests/FSharpx.Collections.Experimental.Tests/RingBufferTest.fs index 56318b26..c4274ea2 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/RingBufferTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/RingBufferTest.fs @@ -9,82 +9,82 @@ module RingBufferTest = [] let testRingBuffer = - testList "Experimental RingBuffer" [ - test "I can create a ring buffer with a given size" { - let actual = new RingBuffer(10) - let expected = Array.init 10 (fun _ -> 0) - actual.ToArray() |> Expect.equal "" expected - } - - test "I can create a ring buffer with a given set of values" { - let actual = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) - let expected = Array.init 10 (fun i -> i + 1) - actual.ToArray() |> Expect.equal "" expected - } - - test "I can normalise a ring buffer" { - let actual = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) - actual.Advance(5) |> ignore - actual.Position |> Expect.equal "" 5 - actual.Normalize() - actual.Position |> Expect.equal "" 0 - - actual.ToArray() - |> Expect.equal "" [| 6; 7; 8; 9; 10; 0; 0; 0; 0; 0 |] - } - - test "I can insert values at 0 offset" { - let buffer = new RingBuffer(10) - buffer.Insert(0, [| 1; 2; 3; 4; 5 |]) - buffer.ToArray() |> Expect.equal "" [| 1; 2; 3; 4; 5; 0; 0; 0; 0; 0 |] - } - - test "I should not be able to insert more values than the size of the buffer" { - let buffer = new RingBuffer(10) - buffer.Insert(0, [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11 |]) - - buffer.ToArray() - |> Expect.equal "" [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |] - } - - test "Insert should not fail if an empty sequence is inserted" { - let actual = new RingBuffer(10) - actual.Insert(0, [||]) - let expected = Array.init 10 (fun _ -> 0) - actual.ToArray() |> Expect.equal "" expected - } - - test "I should be able to move the start index of the buffer" { - let buffer = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) - buffer.Advance(5) |> ignore - - buffer.ToArray() - |> Expect.equal "" [| 6; 7; 8; 9; 10; 0; 0; 0; 0; 0 |] - } - - test "Advancing past the end of the buffer should cause it to wrap" { - let buffer = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) - buffer.Advance(11) |> ignore - buffer.ToArray() |> Expect.equal "" [| 0; 0; 0; 0; 0; 0; 0; 0; 0; 0 |] - buffer.Position |> Expect.equal "" 1 - } - - test "I should be able to clone a ring buffer" { - let buffer = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) - let clone = buffer.Clone() - buffer.ToArray() |> Expect.equal "" <| clone.ToArray() - clone.Advance(2) |> ignore - Expect.notEqual "" (buffer.ToArray()) <| clone.ToArray() - buffer.Position |> Expect.equal "" 0 - clone.Position |> Expect.equal "" 2 - } - - test "I can insert with an operation into the buffer" { - let buffer = new RingBuffer(10) - buffer.Insert(0, [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11 |]) - buffer.Insert((+), 5, [ 100; 100; 100; 100; 100; 100 ]) - - buffer.ToArray() - |> Expect.equal "" [| 1; 2; 3; 4; 5; 106; 107; 108; 109; 110 |] - } - ] + testList + "Experimental RingBuffer" + [ test "I can create a ring buffer with a given size" { + let actual = new RingBuffer(10) + let expected = Array.init 10 (fun _ -> 0) + actual.ToArray() |> Expect.equal "" expected + } + + test "I can create a ring buffer with a given set of values" { + let actual = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) + let expected = Array.init 10 (fun i -> i + 1) + actual.ToArray() |> Expect.equal "" expected + } + + test "I can normalise a ring buffer" { + let actual = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) + actual.Advance(5) |> ignore + actual.Position |> Expect.equal "" 5 + actual.Normalize() + actual.Position |> Expect.equal "" 0 + + actual.ToArray() + |> Expect.equal "" [| 6; 7; 8; 9; 10; 0; 0; 0; 0; 0 |] + } + + test "I can insert values at 0 offset" { + let buffer = new RingBuffer(10) + buffer.Insert(0, [| 1; 2; 3; 4; 5 |]) + buffer.ToArray() |> Expect.equal "" [| 1; 2; 3; 4; 5; 0; 0; 0; 0; 0 |] + } + + test "I should not be able to insert more values than the size of the buffer" { + let buffer = new RingBuffer(10) + buffer.Insert(0, [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11 |]) + + buffer.ToArray() + |> Expect.equal "" [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |] + } + + test "Insert should not fail if an empty sequence is inserted" { + let actual = new RingBuffer(10) + actual.Insert(0, [||]) + let expected = Array.init 10 (fun _ -> 0) + actual.ToArray() |> Expect.equal "" expected + } + + test "I should be able to move the start index of the buffer" { + let buffer = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) + buffer.Advance(5) |> ignore + + buffer.ToArray() + |> Expect.equal "" [| 6; 7; 8; 9; 10; 0; 0; 0; 0; 0 |] + } + + test "Advancing past the end of the buffer should cause it to wrap" { + let buffer = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) + buffer.Advance(11) |> ignore + buffer.ToArray() |> Expect.equal "" [| 0; 0; 0; 0; 0; 0; 0; 0; 0; 0 |] + buffer.Position |> Expect.equal "" 1 + } + + test "I should be able to clone a ring buffer" { + let buffer = new RingBuffer([| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) + let clone = buffer.Clone() + buffer.ToArray() |> Expect.equal "" <| clone.ToArray() + clone.Advance(2) |> ignore + Expect.notEqual "" (buffer.ToArray()) <| clone.ToArray() + buffer.Position |> Expect.equal "" 0 + clone.Position |> Expect.equal "" 2 + } + + test "I can insert with an operation into the buffer" { + let buffer = new RingBuffer(10) + buffer.Insert(0, [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11 |]) + buffer.Insert((+), 5, [ 100; 100; 100; 100; 100; 100 ]) + + buffer.ToArray() + |> Expect.equal "" [| 1; 2; 3; 4; 5; 106; 107; 108; 109; 110 |] + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/RoseTreeTest.fs b/tests/FSharpx.Collections.Experimental.Tests/RoseTreeTest.fs index b7d55c1e..7dc28c58 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/RoseTreeTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/RoseTreeTest.fs @@ -15,15 +15,14 @@ module RoseTreeTest = let atree = tree 1 [ tree 2 [ tree 3 [] ]; tree 4 [ tree 5 [ tree 6 [] ] ] ] let ctree = - tree "f" [ - tree "b" [ tree "a" []; tree "d" [ tree "c" []; tree "e" [] ] ] - tree "g" [ tree "i" [ tree "h" [] ] ] - ] + tree + "f" + [ tree "b" [ tree "a" []; tree "d" [ tree "c" []; tree "e" [] ] ] + tree "g" [ tree "i" [ tree "h" [] ] ] ] - type HtmlElement = { - TagName: string - Attributes: (string * string) list - } + type HtmlElement = + { TagName: string + Attributes: (string * string) list } type HtmlNode = | Element of HtmlElement @@ -46,92 +45,91 @@ module RoseTreeTest = [] let testRoseTree = - testList "Experimental RoseTree" [ - test "dfs pre" { - let actual = RoseTree.dfsPre ctree |> Seq.toList - Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual - } - - test "dfs post" { - let actual = RoseTree.dfsPost ctree |> Seq.toList - Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual - } - - test "map" { - let actual = RoseTree.map ((+) 1) atree - let expected = tree 2 [ tree 3 [ tree 4 [] ]; tree 5 [ tree 6 [ tree 7 [] ] ] ] - Expect.equal "" expected actual - } - - test "fold via dfs" { - let actual = RoseTree.dfsPre atree |> Seq.fold (*) 1 - Expect.equal "" 720 actual - } - - test "unfold" { - let a = RoseTree.unfold (fun i -> i, LazyList.ofSeq { i + 1 .. 3 }) 0 - - let expected = - tree 0 [ tree 1 [ tree 2 [ tree 3 [] ]; tree 3 [] ]; tree 2 [ tree 3 [] ]; tree 3 [] ] - - Expect.equal "" expected a - } - - test "mapAccum" { - let e, taggedHtmlDoc = - RoseTree.mapAccum - (fun i -> - function - | Element x -> - i + 1, - Element - { x with - Attributes = ("data-i", i.ToString()) :: x.Attributes - } - | x -> i, x) - 0 - htmldoc - - let expected = - tree (elemA "body" [ "data-i", "0" ]) [ tree (elemA "div" [ "data-i", "1" ]) [ text "hello world" ] ] - - Expect.equal "" expected taggedHtmlDoc - Expect.equal "" 2 e - } - - test "bind" { - let wrapText = - function - | Text t -> tree (elem "span") [ text t ] - | x -> RoseTree.singleton x - - let newDoc = htmldoc |> RoseTree.bind wrapText - - let expected = - tree (elem "body") [ tree (elem "div") [ tree (elem "span") [ text "hello world" ] ] ] - - Expect.equal "" expected newDoc - } - ] + testList + "Experimental RoseTree" + [ test "dfs pre" { + let actual = RoseTree.dfsPre ctree |> Seq.toList + Expect.equal "" [ "f"; "b"; "a"; "d"; "c"; "e"; "g"; "i"; "h" ] actual + } + + test "dfs post" { + let actual = RoseTree.dfsPost ctree |> Seq.toList + Expect.equal "" [ "a"; "c"; "e"; "d"; "b"; "h"; "i"; "g"; "f" ] actual + } + + test "map" { + let actual = RoseTree.map ((+) 1) atree + let expected = tree 2 [ tree 3 [ tree 4 [] ]; tree 5 [ tree 6 [ tree 7 [] ] ] ] + Expect.equal "" expected actual + } + + test "fold via dfs" { + let actual = RoseTree.dfsPre atree |> Seq.fold (*) 1 + Expect.equal "" 720 actual + } + + test "unfold" { + let a = RoseTree.unfold (fun i -> i, LazyList.ofSeq { i + 1 .. 3 }) 0 + + let expected = + tree 0 [ tree 1 [ tree 2 [ tree 3 [] ]; tree 3 [] ]; tree 2 [ tree 3 [] ]; tree 3 [] ] + + Expect.equal "" expected a + } + + test "mapAccum" { + let e, taggedHtmlDoc = + RoseTree.mapAccum + (fun i -> + function + | Element x -> + i + 1, + Element + { x with + Attributes = ("data-i", i.ToString()) :: x.Attributes } + | x -> i, x) + 0 + htmldoc + + let expected = + tree (elemA "body" [ "data-i", "0" ]) [ tree (elemA "div" [ "data-i", "1" ]) [ text "hello world" ] ] + + Expect.equal "" expected taggedHtmlDoc + Expect.equal "" 2 e + } + + test "bind" { + let wrapText = + function + | Text t -> tree (elem "span") [ text t ] + | x -> RoseTree.singleton x + + let newDoc = htmldoc |> RoseTree.bind wrapText + + let expected = + tree (elem "body") [ tree (elem "div") [ tree (elem "span") [ text "hello world" ] ] ] + + Expect.equal "" expected newDoc + } ] [] let testRoseTreeProperties = let roseTree() = - let rec impl s = gen { - let! root = Arb.generate - // need to set these frequencies to avoid blowing the stack - let! children = - match s with - | s when s > 0 -> - Gen.frequency [ - 70, Gen.constant LazyList.empty - 1, impl(s / 2) |> Gen.listOf |> Gen.map LazyList.ofList - ] - | _ -> Gen.constant LazyList.empty - - return RoseTree.create root children - } + let rec impl s = + gen { + let! root = Arb.generate + // need to set these frequencies to avoid blowing the stack + let! children = + match s with + | s when s > 0 -> + Gen.frequency + [ 70, Gen.constant LazyList.empty + 1, impl(s / 2) |> Gen.listOf |> Gen.map LazyList.ofList ] + | _ -> Gen.constant LazyList.empty + + return RoseTree.create root children + } impl |> Gen.sized |> Arb.fromGen @@ -197,31 +195,33 @@ module RoseTreeTest = let ret = RoseTree.singleton - testList "Experimental RoseTree properties" [ + testList + "Experimental RoseTree properties" + [ - testPropertyWithConfig - config10k - "RoseTree functor laws: preserves identity" - (Prop.forAll(roseTree()) <| fun value -> map id value = value) + testPropertyWithConfig + config10k + "RoseTree functor laws: preserves identity" + (Prop.forAll(roseTree()) <| fun value -> map id value = value) - testPropertyWithConfig - config10k - "RoseTree functor laws: preserves composition" - (Prop.forAll(composition()) - <| fun (f, g, value) -> map (f << g) value = (map f << map g) value) + testPropertyWithConfig + config10k + "RoseTree functor laws: preserves composition" + (Prop.forAll(composition()) + <| fun (f, g, value) -> map (f << g) value = (map f << map g) value) - testPropertyWithConfig config10k "RoseTree monad laws : left identity" (Prop.forAll(leftIdentity()) <| fun (f, a) -> ret a >>= f = f a) + testPropertyWithConfig config10k "RoseTree monad laws : left identity" (Prop.forAll(leftIdentity()) <| fun (f, a) -> ret a >>= f = f a) - testPropertyWithConfig config10k "RoseTree monad laws : right identity" (Prop.forAll(roseTree()) <| fun x -> x >>= ret = x) + testPropertyWithConfig config10k "RoseTree monad laws : right identity" (Prop.forAll(roseTree()) <| fun x -> x >>= ret = x) - testPropertyWithConfig - config10k - "RoseTree monad laws : associativity" - (Prop.forAll(associativity()) - <| fun (f, g, v) -> - let a = (v >>= f) >>= g - let b = v >>= (fun x -> f x >>= g) - a = b) + testPropertyWithConfig + config10k + "RoseTree monad laws : associativity" + (Prop.forAll(associativity()) + <| fun (f, g, v) -> + let a = (v >>= f) >>= g + let b = v >>= (fun x -> f x >>= g) + a = b) - //// TODO port example from http://blog.moertel.com/articles/2007/03/07/directory-tree-printing-in-haskell-part-two-refactoring - ] + //// TODO port example from http://blog.moertel.com/articles/2007/03/07/directory-tree-printing-in-haskell-part-two-refactoring + ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/SkewBinaryRandomAccessListTest.fs b/tests/FSharpx.Collections.Experimental.Tests/SkewBinaryRandomAccessListTest.fs index 29b27136..3ba28f31 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/SkewBinaryRandomAccessListTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/SkewBinaryRandomAccessListTest.fs @@ -13,1267 +13,1267 @@ module SkewBinaryRandomAccessListTest = [] let testSkewBinaryRandomAccessList = - testList "Experimental SkewBinaryRandomAccessList" [ - test "empty list should be empty" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.isEmpty - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.cons works" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.isEmpty - |> Expect.isFalse "" - } - - test "SkewBinaryRandomAccessList.uncons 1 element" { - let x, _ = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.uncons - - (x = 1) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.uncons 2 elements" { - let x, _ = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.uncons - - (x = 2) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.uncons 3 elements" { - let x, _ = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.cons 3 - |> SkewBinaryRandomAccessList.uncons - - (x = 3) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUncons 1 element" { - let x = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.tryUncons - - (fst(x.Value) = 1) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUncons 2 elements" { - let x = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.tryUncons - - (fst(x.Value) = 2) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUncons 3 elements" { - let x = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.cons 3 - |> SkewBinaryRandomAccessList.tryUncons - - (fst(x.Value) = 3) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUncons empty" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.tryUncons - |> Expect.isNone "" - } - - test "SkewBinaryRandomAccessList.head should return" { - let x = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.head - - x |> Expect.equal "" 2 - } - - test "SkewBinaryRandomAccessList.tryGetHead should return" { - let x = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.tryGetHead - - x.Value |> Expect.equal "" 2 - } - - test "SkewBinaryRandomAccessList.tryGetHead on empty should return None" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.tryGetHead - |> Expect.isNone "" - } - - test "SkewBinaryRandomAccessList.tryGetTail on empty should return None" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.tryGetTail - |> Expect.isNone "" - } - - test "SkewBinaryRandomAccessList.tryGetTail on len 1 should return Some empty" { - let x = - (SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.tryGetTail) - .Value - - x |> SkewBinaryRandomAccessList.isEmpty |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tail on len 2 should return" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.tail - |> SkewBinaryRandomAccessList.head - |> Expect.equal "" 1 - } - - test "SkewBinaryRandomAccessList.tryGetTail on len 2 should return" { - let a = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons 1 - |> SkewBinaryRandomAccessList.cons 2 - |> SkewBinaryRandomAccessList.tryGetTail - - ((SkewBinaryRandomAccessList.head a.Value) = 1) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 1" { - let x = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - // let x = SkewBinaryRandomAccessList.empty() |> SkewBinaryRandomAccessList.cons "a" - let x' = x |> SkewBinaryRandomAccessList.lookup 0 - x' |> Expect.equal "" "a" - } - - test "SkewBinaryRandomAccessList.rev empty" { - SkewBinaryRandomAccessList.isEmpty(SkewBinaryRandomAccessList.empty() |> SkewBinaryRandomAccessList.rev) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.rev elements length 5" { - let a = SkewBinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e" ] - - let b = SkewBinaryRandomAccessList.rev a - - let c = List.ofSeq b - - c.Head |> Expect.equal "" "e" - } - - test "SkewBinaryRandomAccessList.lookup length 2" { - (((SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.lookup 0) = "b") - && ((SkewBinaryRandomAccessList.empty() + testList + "Experimental SkewBinaryRandomAccessList" + [ test "empty list should be empty" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.isEmpty + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.cons works" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.isEmpty + |> Expect.isFalse "" + } + + test "SkewBinaryRandomAccessList.uncons 1 element" { + let x, _ = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.uncons + + (x = 1) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.uncons 2 elements" { + let x, _ = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.uncons + + (x = 2) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.uncons 3 elements" { + let x, _ = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.cons 3 + |> SkewBinaryRandomAccessList.uncons + + (x = 3) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUncons 1 element" { + let x = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.tryUncons + + (fst(x.Value) = 1) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUncons 2 elements" { + let x = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.tryUncons + + (fst(x.Value) = 2) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUncons 3 elements" { + let x = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.cons 3 + |> SkewBinaryRandomAccessList.tryUncons + + (fst(x.Value) = 3) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUncons empty" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.tryUncons + |> Expect.isNone "" + } + + test "SkewBinaryRandomAccessList.head should return" { + let x = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.head + + x |> Expect.equal "" 2 + } + + test "SkewBinaryRandomAccessList.tryGetHead should return" { + let x = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.tryGetHead + + x.Value |> Expect.equal "" 2 + } + + test "SkewBinaryRandomAccessList.tryGetHead on empty should return None" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.tryGetHead + |> Expect.isNone "" + } + + test "SkewBinaryRandomAccessList.tryGetTail on empty should return None" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.tryGetTail + |> Expect.isNone "" + } + + test "SkewBinaryRandomAccessList.tryGetTail on len 1 should return Some empty" { + let x = + (SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.tryGetTail) + .Value + + x |> SkewBinaryRandomAccessList.isEmpty |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tail on len 2 should return" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.tail + |> SkewBinaryRandomAccessList.head + |> Expect.equal "" 1 + } + + test "SkewBinaryRandomAccessList.tryGetTail on len 2 should return" { + let a = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons 1 + |> SkewBinaryRandomAccessList.cons 2 + |> SkewBinaryRandomAccessList.tryGetTail + + ((SkewBinaryRandomAccessList.head a.Value) = 1) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 1" { + let x = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + // let x = SkewBinaryRandomAccessList.empty() |> SkewBinaryRandomAccessList.cons "a" + let x' = x |> SkewBinaryRandomAccessList.lookup 0 + x' |> Expect.equal "" "a" + } + + test "SkewBinaryRandomAccessList.rev empty" { + SkewBinaryRandomAccessList.isEmpty(SkewBinaryRandomAccessList.empty() |> SkewBinaryRandomAccessList.rev) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.rev elements length 5" { + let a = SkewBinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e" ] + + let b = SkewBinaryRandomAccessList.rev a + + let c = List.ofSeq b + + c.Head |> Expect.equal "" "e" + } + + test "SkewBinaryRandomAccessList.lookup length 2" { + (((SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.lookup 0) = "b") + && ((SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.lookup 1) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 3" { + let len3 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + + (((len3 |> SkewBinaryRandomAccessList.lookup 0) = "c") + && ((len3 |> SkewBinaryRandomAccessList.lookup 1) = "b") + && ((len3 |> SkewBinaryRandomAccessList.lookup 2) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 4" { + let len4 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + + (((len4 |> SkewBinaryRandomAccessList.lookup 0) = "d") + && ((len4 |> SkewBinaryRandomAccessList.lookup 1) = "c") + && ((len4 |> SkewBinaryRandomAccessList.lookup 2) = "b") + && ((len4 |> SkewBinaryRandomAccessList.lookup 3) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 5" { + let len5 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + + (((len5 |> SkewBinaryRandomAccessList.lookup 0) = "e") + && ((len5 |> SkewBinaryRandomAccessList.lookup 1) = "d") + && ((len5 |> SkewBinaryRandomAccessList.lookup 2) = "c") + && ((len5 |> SkewBinaryRandomAccessList.lookup 3) = "b") + && ((len5 |> SkewBinaryRandomAccessList.lookup 4) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 6" { + let len6 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + + (((len6 |> SkewBinaryRandomAccessList.lookup 0) = "f") + && ((len6 |> SkewBinaryRandomAccessList.lookup 1) = "e") + && ((len6 |> SkewBinaryRandomAccessList.lookup 2) = "d") + && ((len6 |> SkewBinaryRandomAccessList.lookup 3) = "c") + && ((len6 |> SkewBinaryRandomAccessList.lookup 4) = "b") + && ((len6 |> SkewBinaryRandomAccessList.lookup 5) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 7" { + let len7 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + + (((len7 |> SkewBinaryRandomAccessList.lookup 0) = "g") + && ((len7 |> SkewBinaryRandomAccessList.lookup 1) = "f") + && ((len7 |> SkewBinaryRandomAccessList.lookup 2) = "e") + && ((len7 |> SkewBinaryRandomAccessList.lookup 3) = "d") + && ((len7 |> SkewBinaryRandomAccessList.lookup 4) = "c") + && ((len7 |> SkewBinaryRandomAccessList.lookup 5) = "b") + && ((len7 |> SkewBinaryRandomAccessList.lookup 6) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 8" { + let len8 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + + (((len8 |> SkewBinaryRandomAccessList.lookup 0) = "h") + && ((len8 |> SkewBinaryRandomAccessList.lookup 1) = "g") + && ((len8 |> SkewBinaryRandomAccessList.lookup 2) = "f") + && ((len8 |> SkewBinaryRandomAccessList.lookup 3) = "e") + && ((len8 |> SkewBinaryRandomAccessList.lookup 4) = "d") + && ((len8 |> SkewBinaryRandomAccessList.lookup 5) = "c") + && ((len8 |> SkewBinaryRandomAccessList.lookup 6) = "b") + && ((len8 |> SkewBinaryRandomAccessList.lookup 7) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 9" { + let len9 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + + (((len9 |> SkewBinaryRandomAccessList.lookup 0) = "i") + && ((len9 |> SkewBinaryRandomAccessList.lookup 1) = "h") + && ((len9 |> SkewBinaryRandomAccessList.lookup 2) = "g") + && ((len9 |> SkewBinaryRandomAccessList.lookup 3) = "f") + && ((len9 |> SkewBinaryRandomAccessList.lookup 4) = "e") + && ((len9 |> SkewBinaryRandomAccessList.lookup 5) = "d") + && ((len9 |> SkewBinaryRandomAccessList.lookup 6) = "c") + && ((len9 |> SkewBinaryRandomAccessList.lookup 7) = "b") + && ((len9 |> SkewBinaryRandomAccessList.lookup 8) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.lookup length 10" { + let lena = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + (((lena |> SkewBinaryRandomAccessList.lookup 0) = "j") + && ((lena |> SkewBinaryRandomAccessList.lookup 1) = "i") + && ((lena |> SkewBinaryRandomAccessList.lookup 2) = "h") + && ((lena |> SkewBinaryRandomAccessList.lookup 3) = "g") + && ((lena |> SkewBinaryRandomAccessList.lookup 4) = "f") + && ((lena |> SkewBinaryRandomAccessList.lookup 5) = "e") + && ((lena |> SkewBinaryRandomAccessList.lookup 6) = "d") + && ((lena |> SkewBinaryRandomAccessList.lookup 7) = "c") + && ((lena |> SkewBinaryRandomAccessList.lookup 8) = "b") + && ((lena |> SkewBinaryRandomAccessList.lookup 9) = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 1" { + let a = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.tryLookup 0 + + (a.Value = "a") |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 2" { + let len2 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + + let b = len2 |> SkewBinaryRandomAccessList.tryLookup 0 + let a = len2 |> SkewBinaryRandomAccessList.tryLookup 1 + ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 3" { + let len3 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + + let c = len3 |> SkewBinaryRandomAccessList.tryLookup 0 + let b = len3 |> SkewBinaryRandomAccessList.tryLookup 1 + let a = len3 |> SkewBinaryRandomAccessList.tryLookup 2 + + ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 4" { + let len4 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + + let d = len4 |> SkewBinaryRandomAccessList.tryLookup 0 + let c = len4 |> SkewBinaryRandomAccessList.tryLookup 1 + let b = len4 |> SkewBinaryRandomAccessList.tryLookup 2 + let a = len4 |> SkewBinaryRandomAccessList.tryLookup 3 + + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 5" { + let len5 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + + let e = len5 |> SkewBinaryRandomAccessList.tryLookup 0 + let d = len5 |> SkewBinaryRandomAccessList.tryLookup 1 + let c = len5 |> SkewBinaryRandomAccessList.tryLookup 2 + let b = len5 |> SkewBinaryRandomAccessList.tryLookup 3 + let a = len5 |> SkewBinaryRandomAccessList.tryLookup 4 + + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 6" { + let len6 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + + let f = len6 |> SkewBinaryRandomAccessList.tryLookup 0 + let e = len6 |> SkewBinaryRandomAccessList.tryLookup 1 + let d = len6 |> SkewBinaryRandomAccessList.tryLookup 2 + let c = len6 |> SkewBinaryRandomAccessList.tryLookup 3 + let b = len6 |> SkewBinaryRandomAccessList.tryLookup 4 + let a = len6 |> SkewBinaryRandomAccessList.tryLookup 5 + + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 7" { + let len7 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + + let g = len7 |> SkewBinaryRandomAccessList.tryLookup 0 + let f = len7 |> SkewBinaryRandomAccessList.tryLookup 1 + let e = len7 |> SkewBinaryRandomAccessList.tryLookup 2 + let d = len7 |> SkewBinaryRandomAccessList.tryLookup 3 + let c = len7 |> SkewBinaryRandomAccessList.tryLookup 4 + let b = len7 |> SkewBinaryRandomAccessList.tryLookup 5 + let a = len7 |> SkewBinaryRandomAccessList.tryLookup 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 8" { + let len8 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + + let h = len8 |> SkewBinaryRandomAccessList.tryLookup 0 + let g = len8 |> SkewBinaryRandomAccessList.tryLookup 1 + let f = len8 |> SkewBinaryRandomAccessList.tryLookup 2 + let e = len8 |> SkewBinaryRandomAccessList.tryLookup 3 + let d = len8 |> SkewBinaryRandomAccessList.tryLookup 4 + let c = len8 |> SkewBinaryRandomAccessList.tryLookup 5 + let b = len8 |> SkewBinaryRandomAccessList.tryLookup 6 + let a = len8 |> SkewBinaryRandomAccessList.tryLookup 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 9" { + let len9 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + + let i = len9 |> SkewBinaryRandomAccessList.tryLookup 0 + let h = len9 |> SkewBinaryRandomAccessList.tryLookup 1 + let g = len9 |> SkewBinaryRandomAccessList.tryLookup 2 + let f = len9 |> SkewBinaryRandomAccessList.tryLookup 3 + let e = len9 |> SkewBinaryRandomAccessList.tryLookup 4 + let d = len9 |> SkewBinaryRandomAccessList.tryLookup 5 + let c = len9 |> SkewBinaryRandomAccessList.tryLookup 6 + let b = len9 |> SkewBinaryRandomAccessList.tryLookup 7 + let a = len9 |> SkewBinaryRandomAccessList.tryLookup 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup length 10" { + let lena = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + let j = lena |> SkewBinaryRandomAccessList.tryLookup 0 + let i = lena |> SkewBinaryRandomAccessList.tryLookup 1 + let h = lena |> SkewBinaryRandomAccessList.tryLookup 2 + let g = lena |> SkewBinaryRandomAccessList.tryLookup 3 + let f = lena |> SkewBinaryRandomAccessList.tryLookup 4 + let e = lena |> SkewBinaryRandomAccessList.tryLookup 5 + let d = lena |> SkewBinaryRandomAccessList.tryLookup 6 + let c = lena |> SkewBinaryRandomAccessList.tryLookup 7 + let b = lena |> SkewBinaryRandomAccessList.tryLookup 8 + let a = lena |> SkewBinaryRandomAccessList.tryLookup 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryLookup not found" { + let lena = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + lena |> SkewBinaryRandomAccessList.tryLookup 10 |> Expect.isNone "" + } + + test "SkewBinaryRandomAccessList.update length 1" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.update 0 "aa" + |> SkewBinaryRandomAccessList.lookup 0 + |> Expect.equal "" "aa" + } + + test "SkewBinaryRandomAccessList.update length 2" { + let len2 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + + (((len2 + |> SkewBinaryRandomAccessList.update 0 "bb" + |> SkewBinaryRandomAccessList.lookup 0) = "bb") + && ((len2 + |> SkewBinaryRandomAccessList.update 1 "aa" + |> SkewBinaryRandomAccessList.lookup 1) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 3" { + let len3 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + + (((len3 + |> SkewBinaryRandomAccessList.update 0 "cc" + |> SkewBinaryRandomAccessList.lookup 0) = "cc") + && ((len3 + |> SkewBinaryRandomAccessList.update 1 "bb" + |> SkewBinaryRandomAccessList.lookup 1) = "bb") + && ((len3 + |> SkewBinaryRandomAccessList.update 2 "aa" + |> SkewBinaryRandomAccessList.lookup 2) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 4" { + let len4 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + + (((len4 + |> SkewBinaryRandomAccessList.update 0 "dd" + |> SkewBinaryRandomAccessList.lookup 0) = "dd") + && ((len4 + |> SkewBinaryRandomAccessList.update 1 "cc" + |> SkewBinaryRandomAccessList.lookup 1) = "cc") + && ((len4 + |> SkewBinaryRandomAccessList.update 2 "bb" + |> SkewBinaryRandomAccessList.lookup 2) = "bb") + && ((len4 + |> SkewBinaryRandomAccessList.update 3 "aa" + |> SkewBinaryRandomAccessList.lookup 3) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 5" { + let len5 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + + (((len5 + |> SkewBinaryRandomAccessList.update 0 "ee" + |> SkewBinaryRandomAccessList.lookup 0) = "ee") + && ((len5 + |> SkewBinaryRandomAccessList.update 1 "dd" + |> SkewBinaryRandomAccessList.lookup 1) = "dd") + && ((len5 + |> SkewBinaryRandomAccessList.update 2 "cc" + |> SkewBinaryRandomAccessList.lookup 2) = "cc") + && ((len5 + |> SkewBinaryRandomAccessList.update 3 "bb" + |> SkewBinaryRandomAccessList.lookup 3) = "bb") + && ((len5 + |> SkewBinaryRandomAccessList.update 4 "aa" + |> SkewBinaryRandomAccessList.lookup 4) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 6" { + let len6 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + + (((len6 + |> SkewBinaryRandomAccessList.update 0 "ff" + |> SkewBinaryRandomAccessList.lookup 0) = "ff") + && ((len6 + |> SkewBinaryRandomAccessList.update 1 "ee" + |> SkewBinaryRandomAccessList.lookup 1) = "ee") + && ((len6 + |> SkewBinaryRandomAccessList.update 2 "dd" + |> SkewBinaryRandomAccessList.lookup 2) = "dd") + && ((len6 + |> SkewBinaryRandomAccessList.update 3 "cc" + |> SkewBinaryRandomAccessList.lookup 3) = "cc") + && ((len6 + |> SkewBinaryRandomAccessList.update 4 "bb" + |> SkewBinaryRandomAccessList.lookup 4) = "bb") + && ((len6 + |> SkewBinaryRandomAccessList.update 5 "aa" + |> SkewBinaryRandomAccessList.lookup 5) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 7" { + let len7 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + + (((len7 + |> SkewBinaryRandomAccessList.update 0 "gg" + |> SkewBinaryRandomAccessList.lookup 0) = "gg") + && ((len7 + |> SkewBinaryRandomAccessList.update 1 "ff" + |> SkewBinaryRandomAccessList.lookup 1) = "ff") + && ((len7 + |> SkewBinaryRandomAccessList.update 2 "ee" + |> SkewBinaryRandomAccessList.lookup 2) = "ee") + && ((len7 + |> SkewBinaryRandomAccessList.update 3 "dd" + |> SkewBinaryRandomAccessList.lookup 3) = "dd") + && ((len7 + |> SkewBinaryRandomAccessList.update 4 "cc" + |> SkewBinaryRandomAccessList.lookup 4) = "cc") + && ((len7 + |> SkewBinaryRandomAccessList.update 5 "bb" + |> SkewBinaryRandomAccessList.lookup 5) = "bb") + && ((len7 + |> SkewBinaryRandomAccessList.update 6 "aa" + |> SkewBinaryRandomAccessList.lookup 6) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 8" { + let len8 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + + (((len8 + |> SkewBinaryRandomAccessList.update 0 "hh" + |> SkewBinaryRandomAccessList.lookup 0) = "hh") + && ((len8 + |> SkewBinaryRandomAccessList.update 1 "gg" + |> SkewBinaryRandomAccessList.lookup 1) = "gg") + && ((len8 + |> SkewBinaryRandomAccessList.update 2 "ff" + |> SkewBinaryRandomAccessList.lookup 2) = "ff") + && ((len8 + |> SkewBinaryRandomAccessList.update 3 "ee" + |> SkewBinaryRandomAccessList.lookup 3) = "ee") + && ((len8 + |> SkewBinaryRandomAccessList.update 4 "dd" + |> SkewBinaryRandomAccessList.lookup 4) = "dd") + && ((len8 + |> SkewBinaryRandomAccessList.update 5 "cc" + |> SkewBinaryRandomAccessList.lookup 5) = "cc") + && ((len8 + |> SkewBinaryRandomAccessList.update 6 "bb" + |> SkewBinaryRandomAccessList.lookup 6) = "bb") + && ((len8 + |> SkewBinaryRandomAccessList.update 7 "aa" + |> SkewBinaryRandomAccessList.lookup 7) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 9" { + let len9 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + + (((len9 + |> SkewBinaryRandomAccessList.update 0 "ii" + |> SkewBinaryRandomAccessList.lookup 0) = "ii") + && ((len9 + |> SkewBinaryRandomAccessList.update 1 "hh" + |> SkewBinaryRandomAccessList.lookup 1) = "hh") + && ((len9 + |> SkewBinaryRandomAccessList.update 2 "gg" + |> SkewBinaryRandomAccessList.lookup 2) = "gg") + && ((len9 + |> SkewBinaryRandomAccessList.update 3 "ff" + |> SkewBinaryRandomAccessList.lookup 3) = "ff") + && ((len9 + |> SkewBinaryRandomAccessList.update 4 "ee" + |> SkewBinaryRandomAccessList.lookup 4) = "ee") + && ((len9 + |> SkewBinaryRandomAccessList.update 5 "dd" + |> SkewBinaryRandomAccessList.lookup 5) = "dd") + && ((len9 + |> SkewBinaryRandomAccessList.update 6 "cc" + |> SkewBinaryRandomAccessList.lookup 6) = "cc") + && ((len9 + |> SkewBinaryRandomAccessList.update 7 "bb" + |> SkewBinaryRandomAccessList.lookup 7) = "bb") + && ((len9 + |> SkewBinaryRandomAccessList.update 8 "aa" + |> SkewBinaryRandomAccessList.lookup 8) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.update length 10" { + let lena = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + (((lena + |> SkewBinaryRandomAccessList.update 0 "jj" + |> SkewBinaryRandomAccessList.lookup 0) = "jj") + && ((lena + |> SkewBinaryRandomAccessList.update 1 "ii" + |> SkewBinaryRandomAccessList.lookup 1) = "ii") + && ((lena + |> SkewBinaryRandomAccessList.update 2 "hh" + |> SkewBinaryRandomAccessList.lookup 2) = "hh") + && ((lena + |> SkewBinaryRandomAccessList.update 3 "gg" + |> SkewBinaryRandomAccessList.lookup 3) = "gg") + && ((lena + |> SkewBinaryRandomAccessList.update 4 "ff" + |> SkewBinaryRandomAccessList.lookup 4) = "ff") + && ((lena + |> SkewBinaryRandomAccessList.update 5 "ee" + |> SkewBinaryRandomAccessList.lookup 5) = "ee") + && ((lena + |> SkewBinaryRandomAccessList.update 6 "dd" + |> SkewBinaryRandomAccessList.lookup 6) = "dd") + && ((lena + |> SkewBinaryRandomAccessList.update 7 "cc" + |> SkewBinaryRandomAccessList.lookup 7) = "cc") + && ((lena + |> SkewBinaryRandomAccessList.update 8 "bb" + |> SkewBinaryRandomAccessList.lookup 8) = "bb") + && ((lena + |> SkewBinaryRandomAccessList.update 9 "aa" + |> SkewBinaryRandomAccessList.lookup 9) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 1" { + let a = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.tryUpdate 0 "aa" + + ((a.Value |> SkewBinaryRandomAccessList.lookup 0) = "aa") + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 2" { + let len2 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + + let b = len2 |> SkewBinaryRandomAccessList.tryUpdate 0 "bb" + let a = len2 |> SkewBinaryRandomAccessList.tryUpdate 1 "aa" + + (((b.Value |> SkewBinaryRandomAccessList.lookup 0) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 1) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 3" { + let len3 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + + let c = len3 |> SkewBinaryRandomAccessList.tryUpdate 0 "cc" + let b = len3 |> SkewBinaryRandomAccessList.tryUpdate 1 "bb" + let a = len3 |> SkewBinaryRandomAccessList.tryUpdate 2 "aa" + + (((c.Value |> SkewBinaryRandomAccessList.lookup 0) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 1) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 2) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 4" { + let len4 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + + let d = len4 |> SkewBinaryRandomAccessList.tryUpdate 0 "dd" + let c = len4 |> SkewBinaryRandomAccessList.tryUpdate 1 "cc" + let b = len4 |> SkewBinaryRandomAccessList.tryUpdate 2 "bb" + let a = len4 |> SkewBinaryRandomAccessList.tryUpdate 3 "aa" + + (((d.Value |> SkewBinaryRandomAccessList.lookup 0) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 1) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 2) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 3) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 5" { + let len5 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + + let e = len5 |> SkewBinaryRandomAccessList.tryUpdate 0 "ee" + let d = len5 |> SkewBinaryRandomAccessList.tryUpdate 1 "dd" + let c = len5 |> SkewBinaryRandomAccessList.tryUpdate 2 "cc" + let b = len5 |> SkewBinaryRandomAccessList.tryUpdate 3 "bb" + let a = len5 |> SkewBinaryRandomAccessList.tryUpdate 4 "aa" + + (((e.Value |> SkewBinaryRandomAccessList.lookup 0) = "ee") + && ((d.Value |> SkewBinaryRandomAccessList.lookup 1) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 2) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 3) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 4) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 6" { + let len6 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + + let f = len6 |> SkewBinaryRandomAccessList.tryUpdate 0 "ff" + let e = len6 |> SkewBinaryRandomAccessList.tryUpdate 1 "ee" + let d = len6 |> SkewBinaryRandomAccessList.tryUpdate 2 "dd" + let c = len6 |> SkewBinaryRandomAccessList.tryUpdate 3 "cc" + let b = len6 |> SkewBinaryRandomAccessList.tryUpdate 4 "bb" + let a = len6 |> SkewBinaryRandomAccessList.tryUpdate 5 "aa" + + (((f.Value |> SkewBinaryRandomAccessList.lookup 0) = "ff") + && ((e.Value |> SkewBinaryRandomAccessList.lookup 1) = "ee") + && ((d.Value |> SkewBinaryRandomAccessList.lookup 2) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 3) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 4) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 5) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 7" { + let len7 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + + let g = len7 |> SkewBinaryRandomAccessList.tryUpdate 0 "gg" + let f = len7 |> SkewBinaryRandomAccessList.tryUpdate 1 "ff" + let e = len7 |> SkewBinaryRandomAccessList.tryUpdate 2 "ee" + let d = len7 |> SkewBinaryRandomAccessList.tryUpdate 3 "dd" + let c = len7 |> SkewBinaryRandomAccessList.tryUpdate 4 "cc" + let b = len7 |> SkewBinaryRandomAccessList.tryUpdate 5 "bb" + let a = len7 |> SkewBinaryRandomAccessList.tryUpdate 6 "aa" + + (((g.Value |> SkewBinaryRandomAccessList.lookup 0) = "gg") + && ((f.Value |> SkewBinaryRandomAccessList.lookup 1) = "ff") + && ((e.Value |> SkewBinaryRandomAccessList.lookup 2) = "ee") + && ((d.Value |> SkewBinaryRandomAccessList.lookup 3) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 4) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 5) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 6) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 8" { + let len8 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + + let h = len8 |> SkewBinaryRandomAccessList.tryUpdate 0 "hh" + let g = len8 |> SkewBinaryRandomAccessList.tryUpdate 1 "gg" + let f = len8 |> SkewBinaryRandomAccessList.tryUpdate 2 "ff" + let e = len8 |> SkewBinaryRandomAccessList.tryUpdate 3 "ee" + let d = len8 |> SkewBinaryRandomAccessList.tryUpdate 4 "dd" + let c = len8 |> SkewBinaryRandomAccessList.tryUpdate 5 "cc" + let b = len8 |> SkewBinaryRandomAccessList.tryUpdate 6 "bb" + let a = len8 |> SkewBinaryRandomAccessList.tryUpdate 7 "aa" + + (((h.Value |> SkewBinaryRandomAccessList.lookup 0) = "hh") + && ((g.Value |> SkewBinaryRandomAccessList.lookup 1) = "gg") + && ((f.Value |> SkewBinaryRandomAccessList.lookup 2) = "ff") + && ((e.Value |> SkewBinaryRandomAccessList.lookup 3) = "ee") + && ((d.Value |> SkewBinaryRandomAccessList.lookup 4) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 5) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 6) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 7) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 9" { + let len9 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + + let i = len9 |> SkewBinaryRandomAccessList.tryUpdate 0 "ii" + let h = len9 |> SkewBinaryRandomAccessList.tryUpdate 1 "hh" + let g = len9 |> SkewBinaryRandomAccessList.tryUpdate 2 "gg" + let f = len9 |> SkewBinaryRandomAccessList.tryUpdate 3 "ff" + let e = len9 |> SkewBinaryRandomAccessList.tryUpdate 4 "ee" + let d = len9 |> SkewBinaryRandomAccessList.tryUpdate 5 "dd" + let c = len9 |> SkewBinaryRandomAccessList.tryUpdate 6 "cc" + let b = len9 |> SkewBinaryRandomAccessList.tryUpdate 7 "bb" + let a = len9 |> SkewBinaryRandomAccessList.tryUpdate 8 "aa" + + (((i.Value |> SkewBinaryRandomAccessList.lookup 0) = "ii") + && ((h.Value |> SkewBinaryRandomAccessList.lookup 1) = "hh") + && ((g.Value |> SkewBinaryRandomAccessList.lookup 2) = "gg") + && ((f.Value |> SkewBinaryRandomAccessList.lookup 3) = "ff") + && ((e.Value |> SkewBinaryRandomAccessList.lookup 4) = "ee") + && ((d.Value |> SkewBinaryRandomAccessList.lookup 5) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 6) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 7) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 8) = "aa")) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.tryUpdate length 10" { + let lena = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + let j = lena |> SkewBinaryRandomAccessList.tryUpdate 0 "jj" + let i = lena |> SkewBinaryRandomAccessList.tryUpdate 1 "ii" + let h = lena |> SkewBinaryRandomAccessList.tryUpdate 2 "hh" + let g = lena |> SkewBinaryRandomAccessList.tryUpdate 3 "gg" + let f = lena |> SkewBinaryRandomAccessList.tryUpdate 4 "ff" + let e = lena |> SkewBinaryRandomAccessList.tryUpdate 5 "ee" + let d = lena |> SkewBinaryRandomAccessList.tryUpdate 6 "dd" + let c = lena |> SkewBinaryRandomAccessList.tryUpdate 7 "cc" + let b = lena |> SkewBinaryRandomAccessList.tryUpdate 8 "bb" + let a = lena |> SkewBinaryRandomAccessList.tryUpdate 9 "aa" + + (((j.Value |> SkewBinaryRandomAccessList.lookup 0) = "jj") + && ((i.Value |> SkewBinaryRandomAccessList.lookup 1) = "ii") + && ((h.Value |> SkewBinaryRandomAccessList.lookup 2) = "hh") + && ((g.Value |> SkewBinaryRandomAccessList.lookup 3) = "gg") + && ((f.Value |> SkewBinaryRandomAccessList.lookup 4) = "ff") + && ((e.Value |> SkewBinaryRandomAccessList.lookup 5) = "ee") + && ((d.Value |> SkewBinaryRandomAccessList.lookup 6) = "dd") + && ((c.Value |> SkewBinaryRandomAccessList.lookup 7) = "cc") + && ((b.Value |> SkewBinaryRandomAccessList.lookup 8) = "bb") + && ((a.Value |> SkewBinaryRandomAccessList.lookup 9) = "aa")) + |> Expect.isTrue "" + } + + test "length of empty is 0" { + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.length + |> Expect.equal "" 0 + } + + test "length of 1 - 10 good" { + let len1 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + + let len2 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + + let len3 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + + let len4 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + + let len5 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + + let len6 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + + let len7 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + + let len8 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + + let len9 = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + + let lena = + SkewBinaryRandomAccessList.empty() + |> SkewBinaryRandomAccessList.cons "a" + |> SkewBinaryRandomAccessList.cons "b" + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + (((SkewBinaryRandomAccessList.length len1) = 1) + && ((SkewBinaryRandomAccessList.length len2) = 2) + && ((SkewBinaryRandomAccessList.length len3) = 3) + && ((SkewBinaryRandomAccessList.length len4) = 4) + && ((SkewBinaryRandomAccessList.length len5) = 5) + && ((SkewBinaryRandomAccessList.length len6) = 6) + && ((SkewBinaryRandomAccessList.length len7) = 7) + && ((SkewBinaryRandomAccessList.length len8) = 8) + && ((SkewBinaryRandomAccessList.length len9) = 9) + && ((SkewBinaryRandomAccessList.length lena) = 10)) + |> Expect.isTrue "" + } + + test "SkewBinaryRandomAccessList.ofSeq" { + let x = + SkewBinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] + + (((x |> SkewBinaryRandomAccessList.lookup 0) = "a") + && ((x |> SkewBinaryRandomAccessList.lookup 1) = "b") + && ((x |> SkewBinaryRandomAccessList.lookup 2) = "c") + && ((x |> SkewBinaryRandomAccessList.lookup 3) = "d") + && ((x |> SkewBinaryRandomAccessList.lookup 4) = "e") + && ((x |> SkewBinaryRandomAccessList.lookup 5) = "f") + && ((x |> SkewBinaryRandomAccessList.lookup 6) = "g") + && ((x |> SkewBinaryRandomAccessList.lookup 7) = "h") + && ((x |> SkewBinaryRandomAccessList.lookup 8) = "i") + && ((x |> SkewBinaryRandomAccessList.lookup 9) = "j")) + |> Expect.isTrue "" + } + + test "IRandomAccessList SkewBinaryRandomAccessList.cons works" { + let lena = + SkewBinaryRandomAccessList.empty() |> SkewBinaryRandomAccessList.cons "a" |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.lookup 1) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 3" { - let len3 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - - (((len3 |> SkewBinaryRandomAccessList.lookup 0) = "c") - && ((len3 |> SkewBinaryRandomAccessList.lookup 1) = "b") - && ((len3 |> SkewBinaryRandomAccessList.lookup 2) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 4" { - let len4 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - - (((len4 |> SkewBinaryRandomAccessList.lookup 0) = "d") - && ((len4 |> SkewBinaryRandomAccessList.lookup 1) = "c") - && ((len4 |> SkewBinaryRandomAccessList.lookup 2) = "b") - && ((len4 |> SkewBinaryRandomAccessList.lookup 3) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 5" { - let len5 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - - (((len5 |> SkewBinaryRandomAccessList.lookup 0) = "e") - && ((len5 |> SkewBinaryRandomAccessList.lookup 1) = "d") - && ((len5 |> SkewBinaryRandomAccessList.lookup 2) = "c") - && ((len5 |> SkewBinaryRandomAccessList.lookup 3) = "b") - && ((len5 |> SkewBinaryRandomAccessList.lookup 4) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 6" { - let len6 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - - (((len6 |> SkewBinaryRandomAccessList.lookup 0) = "f") - && ((len6 |> SkewBinaryRandomAccessList.lookup 1) = "e") - && ((len6 |> SkewBinaryRandomAccessList.lookup 2) = "d") - && ((len6 |> SkewBinaryRandomAccessList.lookup 3) = "c") - && ((len6 |> SkewBinaryRandomAccessList.lookup 4) = "b") - && ((len6 |> SkewBinaryRandomAccessList.lookup 5) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 7" { - let len7 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - - (((len7 |> SkewBinaryRandomAccessList.lookup 0) = "g") - && ((len7 |> SkewBinaryRandomAccessList.lookup 1) = "f") - && ((len7 |> SkewBinaryRandomAccessList.lookup 2) = "e") - && ((len7 |> SkewBinaryRandomAccessList.lookup 3) = "d") - && ((len7 |> SkewBinaryRandomAccessList.lookup 4) = "c") - && ((len7 |> SkewBinaryRandomAccessList.lookup 5) = "b") - && ((len7 |> SkewBinaryRandomAccessList.lookup 6) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 8" { - let len8 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - - (((len8 |> SkewBinaryRandomAccessList.lookup 0) = "h") - && ((len8 |> SkewBinaryRandomAccessList.lookup 1) = "g") - && ((len8 |> SkewBinaryRandomAccessList.lookup 2) = "f") - && ((len8 |> SkewBinaryRandomAccessList.lookup 3) = "e") - && ((len8 |> SkewBinaryRandomAccessList.lookup 4) = "d") - && ((len8 |> SkewBinaryRandomAccessList.lookup 5) = "c") - && ((len8 |> SkewBinaryRandomAccessList.lookup 6) = "b") - && ((len8 |> SkewBinaryRandomAccessList.lookup 7) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 9" { - let len9 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - - (((len9 |> SkewBinaryRandomAccessList.lookup 0) = "i") - && ((len9 |> SkewBinaryRandomAccessList.lookup 1) = "h") - && ((len9 |> SkewBinaryRandomAccessList.lookup 2) = "g") - && ((len9 |> SkewBinaryRandomAccessList.lookup 3) = "f") - && ((len9 |> SkewBinaryRandomAccessList.lookup 4) = "e") - && ((len9 |> SkewBinaryRandomAccessList.lookup 5) = "d") - && ((len9 |> SkewBinaryRandomAccessList.lookup 6) = "c") - && ((len9 |> SkewBinaryRandomAccessList.lookup 7) = "b") - && ((len9 |> SkewBinaryRandomAccessList.lookup 8) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.lookup length 10" { - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - (((lena |> SkewBinaryRandomAccessList.lookup 0) = "j") - && ((lena |> SkewBinaryRandomAccessList.lookup 1) = "i") - && ((lena |> SkewBinaryRandomAccessList.lookup 2) = "h") - && ((lena |> SkewBinaryRandomAccessList.lookup 3) = "g") - && ((lena |> SkewBinaryRandomAccessList.lookup 4) = "f") - && ((lena |> SkewBinaryRandomAccessList.lookup 5) = "e") - && ((lena |> SkewBinaryRandomAccessList.lookup 6) = "d") - && ((lena |> SkewBinaryRandomAccessList.lookup 7) = "c") - && ((lena |> SkewBinaryRandomAccessList.lookup 8) = "b") - && ((lena |> SkewBinaryRandomAccessList.lookup 9) = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 1" { - let a = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.tryLookup 0 - - (a.Value = "a") |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 2" { - let len2 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - - let b = len2 |> SkewBinaryRandomAccessList.tryLookup 0 - let a = len2 |> SkewBinaryRandomAccessList.tryLookup 1 - ((b.Value = "b") && (a.Value = "a")) |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 3" { - let len3 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - - let c = len3 |> SkewBinaryRandomAccessList.tryLookup 0 - let b = len3 |> SkewBinaryRandomAccessList.tryLookup 1 - let a = len3 |> SkewBinaryRandomAccessList.tryLookup 2 - - ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 4" { - let len4 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - - let d = len4 |> SkewBinaryRandomAccessList.tryLookup 0 - let c = len4 |> SkewBinaryRandomAccessList.tryLookup 1 - let b = len4 |> SkewBinaryRandomAccessList.tryLookup 2 - let a = len4 |> SkewBinaryRandomAccessList.tryLookup 3 - - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 5" { - let len5 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - - let e = len5 |> SkewBinaryRandomAccessList.tryLookup 0 - let d = len5 |> SkewBinaryRandomAccessList.tryLookup 1 - let c = len5 |> SkewBinaryRandomAccessList.tryLookup 2 - let b = len5 |> SkewBinaryRandomAccessList.tryLookup 3 - let a = len5 |> SkewBinaryRandomAccessList.tryLookup 4 - - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 6" { - let len6 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - - let f = len6 |> SkewBinaryRandomAccessList.tryLookup 0 - let e = len6 |> SkewBinaryRandomAccessList.tryLookup 1 - let d = len6 |> SkewBinaryRandomAccessList.tryLookup 2 - let c = len6 |> SkewBinaryRandomAccessList.tryLookup 3 - let b = len6 |> SkewBinaryRandomAccessList.tryLookup 4 - let a = len6 |> SkewBinaryRandomAccessList.tryLookup 5 - - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 7" { - let len7 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - - let g = len7 |> SkewBinaryRandomAccessList.tryLookup 0 - let f = len7 |> SkewBinaryRandomAccessList.tryLookup 1 - let e = len7 |> SkewBinaryRandomAccessList.tryLookup 2 - let d = len7 |> SkewBinaryRandomAccessList.tryLookup 3 - let c = len7 |> SkewBinaryRandomAccessList.tryLookup 4 - let b = len7 |> SkewBinaryRandomAccessList.tryLookup 5 - let a = len7 |> SkewBinaryRandomAccessList.tryLookup 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 8" { - let len8 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - - let h = len8 |> SkewBinaryRandomAccessList.tryLookup 0 - let g = len8 |> SkewBinaryRandomAccessList.tryLookup 1 - let f = len8 |> SkewBinaryRandomAccessList.tryLookup 2 - let e = len8 |> SkewBinaryRandomAccessList.tryLookup 3 - let d = len8 |> SkewBinaryRandomAccessList.tryLookup 4 - let c = len8 |> SkewBinaryRandomAccessList.tryLookup 5 - let b = len8 |> SkewBinaryRandomAccessList.tryLookup 6 - let a = len8 |> SkewBinaryRandomAccessList.tryLookup 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 9" { - let len9 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - - let i = len9 |> SkewBinaryRandomAccessList.tryLookup 0 - let h = len9 |> SkewBinaryRandomAccessList.tryLookup 1 - let g = len9 |> SkewBinaryRandomAccessList.tryLookup 2 - let f = len9 |> SkewBinaryRandomAccessList.tryLookup 3 - let e = len9 |> SkewBinaryRandomAccessList.tryLookup 4 - let d = len9 |> SkewBinaryRandomAccessList.tryLookup 5 - let c = len9 |> SkewBinaryRandomAccessList.tryLookup 6 - let b = len9 |> SkewBinaryRandomAccessList.tryLookup 7 - let a = len9 |> SkewBinaryRandomAccessList.tryLookup 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup length 10" { - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - let j = lena |> SkewBinaryRandomAccessList.tryLookup 0 - let i = lena |> SkewBinaryRandomAccessList.tryLookup 1 - let h = lena |> SkewBinaryRandomAccessList.tryLookup 2 - let g = lena |> SkewBinaryRandomAccessList.tryLookup 3 - let f = lena |> SkewBinaryRandomAccessList.tryLookup 4 - let e = lena |> SkewBinaryRandomAccessList.tryLookup 5 - let d = lena |> SkewBinaryRandomAccessList.tryLookup 6 - let c = lena |> SkewBinaryRandomAccessList.tryLookup 7 - let b = lena |> SkewBinaryRandomAccessList.tryLookup 8 - let a = lena |> SkewBinaryRandomAccessList.tryLookup 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryLookup not found" { - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - lena |> SkewBinaryRandomAccessList.tryLookup 10 |> Expect.isNone "" - } - - test "SkewBinaryRandomAccessList.update length 1" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.update 0 "aa" - |> SkewBinaryRandomAccessList.lookup 0 - |> Expect.equal "" "aa" - } - - test "SkewBinaryRandomAccessList.update length 2" { - let len2 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - - (((len2 - |> SkewBinaryRandomAccessList.update 0 "bb" - |> SkewBinaryRandomAccessList.lookup 0) = "bb") - && ((len2 - |> SkewBinaryRandomAccessList.update 1 "aa" - |> SkewBinaryRandomAccessList.lookup 1) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 3" { - let len3 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - - (((len3 - |> SkewBinaryRandomAccessList.update 0 "cc" - |> SkewBinaryRandomAccessList.lookup 0) = "cc") - && ((len3 - |> SkewBinaryRandomAccessList.update 1 "bb" - |> SkewBinaryRandomAccessList.lookup 1) = "bb") - && ((len3 - |> SkewBinaryRandomAccessList.update 2 "aa" - |> SkewBinaryRandomAccessList.lookup 2) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 4" { - let len4 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - - (((len4 - |> SkewBinaryRandomAccessList.update 0 "dd" - |> SkewBinaryRandomAccessList.lookup 0) = "dd") - && ((len4 - |> SkewBinaryRandomAccessList.update 1 "cc" - |> SkewBinaryRandomAccessList.lookup 1) = "cc") - && ((len4 - |> SkewBinaryRandomAccessList.update 2 "bb" - |> SkewBinaryRandomAccessList.lookup 2) = "bb") - && ((len4 - |> SkewBinaryRandomAccessList.update 3 "aa" - |> SkewBinaryRandomAccessList.lookup 3) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 5" { - let len5 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - - (((len5 - |> SkewBinaryRandomAccessList.update 0 "ee" - |> SkewBinaryRandomAccessList.lookup 0) = "ee") - && ((len5 - |> SkewBinaryRandomAccessList.update 1 "dd" - |> SkewBinaryRandomAccessList.lookup 1) = "dd") - && ((len5 - |> SkewBinaryRandomAccessList.update 2 "cc" - |> SkewBinaryRandomAccessList.lookup 2) = "cc") - && ((len5 - |> SkewBinaryRandomAccessList.update 3 "bb" - |> SkewBinaryRandomAccessList.lookup 3) = "bb") - && ((len5 - |> SkewBinaryRandomAccessList.update 4 "aa" - |> SkewBinaryRandomAccessList.lookup 4) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 6" { - let len6 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - - (((len6 - |> SkewBinaryRandomAccessList.update 0 "ff" - |> SkewBinaryRandomAccessList.lookup 0) = "ff") - && ((len6 - |> SkewBinaryRandomAccessList.update 1 "ee" - |> SkewBinaryRandomAccessList.lookup 1) = "ee") - && ((len6 - |> SkewBinaryRandomAccessList.update 2 "dd" - |> SkewBinaryRandomAccessList.lookup 2) = "dd") - && ((len6 - |> SkewBinaryRandomAccessList.update 3 "cc" - |> SkewBinaryRandomAccessList.lookup 3) = "cc") - && ((len6 - |> SkewBinaryRandomAccessList.update 4 "bb" - |> SkewBinaryRandomAccessList.lookup 4) = "bb") - && ((len6 - |> SkewBinaryRandomAccessList.update 5 "aa" - |> SkewBinaryRandomAccessList.lookup 5) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 7" { - let len7 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - - (((len7 - |> SkewBinaryRandomAccessList.update 0 "gg" - |> SkewBinaryRandomAccessList.lookup 0) = "gg") - && ((len7 - |> SkewBinaryRandomAccessList.update 1 "ff" - |> SkewBinaryRandomAccessList.lookup 1) = "ff") - && ((len7 - |> SkewBinaryRandomAccessList.update 2 "ee" - |> SkewBinaryRandomAccessList.lookup 2) = "ee") - && ((len7 - |> SkewBinaryRandomAccessList.update 3 "dd" - |> SkewBinaryRandomAccessList.lookup 3) = "dd") - && ((len7 - |> SkewBinaryRandomAccessList.update 4 "cc" - |> SkewBinaryRandomAccessList.lookup 4) = "cc") - && ((len7 - |> SkewBinaryRandomAccessList.update 5 "bb" - |> SkewBinaryRandomAccessList.lookup 5) = "bb") - && ((len7 - |> SkewBinaryRandomAccessList.update 6 "aa" - |> SkewBinaryRandomAccessList.lookup 6) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 8" { - let len8 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - - (((len8 - |> SkewBinaryRandomAccessList.update 0 "hh" - |> SkewBinaryRandomAccessList.lookup 0) = "hh") - && ((len8 - |> SkewBinaryRandomAccessList.update 1 "gg" - |> SkewBinaryRandomAccessList.lookup 1) = "gg") - && ((len8 - |> SkewBinaryRandomAccessList.update 2 "ff" - |> SkewBinaryRandomAccessList.lookup 2) = "ff") - && ((len8 - |> SkewBinaryRandomAccessList.update 3 "ee" - |> SkewBinaryRandomAccessList.lookup 3) = "ee") - && ((len8 - |> SkewBinaryRandomAccessList.update 4 "dd" - |> SkewBinaryRandomAccessList.lookup 4) = "dd") - && ((len8 - |> SkewBinaryRandomAccessList.update 5 "cc" - |> SkewBinaryRandomAccessList.lookup 5) = "cc") - && ((len8 - |> SkewBinaryRandomAccessList.update 6 "bb" - |> SkewBinaryRandomAccessList.lookup 6) = "bb") - && ((len8 - |> SkewBinaryRandomAccessList.update 7 "aa" - |> SkewBinaryRandomAccessList.lookup 7) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 9" { - let len9 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - - (((len9 - |> SkewBinaryRandomAccessList.update 0 "ii" - |> SkewBinaryRandomAccessList.lookup 0) = "ii") - && ((len9 - |> SkewBinaryRandomAccessList.update 1 "hh" - |> SkewBinaryRandomAccessList.lookup 1) = "hh") - && ((len9 - |> SkewBinaryRandomAccessList.update 2 "gg" - |> SkewBinaryRandomAccessList.lookup 2) = "gg") - && ((len9 - |> SkewBinaryRandomAccessList.update 3 "ff" - |> SkewBinaryRandomAccessList.lookup 3) = "ff") - && ((len9 - |> SkewBinaryRandomAccessList.update 4 "ee" - |> SkewBinaryRandomAccessList.lookup 4) = "ee") - && ((len9 - |> SkewBinaryRandomAccessList.update 5 "dd" - |> SkewBinaryRandomAccessList.lookup 5) = "dd") - && ((len9 - |> SkewBinaryRandomAccessList.update 6 "cc" - |> SkewBinaryRandomAccessList.lookup 6) = "cc") - && ((len9 - |> SkewBinaryRandomAccessList.update 7 "bb" - |> SkewBinaryRandomAccessList.lookup 7) = "bb") - && ((len9 - |> SkewBinaryRandomAccessList.update 8 "aa" - |> SkewBinaryRandomAccessList.lookup 8) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.update length 10" { - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - (((lena - |> SkewBinaryRandomAccessList.update 0 "jj" - |> SkewBinaryRandomAccessList.lookup 0) = "jj") - && ((lena - |> SkewBinaryRandomAccessList.update 1 "ii" - |> SkewBinaryRandomAccessList.lookup 1) = "ii") - && ((lena - |> SkewBinaryRandomAccessList.update 2 "hh" - |> SkewBinaryRandomAccessList.lookup 2) = "hh") - && ((lena - |> SkewBinaryRandomAccessList.update 3 "gg" - |> SkewBinaryRandomAccessList.lookup 3) = "gg") - && ((lena - |> SkewBinaryRandomAccessList.update 4 "ff" - |> SkewBinaryRandomAccessList.lookup 4) = "ff") - && ((lena - |> SkewBinaryRandomAccessList.update 5 "ee" - |> SkewBinaryRandomAccessList.lookup 5) = "ee") - && ((lena - |> SkewBinaryRandomAccessList.update 6 "dd" - |> SkewBinaryRandomAccessList.lookup 6) = "dd") - && ((lena - |> SkewBinaryRandomAccessList.update 7 "cc" - |> SkewBinaryRandomAccessList.lookup 7) = "cc") - && ((lena - |> SkewBinaryRandomAccessList.update 8 "bb" - |> SkewBinaryRandomAccessList.lookup 8) = "bb") - && ((lena - |> SkewBinaryRandomAccessList.update 9 "aa" - |> SkewBinaryRandomAccessList.lookup 9) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 1" { - let a = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.tryUpdate 0 "aa" - - ((a.Value |> SkewBinaryRandomAccessList.lookup 0) = "aa") - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 2" { - let len2 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - - let b = len2 |> SkewBinaryRandomAccessList.tryUpdate 0 "bb" - let a = len2 |> SkewBinaryRandomAccessList.tryUpdate 1 "aa" - - (((b.Value |> SkewBinaryRandomAccessList.lookup 0) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 1) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 3" { - let len3 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - - let c = len3 |> SkewBinaryRandomAccessList.tryUpdate 0 "cc" - let b = len3 |> SkewBinaryRandomAccessList.tryUpdate 1 "bb" - let a = len3 |> SkewBinaryRandomAccessList.tryUpdate 2 "aa" - - (((c.Value |> SkewBinaryRandomAccessList.lookup 0) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 1) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 2) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 4" { - let len4 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - - let d = len4 |> SkewBinaryRandomAccessList.tryUpdate 0 "dd" - let c = len4 |> SkewBinaryRandomAccessList.tryUpdate 1 "cc" - let b = len4 |> SkewBinaryRandomAccessList.tryUpdate 2 "bb" - let a = len4 |> SkewBinaryRandomAccessList.tryUpdate 3 "aa" - - (((d.Value |> SkewBinaryRandomAccessList.lookup 0) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 1) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 2) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 3) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 5" { - let len5 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - - let e = len5 |> SkewBinaryRandomAccessList.tryUpdate 0 "ee" - let d = len5 |> SkewBinaryRandomAccessList.tryUpdate 1 "dd" - let c = len5 |> SkewBinaryRandomAccessList.tryUpdate 2 "cc" - let b = len5 |> SkewBinaryRandomAccessList.tryUpdate 3 "bb" - let a = len5 |> SkewBinaryRandomAccessList.tryUpdate 4 "aa" - - (((e.Value |> SkewBinaryRandomAccessList.lookup 0) = "ee") - && ((d.Value |> SkewBinaryRandomAccessList.lookup 1) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 2) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 3) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 4) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 6" { - let len6 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - - let f = len6 |> SkewBinaryRandomAccessList.tryUpdate 0 "ff" - let e = len6 |> SkewBinaryRandomAccessList.tryUpdate 1 "ee" - let d = len6 |> SkewBinaryRandomAccessList.tryUpdate 2 "dd" - let c = len6 |> SkewBinaryRandomAccessList.tryUpdate 3 "cc" - let b = len6 |> SkewBinaryRandomAccessList.tryUpdate 4 "bb" - let a = len6 |> SkewBinaryRandomAccessList.tryUpdate 5 "aa" - - (((f.Value |> SkewBinaryRandomAccessList.lookup 0) = "ff") - && ((e.Value |> SkewBinaryRandomAccessList.lookup 1) = "ee") - && ((d.Value |> SkewBinaryRandomAccessList.lookup 2) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 3) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 4) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 5) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 7" { - let len7 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - - let g = len7 |> SkewBinaryRandomAccessList.tryUpdate 0 "gg" - let f = len7 |> SkewBinaryRandomAccessList.tryUpdate 1 "ff" - let e = len7 |> SkewBinaryRandomAccessList.tryUpdate 2 "ee" - let d = len7 |> SkewBinaryRandomAccessList.tryUpdate 3 "dd" - let c = len7 |> SkewBinaryRandomAccessList.tryUpdate 4 "cc" - let b = len7 |> SkewBinaryRandomAccessList.tryUpdate 5 "bb" - let a = len7 |> SkewBinaryRandomAccessList.tryUpdate 6 "aa" - - (((g.Value |> SkewBinaryRandomAccessList.lookup 0) = "gg") - && ((f.Value |> SkewBinaryRandomAccessList.lookup 1) = "ff") - && ((e.Value |> SkewBinaryRandomAccessList.lookup 2) = "ee") - && ((d.Value |> SkewBinaryRandomAccessList.lookup 3) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 4) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 5) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 6) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 8" { - let len8 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - - let h = len8 |> SkewBinaryRandomAccessList.tryUpdate 0 "hh" - let g = len8 |> SkewBinaryRandomAccessList.tryUpdate 1 "gg" - let f = len8 |> SkewBinaryRandomAccessList.tryUpdate 2 "ff" - let e = len8 |> SkewBinaryRandomAccessList.tryUpdate 3 "ee" - let d = len8 |> SkewBinaryRandomAccessList.tryUpdate 4 "dd" - let c = len8 |> SkewBinaryRandomAccessList.tryUpdate 5 "cc" - let b = len8 |> SkewBinaryRandomAccessList.tryUpdate 6 "bb" - let a = len8 |> SkewBinaryRandomAccessList.tryUpdate 7 "aa" - - (((h.Value |> SkewBinaryRandomAccessList.lookup 0) = "hh") - && ((g.Value |> SkewBinaryRandomAccessList.lookup 1) = "gg") - && ((f.Value |> SkewBinaryRandomAccessList.lookup 2) = "ff") - && ((e.Value |> SkewBinaryRandomAccessList.lookup 3) = "ee") - && ((d.Value |> SkewBinaryRandomAccessList.lookup 4) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 5) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 6) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 7) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 9" { - let len9 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - - let i = len9 |> SkewBinaryRandomAccessList.tryUpdate 0 "ii" - let h = len9 |> SkewBinaryRandomAccessList.tryUpdate 1 "hh" - let g = len9 |> SkewBinaryRandomAccessList.tryUpdate 2 "gg" - let f = len9 |> SkewBinaryRandomAccessList.tryUpdate 3 "ff" - let e = len9 |> SkewBinaryRandomAccessList.tryUpdate 4 "ee" - let d = len9 |> SkewBinaryRandomAccessList.tryUpdate 5 "dd" - let c = len9 |> SkewBinaryRandomAccessList.tryUpdate 6 "cc" - let b = len9 |> SkewBinaryRandomAccessList.tryUpdate 7 "bb" - let a = len9 |> SkewBinaryRandomAccessList.tryUpdate 8 "aa" - - (((i.Value |> SkewBinaryRandomAccessList.lookup 0) = "ii") - && ((h.Value |> SkewBinaryRandomAccessList.lookup 1) = "hh") - && ((g.Value |> SkewBinaryRandomAccessList.lookup 2) = "gg") - && ((f.Value |> SkewBinaryRandomAccessList.lookup 3) = "ff") - && ((e.Value |> SkewBinaryRandomAccessList.lookup 4) = "ee") - && ((d.Value |> SkewBinaryRandomAccessList.lookup 5) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 6) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 7) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 8) = "aa")) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.tryUpdate length 10" { - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - let j = lena |> SkewBinaryRandomAccessList.tryUpdate 0 "jj" - let i = lena |> SkewBinaryRandomAccessList.tryUpdate 1 "ii" - let h = lena |> SkewBinaryRandomAccessList.tryUpdate 2 "hh" - let g = lena |> SkewBinaryRandomAccessList.tryUpdate 3 "gg" - let f = lena |> SkewBinaryRandomAccessList.tryUpdate 4 "ff" - let e = lena |> SkewBinaryRandomAccessList.tryUpdate 5 "ee" - let d = lena |> SkewBinaryRandomAccessList.tryUpdate 6 "dd" - let c = lena |> SkewBinaryRandomAccessList.tryUpdate 7 "cc" - let b = lena |> SkewBinaryRandomAccessList.tryUpdate 8 "bb" - let a = lena |> SkewBinaryRandomAccessList.tryUpdate 9 "aa" - - (((j.Value |> SkewBinaryRandomAccessList.lookup 0) = "jj") - && ((i.Value |> SkewBinaryRandomAccessList.lookup 1) = "ii") - && ((h.Value |> SkewBinaryRandomAccessList.lookup 2) = "hh") - && ((g.Value |> SkewBinaryRandomAccessList.lookup 3) = "gg") - && ((f.Value |> SkewBinaryRandomAccessList.lookup 4) = "ff") - && ((e.Value |> SkewBinaryRandomAccessList.lookup 5) = "ee") - && ((d.Value |> SkewBinaryRandomAccessList.lookup 6) = "dd") - && ((c.Value |> SkewBinaryRandomAccessList.lookup 7) = "cc") - && ((b.Value |> SkewBinaryRandomAccessList.lookup 8) = "bb") - && ((a.Value |> SkewBinaryRandomAccessList.lookup 9) = "aa")) - |> Expect.isTrue "" - } - - test "length of empty is 0" { - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.length - |> Expect.equal "" 0 - } - - test "length of 1 - 10 good" { - let len1 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - - let len2 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - - let len3 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - - let len4 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - - let len5 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - - let len6 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - - let len7 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - - let len8 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - - let len9 = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - (((SkewBinaryRandomAccessList.length len1) = 1) - && ((SkewBinaryRandomAccessList.length len2) = 2) - && ((SkewBinaryRandomAccessList.length len3) = 3) - && ((SkewBinaryRandomAccessList.length len4) = 4) - && ((SkewBinaryRandomAccessList.length len5) = 5) - && ((SkewBinaryRandomAccessList.length len6) = 6) - && ((SkewBinaryRandomAccessList.length len7) = 7) - && ((SkewBinaryRandomAccessList.length len8) = 8) - && ((SkewBinaryRandomAccessList.length len9) = 9) - && ((SkewBinaryRandomAccessList.length lena) = 10)) - |> Expect.isTrue "" - } - - test "SkewBinaryRandomAccessList.ofSeq" { - let x = - SkewBinaryRandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] - - (((x |> SkewBinaryRandomAccessList.lookup 0) = "a") - && ((x |> SkewBinaryRandomAccessList.lookup 1) = "b") - && ((x |> SkewBinaryRandomAccessList.lookup 2) = "c") - && ((x |> SkewBinaryRandomAccessList.lookup 3) = "d") - && ((x |> SkewBinaryRandomAccessList.lookup 4) = "e") - && ((x |> SkewBinaryRandomAccessList.lookup 5) = "f") - && ((x |> SkewBinaryRandomAccessList.lookup 6) = "g") - && ((x |> SkewBinaryRandomAccessList.lookup 7) = "h") - && ((x |> SkewBinaryRandomAccessList.lookup 8) = "i") - && ((x |> SkewBinaryRandomAccessList.lookup 9) = "j")) - |> Expect.isTrue "" - } - - test "IRandomAccessList SkewBinaryRandomAccessList.cons works" { - let lena = - SkewBinaryRandomAccessList.empty() - |> SkewBinaryRandomAccessList.cons "a" - |> SkewBinaryRandomAccessList.cons "b" - |> SkewBinaryRandomAccessList.cons "c" - |> SkewBinaryRandomAccessList.cons "d" - |> SkewBinaryRandomAccessList.cons "e" - |> SkewBinaryRandomAccessList.cons "f" - |> SkewBinaryRandomAccessList.cons "g" - |> SkewBinaryRandomAccessList.cons "h" - |> SkewBinaryRandomAccessList.cons "i" - |> SkewBinaryRandomAccessList.cons "j" - - ((lena :> IRandomAccessList).Cons "zz").Head - |> Expect.equal "" "zz" - } - ] + |> SkewBinaryRandomAccessList.cons "c" + |> SkewBinaryRandomAccessList.cons "d" + |> SkewBinaryRandomAccessList.cons "e" + |> SkewBinaryRandomAccessList.cons "f" + |> SkewBinaryRandomAccessList.cons "g" + |> SkewBinaryRandomAccessList.cons "h" + |> SkewBinaryRandomAccessList.cons "i" + |> SkewBinaryRandomAccessList.cons "j" + + ((lena :> IRandomAccessList).Cons "zz").Head + |> Expect.equal "" "zz" + } ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs index 39943acc..53f1d14b 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs @@ -44,11 +44,10 @@ module SkewBinomialHeapTest = } |> Arb.fromGen - type HeapData<'T, 'L when 'T: comparison> = { - Heap: 'T SkewBinomialHeap - Items: 'L list - Desc: bool - } + type HeapData<'T, 'L when 'T: comparison> = + { Heap: 'T SkewBinomialHeap + Items: 'L list + Desc: bool } type SkewBinomialHeapGenerators() = static let genDesc d = @@ -56,78 +55,73 @@ module SkewBinomialHeapTest = | Some v -> Gen.constant v | None -> Gen.elements [ true; false ] // Empty heaps only, some are empty after removing all of its elements - static member private EmptyOnly<'T when 'T: comparison>(d) : Gen> = gen { - let! desc = genDesc d - let! s = Gen.listOf(Arb.generate<'T>) + static member private EmptyOnly<'T when 'T: comparison>(d) : Gen> = + gen { + let! desc = genDesc d + let! s = Gen.listOf(Arb.generate<'T>) - return { - Heap = - Seq.init (s.Length) id - |> Seq.fold (fun heap _ -> heap |> SkewBinomialHeap.tail) (ofList desc s) - Items = [] - Desc = desc + return + { Heap = + Seq.init (s.Length) id + |> Seq.fold (fun heap _ -> heap |> SkewBinomialHeap.tail) (ofList desc s) + Items = [] + Desc = desc } } - } // Non-emtpy heaps only, after a sucession of insertions and deletions - static member private NonemptyOnly<'T when 'T: comparison>(d) : Gen> = gen { - let! desc = genDesc d - let! t = Gen.elements [ true; false ] - let! s = Gen.nonEmptyListOf(Arb.generate<'T>) + static member private NonemptyOnly<'T when 'T: comparison>(d) : Gen> = + gen { + let! desc = genDesc d + let! t = Gen.elements [ true; false ] + let! s = Gen.nonEmptyListOf(Arb.generate<'T>) - let! ndel = - if t then - Gen.constant Int32.MaxValue - else - Gen.choose(2, max 2 (s |> List.length)) + let! ndel = + if t then + Gen.constant Int32.MaxValue + else + Gen.choose(2, max 2 (s |> List.length)) - let (heap, list, _) = - s - |> List.fold - (fun (heap, lst, k) item -> - let newHeap = heap |> SkewBinomialHeap.insert item - let newList = item :: lst + let (heap, list, _) = + s + |> List.fold + (fun (heap, lst, k) item -> + let newHeap = heap |> SkewBinomialHeap.insert item + let newList = item :: lst - if k + 1 = ndel then - (newHeap |> SkewBinomialHeap.tail, newList |> List.sort |> (if desc then List.rev else id) |> List.tail, 0) - else - (newHeap, newList, k + 1)) - (SkewBinomialHeap.empty desc, [], 0) + if k + 1 = ndel then + (newHeap |> SkewBinomialHeap.tail, newList |> List.sort |> (if desc then List.rev else id) |> List.tail, 0) + else + (newHeap, newList, k + 1)) + (SkewBinomialHeap.empty desc, [], 0) - return { - Heap = heap - Items = list - Desc = desc + return + { Heap = heap + Items = list + Desc = desc } } - } static member private Mixed<'T when 'T: comparison>() : Gen> = - Gen.frequency [ - 200, SkewBinomialHeapGenerators.EmptyOnly<'T>(None) - 800, SkewBinomialHeapGenerators.NonemptyOnly<'T>(None) - ] + Gen.frequency + [ 200, SkewBinomialHeapGenerators.EmptyOnly<'T>(None) + 800, SkewBinomialHeapGenerators.NonemptyOnly<'T>(None) ] //Distribute the cases, so the tests that receive two heaps and need both to have the same isDescending don't exhaust the arguments, ex: the merge tests static member private TwoMixed<'T when 'T: comparison>() : Gen * HeapData<'T, 'T>> = - Gen.frequency [ - 500, - Gen.oneof [ - SkewBinomialHeapGenerators.EmptyOnly<'T>(None) - SkewBinomialHeapGenerators.NonemptyOnly<'T>(None) - ] - |> Gen.two - 250, - Gen.oneof [ - SkewBinomialHeapGenerators.EmptyOnly<'T>(Some true) - SkewBinomialHeapGenerators.NonemptyOnly<'T>(Some true) - ] - |> Gen.two - 250, - Gen.oneof [ - SkewBinomialHeapGenerators.EmptyOnly<'T>(Some false) - SkewBinomialHeapGenerators.NonemptyOnly<'T>(Some false) - ] - |> Gen.two - ] + Gen.frequency + [ 500, + Gen.oneof + [ SkewBinomialHeapGenerators.EmptyOnly<'T>(None) + SkewBinomialHeapGenerators.NonemptyOnly<'T>(None) ] + |> Gen.two + 250, + Gen.oneof + [ SkewBinomialHeapGenerators.EmptyOnly<'T>(Some true) + SkewBinomialHeapGenerators.NonemptyOnly<'T>(Some true) ] + |> Gen.two + 250, + Gen.oneof + [ SkewBinomialHeapGenerators.EmptyOnly<'T>(Some false) + SkewBinomialHeapGenerators.NonemptyOnly<'T>(Some false) ] + |> Gen.two ] static member ComparableAndComparable() = SkewBinomialHeapGenerators.Mixed() |> Arb.fromGen @@ -139,11 +133,10 @@ module SkewBinomialHeapTest = gen { let! data = SkewBinomialHeapGenerators.Mixed() - return { - Heap = data.Heap - Items = data.Items |> Seq.cast |> Seq.toList - Desc = data.Desc - } + return + { Heap = data.Heap + Items = data.Items |> Seq.cast |> Seq.toList + Desc = data.Desc } } |> Arb.fromGen @@ -152,63 +145,64 @@ module SkewBinomialHeapTest = let! data1, data2 = SkewBinomialHeapGenerators.TwoMixed() return - { - Heap = data1.Heap - Items = data1.Items |> Seq.cast |> Seq.toList - Desc = data1.Desc - }, - { - Heap = data2.Heap - Items = data2.Items |> Seq.cast |> Seq.toList - Desc = data2.Desc - } + { Heap = data1.Heap + Items = data1.Items |> Seq.cast |> Seq.toList + Desc = data1.Desc }, + { Heap = data2.Heap + Items = data2.Items |> Seq.cast |> Seq.toList + Desc = data2.Desc } } |> Arb.fromGen - let heapIntGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listInt n - let! b' = Gen.listBool 1 - let b = List.head b' - return ((SkewBinomialHeap.ofSeq b x), x) - } - - let heapStringGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listString n - let! b' = Gen.listBool 1 - let b = List.head b' - return ((SkewBinomialHeap.ofSeq b x), x) - } - - let heapIntDescGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listInt n - let! b' = Gen.listBool 1 - let b = List.head b' - return ((SkewBinomialHeap.ofSeq b x), b) - } - - let heapStringDescGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listString n - let! b' = Gen.listBool 1 - let b = List.head b' - return ((SkewBinomialHeap.ofSeq b x), b) - } + let heapIntGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listInt n + let! b' = Gen.listBool 1 + let b = List.head b' + return ((SkewBinomialHeap.ofSeq b x), x) + } + + let heapStringGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listString n + let! b' = Gen.listBool 1 + let b = List.head b' + return ((SkewBinomialHeap.ofSeq b x), x) + } + + let heapIntDescGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listInt n + let! b' = Gen.listBool 1 + let b = List.head b' + return ((SkewBinomialHeap.ofSeq b x), b) + } + + let heapStringDescGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listString n + let! b' = Gen.listBool 1 + let b = List.head b' + return ((SkewBinomialHeap.ofSeq b x), b) + } //@@@@@@@@@@@@@@@@@@@ - let iComparableGen() : Gen = gen { - let! t = - Arb.generate - |> Gen.filter(fun x -> - match x :> obj with - | :? System.IComparable -> true - | _ -> false) - - return t :> System.IComparable - } + let iComparableGen() : Gen = + gen { + let! t = + Arb.generate + |> Gen.filter(fun x -> + match x :> obj with + | :? System.IComparable -> true + | _ -> false) + + return t :> System.IComparable + } //|> Arb.fromGen let genDesc d = @@ -216,49 +210,49 @@ module SkewBinomialHeapTest = | Some v -> Gen.constant v | None -> Gen.elements [ true; false ] - let emptyOnly d = gen { - let! desc = genDesc d - let! s = Gen.listOf(Arb.generate<'T>) + let emptyOnly d = + gen { + let! desc = genDesc d + let! s = Gen.listOf(Arb.generate<'T>) - return { - Heap = - Seq.init (s.Length) id - |> Seq.fold (fun heap _ -> heap |> SkewBinomialHeap.tail) (ofList desc s) - Items = [] - Desc = desc + return + { Heap = + Seq.init (s.Length) id + |> Seq.fold (fun heap _ -> heap |> SkewBinomialHeap.tail) (ofList desc s) + Items = [] + Desc = desc } } - } - - let nonEmptyOnly d = gen { - let! desc = genDesc d - let! t = Gen.elements [ true; false ] - let! s = Gen.nonEmptyListOf <| iComparableGen() - - let! ndel = - if t then - Gen.constant Int32.MaxValue - else - Gen.choose(2, max 2 (s |> List.length)) - - let (heap, list, _) = - s - |> List.fold - (fun (heap, lst, k) item -> - let newHeap = heap |> SkewBinomialHeap.insert item - let newList = item :: lst - - if k + 1 = ndel then - (newHeap |> SkewBinomialHeap.tail, newList |> List.sort |> (if desc then List.rev else id) |> List.tail, 0) - else - (newHeap, newList, k + 1)) - (SkewBinomialHeap.empty desc, [], 0) - return { - Heap = heap - Items = list - Desc = desc + let nonEmptyOnly d = + gen { + let! desc = genDesc d + let! t = Gen.elements [ true; false ] + let! s = Gen.nonEmptyListOf <| iComparableGen() + + let! ndel = + if t then + Gen.constant Int32.MaxValue + else + Gen.choose(2, max 2 (s |> List.length)) + + let (heap, list, _) = + s + |> List.fold + (fun (heap, lst, k) item -> + let newHeap = heap |> SkewBinomialHeap.insert item + let newList = item :: lst + + if k + 1 = ndel then + (newHeap |> SkewBinomialHeap.tail, newList |> List.sort |> (if desc then List.rev else id) |> List.tail, 0) + else + (newHeap, newList, k + 1)) + (SkewBinomialHeap.empty desc, [], 0) + + return + { Heap = heap + Items = list + Desc = desc } } - } let differentOrdered() = gen { @@ -282,357 +276,357 @@ module SkewBinomialHeapTest = [] let testSkewBinomialHeap = - testList "Experimental SkewBinomialHeap" [ - testPropertyWithConfig - config10k - "toSeq returns all the int elements" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList |> List.sort = List.sort orig) - - testPropertyWithConfig - config10k - "toSeq returns all the string elements" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList |> List.sort = List.sort orig) - - testPropertyWithConfig - config10k - "toSeq returns the int elements in the correct order" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList = sortList heap orig) - - testPropertyWithConfig - config10k - "toSeq returns the string elements in the correct order" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList = sortList heap orig) - - ptestPropertyWithConfig - config10k - "toList returns the same as toSeq |> List.ofSeq" - (Prop.forAll(comparableAndComparable()) - <| fun { Heap = heap } -> heap |> SkewBinomialHeap.toList = (heap |> SkewBinomialHeap.toSeq |> List.ofSeq)) - - testPropertyWithConfig - config10k - "int heap isDescending returns correct value" - (Prop.forAll(Arb.fromGen heapIntDescGen) - <| fun (heap, desc) -> SkewBinomialHeap.isDescending heap = desc) - - testPropertyWithConfig - config10k - "string heap isDescending returns correct value" - (Prop.forAll(Arb.fromGen heapStringDescGen) - <| fun (heap, desc) -> SkewBinomialHeap.isDescending heap = desc) - - //testPropertyWithConfig comparableConfig "isEmpty returns true if count = 0, false otherwise" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> (SkewBinomialHeap.count heap) = 0 = SkewBinomialHeap.isEmpty heap ) - - testPropertyWithConfig - config10k - "isEmpty returns true if the int heap is empty, false otherwise" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> SkewBinomialHeap.isEmpty heap = List.isEmpty orig) - - testPropertyWithConfig - config10k - "isEmpty returns true if the string heap is empty, false otherwise" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> SkewBinomialHeap.isEmpty heap = List.isEmpty orig) - - testPropertyWithConfig - config10k - "int heap count returns the number of elements" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> (heap |> SkewBinomialHeap.count) = List.length orig) - - testPropertyWithConfig - config10k - "string heap count returns the number of elements" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> (heap |> SkewBinomialHeap.count) = List.length orig) - - //testPropertyWithConfig config10k "length is the same as count" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // (heap |> SkewBinomialHeap.count) = SkewBinomialHeap.length heap ) - - testPropertyWithConfig - config10k - "int heap head returns the first element when the heap is not empty" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy (heap |> SkewBinomialHeap.head = actualHead heap orig)) - - testPropertyWithConfig - config10k - "string heap head returns the first element when the heap is not empty" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy (heap |> SkewBinomialHeap.head = actualHead heap orig)) - - //testPropertyWithConfig config10k "head throws when the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> lazy(Expect.throwsT "" <| fun () -> heap |> SkewBinomialHeap.head |> ignore) ) - - testPropertyWithConfig - config10k - "tryHead returns Some head when the int heap is not empty" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> match SkewBinomialHeap.tryHead heap with - | Some head -> head = actualHead heap orig - | None -> false) - - testPropertyWithConfig - config10k - "tryHead returns Some head when the string heap is not empty" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> match SkewBinomialHeap.tryHead heap with - | Some head -> head = actualHead heap orig - | None -> false) - - //testPropertyWithConfig config10k "tryHead returns None when the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> (heap |> SkewBinomialHeap.tryHead |> Option.isNone) ) - - testPropertyWithConfig - config10k - "tail returns a heap with the first element removed when the int heap is not empty" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy (heap |> SkewBinomialHeap.tail |> SkewBinomialHeap.toList = actualTail heap orig)) - - testPropertyWithConfig - config10k - "tail returns a heap with the first element removed when the string heap is not empty" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy (heap |> SkewBinomialHeap.tail |> SkewBinomialHeap.toList = actualTail heap orig)) - - //testPropertyWithConfig config10k "tail throws when the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> lazy(Expect.throwsT "" <| fun () -> heap |> SkewBinomialHeap.tail |> ignore) ) - - testPropertyWithConfig - config10k - "tryTail returns Some tail when the int heap is not empty" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy - (match SkewBinomialHeap.tryTail heap with - | Some tail -> tail |> SkewBinomialHeap.toList = actualTail heap orig - | None -> false)) - - testPropertyWithConfig - config10k - "tryTail returns Some tail when the string heap is not empty" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy - (match SkewBinomialHeap.tryTail heap with - | Some tail -> tail |> SkewBinomialHeap.toList = actualTail heap orig - | None -> false)) - - //testPropertyWithConfig config10k "tryTail returns None when the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> (heap |> SkewBinomialHeap.tryTail |> Option.isNone) ) - - testPropertyWithConfig - config10k - "uncons returns (head, tail) when the int heap is not empty" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy - (let (h, t) = SkewBinomialHeap.uncons heap - - h = actualHead heap orig - && SkewBinomialHeap.toList t = actualTail heap orig)) - - testPropertyWithConfig - config10k - "uncons returns (head, tail) when the string heap is not empty" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy - (let (h, t) = SkewBinomialHeap.uncons heap - - h = actualHead heap orig - && SkewBinomialHeap.toList t = actualTail heap orig)) - - //testPropertyWithConfig config10k "uncons throws when the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> lazy(Expect.throwsT "" <| fun () -> heap |> SkewBinomialHeap.uncons |> ignore) ) - - testPropertyWithConfig - config10k - "tryUncons returns Some (head, tail) when the int heap is not empty" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy - (match SkewBinomialHeap.tryUncons heap with - | Some(h, t) -> - h = actualHead heap orig - && SkewBinomialHeap.toList t = actualTail heap orig - | None -> false)) - - testPropertyWithConfig - config10k - "tryUncons returns Some (head, tail) when the string heap is not empty" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) -> - heap |> SkewBinomialHeap.isEmpty |> not - ==> lazy - (match SkewBinomialHeap.tryUncons heap with - | Some(h, t) -> - h = actualHead heap orig - && SkewBinomialHeap.toList t = actualTail heap orig - | None -> false)) - - //testPropertyWithConfig config10k "tryUncons returns None when the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> lazy(heap |> SkewBinomialHeap.tryUncons |> Option.isNone) ) - - testPropertyWithConfig - config10k - "int heap insert always insert" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap, orig) x -> - heap - |> SkewBinomialHeap.insert x - |> SkewBinomialHeap.toList - |> Expect.equal "" (x :: orig |> sortList heap)) - - testPropertyWithConfig - config10k - "string heap insert always insert" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap, orig) x -> - heap - |> SkewBinomialHeap.insert x - |> SkewBinomialHeap.toList - |> Expect.equal "" (x :: orig |> sortList heap)) - - //testPropertyWithConfig config10k "merge should merge if both heaps have the same ordering" <| - // fun ({ Heap = heap1; Items = orig1 }, { Heap = heap2; Items = orig2 }) -> - // heap1.IsDescending = heap2.IsDescending ==> - // lazy( - // SkewBinomialHeap.merge heap1 heap2 - // |> SkewBinomialHeap.toList - // |> Expect.equal "" (orig1 |> List.append orig2 |> sortList heap1)) - - ptestPropertyWithConfig - config10k - "merge throws when both heaps have diferent ordering" - (Prop.forAll(differentOrdered()) - <| fun ({ Heap = heap1 }, { Heap = heap2 }) -> - heap1.IsDescending <> heap2.IsDescending - ==> lazy - (Expect.throwsT "" - <| fun () -> SkewBinomialHeap.merge heap1 heap2 |> ignore)) - - //testPropertyWithConfig config10k "tryMerge returns Some merged heap when both heaps have the same ordering" <| - // fun ({ Heap = heap1; Items = orig1 }, { Heap = heap2; Items = orig2 }) -> - // heap1.IsDescending = heap2.IsDescending ==> - // lazy( - // match SkewBinomialHeap.tryMerge heap1 heap2 |> Option.map SkewBinomialHeap.toList with - // | Some list -> list = (List.append orig1 orig2 |> sortList heap1) - // | None -> false) - - //testPropertyWithConfig config10k "tryMerge returns None when both heaps have diferent ordering" <| - // fun ({ Heap = heap1; Items = orig1 }, { Heap = heap2; Items = orig2 }) -> - // heap1.IsDescending <> heap2.IsDescending ==> lazy(SkewBinomialHeap.tryMerge heap1 heap2 |> Option.isNone) - - //testPropertyWithConfig config10k "Cons pattern always match if the heap is not empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty |> not ==> - // match heap with - // | SkewBinomialHeap.Cons (_, _) -> true - // | _ -> false ) - - //testPropertyWithConfig config10k "Nil pattern always match if the heap is empty" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty ==> - // match heap with - // | SkewBinomialHeap.Cons (_, _) -> false - // | _ -> true ) - - //testPropertyWithConfig config10k "Cons pattern return the same as uncons" - // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| - // fun { Heap = heap } -> - // heap |> SkewBinomialHeap.isEmpty |> not ==> - // match heap with - // | SkewBinomialHeap.Cons (h, t) -> - // let (h', t') = heap |> SkewBinomialHeap.uncons - // h = h' && t = t' - // | _ -> false ) - - //testPropertyWithConfig config10k "GetHashCode is the same for equal heaps" <| - // fun { Heap = heap } item -> - // let heap1 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // let heap2 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // Unchecked.hash heap1 = Unchecked.hash heap2 - - ////Maybe the distribution of the hash should be checked - ////to avoid bad hashes, I don't know if that should be done as part of unit testPropertyWithConfig config10king - - ptestPropertyWithConfig - config10k - "Equality reflexivity" - (Prop.forAll(comparableAndComparable()) - <| fun { Heap = heap } -> heap = heap) - - //testPropertyWithConfig config10k "Equality symmetry" <| - // fun { Heap = heap } item -> - // let heap1 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // let heap2 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // heap1 = heap2 ==> (heap2 = heap1) - - //testPropertyWithConfig config10k "Equality transitivity" <| //maybe this is too much, I guess It would be hard to write an Equals that violates this property and not the others - // fun { Heap = heap } item -> - // let heap1 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // let heap2 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // let heap3 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail - // (heap1 = heap2 && heap2 = heap3) ==> (heap1 = heap3) - - //testPropertyWithConfig config10k "Equals returns false when comparing two heaps with the same ordering but different items" <| - // fun ({ Heap = heap1; Items = orig1}, { Heap = heap2; Items = orig2}) -> - // (heap1.IsDescending = heap2.IsDescending && orig1 <> orig2) ==> (heap1 <> heap2 && not (heap1.Equals heap2)) - - testPropertyWithConfig - config10k - "Equals returns false when comparing two int heaps with the same items but different ordering" - (Prop.forAll(Arb.fromGen heapIntGen) - <| fun (heap1, orig) -> - let heap2 = ofList (not heap1.IsDescending) orig - heap1 <> heap2 && not(heap1.Equals heap2)) - - testPropertyWithConfig - config10k - "Equals returns false when comparing two string heaps with the same items but different ordering" - (Prop.forAll(Arb.fromGen heapStringGen) - <| fun (heap1, orig) -> - let heap2 = ofList (not heap1.IsDescending) orig - heap1 <> heap2 && not(heap1.Equals heap2)) - ] + testList + "Experimental SkewBinomialHeap" + [ testPropertyWithConfig + config10k + "toSeq returns all the int elements" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList |> List.sort = List.sort orig) + + testPropertyWithConfig + config10k + "toSeq returns all the string elements" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList |> List.sort = List.sort orig) + + testPropertyWithConfig + config10k + "toSeq returns the int elements in the correct order" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList = sortList heap orig) + + testPropertyWithConfig + config10k + "toSeq returns the string elements in the correct order" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList = sortList heap orig) + + ptestPropertyWithConfig + config10k + "toList returns the same as toSeq |> List.ofSeq" + (Prop.forAll(comparableAndComparable()) + <| fun { Heap = heap } -> heap |> SkewBinomialHeap.toList = (heap |> SkewBinomialHeap.toSeq |> List.ofSeq)) + + testPropertyWithConfig + config10k + "int heap isDescending returns correct value" + (Prop.forAll(Arb.fromGen heapIntDescGen) + <| fun (heap, desc) -> SkewBinomialHeap.isDescending heap = desc) + + testPropertyWithConfig + config10k + "string heap isDescending returns correct value" + (Prop.forAll(Arb.fromGen heapStringDescGen) + <| fun (heap, desc) -> SkewBinomialHeap.isDescending heap = desc) + + //testPropertyWithConfig comparableConfig "isEmpty returns true if count = 0, false otherwise" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> (SkewBinomialHeap.count heap) = 0 = SkewBinomialHeap.isEmpty heap ) + + testPropertyWithConfig + config10k + "isEmpty returns true if the int heap is empty, false otherwise" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> SkewBinomialHeap.isEmpty heap = List.isEmpty orig) + + testPropertyWithConfig + config10k + "isEmpty returns true if the string heap is empty, false otherwise" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> SkewBinomialHeap.isEmpty heap = List.isEmpty orig) + + testPropertyWithConfig + config10k + "int heap count returns the number of elements" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> (heap |> SkewBinomialHeap.count) = List.length orig) + + testPropertyWithConfig + config10k + "string heap count returns the number of elements" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> (heap |> SkewBinomialHeap.count) = List.length orig) + + //testPropertyWithConfig config10k "length is the same as count" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // (heap |> SkewBinomialHeap.count) = SkewBinomialHeap.length heap ) + + testPropertyWithConfig + config10k + "int heap head returns the first element when the heap is not empty" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy (heap |> SkewBinomialHeap.head = actualHead heap orig)) + + testPropertyWithConfig + config10k + "string heap head returns the first element when the heap is not empty" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy (heap |> SkewBinomialHeap.head = actualHead heap orig)) + + //testPropertyWithConfig config10k "head throws when the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> lazy(Expect.throwsT "" <| fun () -> heap |> SkewBinomialHeap.head |> ignore) ) + + testPropertyWithConfig + config10k + "tryHead returns Some head when the int heap is not empty" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> match SkewBinomialHeap.tryHead heap with + | Some head -> head = actualHead heap orig + | None -> false) + + testPropertyWithConfig + config10k + "tryHead returns Some head when the string heap is not empty" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> match SkewBinomialHeap.tryHead heap with + | Some head -> head = actualHead heap orig + | None -> false) + + //testPropertyWithConfig config10k "tryHead returns None when the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> (heap |> SkewBinomialHeap.tryHead |> Option.isNone) ) + + testPropertyWithConfig + config10k + "tail returns a heap with the first element removed when the int heap is not empty" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy (heap |> SkewBinomialHeap.tail |> SkewBinomialHeap.toList = actualTail heap orig)) + + testPropertyWithConfig + config10k + "tail returns a heap with the first element removed when the string heap is not empty" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy (heap |> SkewBinomialHeap.tail |> SkewBinomialHeap.toList = actualTail heap orig)) + + //testPropertyWithConfig config10k "tail throws when the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> lazy(Expect.throwsT "" <| fun () -> heap |> SkewBinomialHeap.tail |> ignore) ) + + testPropertyWithConfig + config10k + "tryTail returns Some tail when the int heap is not empty" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy + (match SkewBinomialHeap.tryTail heap with + | Some tail -> tail |> SkewBinomialHeap.toList = actualTail heap orig + | None -> false)) + + testPropertyWithConfig + config10k + "tryTail returns Some tail when the string heap is not empty" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy + (match SkewBinomialHeap.tryTail heap with + | Some tail -> tail |> SkewBinomialHeap.toList = actualTail heap orig + | None -> false)) + + //testPropertyWithConfig config10k "tryTail returns None when the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> (heap |> SkewBinomialHeap.tryTail |> Option.isNone) ) + + testPropertyWithConfig + config10k + "uncons returns (head, tail) when the int heap is not empty" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy + (let (h, t) = SkewBinomialHeap.uncons heap + + h = actualHead heap orig + && SkewBinomialHeap.toList t = actualTail heap orig)) + + testPropertyWithConfig + config10k + "uncons returns (head, tail) when the string heap is not empty" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy + (let (h, t) = SkewBinomialHeap.uncons heap + + h = actualHead heap orig + && SkewBinomialHeap.toList t = actualTail heap orig)) + + //testPropertyWithConfig config10k "uncons throws when the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> lazy(Expect.throwsT "" <| fun () -> heap |> SkewBinomialHeap.uncons |> ignore) ) + + testPropertyWithConfig + config10k + "tryUncons returns Some (head, tail) when the int heap is not empty" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy + (match SkewBinomialHeap.tryUncons heap with + | Some(h, t) -> + h = actualHead heap orig + && SkewBinomialHeap.toList t = actualTail heap orig + | None -> false)) + + testPropertyWithConfig + config10k + "tryUncons returns Some (head, tail) when the string heap is not empty" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) -> + heap |> SkewBinomialHeap.isEmpty |> not + ==> lazy + (match SkewBinomialHeap.tryUncons heap with + | Some(h, t) -> + h = actualHead heap orig + && SkewBinomialHeap.toList t = actualTail heap orig + | None -> false)) + + //testPropertyWithConfig config10k "tryUncons returns None when the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> lazy(heap |> SkewBinomialHeap.tryUncons |> Option.isNone) ) + + testPropertyWithConfig + config10k + "int heap insert always insert" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap, orig) x -> + heap + |> SkewBinomialHeap.insert x + |> SkewBinomialHeap.toList + |> Expect.equal "" (x :: orig |> sortList heap)) + + testPropertyWithConfig + config10k + "string heap insert always insert" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap, orig) x -> + heap + |> SkewBinomialHeap.insert x + |> SkewBinomialHeap.toList + |> Expect.equal "" (x :: orig |> sortList heap)) + + //testPropertyWithConfig config10k "merge should merge if both heaps have the same ordering" <| + // fun ({ Heap = heap1; Items = orig1 }, { Heap = heap2; Items = orig2 }) -> + // heap1.IsDescending = heap2.IsDescending ==> + // lazy( + // SkewBinomialHeap.merge heap1 heap2 + // |> SkewBinomialHeap.toList + // |> Expect.equal "" (orig1 |> List.append orig2 |> sortList heap1)) + + ptestPropertyWithConfig + config10k + "merge throws when both heaps have diferent ordering" + (Prop.forAll(differentOrdered()) + <| fun ({ Heap = heap1 }, { Heap = heap2 }) -> + heap1.IsDescending <> heap2.IsDescending + ==> lazy + (Expect.throwsT "" + <| fun () -> SkewBinomialHeap.merge heap1 heap2 |> ignore)) + + //testPropertyWithConfig config10k "tryMerge returns Some merged heap when both heaps have the same ordering" <| + // fun ({ Heap = heap1; Items = orig1 }, { Heap = heap2; Items = orig2 }) -> + // heap1.IsDescending = heap2.IsDescending ==> + // lazy( + // match SkewBinomialHeap.tryMerge heap1 heap2 |> Option.map SkewBinomialHeap.toList with + // | Some list -> list = (List.append orig1 orig2 |> sortList heap1) + // | None -> false) + + //testPropertyWithConfig config10k "tryMerge returns None when both heaps have diferent ordering" <| + // fun ({ Heap = heap1; Items = orig1 }, { Heap = heap2; Items = orig2 }) -> + // heap1.IsDescending <> heap2.IsDescending ==> lazy(SkewBinomialHeap.tryMerge heap1 heap2 |> Option.isNone) + + //testPropertyWithConfig config10k "Cons pattern always match if the heap is not empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty |> not ==> + // match heap with + // | SkewBinomialHeap.Cons (_, _) -> true + // | _ -> false ) + + //testPropertyWithConfig config10k "Nil pattern always match if the heap is empty" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty ==> + // match heap with + // | SkewBinomialHeap.Cons (_, _) -> false + // | _ -> true ) + + //testPropertyWithConfig config10k "Cons pattern return the same as uncons" + // (Prop.forAll (SkewBinomialHeapGenerators.ComparableAndComparable()) <| + // fun { Heap = heap } -> + // heap |> SkewBinomialHeap.isEmpty |> not ==> + // match heap with + // | SkewBinomialHeap.Cons (h, t) -> + // let (h', t') = heap |> SkewBinomialHeap.uncons + // h = h' && t = t' + // | _ -> false ) + + //testPropertyWithConfig config10k "GetHashCode is the same for equal heaps" <| + // fun { Heap = heap } item -> + // let heap1 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // let heap2 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // Unchecked.hash heap1 = Unchecked.hash heap2 + + ////Maybe the distribution of the hash should be checked + ////to avoid bad hashes, I don't know if that should be done as part of unit testPropertyWithConfig config10king + + ptestPropertyWithConfig + config10k + "Equality reflexivity" + (Prop.forAll(comparableAndComparable()) + <| fun { Heap = heap } -> heap = heap) + + //testPropertyWithConfig config10k "Equality symmetry" <| + // fun { Heap = heap } item -> + // let heap1 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // let heap2 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // heap1 = heap2 ==> (heap2 = heap1) + + //testPropertyWithConfig config10k "Equality transitivity" <| //maybe this is too much, I guess It would be hard to write an Equals that violates this property and not the others + // fun { Heap = heap } item -> + // let heap1 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // let heap2 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // let heap3 = heap |> SkewBinomialHeap.insert item |> SkewBinomialHeap.tail + // (heap1 = heap2 && heap2 = heap3) ==> (heap1 = heap3) + + //testPropertyWithConfig config10k "Equals returns false when comparing two heaps with the same ordering but different items" <| + // fun ({ Heap = heap1; Items = orig1}, { Heap = heap2; Items = orig2}) -> + // (heap1.IsDescending = heap2.IsDescending && orig1 <> orig2) ==> (heap1 <> heap2 && not (heap1.Equals heap2)) + + testPropertyWithConfig + config10k + "Equals returns false when comparing two int heaps with the same items but different ordering" + (Prop.forAll(Arb.fromGen heapIntGen) + <| fun (heap1, orig) -> + let heap2 = ofList (not heap1.IsDescending) orig + heap1 <> heap2 && not(heap1.Equals heap2)) + + testPropertyWithConfig + config10k + "Equals returns false when comparing two string heaps with the same items but different ordering" + (Prop.forAll(Arb.fromGen heapStringGen) + <| fun (heap1, orig) -> + let heap2 = ofList (not heap1.IsDescending) orig + heap1 <> heap2 && not(heap1.Equals heap2)) ] diff --git a/tests/FSharpx.Collections.Experimental.Tests/TimeSeriesTest.fs b/tests/FSharpx.Collections.Experimental.Tests/TimeSeriesTest.fs index 803334be..3f77b6aa 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/TimeSeriesTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/TimeSeriesTest.fs @@ -14,247 +14,254 @@ module TimeSeriesTest = [] let testTimeSeries = - testList "Experimental TimeSeries" [ - - test "I should be able to extract the values from the timeseries at a smaller granularity" { - let actual = - (new Timeseries(startDate, granularity, size)) - .ToGranularity(TimeSpan.FromMinutes(5.)) - .AsTimeseries() - |> Seq.toList - - let expected = - Seq.init (72 * 12) (fun i -> startDate.AddMinutes((i |> float) * 5.), 0) - |> Seq.toList - - actual |> Expect.equal "" expected - } - - test "I should be able to extract the values from the timeseries at a larger granularity" { - let actual = - (new Timeseries(startDate, TimeSpan.FromMinutes(5.), 864)) - .ToGranularity(TimeSpan.FromHours(1.)) - .AsTimeseries() - |> Seq.toList - - let expected = - Seq.init 72 (fun i -> startDate.AddMinutes((i |> float) * 60.), 0) - |> Seq.toList - - actual |> Expect.equal "" expected - } - - test "I can create a timeseries" { - let actual = new Timeseries(startDate, granularity, size) - let expected = Seq.init 72 (fun _ -> 0) - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should not be able to advance a timeseries less than one minute" { - let toDate = startDate.AddSeconds(30.) - let actual = new Timeseries(startDate, granularity, size) - let startDate' = actual.Advance(toDate) - startDate' |> Expect.equal "" startDate - } - - test "I should not be able to advance a timeseries to a past date" { - let toDate = startDate.AddDays(-1.) - let actual = new Timeseries(startDate, granularity, size) - - Expect.throwsT "" - <| fun _ -> actual.Advance(toDate) |> ignore - } - - test "I should be to advance a timeseries to a future date" { - let toDate = startDate.AddDays(1.) - let actual = new Timeseries(startDate, granularity, Seq.init 72 id) - - let expected = seq { - yield! Seq.init 48 (fun i -> i + 24) - yield! Seq.init 24 (fun _ -> 0) - } - - actual.Advance(toDate) |> ignore - actual.StartDate |> Expect.equal "" toDate - actual.Buffer.Position |> Expect.equal "" 0 - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the different date and same granularity" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun a b -> b), startDate.AddDays(1.), granularity, List.init 10 (fun i -> i + 1)) - - let expected = seq { - yield! Array.zeroCreate 24 - yield! [ 1..10 ] - yield! Array.zeroCreate 38 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the different date and smaller granularity" { - let actual = new Timeseries(startDate, granularity, size) - - actual.Insert((fun a b -> b), startDate.AddDays(1.), TimeSpan.FromMinutes(12.), List.init 10 (fun i -> i + 1)) - - let expected = seq { - yield! Array.zeroCreate 24 - yield! [ 5; 10 ] - yield! Array.zeroCreate 46 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the different date and larger granularity" { - let actual = new Timeseries(startDate, granularity, size) - - actual.Insert((fun a b -> b), startDate.AddDays(1.), TimeSpan.FromHours(2.), List.init 10 (fun i -> i + 1)) - - let expected = seq { - yield! Array.zeroCreate 24 - yield! (List.init 10 (fun i -> [ i + 1; i + 1 ])) |> List.concat - yield! Array.zeroCreate 28 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the same date and granularity" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun a b -> b), startDate, granularity, List.init 10 (fun i -> i + 1)) - - let expected = seq { - yield! [ 1..10 ] - yield! Array.zeroCreate 62 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the same date and smaller granularity" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun a b -> b), startDate, TimeSpan.FromMinutes(12.), List.init 10 (fun i -> i + 1)) - - let expected = seq { - yield! [ 5; 10 ] - yield! Array.zeroCreate 70 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the same date and larger granularity" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun a b -> b), startDate, TimeSpan.FromHours(2.), List.init 10 (fun i -> i + 1)) - - let expected = seq { - yield! (List.init 10 (fun i -> [ i + 1; i + 1 ])) |> List.concat - yield! Array.zeroCreate 52 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the past date and same granularity" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun a b -> b), startDate.AddDays(-1.), granularity, List.init 48 (fun i -> i + 1)) - - let expected = seq { - yield! [ 25..48 ] - yield! Array.zeroCreate 48 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values with the past date and smaller granularity" { - let actual = new Timeseries(startDate, granularity, size) - - actual.Insert((fun a b -> b), startDate.AddDays(-1.), TimeSpan.FromMinutes(12.), List.init 288 (fun i -> i + 1)) - - let expected = - seq { - yield! [ 125..5..285 ] - yield! Array.zeroCreate 39 - } - |> Seq.toList - - actual.Buffer.ToArray() |> Seq.toList |> Expect.equal "" expected - } - - test "I should be able to insert a set of values with the past date and larger granularity" { - let actual = new Timeseries(startDate, granularity, size) - - actual.Insert((fun a b -> b), startDate.AddDays(-1.), TimeSpan.FromHours(2.), List.init 24 (fun i -> i + 1)) - - let expected = seq { - yield! (List.init 12 (fun i -> [ i + 13; i + 13 ])) |> List.concat - yield! Array.zeroCreate 48 - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to insert a set of values offset from the timeseries start without wrapping round beyond the timeseries position" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun _ b -> b), startDate, granularity, List.init size (fun i -> 1)) - actual.Insert((fun _ b -> b), startDate.AddDays(1.), granularity, List.init (size * 2) (fun i -> 2)) - - let expected = seq { - yield! Array.init 24 (fun i -> 1) - yield! Array.init 48 (fun i -> 2) - } - - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should not be able to insert a set of values offset beyond the timeseries position" { - let actual = new Timeseries(startDate, granularity, size) - actual.Insert((fun _ b -> b), startDate, granularity, List.init size (fun i -> 1)) - actual.Insert((fun _ b -> b), startDate.AddDays(4.), granularity, List.init (size * 2) (fun i -> 2)) - let expected = seq { yield! Array.init size (fun i -> 1) } - actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected - } - - test "I should be able to clone a timeseries" { - let buffer = - new Timeseries(startDate, granularity, [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) - - let clone = buffer.Clone() - buffer.Buffer.ToArray() |> Expect.equal "" (clone.Buffer.ToArray()) - clone.Buffer.Advance(2) |> ignore - Expect.notEqual "" (buffer.Buffer.ToArray()) <| clone.Buffer.ToArray() - buffer.Buffer.Position |> Expect.equal "" 0 - clone.Buffer.Position |> Expect.equal "" 2 - } - - test "I should be able to create an empty timeseries in the past and extract all values" { - let actual = new Timeseries>(startDate, granularity, 10) - - let expected = - Seq.init 10 (fun i -> startDate.AddHours(i |> float), Nullable()) - - actual.AsTimeseries(startDate) |> Expect.sequenceEqual "" expected - } - - test - "I should be able to insert a set of values with a zero offset from the timeseries start applying an operation between existing and new values" { - let merge op (a: Nullable) (b: Nullable) = - if a.HasValue then - if b.HasValue then Nullable(op a.Value b.Value) else a - else - b - - let actual = new Timeseries>(startDate, granularity, 10) - actual.Insert(merge (+), startDate, granularity, [ 1..10 ] |> List.map(fun i -> Nullable(float i))) - actual.Insert(merge (+), startDate, granularity, [ 1..10 ] |> List.map(fun i -> Nullable(float i))) - - let expected = - [ 1..10 ] - |> List.map(fun i -> startDate.AddHours(i - 1 |> float), Nullable(float i * 2.)) - - actual.AsTimeseries(startDate) |> Expect.sequenceEqual "" expected - } - ] + testList + "Experimental TimeSeries" + [ + + test "I should be able to extract the values from the timeseries at a smaller granularity" { + let actual = + (new Timeseries(startDate, granularity, size)).ToGranularity(TimeSpan.FromMinutes(5.)).AsTimeseries() + |> Seq.toList + + let expected = + Seq.init (72 * 12) (fun i -> startDate.AddMinutes((i |> float) * 5.), 0) + |> Seq.toList + + actual |> Expect.equal "" expected + } + + test "I should be able to extract the values from the timeseries at a larger granularity" { + let actual = + (new Timeseries(startDate, TimeSpan.FromMinutes(5.), 864)).ToGranularity(TimeSpan.FromHours(1.)).AsTimeseries() + |> Seq.toList + + let expected = + Seq.init 72 (fun i -> startDate.AddMinutes((i |> float) * 60.), 0) + |> Seq.toList + + actual |> Expect.equal "" expected + } + + test "I can create a timeseries" { + let actual = new Timeseries(startDate, granularity, size) + let expected = Seq.init 72 (fun _ -> 0) + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should not be able to advance a timeseries less than one minute" { + let toDate = startDate.AddSeconds(30.) + let actual = new Timeseries(startDate, granularity, size) + let startDate' = actual.Advance(toDate) + startDate' |> Expect.equal "" startDate + } + + test "I should not be able to advance a timeseries to a past date" { + let toDate = startDate.AddDays(-1.) + let actual = new Timeseries(startDate, granularity, size) + + Expect.throwsT "" + <| fun _ -> actual.Advance(toDate) |> ignore + } + + test "I should be to advance a timeseries to a future date" { + let toDate = startDate.AddDays(1.) + let actual = new Timeseries(startDate, granularity, Seq.init 72 id) + + let expected = + seq { + yield! Seq.init 48 (fun i -> i + 24) + yield! Seq.init 24 (fun _ -> 0) + } + + actual.Advance(toDate) |> ignore + actual.StartDate |> Expect.equal "" toDate + actual.Buffer.Position |> Expect.equal "" 0 + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the different date and same granularity" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun a b -> b), startDate.AddDays(1.), granularity, List.init 10 (fun i -> i + 1)) + + let expected = + seq { + yield! Array.zeroCreate 24 + yield! [ 1..10 ] + yield! Array.zeroCreate 38 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the different date and smaller granularity" { + let actual = new Timeseries(startDate, granularity, size) + + actual.Insert((fun a b -> b), startDate.AddDays(1.), TimeSpan.FromMinutes(12.), List.init 10 (fun i -> i + 1)) + + let expected = + seq { + yield! Array.zeroCreate 24 + yield! [ 5; 10 ] + yield! Array.zeroCreate 46 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the different date and larger granularity" { + let actual = new Timeseries(startDate, granularity, size) + + actual.Insert((fun a b -> b), startDate.AddDays(1.), TimeSpan.FromHours(2.), List.init 10 (fun i -> i + 1)) + + let expected = + seq { + yield! Array.zeroCreate 24 + yield! (List.init 10 (fun i -> [ i + 1; i + 1 ])) |> List.concat + yield! Array.zeroCreate 28 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the same date and granularity" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun a b -> b), startDate, granularity, List.init 10 (fun i -> i + 1)) + + let expected = + seq { + yield! [ 1..10 ] + yield! Array.zeroCreate 62 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the same date and smaller granularity" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun a b -> b), startDate, TimeSpan.FromMinutes(12.), List.init 10 (fun i -> i + 1)) + + let expected = + seq { + yield! [ 5; 10 ] + yield! Array.zeroCreate 70 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the same date and larger granularity" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun a b -> b), startDate, TimeSpan.FromHours(2.), List.init 10 (fun i -> i + 1)) + + let expected = + seq { + yield! (List.init 10 (fun i -> [ i + 1; i + 1 ])) |> List.concat + yield! Array.zeroCreate 52 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the past date and same granularity" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun a b -> b), startDate.AddDays(-1.), granularity, List.init 48 (fun i -> i + 1)) + + let expected = + seq { + yield! [ 25..48 ] + yield! Array.zeroCreate 48 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values with the past date and smaller granularity" { + let actual = new Timeseries(startDate, granularity, size) + + actual.Insert((fun a b -> b), startDate.AddDays(-1.), TimeSpan.FromMinutes(12.), List.init 288 (fun i -> i + 1)) + + let expected = + seq { + yield! [ 125..5..285 ] + yield! Array.zeroCreate 39 + } + |> Seq.toList + + actual.Buffer.ToArray() |> Seq.toList |> Expect.equal "" expected + } + + test "I should be able to insert a set of values with the past date and larger granularity" { + let actual = new Timeseries(startDate, granularity, size) + + actual.Insert((fun a b -> b), startDate.AddDays(-1.), TimeSpan.FromHours(2.), List.init 24 (fun i -> i + 1)) + + let expected = + seq { + yield! (List.init 12 (fun i -> [ i + 13; i + 13 ])) |> List.concat + yield! Array.zeroCreate 48 + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to insert a set of values offset from the timeseries start without wrapping round beyond the timeseries position" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun _ b -> b), startDate, granularity, List.init size (fun i -> 1)) + actual.Insert((fun _ b -> b), startDate.AddDays(1.), granularity, List.init (size * 2) (fun i -> 2)) + + let expected = + seq { + yield! Array.init 24 (fun i -> 1) + yield! Array.init 48 (fun i -> 2) + } + + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should not be able to insert a set of values offset beyond the timeseries position" { + let actual = new Timeseries(startDate, granularity, size) + actual.Insert((fun _ b -> b), startDate, granularity, List.init size (fun i -> 1)) + actual.Insert((fun _ b -> b), startDate.AddDays(4.), granularity, List.init (size * 2) (fun i -> 2)) + let expected = seq { yield! Array.init size (fun i -> 1) } + actual.Buffer.ToArray() |> Expect.sequenceEqual "" expected + } + + test "I should be able to clone a timeseries" { + let buffer = + new Timeseries(startDate, granularity, [| 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 |]) + + let clone = buffer.Clone() + buffer.Buffer.ToArray() |> Expect.equal "" (clone.Buffer.ToArray()) + clone.Buffer.Advance(2) |> ignore + Expect.notEqual "" (buffer.Buffer.ToArray()) <| clone.Buffer.ToArray() + buffer.Buffer.Position |> Expect.equal "" 0 + clone.Buffer.Position |> Expect.equal "" 2 + } + + test "I should be able to create an empty timeseries in the past and extract all values" { + let actual = new Timeseries>(startDate, granularity, 10) + + let expected = + Seq.init 10 (fun i -> startDate.AddHours(i |> float), Nullable()) + + actual.AsTimeseries(startDate) |> Expect.sequenceEqual "" expected + } + + test + "I should be able to insert a set of values with a zero offset from the timeseries start applying an operation between existing and new values" { + let merge op (a: Nullable) (b: Nullable) = + if a.HasValue then + if b.HasValue then Nullable(op a.Value b.Value) else a + else + b + + let actual = new Timeseries>(startDate, granularity, 10) + actual.Insert(merge (+), startDate, granularity, [ 1..10 ] |> List.map(fun i -> Nullable(float i))) + actual.Insert(merge (+), startDate, granularity, [ 1..10 ] |> List.map(fun i -> Nullable(float i))) + + let expected = + [ 1..10 ] + |> List.map(fun i -> startDate.AddHours(i - 1 |> float), Nullable(float i * 2.)) + + actual.AsTimeseries(startDate) |> Expect.sequenceEqual "" expected + } ] diff --git a/tests/FSharpx.Collections.Tests/ArrayTests.fs b/tests/FSharpx.Collections.Tests/ArrayTests.fs index d4864c09..18cb9f56 100644 --- a/tests/FSharpx.Collections.Tests/ArrayTests.fs +++ b/tests/FSharpx.Collections.Tests/ArrayTests.fs @@ -10,46 +10,45 @@ module ArrayTests = [] let testArray = - testList "Array" [ - test "I should be able to part of an array to a target array" { - let a, b = [| 1; 2; 3; 4; 5 |], [| 10; 11; 12; 13; 14 |] - Array.copyTo 0 2 a b - Expect.equal "expect arrays equal" [| 10; 11; 1; 2; 3 |] b - } - - test "I should be able to convert a tuple to an array" { - (1, 2) - |> Array.ofTuple - |> (Expect.equal "expect arrays equal" [| 1; 2 |]) - } - - test "I should be able to convert an array to a tuple" { - let result: (int * int) = [| 1; 2 |] |> Array.toTuple - Expect.equal "expect tuples equal" (1, 2) result - } - - test "I should be able to create a centered window from a seq" { - let expected = [| - [| 1.; 2.; 3.; 4. |] - [| 1.; 2.; 3.; 4.; 5. |] - [| 1.; 2.; 3.; 4.; 5.; 6. |] - [| 1.; 2.; 3.; 4.; 5.; 6.; 7. |] - [| 2.; 3.; 4.; 5.; 6.; 7.; 8. |] - [| 3.; 4.; 5.; 6.; 7.; 8.; 9. |] - [| 4.; 5.; 6.; 7.; 8.; 9.; 10. |] - [| 5.; 6.; 7.; 8.; 9.; 10. |] - [| 6.; 7.; 8.; 9.; 10. |] - [| 7.; 8.; 9.; 10. |] - |] - - Expect.equal "expect arrays equal" expected - <| Array.centeredWindow 3 data - } - - test "I should be able to compute the central moving average of a seq" { - let expected = [| 2.5; 3.; 3.5; 4.; 5.; 6.; 7.; 7.5; 8.; 8.5 |] - - Expect.equal "expect arrays equal" expected - <| Array.centralMovingAverage 3 data - } - ] + testList + "Array" + [ test "I should be able to part of an array to a target array" { + let a, b = [| 1; 2; 3; 4; 5 |], [| 10; 11; 12; 13; 14 |] + Array.copyTo 0 2 a b + Expect.equal "expect arrays equal" [| 10; 11; 1; 2; 3 |] b + } + + test "I should be able to convert a tuple to an array" { + (1, 2) + |> Array.ofTuple + |> (Expect.equal "expect arrays equal" [| 1; 2 |]) + } + + test "I should be able to convert an array to a tuple" { + let result: (int * int) = [| 1; 2 |] |> Array.toTuple + Expect.equal "expect tuples equal" (1, 2) result + } + + test "I should be able to create a centered window from a seq" { + let expected = + [| [| 1.; 2.; 3.; 4. |] + [| 1.; 2.; 3.; 4.; 5. |] + [| 1.; 2.; 3.; 4.; 5.; 6. |] + [| 1.; 2.; 3.; 4.; 5.; 6.; 7. |] + [| 2.; 3.; 4.; 5.; 6.; 7.; 8. |] + [| 3.; 4.; 5.; 6.; 7.; 8.; 9. |] + [| 4.; 5.; 6.; 7.; 8.; 9.; 10. |] + [| 5.; 6.; 7.; 8.; 9.; 10. |] + [| 6.; 7.; 8.; 9.; 10. |] + [| 7.; 8.; 9.; 10. |] |] + + Expect.equal "expect arrays equal" expected + <| Array.centeredWindow 3 data + } + + test "I should be able to compute the central moving average of a seq" { + let expected = [| 2.5; 3.; 3.5; 4.; 5.; 6.; 7.; 7.5; 8.; 8.5 |] + + Expect.equal "expect arrays equal" expected + <| Array.centralMovingAverage 3 data + } ] diff --git a/tests/FSharpx.Collections.Tests/ByteStringTest.fs b/tests/FSharpx.Collections.Tests/ByteStringTest.fs index 195ad811..5a14a745 100644 --- a/tests/FSharpx.Collections.Tests/ByteStringTest.fs +++ b/tests/FSharpx.Collections.Tests/ByteStringTest.fs @@ -8,214 +8,214 @@ open Expecto.Flip module ByteStringTests = type BS = ByteString - let comparisonTests = [ - // When the base array is different - "empty1", ByteString.create ""B, ByteString.create ""B, 0 - "empty2", ByteString.create ""B, ByteString.create "a"B, -1 - "empty3", ByteString.create "a"B, ByteString.create ""B, 1 - "empty5", ByteString.empty, ByteString.create "a"B, -1 - "empty6", ByteString.create "a"B, ByteString.empty, 1 - "empty7", ByteString.empty, ByteString.create ""B, 0 - - "same1", ByteString.create "a"B, ByteString.create "a"B, 0 - "smaller1", ByteString.create "a"B, ByteString.create "b"B, -1 - "bigger1", ByteString.create "b"B, ByteString.create "a"B, 1 - - "longer1", ByteString.create "aa"B, ByteString.create "a"B, 1 - "shorter1", ByteString.create "b"B, ByteString.create "aa"B, -1 - - //when the base array is the same - let x = "baab"B - "same2", ByteString(x, 0, 1), ByteString(x, 0, 1), 0 - "same3", ByteString(x, 0, 1), ByteString(x, 3, 1), 0 - "shorter2", ByteString(x, 0, 1), ByteString(x, 0, 2), -1 - "shorter3", ByteString(x, 0, 1), ByteString(x, 2, 2), -1 - "longer2", ByteString(x, 0, 2), ByteString(x, 0, 1), 1 - "longet3", ByteString(x, 1, 2), ByteString(x, 0, 1), 1 - "longer4", ByteString(x, 2, 2), ByteString(x, 0, 1), 1 - ] - - let spanAndSplitTests = [| - "Howdy! Want to play?"B, ' 'B, 6 - "Howdy! Want to play?"B, '?'B, 19 - "Howdy! Want to play?"B, '\r'B, 20 - |] + let comparisonTests = + [ + // When the base array is different + "empty1", ByteString.create ""B, ByteString.create ""B, 0 + "empty2", ByteString.create ""B, ByteString.create "a"B, -1 + "empty3", ByteString.create "a"B, ByteString.create ""B, 1 + "empty5", ByteString.empty, ByteString.create "a"B, -1 + "empty6", ByteString.create "a"B, ByteString.empty, 1 + "empty7", ByteString.empty, ByteString.create ""B, 0 + + "same1", ByteString.create "a"B, ByteString.create "a"B, 0 + "smaller1", ByteString.create "a"B, ByteString.create "b"B, -1 + "bigger1", ByteString.create "b"B, ByteString.create "a"B, 1 + + "longer1", ByteString.create "aa"B, ByteString.create "a"B, 1 + "shorter1", ByteString.create "b"B, ByteString.create "aa"B, -1 + + //when the base array is the same + let x = "baab"B + "same2", ByteString(x, 0, 1), ByteString(x, 0, 1), 0 + "same3", ByteString(x, 0, 1), ByteString(x, 3, 1), 0 + "shorter2", ByteString(x, 0, 1), ByteString(x, 0, 2), -1 + "shorter3", ByteString(x, 0, 1), ByteString(x, 2, 2), -1 + "longer2", ByteString(x, 0, 2), ByteString(x, 0, 1), 1 + "longet3", ByteString(x, 1, 2), ByteString(x, 0, 1), 1 + "longer4", ByteString(x, 2, 2), ByteString(x, 0, 1), 1 ] + + let spanAndSplitTests = + [| "Howdy! Want to play?"B, ' 'B, 6 + "Howdy! Want to play?"B, '?'B, 19 + "Howdy! Want to play?"B, '\r'B, 20 |] [] let testByteString = - testList "ByteString" [ - - testList - "test ByteString comparison should correctly return -1, 0, or 1" - (comparisonTests - |> List.map(fun (name, x, y, expectedResult) -> test name { BS.Compare(x, y) |> Expect.equal "comparison" expectedResult })) - - - test "test ByteString_length should return the length of the byte string" { - let input = ByteString.create "Hello, world!"B - Expect.equal "length" 13 <| ByteString.length input - } - - test "test ByteString_span correctly breaks the ByteString on the specified predicate" { - spanAndSplitTests - |> Array.iter(fun (input, breakChar, breakIndex) -> - let str = ByteString.create input - - let expected = - if input.Length = breakIndex then - str, ByteString.empty - else - BS(input, 0, breakIndex), BS(input, breakIndex, input.Length - breakIndex) - - Expect.equal "ByteString * ByteString" expected - <| ByteString.span ((<>) breakChar) str) - } - - test "test ByteString_split correctly breaks the ByteString on the specified predicate" { - spanAndSplitTests - |> Array.iter(fun (input, breakChar, breakIndex) -> - let str = ByteString.create input - - let expected = - if input.Length = breakIndex then - str, ByteString.empty - else - BS(input, 0, breakIndex), BS(input, breakIndex, input.Length - breakIndex) - - Expect.equal "ByteString * ByteString" expected - <| ByteString.split ((=) breakChar) str) - } - - test "test ByteString_span correctly breaks the ByteString on \r" { - let input = "test\r\ntest"B - let str = ByteString.create input - let expected = BS(input, 0, 4), BS(input, 4, 6) - - Expect.equal "ByteString * ByteString" expected - <| ByteString.span (fun c -> c <> '\r'B && c <> '\n'B) str - } - - test "test ByteString_split correctly breaks the ByteString on \r" { - let input = "test\r\ntest"B - let str = ByteString.create input - let expected = BS(input, 0, 4), BS(input, 4, 6) - - Expect.equal "ByteString * ByteString" expected - <| ByteString.split (fun c -> c = '\r'B || c = '\n'B) str - } - - test "test ByteString_splitAt correctly breaks the ByteString on the specified index" { - let input = "Howdy! Want to play?"B - let str = ByteString.create input - let expected = BS(input, 0, 6), BS(input, 6, 14) - - Expect.equal "ByteString * ByteString" expected - <| ByteString.splitAt 6 str - } - - test "test ByteString_fold should concatenate bytes into a string" { - Expect.equal "string" "Howdy" - <| (ByteString.create "Howdy"B - |> ByteString.fold (fun a b -> a + (char b).ToString()) "") - } - - test "test ByteString_take correctly truncates the ByteString at the selected index" { - let input = "Howdy! Want to play?"B - let str = ByteString.create input - let expected = BS(input, 0, 6) - Expect.equal "ByteString" expected <| ByteString.take 6 str - } - - - test "test drop should drop the first n items" { - let input = "Howdy! Want to play?"B - - Expect.equal "ByteString" (BS(input, 7, 13)) - <| ByteString.skip 7 (ByteString.create input) - } - - test "test dropWhile should drop anything before the first space" { - let input = ByteString.create "Howdy! Want to play?"B - let dropWhile2Head = ByteString.skipWhile((<>) ' 'B) >> ByteString.head - Expect.equal "Byte" ' 'B <| dropWhile2Head input - } - - test "test take should return an empty ArraySegment when asked to take 0" { - Expect.equal "empty ByteString" ByteString.empty - <| ByteString.take 0 (ByteString.create "Nothing should be taken"B) - } - - test "test take should return an empty ArraySegment when given an empty ArraySegment" { - Expect.equal "empty ByteString" ByteString.empty - <| ByteString.take 4 ByteString.empty - } - - test "test take should take the first n items" { - let input = [| 0uy .. 9uy |] - - [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] - |> List.iter(fun x -> - Expect.equal "ByteString" (BS(input, 0, x)) - <| ByteString.take x (ByteString.create input)) - } - - test "test takeWhile should return an empty ArraySegment when given an empty ArraySegment" { - Expect.equal "empty ByteString" ByteString.empty - <| ByteString.takeWhile ((<>) ' 'B) ByteString.empty - } - - test "test takeWhile should take anything before the first space" { - let input = "Hello world"B - - Expect.equal "ByteString" (BS(input, 0, 5)) - <| (ByteString.takeWhile ((<>) ' 'B) (ByteString.create input)) - } - - test "test takeUntil should return an empty ArraySegment when given an empty ArraySegment" { - Expect.equal "empty ByteString" ByteString.empty - <| ByteString.takeUntil ((=) ' 'B) ByteString.empty - } - - test "test takeUntil should correctly split the input" { - let input = "abcde"B - - Expect.equal "ByteString" (BS(input, 0, 2)) - <| ByteString.takeUntil ((=) 'c'B) (ByteString.create input) - } - - testProperty "test if ByteString Compare follows lexicographic order" - <| fun xs ys -> BS.Compare(ByteString xs, ByteString ys) = LanguagePrimitives.GenericComparison xs ys + testList + "ByteString" + [ + + testList + "test ByteString comparison should correctly return -1, 0, or 1" + (comparisonTests + |> List.map(fun (name, x, y, expectedResult) -> test name { BS.Compare(x, y) |> Expect.equal "comparison" expectedResult })) + + + test "test ByteString_length should return the length of the byte string" { + let input = ByteString.create "Hello, world!"B + Expect.equal "length" 13 <| ByteString.length input + } + + test "test ByteString_span correctly breaks the ByteString on the specified predicate" { + spanAndSplitTests + |> Array.iter(fun (input, breakChar, breakIndex) -> + let str = ByteString.create input + + let expected = + if input.Length = breakIndex then + str, ByteString.empty + else + BS(input, 0, breakIndex), BS(input, breakIndex, input.Length - breakIndex) + + Expect.equal "ByteString * ByteString" expected + <| ByteString.span ((<>) breakChar) str) + } + + test "test ByteString_split correctly breaks the ByteString on the specified predicate" { + spanAndSplitTests + |> Array.iter(fun (input, breakChar, breakIndex) -> + let str = ByteString.create input + + let expected = + if input.Length = breakIndex then + str, ByteString.empty + else + BS(input, 0, breakIndex), BS(input, breakIndex, input.Length - breakIndex) + + Expect.equal "ByteString * ByteString" expected + <| ByteString.split ((=) breakChar) str) + } + + test "test ByteString_span correctly breaks the ByteString on \r" { + let input = "test\r\ntest"B + let str = ByteString.create input + let expected = BS(input, 0, 4), BS(input, 4, 6) + + Expect.equal "ByteString * ByteString" expected + <| ByteString.span (fun c -> c <> '\r'B && c <> '\n'B) str + } + + test "test ByteString_split correctly breaks the ByteString on \r" { + let input = "test\r\ntest"B + let str = ByteString.create input + let expected = BS(input, 0, 4), BS(input, 4, 6) + + Expect.equal "ByteString * ByteString" expected + <| ByteString.split (fun c -> c = '\r'B || c = '\n'B) str + } + + test "test ByteString_splitAt correctly breaks the ByteString on the specified index" { + let input = "Howdy! Want to play?"B + let str = ByteString.create input + let expected = BS(input, 0, 6), BS(input, 6, 14) + + Expect.equal "ByteString * ByteString" expected + <| ByteString.splitAt 6 str + } + + test "test ByteString_fold should concatenate bytes into a string" { + Expect.equal "string" "Howdy" + <| (ByteString.create "Howdy"B + |> ByteString.fold (fun a b -> a + (char b).ToString()) "") + } + + test "test ByteString_take correctly truncates the ByteString at the selected index" { + let input = "Howdy! Want to play?"B + let str = ByteString.create input + let expected = BS(input, 0, 6) + Expect.equal "ByteString" expected <| ByteString.take 6 str + } + + + test "test drop should drop the first n items" { + let input = "Howdy! Want to play?"B + + Expect.equal "ByteString" (BS(input, 7, 13)) + <| ByteString.skip 7 (ByteString.create input) + } + + test "test dropWhile should drop anything before the first space" { + let input = ByteString.create "Howdy! Want to play?"B + let dropWhile2Head = ByteString.skipWhile((<>) ' 'B) >> ByteString.head + Expect.equal "Byte" ' 'B <| dropWhile2Head input + } + + test "test take should return an empty ArraySegment when asked to take 0" { + Expect.equal "empty ByteString" ByteString.empty + <| ByteString.take 0 (ByteString.create "Nothing should be taken"B) + } + + test "test take should return an empty ArraySegment when given an empty ArraySegment" { + Expect.equal "empty ByteString" ByteString.empty + <| ByteString.take 4 ByteString.empty + } + + test "test take should take the first n items" { + let input = [| 0uy .. 9uy |] + + [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] + |> List.iter(fun x -> + Expect.equal "ByteString" (BS(input, 0, x)) + <| ByteString.take x (ByteString.create input)) + } + + test "test takeWhile should return an empty ArraySegment when given an empty ArraySegment" { + Expect.equal "empty ByteString" ByteString.empty + <| ByteString.takeWhile ((<>) ' 'B) ByteString.empty + } + + test "test takeWhile should take anything before the first space" { + let input = "Hello world"B + + Expect.equal "ByteString" (BS(input, 0, 5)) + <| (ByteString.takeWhile ((<>) ' 'B) (ByteString.create input)) + } + + test "test takeUntil should return an empty ArraySegment when given an empty ArraySegment" { + Expect.equal "empty ByteString" ByteString.empty + <| ByteString.takeUntil ((=) ' 'B) ByteString.empty + } - testSequenced - <| testList "performance" [ - test "Comparision should only compare relevent part of Array" { - let veryLargeArray1 = Array.init 2000 byte |> ByteString.create - let veryLargeArray2 = Array.init 2000 byte |> ByteString.create - - let compareVeryLargeArray() = - BS.Compare(veryLargeArray1, veryLargeArray2) + test "test takeUntil should correctly split the input" { + let input = "abcde"B + + Expect.equal "ByteString" (BS(input, 0, 2)) + <| ByteString.takeUntil ((=) 'c'B) (ByteString.create input) + } + + testProperty "test if ByteString Compare follows lexicographic order" + <| fun xs ys -> BS.Compare(ByteString xs, ByteString ys) = LanguagePrimitives.GenericComparison xs ys - let theExactSameByteString1 = ByteString.take 2000 veryLargeArray1 - let theExactSameByteString2 = ByteString.take 2000 veryLargeArray1 + testSequenced + <| testList + "performance" + [ test "Comparision should only compare relevent part of Array" { + let veryLargeArray1 = Array.init 2000 byte |> ByteString.create + let veryLargeArray2 = Array.init 2000 byte |> ByteString.create - let compareExactSameByteArray() = - BS.Compare(theExactSameByteString1, theExactSameByteString2) + let compareVeryLargeArray() = + BS.Compare(veryLargeArray1, veryLargeArray2) - let smallByteArray1 = ByteString.take 100 veryLargeArray1 - let smallByteArray2 = ByteString.take 100 veryLargeArray2 + let theExactSameByteString1 = ByteString.take 2000 veryLargeArray1 + let theExactSameByteString2 = ByteString.take 2000 veryLargeArray1 - let compareSmallByteArray() = - BS.Compare(smallByteArray1, smallByteArray2) + let compareExactSameByteArray() = + BS.Compare(theExactSameByteString1, theExactSameByteString2) - Expect.equal "" (compareVeryLargeArray()) (compareExactSameByteArray()) + let smallByteArray1 = ByteString.take 100 veryLargeArray1 + let smallByteArray2 = ByteString.take 100 veryLargeArray2 - compareExactSameByteArray - |> Expect.isFasterThan "" compareVeryLargeArray + let compareSmallByteArray() = + BS.Compare(smallByteArray1, smallByteArray2) - compareExactSameByteArray - |> Expect.isFasterThan "" compareSmallByteArray + Expect.equal "" (compareVeryLargeArray()) (compareExactSameByteArray()) - compareSmallByteArray |> Expect.isFasterThan "" compareVeryLargeArray - } - ] - ] + compareExactSameByteArray + |> Expect.isFasterThan "" compareVeryLargeArray + + compareExactSameByteArray + |> Expect.isFasterThan "" compareSmallByteArray + + compareSmallByteArray |> Expect.isFasterThan "" compareVeryLargeArray + } ] ] diff --git a/tests/FSharpx.Collections.Tests/CircularBufferTests.fs b/tests/FSharpx.Collections.Tests/CircularBufferTests.fs index 03c2e873..ae455d44 100644 --- a/tests/FSharpx.Collections.Tests/CircularBufferTests.fs +++ b/tests/FSharpx.Collections.Tests/CircularBufferTests.fs @@ -9,285 +9,288 @@ module CircularBufferTests = [] let testCircularBuffer = - testList "CircularBuffer" [ - test "Printing from a queue 1..5, all" { - let circularBuffer = CircularBuffer 5 - - circularBuffer.Enqueue(1) - circularBuffer.Enqueue(2) - circularBuffer.Enqueue(3) - circularBuffer.Enqueue(4) - circularBuffer.Enqueue 5 - Expect.equal "" [| 1; 2; 3; 4; 5 |] <| circularBuffer.Dequeue 5 - } - - test "Printing from a queue 1..8, twice, all" { - let circularBuffer = CircularBuffer 5 - - circularBuffer.Enqueue(1) - circularBuffer.Enqueue(2) - circularBuffer.Enqueue(3) - circularBuffer.Enqueue(4) - circularBuffer.Enqueue 5 // <--- - circularBuffer.Enqueue(6) - circularBuffer.Enqueue(7) - circularBuffer.Enqueue(8) - circularBuffer.Enqueue(1) - circularBuffer.Enqueue(2) // <--- - circularBuffer.Enqueue(3) - circularBuffer.Enqueue(4) - circularBuffer.Enqueue 5 - circularBuffer.Enqueue(6) - circularBuffer.Enqueue(7) // <--- - circularBuffer.Enqueue(8) - Expect.equal "" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 - } - - test "Printing from a queue 1..5, partial" { - let circularBuffer = CircularBuffer 5 - - circularBuffer.Enqueue 1 - circularBuffer.Enqueue 2 - circularBuffer.Enqueue 3 - circularBuffer.Enqueue 4 - circularBuffer.Enqueue 5 - Expect.equal "buffer" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 - Expect.equal "count" 2 <| circularBuffer.Count - } - - - test "Printing from a queue 1..8 and dequeue 5, then enqueue 1..3 and dequeue 3" { - let circularBuffer = CircularBuffer 5 - - circularBuffer.Enqueue(1) - circularBuffer.Enqueue(2) - circularBuffer.Enqueue(3) - circularBuffer.Enqueue(4) - circularBuffer.Enqueue 5 // <--- - circularBuffer.Enqueue(6) - circularBuffer.Enqueue(7) - circularBuffer.Enqueue(8) - Expect.equal "buffer" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 - circularBuffer.Enqueue(1) - circularBuffer.Enqueue(2) - circularBuffer.Enqueue(3) - Expect.equal "buffer 2" [| 1; 2; 3 |] <| circularBuffer.Dequeue(3) - } - - test "fail on overflow buffer" { - let f = - fun _ -> - let circularBuffer = CircularBuffer 5 - circularBuffer.Enqueue [| 1; 2; 3; 4; 5; 6; 7; 8; 1; 2; 3; 4; 5; 6; 7; 8 |] - - Expect.throwsT "" f - } - - ptest "Printing after multiple enqueue circles" { - let circularBuffer = CircularBuffer 5 - - circularBuffer.Enqueue [| 1; 2; 3; 4; 5 |] - circularBuffer.Enqueue [| 6; 7; 8 |] - circularBuffer.Enqueue [| 1; 2; 3; 4; 5 |] - circularBuffer.Enqueue [| 6; 7; 8 |] - Expect.equal "buffer" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 - } - - - - ptest "Printing from a queue 1..8 and dequeue 5, then enqueue 1..3 and dequeue 3, from array" { - let circularBuffer = CircularBuffer 5 - - circularBuffer.Enqueue([| 1; 2; 3; 4; 5 |]) - circularBuffer.Enqueue([| 6; 7; 8 |]) - Expect.equal "buffer" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 - circularBuffer.Enqueue([| 1; 2; 3 |]) - Expect.equal "buffer" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 - } - - ptest "Consider a large array with various, incoming array segments" { - let circularBuffer = CircularBuffer 5 - - let source = [| - 1 - 2 - 3 - 4 - 5 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 1 - 2 - 3 - 4 - 5 - 1 - 2 - 3 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 1 - 2 - 3 - |] - - let incoming = - let generator = seq { - yield ArraySegment<_>(source, 0, 5) - yield ArraySegment<_>(source, 5, 5) - yield ArraySegment<_>(source, 10, 3) - yield ArraySegment<_>(source, 13, 5) - yield ArraySegment<_>(source, 18, 3) - yield ArraySegment<_>(source, 21, 5) - yield ArraySegment<_>(source, 26, 3) - yield ArraySegment<_>(source, 29, 5) - yield ArraySegment<_>(source, 34, 3) - yield ArraySegment<_>(source, 37, 3) - } in generator.GetEnumerator() - - let enqueueNext() = - incoming.MoveNext() |> ignore - circularBuffer.Enqueue(incoming.Current) - - // Printing from a queue 1..5 - enqueueNext() - - Expect.equal "buffer 1" [| 1; 2; 3; 4; 5 |] - <| circularBuffer.Dequeue 5 - - // Printing from a queue 1..8, twice - enqueueNext() - enqueueNext() - enqueueNext() - enqueueNext() - - Expect.equal "buffer 2" [| 4; 5; 6; 7; 8 |] - <| circularBuffer.Dequeue 5 - - // Printing from a queue 1..5 - enqueueNext() - Expect.equal "buffer 3" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 - - // Clear out the rest - circularBuffer.Dequeue 2 |> ignore - - // Printing from a queue 1..3 - enqueueNext() - Expect.equal "buffer 4" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 - - // Printing from a queue 1..8 and dequeue 5, then enqueue 1..3 and dequeue 3 - enqueueNext() - enqueueNext() - - Expect.equal "buffer 5" [| 4; 5; 6; 7; 8 |] - <| circularBuffer.Dequeue 5 - - enqueueNext() - Expect.equal "buffer 6" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 - } - - //printfn "Enqueue(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds - - //let data = [|1;2;3;4;5|] - //circularBuffer.Enqueue(data) - //assert ((data |> Array.toList) = (queue |> Seq.toList)) - - //printfn "Seq.toList matches enqueued data." - - //// [/snippet] - - //stopwatch.Reset() - //stopwatch.Start() - //// [snippet: Using CircularQueueAgent] - //let buffer = new CircularQueueAgent(3) - - //// The sample uses two workflows that add/take elements - //// from the buffer with the following timeouts. When the producer - //// timout is larger, consumer will be blocked. Otherwise, producer - //// will be blocked. - //let producerTimeout = 500 - //let consumerTimeout = 1000 - - //async { - // for i in 0 .. 10 do - // // Sleep for some time and then add value - // do! Async.Sleep(producerTimeout) - // buffer.Enqueue([|i|]) - // printfn "Added %d" i } - //|> Async.Start - - //async { - // while true do - // // Sleep for some time and then get value - // do! Async.Sleep(consumerTimeout) - // let! v = buffer.AsyncDequeue(1) - // printfn "Got %d" v.[0] } - //|> Async.Start - //// [/snippet] - //printfn "CircularQueueAgent.Enqueue(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds - - //stopwatch.Reset() - //stopwatch.Start() - //// [snippet: Using CircularQueueAgent with AsyncEnqueue] - //async { - // for i in 0 .. 10 do - // // Sleep for some time and then add value - // do! Async.Sleep(producerTimeout) - // do! buffer.AsyncEnqueue([|i|]) - // printfn "Added %d" i } - //|> Async.Start - - //async { - // while true do - // // Sleep for some time and then get value - // do! Async.Sleep(consumerTimeout) - // let! v = buffer.AsyncDequeue(1) - // printfn "Got %d" v.[0] } - //|> Async.Start - //// [/snippet] - //printfn "CircularQueueAgent.AsyncEnqueue(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds - - //stopwatch.Reset() - //stopwatch.Start() - //// [snippet: Using CircularStream] - //let stream = new CircularStream(3) - - //async { - // for i in 0uy .. 10uy do - // // Sleep for some time and then add value - // do! Async.Sleep(producerTimeout) - // do! stream.AsyncWrite([|i|], 0, 1) - // printfn "Wrote %d" i } - //|> Async.Start - - //async { - // let buffer = Array.zeroCreate 1 - // while true do - // // Sleep for some time and then get value - // do! Async.Sleep(consumerTimeout) - // let! v = stream.AsyncRead(buffer, 0, 1) - // printfn "Read %d bytes with value %A" v buffer.[0] } - //|> Async.Start - //// [/snippet] - //printfn "CircularStream.AsyncWrite(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds - ] + testList + "CircularBuffer" + [ test "Printing from a queue 1..5, all" { + let circularBuffer = CircularBuffer 5 + + circularBuffer.Enqueue(1) + circularBuffer.Enqueue(2) + circularBuffer.Enqueue(3) + circularBuffer.Enqueue(4) + circularBuffer.Enqueue 5 + Expect.equal "" [| 1; 2; 3; 4; 5 |] <| circularBuffer.Dequeue 5 + } + + test "Printing from a queue 1..8, twice, all" { + let circularBuffer = CircularBuffer 5 + + circularBuffer.Enqueue(1) + circularBuffer.Enqueue(2) + circularBuffer.Enqueue(3) + circularBuffer.Enqueue(4) + circularBuffer.Enqueue 5 // <--- + circularBuffer.Enqueue(6) + circularBuffer.Enqueue(7) + circularBuffer.Enqueue(8) + circularBuffer.Enqueue(1) + circularBuffer.Enqueue(2) // <--- + circularBuffer.Enqueue(3) + circularBuffer.Enqueue(4) + circularBuffer.Enqueue 5 + circularBuffer.Enqueue(6) + circularBuffer.Enqueue(7) // <--- + circularBuffer.Enqueue(8) + Expect.equal "" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 + } + + test "Printing from a queue 1..5, partial" { + let circularBuffer = CircularBuffer 5 + + circularBuffer.Enqueue 1 + circularBuffer.Enqueue 2 + circularBuffer.Enqueue 3 + circularBuffer.Enqueue 4 + circularBuffer.Enqueue 5 + Expect.equal "buffer" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 + Expect.equal "count" 2 <| circularBuffer.Count + } + + + test "Printing from a queue 1..8 and dequeue 5, then enqueue 1..3 and dequeue 3" { + let circularBuffer = CircularBuffer 5 + + circularBuffer.Enqueue(1) + circularBuffer.Enqueue(2) + circularBuffer.Enqueue(3) + circularBuffer.Enqueue(4) + circularBuffer.Enqueue 5 // <--- + circularBuffer.Enqueue(6) + circularBuffer.Enqueue(7) + circularBuffer.Enqueue(8) + Expect.equal "buffer" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 + circularBuffer.Enqueue(1) + circularBuffer.Enqueue(2) + circularBuffer.Enqueue(3) + Expect.equal "buffer 2" [| 1; 2; 3 |] <| circularBuffer.Dequeue(3) + } + + test "fail on overflow buffer" { + let f = + fun _ -> + let circularBuffer = CircularBuffer 5 + circularBuffer.Enqueue [| 1; 2; 3; 4; 5; 6; 7; 8; 1; 2; 3; 4; 5; 6; 7; 8 |] + + Expect.throwsT "" f + } + + ptest "Printing after multiple enqueue circles" { + let circularBuffer = CircularBuffer 5 + + circularBuffer.Enqueue [| 1; 2; 3; 4; 5 |] + circularBuffer.Enqueue [| 6; 7; 8 |] + circularBuffer.Enqueue [| 1; 2; 3; 4; 5 |] + circularBuffer.Enqueue [| 6; 7; 8 |] + Expect.equal "buffer" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 + } + + + + ptest "Printing from a queue 1..8 and dequeue 5, then enqueue 1..3 and dequeue 3, from array" { + let circularBuffer = CircularBuffer 5 + + circularBuffer.Enqueue([| 1; 2; 3; 4; 5 |]) + circularBuffer.Enqueue([| 6; 7; 8 |]) + Expect.equal "buffer" [| 4; 5; 6; 7; 8 |] <| circularBuffer.Dequeue 5 + circularBuffer.Enqueue([| 1; 2; 3 |]) + Expect.equal "buffer" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 + } + + ptest "Consider a large array with various, incoming array segments" { + let circularBuffer = CircularBuffer 5 + + let source = + [| 1 + 2 + 3 + 4 + 5 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 1 + 2 + 3 + 4 + 5 + 1 + 2 + 3 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 1 + 2 + 3 |] + + let incoming = + let generator = + seq { + yield ArraySegment<_>(source, 0, 5) + yield ArraySegment<_>(source, 5, 5) + yield ArraySegment<_>(source, 10, 3) + yield ArraySegment<_>(source, 13, 5) + yield ArraySegment<_>(source, 18, 3) + yield ArraySegment<_>(source, 21, 5) + yield ArraySegment<_>(source, 26, 3) + yield ArraySegment<_>(source, 29, 5) + yield ArraySegment<_>(source, 34, 3) + yield ArraySegment<_>(source, 37, 3) + } in + + generator.GetEnumerator() + + let enqueueNext() = + incoming.MoveNext() |> ignore + circularBuffer.Enqueue(incoming.Current) + + // Printing from a queue 1..5 + enqueueNext() + + Expect.equal "buffer 1" [| 1; 2; 3; 4; 5 |] + <| circularBuffer.Dequeue 5 + + // Printing from a queue 1..8, twice + enqueueNext() + enqueueNext() + enqueueNext() + enqueueNext() + + Expect.equal "buffer 2" [| 4; 5; 6; 7; 8 |] + <| circularBuffer.Dequeue 5 + + // Printing from a queue 1..5 + enqueueNext() + Expect.equal "buffer 3" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 + + // Clear out the rest + circularBuffer.Dequeue 2 |> ignore + + // Printing from a queue 1..3 + enqueueNext() + Expect.equal "buffer 4" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 + + // Printing from a queue 1..8 and dequeue 5, then enqueue 1..3 and dequeue 3 + enqueueNext() + enqueueNext() + + Expect.equal "buffer 5" [| 4; 5; 6; 7; 8 |] + <| circularBuffer.Dequeue 5 + + enqueueNext() + Expect.equal "buffer 6" [| 1; 2; 3 |] <| circularBuffer.Dequeue 3 + } + + //printfn "Enqueue(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds + + //let data = [|1;2;3;4;5|] + //circularBuffer.Enqueue(data) + //assert ((data |> Array.toList) = (queue |> Seq.toList)) + + //printfn "Seq.toList matches enqueued data." + + //// [/snippet] + + //stopwatch.Reset() + //stopwatch.Start() + //// [snippet: Using CircularQueueAgent] + //let buffer = new CircularQueueAgent(3) + + //// The sample uses two workflows that add/take elements + //// from the buffer with the following timeouts. When the producer + //// timout is larger, consumer will be blocked. Otherwise, producer + //// will be blocked. + //let producerTimeout = 500 + //let consumerTimeout = 1000 + + //async { + // for i in 0 .. 10 do + // // Sleep for some time and then add value + // do! Async.Sleep(producerTimeout) + // buffer.Enqueue([|i|]) + // printfn "Added %d" i } + //|> Async.Start + + //async { + // while true do + // // Sleep for some time and then get value + // do! Async.Sleep(consumerTimeout) + // let! v = buffer.AsyncDequeue(1) + // printfn "Got %d" v.[0] } + //|> Async.Start + //// [/snippet] + //printfn "CircularQueueAgent.Enqueue(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds + + //stopwatch.Reset() + //stopwatch.Start() + //// [snippet: Using CircularQueueAgent with AsyncEnqueue] + //async { + // for i in 0 .. 10 do + // // Sleep for some time and then add value + // do! Async.Sleep(producerTimeout) + // do! buffer.AsyncEnqueue([|i|]) + // printfn "Added %d" i } + //|> Async.Start + + //async { + // while true do + // // Sleep for some time and then get value + // do! Async.Sleep(consumerTimeout) + // let! v = buffer.AsyncDequeue(1) + // printfn "Got %d" v.[0] } + //|> Async.Start + //// [/snippet] + //printfn "CircularQueueAgent.AsyncEnqueue(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds + + //stopwatch.Reset() + //stopwatch.Start() + //// [snippet: Using CircularStream] + //let stream = new CircularStream(3) + + //async { + // for i in 0uy .. 10uy do + // // Sleep for some time and then add value + // do! Async.Sleep(producerTimeout) + // do! stream.AsyncWrite([|i|], 0, 1) + // printfn "Wrote %d" i } + //|> Async.Start + + //async { + // let buffer = Array.zeroCreate 1 + // while true do + // // Sleep for some time and then get value + // do! Async.Sleep(consumerTimeout) + // let! v = stream.AsyncRead(buffer, 0, 1) + // printfn "Read %d bytes with value %A" v buffer.[0] } + //|> Async.Start + //// [/snippet] + //printfn "CircularStream.AsyncWrite(array) tests passed in %d ms" stopwatch.ElapsedMilliseconds + ] diff --git a/tests/FSharpx.Collections.Tests/DListTest.fs b/tests/FSharpx.Collections.Tests/DListTest.fs index 6eb40735..047e00fa 100644 --- a/tests/FSharpx.Collections.Tests/DListTest.fs +++ b/tests/FSharpx.Collections.Tests/DListTest.fs @@ -14,157 +14,157 @@ module DListTests = let emptyDList = DList.empty - testList "DList" [ - test "allow to DList.tail to work" { Expect.isTrue "DList.conj DList.tail" (emptyDList |> DList.conj 1 |> DList.tail |> DList.isEmpty) } - - test "DList.conj to work" { Expect.isFalse "DList.conj length" (emptyDList |> DList.conj 1 |> DList.conj 2 |> DList.isEmpty) } - - test "DList.cons to work" { Expect.equal "DList.cons length" 2 (emptyDList |> DList.cons 1 |> DList.cons 2 |> DList.length) } - - test "allow to DList.cons and DList.conj to work" { - Expect.equal - "DList.cons DList.conj length" - 3 - (emptyDList - |> DList.cons 1 - |> DList.cons 2 - |> DList.conj 3 - |> DList.length) - } + testList + "DList" + [ test "allow to DList.tail to work" { Expect.isTrue "DList.conj DList.tail" (emptyDList |> DList.conj 1 |> DList.tail |> DList.isEmpty) } - test "DList.cons pattern discriminator - DList" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "DList.conj to work" { Expect.isFalse "DList.conj length" (emptyDList |> DList.conj 1 |> DList.conj 2 |> DList.isEmpty) } - let h1, t1 = - match q with - | DList.Cons(h, t) -> h, t - | _ -> "x", q + test "DList.cons to work" { Expect.equal "DList.cons length" 2 (emptyDList |> DList.cons 1 |> DList.cons 2 |> DList.length) } - Expect.isTrue "DList.cons pattern discriminator" ((h1 = "f") && (t1.Length = 5)) - } + test "allow to DList.cons and DList.conj to work" { + Expect.equal + "DList.cons DList.conj length" + 3 + (emptyDList + |> DList.cons 1 + |> DList.cons 2 + |> DList.conj 3 + |> DList.length) + } - test "empty DList should be empty" { Expect.isTrue "empty" (emptyDList |> DList.isEmpty) } + test "DList.cons pattern discriminator - DList" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - test "fail if there is no DList.head in the DList" { - Expect.throwsT "empty DList.head" (fun () -> emptyDList |> DList.head |> ignore) - } + let h1, t1 = + match q with + | DList.Cons(h, t) -> h, t + | _ -> "x", q - test "fail if there is no DList.tail in the DList" { - Expect.throwsT "no DList.tail" (fun () -> emptyDList |> DList.tail |> ignore) - } + Expect.isTrue "DList.cons pattern discriminator" ((h1 = "f") && (t1.Length = 5)) + } - test "foldBack matches build list 2" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let lq = DList.foldBack (fun (elem: string) (l': string list) -> elem :: l') q [] - Expect.equal "foldBack" (DList.toList q) lq - } + test "empty DList should be empty" { Expect.isTrue "empty" (emptyDList |> DList.isEmpty) } - test "fold matches build list rev 2" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let lq = DList.fold (fun (l': string list) (elem: string) -> elem :: l') [] q - Expect.equal "fold rev" (List.rev <| DList.toList q) lq - } + test "fail if there is no DList.head in the DList" { + Expect.throwsT "empty DList.head" (fun () -> emptyDList |> DList.head |> ignore) + } - test "give None if there is no DList.head in the DList" { Expect.isNone "DList.tryHead" (emptyDList |> DList.tryHead) } + test "fail if there is no DList.tail in the DList" { + Expect.throwsT "no DList.tail" (fun () -> emptyDList |> DList.tail |> ignore) + } - test "give None if there is no DList.tail in the DList" { Expect.isNone "tryTail" (emptyDList |> DList.tryTail) } + test "foldBack matches build list 2" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + let lq = DList.foldBack (fun (elem: string) (l': string list) -> elem :: l') q [] + Expect.equal "foldBack" (DList.toList q) lq + } - test "TryUncons wind-down to None" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "fold matches build list rev 2" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + let lq = DList.fold (fun (l': string list) (elem: string) -> elem :: l') [] q + Expect.equal "fold rev" (List.rev <| DList.toList q) lq + } - let rec loop(q': DList) = - match (q'.TryUncons) with - | Some(hd, tl) -> loop tl - | None -> None + test "give None if there is no DList.head in the DList" { Expect.isNone "DList.tryHead" (emptyDList |> DList.tryHead) } - Expect.isNone "TryUncons" <| loop q - } + test "give None if there is no DList.tail in the DList" { Expect.isNone "tryTail" (emptyDList |> DList.tryTail) } - test "Uncons wind-down to None" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "TryUncons wind-down to None" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let rec loop(q': DList) = - match (q'.Uncons) with - | hd, tl when tl.IsEmpty -> true - | hd, tl -> loop tl + let rec loop(q': DList) = + match (q'.TryUncons) with + | Some(hd, tl) -> loop tl + | None -> None - Expect.isTrue "Uncons" <| loop q - } + Expect.isNone "TryUncons" <| loop q + } - test "test length should return 6" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - Expect.equal "length" 6 <| DList.length q - } + test "Uncons wind-down to None" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - test "singleton length 1" { Expect.equal "singleton length" 1 (DList.singleton 1 |> DList.length) } + let rec loop(q': DList) = + match (q'.Uncons) with + | hd, tl when tl.IsEmpty -> true + | hd, tl -> loop tl - test "empty length 0" { Expect.equal "empty length" 0 (DList.empty |> DList.length) } + Expect.isTrue "Uncons" <| loop q + } - test "test ofSeq should create a DList from a list" { - let test = [ for i in 0..4 -> i ] - Expect.sequenceEqual "ofSeq" (List.toSeq test) (DList.ofSeq test |> DList.toSeq) - } + test "test length should return 6" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + Expect.equal "length" 6 <| DList.length q + } - test "test ofSeq should create a DList from an array" { - let test = [| for i in 0..4 -> i |] - Expect.sequenceEqual "ofSeq from Array" (Array.toSeq test) (DList.ofSeq test |> DList.toSeq) - } + test "singleton length 1" { Expect.equal "singleton length" 1 (DList.singleton 1 |> DList.length) } - test "test singleton should return a Unit containing the solo value" { Expect.equal "singleton" 1 (DList.singleton 1 |> DList.head) } + test "empty length 0" { Expect.equal "empty length" 0 (DList.empty |> DList.length) } - test "test append should join two DLists together" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let q2 = DList.ofSeq [ "1"; "2"; "3"; "4"; "5"; "6" ] - let q3 = DList.append q q2 - Expect.equal "append" 12 (q3 |> DList.length) - Expect.equal "append" "f" (q3 |> DList.head) - } + test "test ofSeq should create a DList from a list" { + let test = [ for i in 0..4 -> i ] + Expect.sequenceEqual "ofSeq" (List.toSeq test) (DList.ofSeq test |> DList.toSeq) + } - test "test toSeq" { - let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "test ofSeq should create a DList from an array" { + let test = [| for i in 0..4 -> i |] + Expect.sequenceEqual "ofSeq from Array" (Array.toSeq test) (DList.ofSeq test |> DList.toSeq) + } - Expect.equal "toSeq" [ "f"; "e"; "d"; "c"; "b"; "a" ] - <| List.ofSeq(DList.toSeq q) - } + test "test singleton should return a Unit containing the solo value" { Expect.equal "singleton" 1 (DList.singleton 1 |> DList.head) } - test "test toList" { - let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] - let q = DList.ofSeq l - Expect.equal "toList" l <| DList.toList q - } + test "test append should join two DLists together" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + let q2 = DList.ofSeq [ "1"; "2"; "3"; "4"; "5"; "6" ] + let q3 = DList.append q q2 + Expect.equal "append" 12 (q3 |> DList.length) + Expect.equal "append" "f" (q3 |> DList.head) + } - test "structural equality" { - let l1 = DList.ofSeq [ 1..100 ] - let l2 = DList.ofSeq [ 1..100 ] + test "test toSeq" { + let q = DList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - Expect.sequenceEqual "structural equality" l1 l2 + Expect.equal "toSeq" [ "f"; "e"; "d"; "c"; "b"; "a" ] + <| List.ofSeq(DList.toSeq q) + } - let l3 = DList.ofSeq [ 1..99 ] |> DList.conj 7 + test "test toList" { + let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] + let q = DList.ofSeq l + Expect.equal "toList" l <| DList.toList q + } - Expect.isFalse "structural equality" (l1 = l3) - } + test "structural equality" { + let l1 = DList.ofSeq [ 1..100 ] + let l2 = DList.ofSeq [ 1..100 ] - test "test DList pairwise on 0 1 2 3 lengths" { - for lengthTest in 0..3 do - let testList = [ for i in 0..lengthTest -> i ] - let expectedPairs = testList |> List.pairwise |> DList.ofSeq - let testDList = DList.ofSeq testList - let paired = DList.pairwise testDList + Expect.sequenceEqual "structural equality" l1 l2 - let message = - sprintf "pairwise does not match List.pairwise for length %d" lengthTest + let l3 = DList.ofSeq [ 1..99 ] |> DList.conj 7 - Expect.sequenceEqual message expectedPairs paired - } + Expect.isFalse "structural equality" (l1 = l3) + } - test "test DList pairwise 10k" { - let testList = [ for i in 0..10000 -> i ] - let expectedPairs = testList |> List.pairwise |> DList.ofSeq - let testDList = DList.ofSeq testList - let paired = DList.pairwise testDList - Expect.sequenceEqual "pairwise does not match List.pairwise" expectedPairs paired - } - ] + test "test DList pairwise on 0 1 2 3 lengths" { + for lengthTest in 0..3 do + let testList = [ for i in 0..lengthTest -> i ] + let expectedPairs = testList |> List.pairwise |> DList.ofSeq + let testDList = DList.ofSeq testList + let paired = DList.pairwise testDList + + let message = + sprintf "pairwise does not match List.pairwise for length %d" lengthTest + + Expect.sequenceEqual message expectedPairs paired + } + + test "test DList pairwise 10k" { + let testList = [ for i in 0..10000 -> i ] + let expectedPairs = testList |> List.pairwise |> DList.ofSeq + let testDList = DList.ofSeq testList + let paired = DList.pairwise testDList + Expect.sequenceEqual "pairwise does not match List.pairwise" expectedPairs paired + } ] [] let propertyTestDList = @@ -182,50 +182,56 @@ module DListTests = (* non-IDList generators from random ofList *) - let DListOfListGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((DList.ofSeq x), x) - } + let DListOfListGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((DList.ofSeq x), x) + } (* IDList generators from random ofSeq and/or DList.conj elements from random list *) - let DListIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((DList.ofSeq x |> enDListThruList y), (x @ y)) - } - - let DListIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((DList.ofSeq x), x) - } - - let DListIntConjGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((DList.empty |> enDListThruList x), x) - } - - let DListObjGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((DList.ofSeq x |> enDListThruList y), (x @ y)) - } - - let DListStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((DList.ofSeq x |> enDListThruList y), (x @ y)) - } + let DListIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((DList.ofSeq x |> enDListThruList y), (x @ y)) + } + + let DListIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((DList.ofSeq x), x) + } + + let DListIntConjGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((DList.empty |> enDListThruList x), x) + } + + let DListObjGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((DList.ofSeq x |> enDListThruList y), (x @ y)) + } + + let DListStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((DList.ofSeq x |> enDListThruList y), (x @ y)) + } let intGens start = let v = Array.create 3 DListIntGen @@ -237,143 +243,144 @@ module DListTests = let intGensStart2 = intGens 2 // this will accept 11 out of 12 - testList "DList property tests" [ - - testPropertyWithConfig - config10k - "DList fold matches build list rev" - (Prop.forAll(Arb.fromGen DListIntGen) - <| fun (q, l) -> q |> DList.fold (fun l' elem -> elem :: l') [] = List.rev l) - - testPropertyWithConfig - config10k - "DList OfSeq fold matches build list rev" - (Prop.forAll(Arb.fromGen DListIntOfSeqGen) - <| fun (q, l) -> q |> DList.fold (fun l' elem -> elem :: l') [] = List.rev l) - - testPropertyWithConfig - config10k - "DList Conj fold matches build list rev" - (Prop.forAll(Arb.fromGen DListIntConjGen) - <| fun (q, l) -> q |> DList.fold (fun l' elem -> elem :: l') [] = List.rev l) - - testPropertyWithConfig - config10k - "DList foldBack matches build list" - (Prop.forAll(Arb.fromGen DListIntGen) - <| fun (q, l) -> DList.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "DList OfSeq foldBack matches build list" - (Prop.forAll(Arb.fromGen DListIntOfSeqGen) - <| fun (q, l) -> DList.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "DList Conj foldBack matches build list" - (Prop.forAll(Arb.fromGen DListIntConjGen) - <| fun (q, l) -> DList.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "get DList.head from DList 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> DList.head q = List.item 0 l) - - testPropertyWithConfig - config10k - "get DList.head from DList 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> DList.head q = List.item 0 l) - - testPropertyWithConfig - config10k - "get DList.head from DList 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> DList.head q = List.item 0 l) - - testPropertyWithConfig - config10k - "get DList.head from DList safely 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> (DList.tryHead q).Value = List.item 0 l) - - testPropertyWithConfig - config10k - "get DList.head from DList safely 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> (DList.tryHead q).Value = List.item 0 l) - - testPropertyWithConfig - config10k - "get DList.head from DList safely 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> (DList.tryHead q).Value = List.item 0 l) - - testPropertyWithConfig - config10k - "get DList.tail from DList 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun ((q: DList), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get DList.tail from DList 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun ((q: DList), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get DList.tail from DList 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun ((q: DList), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get DList.tail from DList safely 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get DList.tail from DList safely 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get DList.tail from DList safely 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "int DList builds and serializes 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int DList builds and serializes 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int DList builds and serializes 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "obj DList builds and serializes" - (Prop.forAll(Arb.fromGen DListObjGen) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "string DList builds and serializes" - (Prop.forAll(Arb.fromGen DListStringGen) - <| fun (q, l) -> q |> Seq.toList = l) - ] + testList + "DList property tests" + [ + + testPropertyWithConfig + config10k + "DList fold matches build list rev" + (Prop.forAll(Arb.fromGen DListIntGen) + <| fun (q, l) -> q |> DList.fold (fun l' elem -> elem :: l') [] = List.rev l) + + testPropertyWithConfig + config10k + "DList OfSeq fold matches build list rev" + (Prop.forAll(Arb.fromGen DListIntOfSeqGen) + <| fun (q, l) -> q |> DList.fold (fun l' elem -> elem :: l') [] = List.rev l) + + testPropertyWithConfig + config10k + "DList Conj fold matches build list rev" + (Prop.forAll(Arb.fromGen DListIntConjGen) + <| fun (q, l) -> q |> DList.fold (fun l' elem -> elem :: l') [] = List.rev l) + + testPropertyWithConfig + config10k + "DList foldBack matches build list" + (Prop.forAll(Arb.fromGen DListIntGen) + <| fun (q, l) -> DList.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "DList OfSeq foldBack matches build list" + (Prop.forAll(Arb.fromGen DListIntOfSeqGen) + <| fun (q, l) -> DList.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "DList Conj foldBack matches build list" + (Prop.forAll(Arb.fromGen DListIntConjGen) + <| fun (q, l) -> DList.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "get DList.head from DList 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> DList.head q = List.item 0 l) + + testPropertyWithConfig + config10k + "get DList.head from DList 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> DList.head q = List.item 0 l) + + testPropertyWithConfig + config10k + "get DList.head from DList 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> DList.head q = List.item 0 l) + + testPropertyWithConfig + config10k + "get DList.head from DList safely 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> (DList.tryHead q).Value = List.item 0 l) + + testPropertyWithConfig + config10k + "get DList.head from DList safely 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> (DList.tryHead q).Value = List.item 0 l) + + testPropertyWithConfig + config10k + "get DList.head from DList safely 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> (DList.tryHead q).Value = List.item 0 l) + + testPropertyWithConfig + config10k + "get DList.tail from DList 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun ((q: DList), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get DList.tail from DList 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun ((q: DList), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get DList.tail from DList 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun ((q: DList), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get DList.tail from DList safely 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get DList.tail from DList safely 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get DList.tail from DList safely 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "int DList builds and serializes 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int DList builds and serializes 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int DList builds and serializes 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "obj DList builds and serializes" + (Prop.forAll(Arb.fromGen DListObjGen) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "string DList builds and serializes" + (Prop.forAll(Arb.fromGen DListStringGen) + <| fun (q, l) -> q |> Seq.toList = l) ] diff --git a/tests/FSharpx.Collections.Tests/DequeTest.fs b/tests/FSharpx.Collections.Tests/DequeTest.fs index 216e2ab8..153366db 100644 --- a/tests/FSharpx.Collections.Tests/DequeTest.fs +++ b/tests/FSharpx.Collections.Tests/DequeTest.fs @@ -156,808 +156,808 @@ module DequeTests = |> Deque.conj "b" |> Deque.conj "a" - testList "Deque" [ - test "empty dqueue should be empty" { Expect.isTrue "empty is empty" (Deque.empty |> Deque.isEmpty) } - - test "Deque.cons works" { Expect.isFalse "not empty" (len2 |> Deque.isEmpty) } - - test "Deque.conj works" { Expect.isFalse "" (len2conj |> Deque.isEmpty) } - - test "Deque.singleton head works" { Expect.equal "Deque.singleton" "a" (len1 |> Deque.head) } - - test "Deque.singleton last works" { Expect.equal "" "a" (len1 |> Deque.last) } - - test "TryUncons wind-down to None" { - let q = Deque.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - let rec loop(q': Deque) = - match (q'.TryUncons) with - | Some(hd, tl) -> loop tl - | None -> () - - Expect.equal "unit" () <| loop q - } - - test "Uncons wind-down to None" { - let q = Deque.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - let rec loop(q': Deque) = - match (q'.Uncons) with - | hd, tl when tl.Length = 0 -> () - | hd, tl -> loop tl - - Expect.equal "unit" () <| loop q - } - - test "toSeq works" { - let q = Deque.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let l = List.ofSeq q - Expect.equal "toSeq" l <| List.ofSeq(Deque.toSeq q) - } - - test "Deque.tail of Deque.singleton empty" { - Expect.isTrue "Deque.isEmpty" (len1 |> Deque.tail |> Deque.isEmpty) - Expect.isTrue "Deque.isEmpty" (len1conj |> Deque.tail |> Deque.isEmpty) - } - - test "Deque.tail of Deque.tail of 2 empty" { - Expect.isTrue "Deque.isEmpty" (len2 |> Deque.tail |> Deque.tail |> Deque.isEmpty) - Expect.isTrue "Deque.isEmpty" (len2conj |> Deque.tail |> Deque.tail |> Deque.isEmpty) - } - - test "Deque.initial of Deque.singleton empty" { - Expect.isTrue "Deque.isEmpty" (len1 |> Deque.initial |> Deque.isEmpty) - Expect.isTrue "Deque.isEmpty" (len1conj |> Deque.initial |> Deque.isEmpty) - } - - test "head, Deque.tail, and length work test 1" { - let t1 = Deque.tail len2 - let t1s = Deque.tail len2conj - - Expect.isTrue - "head, Deque.tail, and length" - (((Deque.length t1) = 1) - && ((Deque.length t1s) = 1) - && ((Deque.head t1) = "a") - && ((Deque.head t1s) = "a")) - } - - test "head, Deque.tail, and length work test 2" { - let t1 = Deque.tail len3 - let t1s = Deque.tail len3conj - - let t1_1 = Deque.tail t1 - let t1_1s = Deque.tail t1s - - (((Deque.length t1) = 2) - && ((Deque.length t1s) = 2) - && ((Deque.head t1) = "b") - && ((Deque.head t1s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 3" { - let t1 = Deque.tail len4 - let t1s = Deque.tail len4conj - - let t1_2 = Deque.tail t1 - let t1_2s = Deque.tail t1s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 3) - && ((Deque.length t1s) = 3) - && ((Deque.head t1) = "c") - && ((Deque.head t1s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 4" { - let t1 = Deque.tail len5 - let t1s = Deque.tail len5conj - - let t1_3 = Deque.tail t1 - let t1_3s = Deque.tail t1s - - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 4) - && ((Deque.length t1s) = 4) - && ((Deque.head t1) = "d") - && ((Deque.head t1s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 5" { - let t1 = Deque.tail len6 - let t1s = Deque.tail len6conj - - let t1_4 = Deque.tail t1 - let t1_4s = Deque.tail t1s - - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 5) - && ((Deque.length t1s) = 5) - && ((Deque.head t1) = "e") - && ((Deque.head t1s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 6" { - let t1 = Deque.tail len7 - let t1s = Deque.tail len7conj - - let t1_5 = Deque.tail t1 - let t1_5s = Deque.tail t1s - - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 6) - && ((Deque.length t1s) = 6) - && ((Deque.head t1) = "f") - && ((Deque.head t1s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 7" { - let t1 = Deque.tail len8 - let t1s = Deque.tail len8conj - let t1_6 = Deque.tail t1 - let t1_6s = Deque.tail t1s - let t1_5 = Deque.tail t1_6 - let t1_5s = Deque.tail t1_6s - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 7) - && ((Deque.length t1s) = 7) - && ((Deque.head t1) = "g") - && ((Deque.head t1s) = "g") - && ((Deque.length t1_6) = 6) - && ((Deque.length t1_6s) = 6) - && ((Deque.head t1_6) = "f") - && ((Deque.head t1_6s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 8" { - let t1 = Deque.tail len9 - let t1s = Deque.tail len9conj - let t1_7 = Deque.tail t1 - let t1_7s = Deque.tail t1s - let t1_6 = Deque.tail t1_7 - let t1_6s = Deque.tail t1_7s - let t1_5 = Deque.tail t1_6 - let t1_5s = Deque.tail t1_6s - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 8) - && ((Deque.length t1s) = 8) - && ((Deque.head t1) = "h") - && ((Deque.head t1s) = "h") - && ((Deque.length t1_7) = 7) - && ((Deque.length t1_7s) = 7) - && ((Deque.head t1_7) = "g") - && ((Deque.head t1_7s) = "g") - && ((Deque.length t1_6) = 6) - && ((Deque.length t1_6s) = 6) - && ((Deque.head t1_6) = "f") - && ((Deque.head t1_6s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - test "head, Deque.tail, and length work test 9" { - let t1 = Deque.tail lena - let t1s = Deque.tail lenaconj - let t1_8 = Deque.tail t1 - let t1_8s = Deque.tail t1s - let t1_7 = Deque.tail t1_8 - let t1_7s = Deque.tail t1_8s - let t1_6 = Deque.tail t1_7 - let t1_6s = Deque.tail t1_7s - let t1_5 = Deque.tail t1_6 - let t1_5s = Deque.tail t1_6s - let t1_4 = Deque.tail t1_5 - let t1_4s = Deque.tail t1_5s - let t1_3 = Deque.tail t1_4 - let t1_3s = Deque.tail t1_4s - let t1_2 = Deque.tail t1_3 - let t1_2s = Deque.tail t1_3s - let t1_1 = Deque.tail t1_2 - let t1_1s = Deque.tail t1_2s - - (((Deque.length t1) = 9) - && ((Deque.length t1s) = 9) - && ((Deque.head t1) = "i") - && ((Deque.head t1s) = "i") - && ((Deque.length t1_8) = 8) - && ((Deque.length t1_8s) = 8) - && ((Deque.head t1_8) = "h") - && ((Deque.head t1_8s) = "h") - && ((Deque.length t1_7) = 7) - && ((Deque.length t1_7s) = 7) - && ((Deque.head t1_7) = "g") - && ((Deque.head t1_7s) = "g") - && ((Deque.length t1_6) = 6) - && ((Deque.length t1_6s) = 6) - && ((Deque.head t1_6) = "f") - && ((Deque.head t1_6s) = "f") - && ((Deque.length t1_5) = 5) - && ((Deque.length t1_5s) = 5) - && ((Deque.head t1_5) = "e") - && ((Deque.head t1_5s) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.length t1_4s) = 4) - && ((Deque.head t1_4) = "d") - && ((Deque.head t1_4s) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.length t1_3s) = 3) - && ((Deque.head t1_3) = "c") - && ((Deque.head t1_3s) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.length t1_2s) = 2) - && ((Deque.head t1_2) = "b") - && ((Deque.head t1_2s) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.length t1_1s) = 1) - && ((Deque.head t1_1) = "a") - && ((Deque.head t1_1s) = "a")) - |> Expect.isTrue "head, Deque.tail, and length" - } - - //the previous series thoroughly tested construction by Deque.conj, so we'll leave those out - test "last, init, and length work test 1" { - let t1 = Deque.initial len2 - Expect.isTrue "last, init, and length" (((Deque.length t1) = 1) && ((Deque.last t1) = "b")) - } - - test "last, init, and length work test 2" { - let t1 = Deque.initial len3 - let t1_1 = Deque.initial t1 - - Expect.isTrue - "last, init, and length" - (((Deque.length t1) = 2) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 1) - && ((Deque.last t1_1) = "c")) - } - - test "last, init, and length work test 3" { - let t1 = Deque.initial len4 - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - - (((Deque.length t1) = 3) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 2) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 1) - && ((Deque.last t1_2) = "d")) - |> Expect.isTrue "last, init, and length" - } - - test "last, init, and length work test 4" { - let t1 = Deque.initial len5 - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - let t1_3 = Deque.initial t1_2 - - (((Deque.length t1) = 4) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 3) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 2) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 1) - && ((Deque.last t1_3) = "e")) - |> Expect.isTrue "last, init, and length" - } - - test "last, init, and length work test 5" { - let t1 = Deque.initial len6 - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - let t1_3 = Deque.initial t1_2 - let t1_4 = Deque.initial t1_3 - - (((Deque.length t1) = 5) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 4) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 3) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 2) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 1) - && ((Deque.last t1_4) = "f")) - |> Expect.isTrue "last, init, and length" - } - - test "last, init, and length work test 6" { - let t1 = Deque.initial len7 - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - let t1_3 = Deque.initial t1_2 - let t1_4 = Deque.initial t1_3 - let t1_5 = Deque.initial t1_4 - - (((Deque.length t1) = 6) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 5) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 4) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 3) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 2) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 1) - && ((Deque.last t1_5) = "g")) - |> Expect.isTrue "last, init, and length" - } - - test "last, init, and length work test 7" { - let t1 = Deque.initial len8 - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - let t1_3 = Deque.initial t1_2 - let t1_4 = Deque.initial t1_3 - let t1_5 = Deque.initial t1_4 - let t1_6 = Deque.initial t1_5 - - (((Deque.length t1) = 7) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 6) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 5) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 4) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 3) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 2) - && ((Deque.last t1_5) = "g") - && ((Deque.length t1_6) = 1) - && ((Deque.last t1_6) = "h")) - |> Expect.isTrue "last, init, and length" - } - - test "last, init, and length work test 8" { - let t1 = Deque.initial len9 - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - let t1_3 = Deque.initial t1_2 - let t1_4 = Deque.initial t1_3 - let t1_5 = Deque.initial t1_4 - let t1_6 = Deque.initial t1_5 - let t1_7 = Deque.initial t1_6 - - (((Deque.length t1) = 8) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 7) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 6) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 5) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 4) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 3) - && ((Deque.last t1_5) = "g") - && ((Deque.length t1_6) = 2) - && ((Deque.last t1_6) = "h") - && ((Deque.length t1_7) = 1) - && ((Deque.last t1_7) = "i")) - |> Expect.isTrue "last, init, and length" - } - - test "last, init, and length work test 9" { - let t1 = Deque.initial lena - let t1_1 = Deque.initial t1 - let t1_2 = Deque.initial t1_1 - let t1_3 = Deque.initial t1_2 - let t1_4 = Deque.initial t1_3 - let t1_5 = Deque.initial t1_4 - let t1_6 = Deque.initial t1_5 - let t1_7 = Deque.initial t1_6 - let t1_8 = Deque.initial t1_7 - - (((Deque.length t1) = 9) - && ((Deque.last t1) = "b") - && ((Deque.length t1_1) = 8) - && ((Deque.last t1_1) = "c") - && ((Deque.length t1_2) = 7) - && ((Deque.last t1_2) = "d") - && ((Deque.length t1_3) = 6) - && ((Deque.last t1_3) = "e") - && ((Deque.length t1_4) = 5) - && ((Deque.last t1_4) = "f") - && ((Deque.length t1_5) = 4) - && ((Deque.last t1_5) = "g") - && ((Deque.length t1_6) = 3) - && ((Deque.last t1_6) = "h") - && ((Deque.length t1_7) = 2) - && ((Deque.last t1_7) = "i") - && ((Deque.length t1_8) = 1) - && ((Deque.last t1_8) = "j")) - |> Expect.isTrue "last, init, and length" - } - - test "IEnumerable Seq nth" { Expect.equal "IEnumerable nth" "e" (lena |> Seq.item 5) } - - test "IEnumerable Seq length" { Expect.equal "IEnumerable length" 10 (lena |> Seq.length) } - - test "type Deque.cons works" { Expect.equal "Deque.cons" "zz" (lena.Cons "zz" |> Deque.head) } - - test "ofCatLists and Deque.uncons" { - let d = Deque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] - let h1, t1 = Deque.uncons d - let h2, t2 = Deque.uncons t1 - let h3, t3 = Deque.uncons t2 - let h4, t4 = Deque.uncons t3 - let h5, t5 = Deque.uncons t4 - let h6, t6 = Deque.uncons t5 - - Expect.isTrue - "ofCatLists and Deque.uncons" - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f") - && (Deque.isEmpty t6)) - } - - test "Deque.unconj works" { - let d = Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] - let i1, l1 = Deque.unconj d - let i2, l2 = Deque.unconj i1 - let i3, l3 = Deque.unconj i2 - let i4, l4 = Deque.unconj i3 - let i5, l5 = Deque.unconj i4 - let i6, l6 = Deque.unconj i5 - - Expect.isTrue - "Deque.unconj" - ((l1 = "a") - && (l2 = "b") - && (l3 = "c") - && (l4 = "d") - && (l5 = "e") - && (l6 = "f") - && (Deque.isEmpty i6)) - } - - test "Deque.conj pattern discriminator" { - let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let i1, l1 = Deque.unconj d - - let i2, l2 = - match i1 with - | Deque.Conj(i, l) -> i, l - | _ -> i1, "x" - - Expect.isTrue "Deque.conj" ((l2 = "b") && ((Deque.length i2) = 4)) - } - - test "Deque.cons pattern discriminator" { - let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - let h1, t1 = Deque.uncons d - - let h2, t2 = - match t1 with - | Deque.Cons(h, t) -> h, t - | _ -> "x", t1 - - Expect.isTrue "Deque.cons" ((h2 = "e") && ((Deque.length t2) = 4)) - } - - test "Deque.cons and Deque.conj pattern discriminator" { - let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) - - let mid1 = - match d with - | Deque.Cons(h, Deque.Conj(i, l)) -> i - | _ -> d - - let head, last = - match mid1 with - | Deque.Cons(h, Deque.Conj(i, l)) -> h, l - | _ -> "x", "x" - - Expect.isTrue "Deque.cons and Deque.conj" ((head = "e") && (last = "b")) - } - - test "rev deque length 1" { Expect.equal "length" "a" (Deque.rev len1 |> Deque.head) } - - test "rev deque length 2" { - let r1 = Deque.rev len2 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - - Expect.isTrue "length" ((h1 = "a") && (h2 = "b")) - } - - test "rev deque length 3" { - let r1 = Deque.rev len3 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - - Expect.isTrue "length" ((h1 = "a") && (h2 = "b") && (h3 = "c")) - } - - test "rev deque length 4" { - let r1 = Deque.rev len4 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - let t4 = Deque.tail t3 - let h4 = Deque.head t4 - - Expect.isTrue "length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d")) - } - - test "rev deque length 5" { - let r1 = Deque.rev len5 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - let t4 = Deque.tail t3 - let h4 = Deque.head t4 - let t5 = Deque.tail t4 - let h5 = Deque.head t5 - - Expect.isTrue "length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d") && (h5 = "e")) - } - - test "rev deque length 6" { - let r1 = Deque.rev len6 - let h1 = Deque.head r1 - let t2 = Deque.tail r1 - let h2 = Deque.head t2 - let t3 = Deque.tail t2 - let h3 = Deque.head t3 - let t4 = Deque.tail t3 - let h4 = Deque.head t4 - let t5 = Deque.tail t4 - let h5 = Deque.head t5 - let t6 = Deque.tail t5 - let h6 = Deque.head t6 - - Expect.isTrue - "rev length" - ((h1 = "a") - && (h2 = "b") - && (h3 = "c") - && (h4 = "d") - && (h5 = "e") - && (h6 = "f")) - } - - test "Deque.tryUncons on empty" { - let q = Deque.empty - Expect.isNone "Deque.tryUncons" <| Deque.tryUncons q - } - - test "Deque.tryUncons on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - let x, _ = (Deque.tryUncons q).Value - Expect.equal "Deque.tryUncons" "a" x - } - - test "tryUnconj on empty" { - let q = Deque.empty - Expect.isNone "tryUnconj" <| Deque.tryUnconj q - } - - test "tryUnconj on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - let _, x = (Deque.tryUnconj q).Value - Expect.equal "tryUnconj" "d" x - } - - test "tryHead on empty" { - let q = Deque.empty - Expect.isNone "tryHead" <| Deque.tryHead q - } - - test "tryHead on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - Expect.equal "tryHead" "a" (Deque.tryHead q).Value - } - - test "tryInitial on empty" { - let q = Deque.empty - Expect.isNone "tryInitial" <| Deque.tryInitial q - } - - test "tryinitial on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - let x = (Deque.tryInitial q).Value - let x2 = x |> Deque.last - Expect.equal "tryinitial" "c" x2 - } - - test "tryLast on empty" { - let q = Deque.empty - Expect.isNone "tryLast" <| Deque.tryLast q - } - - test "tryLast on deque" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - Expect.equal "tryLast" "d" (Deque.tryLast q).Value - Expect.equal "tryLast" "a" (len2 |> Deque.tryLast).Value - Expect.equal "tryLast" "a" (len2conj |> Deque.tryLast).Value - } - - test "tryTail on empty" { - let q = Deque.empty - Expect.isNone "tryTail" <| Deque.tryTail q - } - - test "tryTail on q" { - let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] - Expect.equal "tryTail" "b" ((Deque.tryTail q).Value |> Deque.head) - } - - test "structural equality" { - - let l1 = Deque.ofSeq [ 1..100 ] - let l2 = Deque.ofSeq [ 1..100 ] - - Expect.equal "equality" l1 l2 - - let l3 = Deque.ofSeq [ 1..99 ] |> Deque.conj 7 - - Expect.notEqual "equality" l1 l3 - } - ] + testList + "Deque" + [ test "empty dqueue should be empty" { Expect.isTrue "empty is empty" (Deque.empty |> Deque.isEmpty) } + + test "Deque.cons works" { Expect.isFalse "not empty" (len2 |> Deque.isEmpty) } + + test "Deque.conj works" { Expect.isFalse "" (len2conj |> Deque.isEmpty) } + + test "Deque.singleton head works" { Expect.equal "Deque.singleton" "a" (len1 |> Deque.head) } + + test "Deque.singleton last works" { Expect.equal "" "a" (len1 |> Deque.last) } + + test "TryUncons wind-down to None" { + let q = Deque.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + let rec loop(q': Deque) = + match (q'.TryUncons) with + | Some(hd, tl) -> loop tl + | None -> () + + Expect.equal "unit" () <| loop q + } + + test "Uncons wind-down to None" { + let q = Deque.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + let rec loop(q': Deque) = + match (q'.Uncons) with + | hd, tl when tl.Length = 0 -> () + | hd, tl -> loop tl + + Expect.equal "unit" () <| loop q + } + + test "toSeq works" { + let q = Deque.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + let l = List.ofSeq q + Expect.equal "toSeq" l <| List.ofSeq(Deque.toSeq q) + } + + test "Deque.tail of Deque.singleton empty" { + Expect.isTrue "Deque.isEmpty" (len1 |> Deque.tail |> Deque.isEmpty) + Expect.isTrue "Deque.isEmpty" (len1conj |> Deque.tail |> Deque.isEmpty) + } + + test "Deque.tail of Deque.tail of 2 empty" { + Expect.isTrue "Deque.isEmpty" (len2 |> Deque.tail |> Deque.tail |> Deque.isEmpty) + Expect.isTrue "Deque.isEmpty" (len2conj |> Deque.tail |> Deque.tail |> Deque.isEmpty) + } + + test "Deque.initial of Deque.singleton empty" { + Expect.isTrue "Deque.isEmpty" (len1 |> Deque.initial |> Deque.isEmpty) + Expect.isTrue "Deque.isEmpty" (len1conj |> Deque.initial |> Deque.isEmpty) + } + + test "head, Deque.tail, and length work test 1" { + let t1 = Deque.tail len2 + let t1s = Deque.tail len2conj + + Expect.isTrue + "head, Deque.tail, and length" + (((Deque.length t1) = 1) + && ((Deque.length t1s) = 1) + && ((Deque.head t1) = "a") + && ((Deque.head t1s) = "a")) + } + + test "head, Deque.tail, and length work test 2" { + let t1 = Deque.tail len3 + let t1s = Deque.tail len3conj + + let t1_1 = Deque.tail t1 + let t1_1s = Deque.tail t1s + + (((Deque.length t1) = 2) + && ((Deque.length t1s) = 2) + && ((Deque.head t1) = "b") + && ((Deque.head t1s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 3" { + let t1 = Deque.tail len4 + let t1s = Deque.tail len4conj + + let t1_2 = Deque.tail t1 + let t1_2s = Deque.tail t1s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 3) + && ((Deque.length t1s) = 3) + && ((Deque.head t1) = "c") + && ((Deque.head t1s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 4" { + let t1 = Deque.tail len5 + let t1s = Deque.tail len5conj + + let t1_3 = Deque.tail t1 + let t1_3s = Deque.tail t1s + + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 4) + && ((Deque.length t1s) = 4) + && ((Deque.head t1) = "d") + && ((Deque.head t1s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 5" { + let t1 = Deque.tail len6 + let t1s = Deque.tail len6conj + + let t1_4 = Deque.tail t1 + let t1_4s = Deque.tail t1s + + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 5) + && ((Deque.length t1s) = 5) + && ((Deque.head t1) = "e") + && ((Deque.head t1s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 6" { + let t1 = Deque.tail len7 + let t1s = Deque.tail len7conj + + let t1_5 = Deque.tail t1 + let t1_5s = Deque.tail t1s + + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 6) + && ((Deque.length t1s) = 6) + && ((Deque.head t1) = "f") + && ((Deque.head t1s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 7" { + let t1 = Deque.tail len8 + let t1s = Deque.tail len8conj + let t1_6 = Deque.tail t1 + let t1_6s = Deque.tail t1s + let t1_5 = Deque.tail t1_6 + let t1_5s = Deque.tail t1_6s + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 7) + && ((Deque.length t1s) = 7) + && ((Deque.head t1) = "g") + && ((Deque.head t1s) = "g") + && ((Deque.length t1_6) = 6) + && ((Deque.length t1_6s) = 6) + && ((Deque.head t1_6) = "f") + && ((Deque.head t1_6s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 8" { + let t1 = Deque.tail len9 + let t1s = Deque.tail len9conj + let t1_7 = Deque.tail t1 + let t1_7s = Deque.tail t1s + let t1_6 = Deque.tail t1_7 + let t1_6s = Deque.tail t1_7s + let t1_5 = Deque.tail t1_6 + let t1_5s = Deque.tail t1_6s + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 8) + && ((Deque.length t1s) = 8) + && ((Deque.head t1) = "h") + && ((Deque.head t1s) = "h") + && ((Deque.length t1_7) = 7) + && ((Deque.length t1_7s) = 7) + && ((Deque.head t1_7) = "g") + && ((Deque.head t1_7s) = "g") + && ((Deque.length t1_6) = 6) + && ((Deque.length t1_6s) = 6) + && ((Deque.head t1_6) = "f") + && ((Deque.head t1_6s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + test "head, Deque.tail, and length work test 9" { + let t1 = Deque.tail lena + let t1s = Deque.tail lenaconj + let t1_8 = Deque.tail t1 + let t1_8s = Deque.tail t1s + let t1_7 = Deque.tail t1_8 + let t1_7s = Deque.tail t1_8s + let t1_6 = Deque.tail t1_7 + let t1_6s = Deque.tail t1_7s + let t1_5 = Deque.tail t1_6 + let t1_5s = Deque.tail t1_6s + let t1_4 = Deque.tail t1_5 + let t1_4s = Deque.tail t1_5s + let t1_3 = Deque.tail t1_4 + let t1_3s = Deque.tail t1_4s + let t1_2 = Deque.tail t1_3 + let t1_2s = Deque.tail t1_3s + let t1_1 = Deque.tail t1_2 + let t1_1s = Deque.tail t1_2s + + (((Deque.length t1) = 9) + && ((Deque.length t1s) = 9) + && ((Deque.head t1) = "i") + && ((Deque.head t1s) = "i") + && ((Deque.length t1_8) = 8) + && ((Deque.length t1_8s) = 8) + && ((Deque.head t1_8) = "h") + && ((Deque.head t1_8s) = "h") + && ((Deque.length t1_7) = 7) + && ((Deque.length t1_7s) = 7) + && ((Deque.head t1_7) = "g") + && ((Deque.head t1_7s) = "g") + && ((Deque.length t1_6) = 6) + && ((Deque.length t1_6s) = 6) + && ((Deque.head t1_6) = "f") + && ((Deque.head t1_6s) = "f") + && ((Deque.length t1_5) = 5) + && ((Deque.length t1_5s) = 5) + && ((Deque.head t1_5) = "e") + && ((Deque.head t1_5s) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.length t1_4s) = 4) + && ((Deque.head t1_4) = "d") + && ((Deque.head t1_4s) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.length t1_3s) = 3) + && ((Deque.head t1_3) = "c") + && ((Deque.head t1_3s) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.length t1_2s) = 2) + && ((Deque.head t1_2) = "b") + && ((Deque.head t1_2s) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.length t1_1s) = 1) + && ((Deque.head t1_1) = "a") + && ((Deque.head t1_1s) = "a")) + |> Expect.isTrue "head, Deque.tail, and length" + } + + //the previous series thoroughly tested construction by Deque.conj, so we'll leave those out + test "last, init, and length work test 1" { + let t1 = Deque.initial len2 + Expect.isTrue "last, init, and length" (((Deque.length t1) = 1) && ((Deque.last t1) = "b")) + } + + test "last, init, and length work test 2" { + let t1 = Deque.initial len3 + let t1_1 = Deque.initial t1 + + Expect.isTrue + "last, init, and length" + (((Deque.length t1) = 2) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 1) + && ((Deque.last t1_1) = "c")) + } + + test "last, init, and length work test 3" { + let t1 = Deque.initial len4 + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + + (((Deque.length t1) = 3) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 2) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 1) + && ((Deque.last t1_2) = "d")) + |> Expect.isTrue "last, init, and length" + } + + test "last, init, and length work test 4" { + let t1 = Deque.initial len5 + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + let t1_3 = Deque.initial t1_2 + + (((Deque.length t1) = 4) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 3) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 2) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 1) + && ((Deque.last t1_3) = "e")) + |> Expect.isTrue "last, init, and length" + } + + test "last, init, and length work test 5" { + let t1 = Deque.initial len6 + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + let t1_3 = Deque.initial t1_2 + let t1_4 = Deque.initial t1_3 + + (((Deque.length t1) = 5) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 4) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 3) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 2) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 1) + && ((Deque.last t1_4) = "f")) + |> Expect.isTrue "last, init, and length" + } + + test "last, init, and length work test 6" { + let t1 = Deque.initial len7 + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + let t1_3 = Deque.initial t1_2 + let t1_4 = Deque.initial t1_3 + let t1_5 = Deque.initial t1_4 + + (((Deque.length t1) = 6) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 5) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 4) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 3) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 2) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 1) + && ((Deque.last t1_5) = "g")) + |> Expect.isTrue "last, init, and length" + } + + test "last, init, and length work test 7" { + let t1 = Deque.initial len8 + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + let t1_3 = Deque.initial t1_2 + let t1_4 = Deque.initial t1_3 + let t1_5 = Deque.initial t1_4 + let t1_6 = Deque.initial t1_5 + + (((Deque.length t1) = 7) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 6) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 5) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 4) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 3) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 2) + && ((Deque.last t1_5) = "g") + && ((Deque.length t1_6) = 1) + && ((Deque.last t1_6) = "h")) + |> Expect.isTrue "last, init, and length" + } + + test "last, init, and length work test 8" { + let t1 = Deque.initial len9 + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + let t1_3 = Deque.initial t1_2 + let t1_4 = Deque.initial t1_3 + let t1_5 = Deque.initial t1_4 + let t1_6 = Deque.initial t1_5 + let t1_7 = Deque.initial t1_6 + + (((Deque.length t1) = 8) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 7) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 6) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 5) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 4) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 3) + && ((Deque.last t1_5) = "g") + && ((Deque.length t1_6) = 2) + && ((Deque.last t1_6) = "h") + && ((Deque.length t1_7) = 1) + && ((Deque.last t1_7) = "i")) + |> Expect.isTrue "last, init, and length" + } + + test "last, init, and length work test 9" { + let t1 = Deque.initial lena + let t1_1 = Deque.initial t1 + let t1_2 = Deque.initial t1_1 + let t1_3 = Deque.initial t1_2 + let t1_4 = Deque.initial t1_3 + let t1_5 = Deque.initial t1_4 + let t1_6 = Deque.initial t1_5 + let t1_7 = Deque.initial t1_6 + let t1_8 = Deque.initial t1_7 + + (((Deque.length t1) = 9) + && ((Deque.last t1) = "b") + && ((Deque.length t1_1) = 8) + && ((Deque.last t1_1) = "c") + && ((Deque.length t1_2) = 7) + && ((Deque.last t1_2) = "d") + && ((Deque.length t1_3) = 6) + && ((Deque.last t1_3) = "e") + && ((Deque.length t1_4) = 5) + && ((Deque.last t1_4) = "f") + && ((Deque.length t1_5) = 4) + && ((Deque.last t1_5) = "g") + && ((Deque.length t1_6) = 3) + && ((Deque.last t1_6) = "h") + && ((Deque.length t1_7) = 2) + && ((Deque.last t1_7) = "i") + && ((Deque.length t1_8) = 1) + && ((Deque.last t1_8) = "j")) + |> Expect.isTrue "last, init, and length" + } + + test "IEnumerable Seq nth" { Expect.equal "IEnumerable nth" "e" (lena |> Seq.item 5) } + + test "IEnumerable Seq length" { Expect.equal "IEnumerable length" 10 (lena |> Seq.length) } + + test "type Deque.cons works" { Expect.equal "Deque.cons" "zz" (lena.Cons "zz" |> Deque.head) } + + test "ofCatLists and Deque.uncons" { + let d = Deque.ofCatLists [ "a"; "b"; "c" ] [ "d"; "e"; "f" ] + let h1, t1 = Deque.uncons d + let h2, t2 = Deque.uncons t1 + let h3, t3 = Deque.uncons t2 + let h4, t4 = Deque.uncons t3 + let h5, t5 = Deque.uncons t4 + let h6, t6 = Deque.uncons t5 + + Expect.isTrue + "ofCatLists and Deque.uncons" + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f") + && (Deque.isEmpty t6)) + } + + test "Deque.unconj works" { + let d = Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ] + let i1, l1 = Deque.unconj d + let i2, l2 = Deque.unconj i1 + let i3, l3 = Deque.unconj i2 + let i4, l4 = Deque.unconj i3 + let i5, l5 = Deque.unconj i4 + let i6, l6 = Deque.unconj i5 + + Expect.isTrue + "Deque.unconj" + ((l1 = "a") + && (l2 = "b") + && (l3 = "c") + && (l4 = "d") + && (l5 = "e") + && (l6 = "f") + && (Deque.isEmpty i6)) + } + + test "Deque.conj pattern discriminator" { + let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let i1, l1 = Deque.unconj d + + let i2, l2 = + match i1 with + | Deque.Conj(i, l) -> i, l + | _ -> i1, "x" + + Expect.isTrue "Deque.conj" ((l2 = "b") && ((Deque.length i2) = 4)) + } + + test "Deque.cons pattern discriminator" { + let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + let h1, t1 = Deque.uncons d + + let h2, t2 = + match t1 with + | Deque.Cons(h, t) -> h, t + | _ -> "x", t1 + + Expect.isTrue "Deque.cons" ((h2 = "e") && ((Deque.length t2) = 4)) + } + + test "Deque.cons and Deque.conj pattern discriminator" { + let d = (Deque.ofCatLists [ "f"; "e"; "d" ] [ "c"; "b"; "a" ]) + + let mid1 = + match d with + | Deque.Cons(h, Deque.Conj(i, l)) -> i + | _ -> d + + let head, last = + match mid1 with + | Deque.Cons(h, Deque.Conj(i, l)) -> h, l + | _ -> "x", "x" + + Expect.isTrue "Deque.cons and Deque.conj" ((head = "e") && (last = "b")) + } + + test "rev deque length 1" { Expect.equal "length" "a" (Deque.rev len1 |> Deque.head) } + + test "rev deque length 2" { + let r1 = Deque.rev len2 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + + Expect.isTrue "length" ((h1 = "a") && (h2 = "b")) + } + + test "rev deque length 3" { + let r1 = Deque.rev len3 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + + Expect.isTrue "length" ((h1 = "a") && (h2 = "b") && (h3 = "c")) + } + + test "rev deque length 4" { + let r1 = Deque.rev len4 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + let t4 = Deque.tail t3 + let h4 = Deque.head t4 + + Expect.isTrue "length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d")) + } + + test "rev deque length 5" { + let r1 = Deque.rev len5 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + let t4 = Deque.tail t3 + let h4 = Deque.head t4 + let t5 = Deque.tail t4 + let h5 = Deque.head t5 + + Expect.isTrue "length" ((h1 = "a") && (h2 = "b") && (h3 = "c") && (h4 = "d") && (h5 = "e")) + } + + test "rev deque length 6" { + let r1 = Deque.rev len6 + let h1 = Deque.head r1 + let t2 = Deque.tail r1 + let h2 = Deque.head t2 + let t3 = Deque.tail t2 + let h3 = Deque.head t3 + let t4 = Deque.tail t3 + let h4 = Deque.head t4 + let t5 = Deque.tail t4 + let h5 = Deque.head t5 + let t6 = Deque.tail t5 + let h6 = Deque.head t6 + + Expect.isTrue + "rev length" + ((h1 = "a") + && (h2 = "b") + && (h3 = "c") + && (h4 = "d") + && (h5 = "e") + && (h6 = "f")) + } + + test "Deque.tryUncons on empty" { + let q = Deque.empty + Expect.isNone "Deque.tryUncons" <| Deque.tryUncons q + } + + test "Deque.tryUncons on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + let x, _ = (Deque.tryUncons q).Value + Expect.equal "Deque.tryUncons" "a" x + } + + test "tryUnconj on empty" { + let q = Deque.empty + Expect.isNone "tryUnconj" <| Deque.tryUnconj q + } + + test "tryUnconj on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + let _, x = (Deque.tryUnconj q).Value + Expect.equal "tryUnconj" "d" x + } + + test "tryHead on empty" { + let q = Deque.empty + Expect.isNone "tryHead" <| Deque.tryHead q + } + + test "tryHead on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + Expect.equal "tryHead" "a" (Deque.tryHead q).Value + } + + test "tryInitial on empty" { + let q = Deque.empty + Expect.isNone "tryInitial" <| Deque.tryInitial q + } + + test "tryinitial on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + let x = (Deque.tryInitial q).Value + let x2 = x |> Deque.last + Expect.equal "tryinitial" "c" x2 + } + + test "tryLast on empty" { + let q = Deque.empty + Expect.isNone "tryLast" <| Deque.tryLast q + } + + test "tryLast on deque" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + Expect.equal "tryLast" "d" (Deque.tryLast q).Value + Expect.equal "tryLast" "a" (len2 |> Deque.tryLast).Value + Expect.equal "tryLast" "a" (len2conj |> Deque.tryLast).Value + } + + test "tryTail on empty" { + let q = Deque.empty + Expect.isNone "tryTail" <| Deque.tryTail q + } + + test "tryTail on q" { + let q = Deque.ofSeq [ "a"; "b"; "c"; "d" ] + Expect.equal "tryTail" "b" ((Deque.tryTail q).Value |> Deque.head) + } + + test "structural equality" { + + let l1 = Deque.ofSeq [ 1..100 ] + let l2 = Deque.ofSeq [ 1..100 ] + + Expect.equal "equality" l1 l2 + + let l3 = Deque.ofSeq [ 1..99 ] |> Deque.conj 7 + + Expect.notEqual "equality" l1 l3 + } ] [] let propertyTestDeque = @@ -972,50 +972,56 @@ module DequeTests = (* non-Deque generators from random ofList *) - let dequeOfListGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((Deque.ofList x), x) - } + let dequeOfListGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((Deque.ofList x), x) + } (* Deque generators from random ofSeq and/or Deque.conj elements from random list *) - let dequeIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((Deque.ofSeq x |> conjThruList y), (x @ y)) - } - - let dequeIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Deque.ofSeq x), x) - } - - let dequeIntConjGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Deque.empty |> conjThruList x), x) - } - - let dequeObjGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((Deque.ofSeq x |> conjThruList y), (x @ y)) - } - - let dequeStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((Deque.ofSeq x |> conjThruList y), (x @ y)) - } + let dequeIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((Deque.ofSeq x |> conjThruList y), (x @ y)) + } + + let dequeIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Deque.ofSeq x), x) + } + + let dequeIntConjGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Deque.empty |> conjThruList x), x) + } + + let dequeObjGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((Deque.ofSeq x |> conjThruList y), (x @ y)) + } + + let dequeStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((Deque.ofSeq x |> conjThruList y), (x @ y)) + } let intGens start = let v = Array.create 3 dequeIntGen @@ -1027,191 +1033,192 @@ module DequeTests = let intGensStart2 = intGens 2 // this will accept 11 out of 12 - testList "Deque property tests" [ - - testPropertyWithConfig - config10k - "Deque fold matches build list rev" - (Prop.forAll(Arb.fromGen dequeIntGen) - <| fun (q, l) -> q |> Deque.fold (fun l' elem -> elem :: l') [] = List.rev l) - - testPropertyWithConfig - config10k - "Deque OfSeq fold matches build list rev" - (Prop.forAll(Arb.fromGen dequeIntOfSeqGen) - <| fun (q, l) -> q |> Deque.fold (fun l' elem -> elem :: l') [] = List.rev l) - - testPropertyWithConfig - config10k - "Deque Conj fold matches build list rev" - (Prop.forAll(Arb.fromGen dequeIntConjGen) - <| fun (q, l) -> q |> Deque.fold (fun l' elem -> elem :: l') [] = List.rev l) - - testPropertyWithConfig - config10k - "Deque foldback matches build list" - (Prop.forAll(Arb.fromGen dequeIntGen) - <| fun (q, l) -> Deque.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "Deque OfSeq foldback matches build list" - (Prop.forAll(Arb.fromGen dequeIntOfSeqGen) - <| fun (q, l) -> Deque.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "Deque Conj foldback matches build list" - (Prop.forAll(Arb.fromGen dequeIntConjGen) - <| fun (q, l) -> Deque.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "int deque builds and serializes 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int deque builds and serializes 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int deque builds and serializes 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "obj deque builds and serializes" - (Prop.forAll(Arb.fromGen dequeObjGen) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "string deque builds and serializes" - (Prop.forAll(Arb.fromGen dequeStringGen) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "obj Deque reverse . reverse = id" - (Prop.forAll(Arb.fromGen dequeObjGen) - <| fun (q, l) -> q |> Deque.rev |> Deque.rev |> Seq.toList = (q |> Seq.toList)) - - testPropertyWithConfig - config10k - "Deque ofList build and serialize" - (Prop.forAll(Arb.fromGen dequeOfListGen) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "get head from deque 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> Deque.head q = List.item 0 l) - - testPropertyWithConfig - config10k - "get head from deque 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> Deque.head q = List.item 0 l) - - testPropertyWithConfig - config10k - "get head from deque 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> Deque.head q = List.item 0 l) - - testPropertyWithConfig - config10k - "get head from deque safely 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> (Deque.tryHead q).Value = List.item 0 l) - - testPropertyWithConfig - config10k - "get head from deque safely 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> (Deque.tryHead q).Value = List.item 0 l) - - testPropertyWithConfig - config10k - "get head from deque safely 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> (Deque.tryHead q).Value = List.item 0 l) - - testPropertyWithConfig - config10k - "get Deque.tail from deque 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.Tail.Head = List.item 1 l) - - testPropertyWithConfig - config10k - "get Deque.tail from deque 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.Tail.Head = List.item 1 l) - - testPropertyWithConfig - config10k - "get Deque.tail from deque 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.Tail.Head = List.item 1 l) - - testPropertyWithConfig - config10k - "get Deque.tail from deque safely 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.TryTail.Value.Head = List.item 1 l) - - testPropertyWithConfig - config10k - "get Deque.tail from deque safely 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.TryTail.Value.Head = List.item 1 l) - - testPropertyWithConfig - config10k - "get Deque.tail from deque safely 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.TryTail.Value.Head = List.item 1 l) - - testPropertyWithConfig - config10k - "get Deque.initial from deque 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> List.ofSeq(Deque.initial q) = (List.rev l |> List.tail |> List.rev)) - - testPropertyWithConfig - config10k - "get Deque.initial from deque 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> List.ofSeq(Deque.initial q) = (List.rev l |> List.tail |> List.rev)) - - testPropertyWithConfig - config10k - "get Deque.initial from deque 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> List.ofSeq(Deque.initial q) = (List.rev l |> List.tail |> List.rev)) - - testPropertyWithConfig - config10k - "get Deque.initial from deque safely 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> List.ofSeq q.TryInitial.Value = (List.rev l |> List.tail |> List.rev)) - - testPropertyWithConfig - config10k - "get Deque.initial from deque safely 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> List.ofSeq q.TryInitial.Value = (List.rev l |> List.tail |> List.rev)) - - testPropertyWithConfig - config10k - "get Deque.initial from deque safely 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> List.ofSeq q.TryInitial.Value = (List.rev l |> List.tail |> List.rev)) - ] + testList + "Deque property tests" + [ + + testPropertyWithConfig + config10k + "Deque fold matches build list rev" + (Prop.forAll(Arb.fromGen dequeIntGen) + <| fun (q, l) -> q |> Deque.fold (fun l' elem -> elem :: l') [] = List.rev l) + + testPropertyWithConfig + config10k + "Deque OfSeq fold matches build list rev" + (Prop.forAll(Arb.fromGen dequeIntOfSeqGen) + <| fun (q, l) -> q |> Deque.fold (fun l' elem -> elem :: l') [] = List.rev l) + + testPropertyWithConfig + config10k + "Deque Conj fold matches build list rev" + (Prop.forAll(Arb.fromGen dequeIntConjGen) + <| fun (q, l) -> q |> Deque.fold (fun l' elem -> elem :: l') [] = List.rev l) + + testPropertyWithConfig + config10k + "Deque foldback matches build list" + (Prop.forAll(Arb.fromGen dequeIntGen) + <| fun (q, l) -> Deque.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "Deque OfSeq foldback matches build list" + (Prop.forAll(Arb.fromGen dequeIntOfSeqGen) + <| fun (q, l) -> Deque.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "Deque Conj foldback matches build list" + (Prop.forAll(Arb.fromGen dequeIntConjGen) + <| fun (q, l) -> Deque.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "int deque builds and serializes 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int deque builds and serializes 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int deque builds and serializes 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "obj deque builds and serializes" + (Prop.forAll(Arb.fromGen dequeObjGen) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "string deque builds and serializes" + (Prop.forAll(Arb.fromGen dequeStringGen) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "obj Deque reverse . reverse = id" + (Prop.forAll(Arb.fromGen dequeObjGen) + <| fun (q, l) -> q |> Deque.rev |> Deque.rev |> Seq.toList = (q |> Seq.toList)) + + testPropertyWithConfig + config10k + "Deque ofList build and serialize" + (Prop.forAll(Arb.fromGen dequeOfListGen) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "get head from deque 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> Deque.head q = List.item 0 l) + + testPropertyWithConfig + config10k + "get head from deque 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> Deque.head q = List.item 0 l) + + testPropertyWithConfig + config10k + "get head from deque 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> Deque.head q = List.item 0 l) + + testPropertyWithConfig + config10k + "get head from deque safely 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> (Deque.tryHead q).Value = List.item 0 l) + + testPropertyWithConfig + config10k + "get head from deque safely 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> (Deque.tryHead q).Value = List.item 0 l) + + testPropertyWithConfig + config10k + "get head from deque safely 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> (Deque.tryHead q).Value = List.item 0 l) + + testPropertyWithConfig + config10k + "get Deque.tail from deque 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.Tail.Head = List.item 1 l) + + testPropertyWithConfig + config10k + "get Deque.tail from deque 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.Tail.Head = List.item 1 l) + + testPropertyWithConfig + config10k + "get Deque.tail from deque 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.Tail.Head = List.item 1 l) + + testPropertyWithConfig + config10k + "get Deque.tail from deque safely 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.TryTail.Value.Head = List.item 1 l) + + testPropertyWithConfig + config10k + "get Deque.tail from deque safely 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.TryTail.Value.Head = List.item 1 l) + + testPropertyWithConfig + config10k + "get Deque.tail from deque safely 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.TryTail.Value.Head = List.item 1 l) + + testPropertyWithConfig + config10k + "get Deque.initial from deque 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> List.ofSeq(Deque.initial q) = (List.rev l |> List.tail |> List.rev)) + + testPropertyWithConfig + config10k + "get Deque.initial from deque 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> List.ofSeq(Deque.initial q) = (List.rev l |> List.tail |> List.rev)) + + testPropertyWithConfig + config10k + "get Deque.initial from deque 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> List.ofSeq(Deque.initial q) = (List.rev l |> List.tail |> List.rev)) + + testPropertyWithConfig + config10k + "get Deque.initial from deque safely 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> List.ofSeq q.TryInitial.Value = (List.rev l |> List.tail |> List.rev)) + + testPropertyWithConfig + config10k + "get Deque.initial from deque safely 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> List.ofSeq q.TryInitial.Value = (List.rev l |> List.tail |> List.rev)) + + testPropertyWithConfig + config10k + "get Deque.initial from deque safely 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> List.ofSeq q.TryInitial.Value = (List.rev l |> List.tail |> List.rev)) ] diff --git a/tests/FSharpx.Collections.Tests/DictionaryExtensionsTests.fs b/tests/FSharpx.Collections.Tests/DictionaryExtensionsTests.fs index e11a43ca..a16fa7f4 100644 --- a/tests/FSharpx.Collections.Tests/DictionaryExtensionsTests.fs +++ b/tests/FSharpx.Collections.Tests/DictionaryExtensionsTests.fs @@ -8,15 +8,16 @@ module DictionaryExtensionsTests = [] let testDictionaryExtensions = - testList "DictionaryExtensions" [ + testList + "DictionaryExtensions" + [ - test "dictionary tryfind with some" { - let a = dict [ 1, "one"; 2, "two" ] - Expect.equal "tryfind" (Some "one") (a |> Dictionary.tryFind 1) - } + test "dictionary tryfind with some" { + let a = dict [ 1, "one"; 2, "two" ] + Expect.equal "tryfind" (Some "one") (a |> Dictionary.tryFind 1) + } - test "dictionary tryfind with none" { - let a = dict [ 1, "one"; 2, "two" ] - Expect.isNone "tryfind" (a |> Dictionary.tryFind 3) - } - ] + test "dictionary tryfind with none" { + let a = dict [ 1, "one"; 2, "two" ] + Expect.isNone "tryfind" (a |> Dictionary.tryFind 3) + } ] diff --git a/tests/FSharpx.Collections.Tests/FsCheckProperties.fs b/tests/FSharpx.Collections.Tests/FsCheckProperties.fs index 9a55194a..25815d9a 100644 --- a/tests/FSharpx.Collections.Tests/FsCheckProperties.fs +++ b/tests/FSharpx.Collections.Tests/FsCheckProperties.fs @@ -7,13 +7,11 @@ open FsCheck let configReplay = { FsCheckConfig.defaultConfig with maxTest = 10000 - replay = Some <| (1940624926, 296296394) - } + replay = Some <| (1940624926, 296296394) } let config10k = { FsCheckConfig.defaultConfig with - maxTest = 10000 - } + maxTest = 10000 } let classifyCollect xs (count: int) (y: bool) = y @@ -24,11 +22,12 @@ let classifyCollect xs (count: int) (y: bool) = |> Prop.classify (xs.GetType().FullName.Contains("System.Object")) "object" module Gen = - let rec infiniteSeq() = gen { - let! x = Arb.generate - let! xs = infiniteSeq() - return Seq.append (Seq.singleton x) xs - } + let rec infiniteSeq() = + gen { + let! x = Arb.generate + let! xs = infiniteSeq() + return Seq.append (Seq.singleton x) xs + } let infiniteLazyList() = Gen.map LazyList.ofSeq (infiniteSeq()) @@ -36,15 +35,17 @@ module Gen = let finiteLazyList() = Gen.map LazyList.ofList Arb.generate - let ArbitrarySeqGen() = gen { - let! len = Gen.choose(0, 10) - let! l = Gen.listOfLength len Arb.generate + let ArbitrarySeqGen() = + gen { + let! len = Gen.choose(0, 10) + let! l = Gen.listOfLength len Arb.generate - return seq { - for i = 0 to len - 1 do - yield l.[i] + return + seq { + for i = 0 to len - 1 do + yield l.[i] + } } - } let ArbitrarySeq() = ArbitrarySeqGen() |> Arb.fromGen diff --git a/tests/FSharpx.Collections.Tests/HeapTest.fs b/tests/FSharpx.Collections.Tests/HeapTest.fs index 89c923ae..36e56c5f 100644 --- a/tests/FSharpx.Collections.Tests/HeapTest.fs +++ b/tests/FSharpx.Collections.Tests/HeapTest.fs @@ -10,90 +10,91 @@ module HeapTests = [] let testHeap = - testList "Heap" [ + testList + "Heap" + [ - test "cons pattern discriminator" { - let h = Heap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h1, t1 = Heap.uncons h + test "cons pattern discriminator" { + let h = Heap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h1, t1 = Heap.uncons h - let h2, t2 = - match t1 with - | Heap.Cons(h, t) -> h, t - | _ -> "x", t1 + let h2, t2 = + match t1 with + | Heap.Cons(h, t) -> h, t + | _ -> "x", t1 - Expect.isTrue "cons pattern" ((h2 = "e") && ((Heap.length t2) = 4)) - } + Expect.isTrue "cons pattern" ((h2 = "e") && ((Heap.length t2) = 4)) + } - test "cons pattern discriminator 2" { - let h = Heap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "cons pattern discriminator 2" { + let h = Heap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let t2 = - match h with - | Heap.Cons("f", Heap.Cons(_, t)) -> t - | _ -> h + let t2 = + match h with + | Heap.Cons("f", Heap.Cons(_, t)) -> t + | _ -> h - let h1, t3 = Heap.uncons t2 + let h1, t3 = Heap.uncons t2 - Expect.isTrue "cons pattern" ((h1 = "d") && ((Heap.length t2) = 4)) - } + Expect.isTrue "cons pattern" ((h1 = "d") && ((Heap.length t2) = 4)) + } - test "empty list should be empty" { Expect.isTrue "empty" (Heap.empty true).IsEmpty } + test "empty list should be empty" { Expect.isTrue "empty" (Heap.empty true).IsEmpty } - test "rev empty" { - let h = Heap.empty true - Expect.isTrue "" (h |> Heap.rev |> Heap.isEmpty) - let h' = Heap.empty false - Expect.isTrue "" (h' |> Heap.rev |> Heap.isEmpty) - } + test "rev empty" { + let h = Heap.empty true + Expect.isTrue "" (h |> Heap.rev |> Heap.isEmpty) + let h' = Heap.empty false + Expect.isTrue "" (h' |> Heap.rev |> Heap.isEmpty) + } - test "insert works" { Expect.isFalse "" (((Heap.empty true).Insert 1).Insert 2).IsEmpty } + test "insert works" { Expect.isFalse "" (((Heap.empty true).Insert 1).Insert 2).IsEmpty } - test "length of empty is 0" { Expect.equal "empty" 0 (Heap.empty true).Length } + test "length of empty is 0" { Expect.equal "empty" 0 (Heap.empty true).Length } - test "tryHead on empty should return None" { Expect.isNone "tryHead" (Heap.empty true).TryHead } + test "tryHead on empty should return None" { Expect.isNone "tryHead" (Heap.empty true).TryHead } - test "tryTail on empty should return None" { Expect.isNone "tryTail" <| (Heap.empty true).TryTail() } + test "tryTail on empty should return None" { Expect.isNone "tryTail" <| (Heap.empty true).TryTail() } - test "tryTail on len 1 should return Some empty" { - let h = Heap.empty true |> Heap.insert 1 |> Heap.tryTail - Expect.isTrue "tryTail" (h.Value |> Heap.isEmpty) - } + test "tryTail on len 1 should return Some empty" { + let h = Heap.empty true |> Heap.insert 1 |> Heap.tryTail + Expect.isTrue "tryTail" (h.Value |> Heap.isEmpty) + } - test "tryMerge max and min should be None" { - let h1 = Heap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h2 = Heap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] + test "tryMerge max and min should be None" { + let h1 = Heap.ofSeq true [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h2 = Heap.ofSeq false [ "t"; "u"; "v"; "w"; "x"; "y"; "z" ] - Expect.isNone "tryMerge" <| Heap.tryMerge h1 h2 - } + Expect.isNone "tryMerge" <| Heap.tryMerge h1 h2 + } - test "structural equality" { - let l1 = Heap.ofSeq true [ 1..100 ] - let l2 = Heap.ofSeq true [ 1..100 ] + test "structural equality" { + let l1 = Heap.ofSeq true [ 1..100 ] + let l2 = Heap.ofSeq true [ 1..100 ] - Expect.equal "structural equality" l1 l2 + Expect.equal "structural equality" l1 l2 - let l3 = Heap.ofSeq true [ 1..99 ] |> Heap.insert 7 + let l3 = Heap.ofSeq true [ 1..99 ] |> Heap.insert 7 - Expect.notEqual "structural equality" l1 l3 - } + Expect.notEqual "structural equality" l1 l3 + } - test "toSeq to list" { - let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h = Heap.ofSeq true l + test "toSeq to list" { + let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] + let h = Heap.ofSeq true l - Expect.equal "toSeq to list" l (h |> Heap.toSeq |> List.ofSeq) - } + Expect.equal "toSeq to list" l (h |> Heap.toSeq |> List.ofSeq) + } - test "tryUncons empty" { Expect.isNone "TryUncons" <| (Heap.empty true).TryUncons() } + test "tryUncons empty" { Expect.isNone "TryUncons" <| (Heap.empty true).TryUncons() } - test "Tail of large heap does not result in stackoverflow" { - let rnd = new System.Random() - let h = [ 1..1000000 ] |> Seq.sortBy(fun x -> rnd.Next()) |> Heap.ofSeq false + test "Tail of large heap does not result in stackoverflow" { + let rnd = new System.Random() + let h = [ 1..1000000 ] |> Seq.sortBy(fun x -> rnd.Next()) |> Heap.ofSeq false - Heap.tail h |> ignore - Expect.isTrue "" true - } - ] + Heap.tail h |> ignore + Expect.isTrue "" true + } ] [] let propertyTestHeap = @@ -102,61 +103,69 @@ module HeapTests = let insertThruList l h = List.fold (fun (h': Heap<'a>) x -> h'.Insert x) h l - let maxHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((Heap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let maxHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Heap.ofSeq true x), (x |> List.sort |> List.rev)) - } - - let maxHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Heap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) - } - - let maxHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((Heap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) - } - - let minHeapIntGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((Heap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } - - let minHeapIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Heap.ofSeq false x), (x |> List.sort)) - } - - let minHeapIntInsertGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Heap.empty false |> insertThruList x), (x |> List.sort)) - } - - let minHeapStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((Heap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) - } + let maxHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((Heap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let maxHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Heap.ofSeq true x), (x |> List.sort |> List.rev)) + } + + let maxHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Heap.empty true |> insertThruList x), (x |> List.sort |> List.rev)) + } + + let maxHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((Heap.ofSeq true x |> insertThruList y), ((x @ y) |> List.sort |> List.rev)) + } + + let minHeapIntGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((Heap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } + + let minHeapIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Heap.ofSeq false x), (x |> List.sort)) + } + + let minHeapIntInsertGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Heap.empty false |> insertThruList x), (x |> List.sort)) + } + + let minHeapStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((Heap.ofSeq false x |> insertThruList y), ((x @ y) |> List.sort)) + } let intGens start = let v = Array.create 6 maxHeapIntGen @@ -176,300 +185,301 @@ module HeapTests = let intGensStart2 = intGens 2 // this will accept 11 out of 12 - testList "Heap property tests" [ - - testPropertyWithConfig - config10k - "head should return 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> h.Head = l.Head) - - testPropertyWithConfig - config10k - "head should return 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> h.Head = l.Head) - - testPropertyWithConfig - config10k - "head should return 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> h.Head = l.Head) - - testPropertyWithConfig - config10k - "head should return 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> h.Head = l.Head) - - testPropertyWithConfig - config10k - "head should return 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> h.Head = l.Head) - - testPropertyWithConfig - config10k - "head should return 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> h.Head = l.Head) - - testPropertyWithConfig - config10k - "maxHeap seq enumerate matches build list" - (Prop.forAll(Arb.fromGen maxHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "minHeap seq enumerate matches build list" - (Prop.forAll(Arb.fromGen minHeapIntGen) - <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) - - testPropertyWithConfig - config10k - "rev works max heap" - (Prop.forAll(Arb.fromGen maxHeapIntGen) - <| fun (h, l) -> h |> Heap.rev |> List.ofSeq = (h |> List.ofSeq |> List.rev)) - - testPropertyWithConfig - config10k - "rev works min heap" - (Prop.forAll(Arb.fromGen minHeapIntGen) - <| fun (h, l) -> h |> Heap.rev |> List.ofSeq = (h |> List.ofSeq |> List.rev)) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (h, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (h, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (h, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 3" - (Prop.forAll(Arb.fromGen intGensStart1.[3]) - <| fun (h, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 4" - (Prop.forAll(Arb.fromGen intGensStart1.[4]) - <| fun (h, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list int 5" - (Prop.forAll(Arb.fromGen intGensStart1.[5]) - <| fun (h, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list string 0" - (Prop.forAll(Arb.fromGen stringGens.[0]) - <| fun (h: Heap, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "seq enumerate matches build list string 1" - (Prop.forAll(Arb.fromGen stringGens.[1]) - <| fun (h: Heap, l) -> h |> Seq.toList = l) - - testPropertyWithConfig - config10k - "tail should return 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true - tlHead && (tl.Length = l.Length - 1)) - - testPropertyWithConfig - config10k - "tail should return 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true - tlHead && (tl.Length = l.Length - 1)) - - testPropertyWithConfig - config10k - "tail should return 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true - tlHead && (tl.Length = l.Length - 1)) - - testPropertyWithConfig - config10k - "tail should return 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true - tlHead && (tl.Length = l.Length - 1)) - - - testPropertyWithConfig - config10k - "tail should return 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true - tlHead && (tl.Length = l.Length - 1)) - - testPropertyWithConfig - config10k - "tail should return 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let tl = h.Tail() - let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true - tlHead && (tl.Length = l.Length - 1)) - - testPropertyWithConfig - config10k - "tryHead should return 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> h.TryHead.Value = l.Head) - - testPropertyWithConfig - config10k - "tryHead should return 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> h.TryHead.Value = l.Head) - - testPropertyWithConfig - config10k - "tryHead should return 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> h.TryHead.Value = l.Head) - - testPropertyWithConfig - config10k - "tryHead should return 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> h.TryHead.Value = l.Head) - - testPropertyWithConfig - config10k - "tryHead should return 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> h.TryHead.Value = l.Head) - - testPropertyWithConfig - config10k - "tryHead should return 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> h.TryHead.Value = l.Head) - - testPropertyWithConfig - config10k - "tryUncons 1 element 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "tryUncons 1 element 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "tryUncons 1 element 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "tryUncons 1 element 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "tryUncons 1 element 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "tryUncons 1 element 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let x, tl = h.TryUncons().Value - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "Heap.uncons 1 element 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (h, l) -> - let x, tl = h.Uncons() - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "Heap.uncons 1 element 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (h, l) -> - let x, tl = h.Uncons() - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "Heap.uncons 1 element 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (h, l) -> - let x, tl = h.Uncons() - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "Heap.uncons 1 element 3" - (Prop.forAll(Arb.fromGen intGensStart2.[3]) - <| fun (h, l) -> - let x, tl = h.Uncons() - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "Heap.uncons 1 element 4" - (Prop.forAll(Arb.fromGen intGensStart2.[4]) - <| fun (h, l) -> - let x, tl = h.Uncons() - x = l.Head && tl.Length = (l.Length - 1)) - - testPropertyWithConfig - config10k - "Heap.uncons 1 element 5" - (Prop.forAll(Arb.fromGen intGensStart2.[5]) - <| fun (h, l) -> - let x, tl = h.Uncons() - x = l.Head && tl.Length = (l.Length - 1)) - ] + testList + "Heap property tests" + [ + + testPropertyWithConfig + config10k + "head should return 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> h.Head = l.Head) + + testPropertyWithConfig + config10k + "head should return 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> h.Head = l.Head) + + testPropertyWithConfig + config10k + "head should return 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> h.Head = l.Head) + + testPropertyWithConfig + config10k + "head should return 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> h.Head = l.Head) + + testPropertyWithConfig + config10k + "head should return 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> h.Head = l.Head) + + testPropertyWithConfig + config10k + "head should return 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> h.Head = l.Head) + + testPropertyWithConfig + config10k + "maxHeap seq enumerate matches build list" + (Prop.forAll(Arb.fromGen maxHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "minHeap seq enumerate matches build list" + (Prop.forAll(Arb.fromGen minHeapIntGen) + <| fun (h, l) -> h |> List.ofSeq = l |> classifyCollect h h.Length) + + testPropertyWithConfig + config10k + "rev works max heap" + (Prop.forAll(Arb.fromGen maxHeapIntGen) + <| fun (h, l) -> h |> Heap.rev |> List.ofSeq = (h |> List.ofSeq |> List.rev)) + + testPropertyWithConfig + config10k + "rev works min heap" + (Prop.forAll(Arb.fromGen minHeapIntGen) + <| fun (h, l) -> h |> Heap.rev |> List.ofSeq = (h |> List.ofSeq |> List.rev)) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (h, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (h, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (h, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 3" + (Prop.forAll(Arb.fromGen intGensStart1.[3]) + <| fun (h, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 4" + (Prop.forAll(Arb.fromGen intGensStart1.[4]) + <| fun (h, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list int 5" + (Prop.forAll(Arb.fromGen intGensStart1.[5]) + <| fun (h, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list string 0" + (Prop.forAll(Arb.fromGen stringGens.[0]) + <| fun (h: Heap, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "seq enumerate matches build list string 1" + (Prop.forAll(Arb.fromGen stringGens.[1]) + <| fun (h: Heap, l) -> h |> Seq.toList = l) + + testPropertyWithConfig + config10k + "tail should return 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true + tlHead && (tl.Length = l.Length - 1)) + + testPropertyWithConfig + config10k + "tail should return 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true + tlHead && (tl.Length = l.Length - 1)) + + testPropertyWithConfig + config10k + "tail should return 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true + tlHead && (tl.Length = l.Length - 1)) + + testPropertyWithConfig + config10k + "tail should return 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true + tlHead && (tl.Length = l.Length - 1)) + + + testPropertyWithConfig + config10k + "tail should return 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true + tlHead && (tl.Length = l.Length - 1)) + + testPropertyWithConfig + config10k + "tail should return 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let tl = h.Tail() + let tlHead = if (tl.Length > 0) then tl.Head = l.Item(1) else true + tlHead && (tl.Length = l.Length - 1)) + + testPropertyWithConfig + config10k + "tryHead should return 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> h.TryHead.Value = l.Head) + + testPropertyWithConfig + config10k + "tryHead should return 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> h.TryHead.Value = l.Head) + + testPropertyWithConfig + config10k + "tryHead should return 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> h.TryHead.Value = l.Head) + + testPropertyWithConfig + config10k + "tryHead should return 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> h.TryHead.Value = l.Head) + + testPropertyWithConfig + config10k + "tryHead should return 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> h.TryHead.Value = l.Head) + + testPropertyWithConfig + config10k + "tryHead should return 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> h.TryHead.Value = l.Head) + + testPropertyWithConfig + config10k + "tryUncons 1 element 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "tryUncons 1 element 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "tryUncons 1 element 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "tryUncons 1 element 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "tryUncons 1 element 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "tryUncons 1 element 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let x, tl = h.TryUncons().Value + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "Heap.uncons 1 element 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (h, l) -> + let x, tl = h.Uncons() + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "Heap.uncons 1 element 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (h, l) -> + let x, tl = h.Uncons() + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "Heap.uncons 1 element 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (h, l) -> + let x, tl = h.Uncons() + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "Heap.uncons 1 element 3" + (Prop.forAll(Arb.fromGen intGensStart2.[3]) + <| fun (h, l) -> + let x, tl = h.Uncons() + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "Heap.uncons 1 element 4" + (Prop.forAll(Arb.fromGen intGensStart2.[4]) + <| fun (h, l) -> + let x, tl = h.Uncons() + x = l.Head && tl.Length = (l.Length - 1)) + + testPropertyWithConfig + config10k + "Heap.uncons 1 element 5" + (Prop.forAll(Arb.fromGen intGensStart2.[5]) + <| fun (h, l) -> + let x, tl = h.Uncons() + x = l.Head && tl.Length = (l.Length - 1)) ] diff --git a/tests/FSharpx.Collections.Tests/LazyListTests.fs b/tests/FSharpx.Collections.Tests/LazyListTests.fs index b47ed10a..abdd1bdb 100644 --- a/tests/FSharpx.Collections.Tests/LazyListTests.fs +++ b/tests/FSharpx.Collections.Tests/LazyListTests.fs @@ -64,16 +64,14 @@ module LazyList = box ie.Current member x.Reset() = - ie.Reset() - } in + ie.Reset() } in { new seq<'a> with member x.GetEnumerator() = enumerator() interface System.Collections.IEnumerable with member x.GetEnumerator() = - (enumerator() :> _) - } + (enumerator() :> _) } let countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd numActiveEnumerators (seq: seq<'a>) = let enumerator() = @@ -123,16 +121,14 @@ module LazyList = box ie.Current member x.Reset() = - ie.Reset() - } in + ie.Reset() } in { new seq<'a> with member x.GetEnumerator() = enumerator() interface System.Collections.IEnumerable with member x.GetEnumerator() = - (enumerator() :> _) - } + (enumerator() :> _) } [] let testLazyList = @@ -140,408 +136,400 @@ module LazyList = let nats = LazyList.unfold (fun z -> Some(z, z + 1)) 0 let rec diverge() = diverge() - testList "LazyList" [ - - test "test2398984: LazyList.toSeq" { - let l = LazyList.ofList [ 1; 2; 3 ] in - let res = ref 2 in - - for i in (LazyList.toSeq l) do - res := !res + i - - Expect.equal "LazyList.toSeq" 8 !res - } - - test "test2398984: LazyList.toSeq 2" { - let l = LazyList.ofList [ 1; 2; 3 ] in - let res = ref 2 in - - for i in LazyList.toSeq l do - res := !res + i - - Expect.equal "LazyList.toSeq" 8 !res - } - - test "test2398994: foreach, LazyList.toSeq" { - let l = LazyList.ofList [ 1; 2; 3 ] in - let res = ref 2 in - Seq.iter (fun i -> res := !res + i) (LazyList.toSeq l) - Expect.equal "LazyList.toSeq" 8 !res - } - - test "se1" { Expect.isTrue "isEmpty" <| LazyList.isEmpty LazyList.empty } - test "se2" { - Expect.isFalse "cons" - <| LazyList.isEmpty(LazyList.cons 1 LazyList.empty) - } - test "se3" { Expect.isFalse "repeat" <| LazyList.isEmpty(LazyList.repeat 1) } - test "se4" { - Expect.isFalse "unfold" - <| LazyList.isEmpty(LazyList.unfold (fun z -> Some(z, z + 1)) 0) - } - - test "seq1" { Expect.equal "cons" 1 <| LazyList.head(LazyList.cons 1 LazyList.empty) } - test "seq2" { - Expect.equal "cons" 1 - <| LazyList.head(LazyList.cons 1 (LazyList.cons 2 LazyList.empty)) - } - test "seq3" { - Expect.equal "cons" 2 - <| LazyList.head(LazyList.tail(LazyList.cons 1 (LazyList.cons 2 LazyList.empty))) - } - - test "tryHead empty" { Expect.isNone "tryHead" <| LazyList.tryHead LazyList.empty } - test "tryHead seq1" { Expect.equal "tryHead" 1 (LazyList.tryHead(LazyList.cons 1 LazyList.empty)).Value } - test "tryHead seq2" { Expect.equal "tryHead" 1 (LazyList.tryHead(LazyList.cons 1 (LazyList.cons 2 LazyList.empty))).Value } - - test "tryTail empty" { Expect.isNone "tryTail" (LazyList.tryTail LazyList.empty) } - test "tryTail seq1" { - Expect.isTrue "tryTail" - <| LazyList.isEmpty (LazyList.tryTail(LazyList.cons 1 LazyList.empty)).Value - } - test "tryTail seq2" { - Expect.equal "tryTail" [ 2 ] - <| LazyList.toList((LazyList.tryTail(LazyList.cons 1 (LazyList.cons 2 LazyList.empty))).Value) - } - test "tryTail seq3" { - Expect.equal "tryTail" [ 2; 3 ] - <| LazyList.toList( - (LazyList.tryTail(LazyList.cons 1 (LazyList.cons 2 (LazyList.cons 3 LazyList.empty)))) - .Value - ) - } - - test "take1" { - Expect.equal "take1" [ 0; 1; 2; 3 ] - <| LazyList.toList(LazyList.take 4 nats) - } - test "skip 4" { Expect.equal "drop1" 4 <| LazyList.head(LazyList.skip 4 nats) } - test "skip 0" { Expect.equal "drop1" 0 <| LazyList.head(LazyList.skip 0 nats) } - - test "tryTake empty" { Expect.isNone "tryTake" <| LazyList.tryTake 4 LazyList.empty } - test "tryTake0" { - Expect.isTrue "tryTake0" - <| LazyList.isEmpty (LazyList.tryTake 0 LazyList.empty).Value - } - test "tryTake1" { - Expect.equal "tryTake1" [ 0 ] - <| LazyList.toList (LazyList.tryTake 1 nats).Value - } - test "tryTake4" { - Expect.equal "tryTake4" [ 0; 1; 2; 3 ] - <| LazyList.toList (LazyList.tryTake 4 nats).Value - } - test "tryTake4 from list of 3" { - Expect.equal "" [ 0; 1; 2 ] - <| LazyList.toList (LazyList.tryTake 4 (LazyList.tryTake 3 nats).Value).Value - } - - test "trySkip 0" { Expect.equal "" 0 <| LazyList.head (LazyList.trySkip 0 nats).Value } - test "trySkip 4" { Expect.equal "" 4 <| LazyList.head (LazyList.trySkip 4 nats).Value } - test "trySkip -1" { Expect.isNone "" <| LazyList.trySkip -1 nats } - test "trySkip 4 from list of 3" { Expect.isNone "" <| LazyList.trySkip 4 (LazyList.tryTake 3 nats).Value } - - test "tryUncons empty" { Expect.isNone "" <| LazyList.tryUncons LazyList.empty } - - test "tryUncons 1" { - let x, y = (LazyList.tryUncons(LazyList.take 1 nats)).Value - Expect.equal "tryUncons" (0, true) (x, (LazyList.isEmpty y)) - } - - test "tryUncons take 2" { - let x2, y2 = (LazyList.tryUncons(LazyList.take 2 nats)).Value - Expect.equal "tryUncons" (0, [ 1 ]) (x2, (LazyList.toList y2)) - } - - test "tryUncons take 3" { - let x3, y3 = (LazyList.tryUncons(LazyList.take 3 nats)).Value - Expect.equal "tryUncons" (0, [ 1; 2 ]) (x3, (LazyList.toList y3)) - } - - test "uncons 1" { - let xa, ya = LazyList.uncons(LazyList.take 1 nats) - Expect.equal "uncons" (0, true) (xa, (LazyList.isEmpty ya)) - } - - test "uncons take 2" { - let xa2, ya2 = LazyList.uncons(LazyList.take 2 nats) - Expect.equal "uncons" (0, [ 1 ]) (xa2, (LazyList.toList ya2)) - } - - test "uncons take 3" { - let xa3, ya3 = LazyList.uncons(LazyList.take 3 nats) - Expect.equal "uncons" (0, [ 1; 2 ]) (xa3, (LazyList.toList ya3)) - } - - test "mapAccum" { - let ll = LazyList.ofList [ -5 .. -1 ] - let expected = (15, [ 5; 4; 3; 2; 1 ]) - let x, y = LazyList.mapAccum (fun a b -> let c = abs b in (a + c, c)) 0 ll - Expect.equal "mapAccum" expected (x, (LazyList.toList y)) - } - - test "fold" { - let ll = LazyList.ofList [ -5 .. -1 ] - let expected = 15 - - Expect.equal "fold" expected - <| LazyList.fold (fun a b -> a + abs b) 0 ll - } - - test "repeat" { - Expect.equal "take repeat" [ 1; 1; 1; 1 ] - <| LazyList.toList(LazyList.take 4 (LazyList.repeat 1)) - } - test "append" { - Expect.equal "append" [ 77; 0; 1; 2 ] - <| LazyList.toList(LazyList.take 4 (LazyList.append (LazyList.cons 77 (LazyList.empty)) nats)) - } - test "zip" { - Expect.equal "zip" [ 0, 6; 1, 7; 2, 8 ] - <| LazyList.toList(LazyList.take 3 (LazyList.zip nats (LazyList.skip 6 nats))) - } - test "firstS" { - Expect.equal "tryFind" (Some 8) - <| LazyList.tryFind (fun x -> x >= 8) nats - } - test "firstN" { - Expect.isNone "take" - <| LazyList.tryFind (fun x -> x >= 8) (LazyList.take 5 nats) - } - test "find S" { Expect.equal "find" 8 <| LazyList.find (fun x -> x >= 8) nats } - - test "find N" { - Expect.throwsT "find N" (fun () -> LazyList.find (fun x -> x >= 8) (LazyList.take 5 nats) |> ignore) - } - - test "consfA" { - Expect.equal "consDelayed" 1 - <| LazyList.head(LazyList.consDelayed 1 diverge) - } - test "consfB" { - Expect.isTrue "divergence" (let ss = LazyList.tail(LazyList.consDelayed 1 diverge) in true) - } (* testing for lazy divergence *) - test "dropDiverge1" { - Expect.isTrue "divergence" (let ss = LazyList.skip 1 (LazyList.consDelayed 1 diverge) in true) - } (* testing for lazy divergence *) - test "dropDiverge0" { - Expect.isTrue "divergence" (let ss = LazyList.skip 0 (LazyList.delayed(fun () -> failwith "errors")) in true) - } (* testing for lazy divergence *) - - test "takedrop" { - Expect.equal "takedrop" [ 4; 5; 6 ] - <| LazyList.toList(LazyList.take 3 (LazyList.skip 4 nats)) - } - test "filter" { - Expect.equal "filter" [ 0; 2; 4; 6 ] - <| LazyList.toList(LazyList.take 4 (LazyList.filter (fun x -> x % 2 = 0) nats)) - } - test "map" { - Expect.equal "map" [ 1; 2; 3; 4 ] - <| LazyList.toList(LazyList.take 4 (LazyList.map (fun x -> x + 1) nats)) - } - test "map2" { - Expect.equal "map2" [ 0 * 1; 1 * 2; 2 * 3; 3 * 4 ] - <| LazyList.toList(LazyList.take 4 (LazyList.map2 (fun x y -> x * y) nats (LazyList.tail nats))) - } - - test "array take6" { - Expect.equal "array" (LazyList.toList(LazyList.take 6 nats)) - <| Array.toList(LazyList.toArray(LazyList.take 6 nats)) - } - test "array list" { - Expect.equal "array" (LazyList.toList(LazyList.ofArray [| 1; 2; 3; 4 |])) - <| LazyList.toList(LazyList.ofList [ 1; 2; 3; 4 ]) - } - - test "equalsWith" { - Expect.isTrue "equalsWith" - <| LazyList.equalsWith (=) (LazyList.ofList [ 1; 2; 3; 4; 5 ]) (LazyList.ofList [ 1..5 ]) - } - test "compareWith" { - Expect.equal "compareWith" -1 - <| LazyList.compareWith Unchecked.compare (LazyList.ofList [ 1; 2; 3; 4 ]) (LazyList.ofList [ 1..5 ]) - } - - // This checks that LazyList.map, LazyList.length etc. are tail recursive - test "LazyList.length 100" { Expect.equal "length" 100 (LazyList.ofSeq(Seq.init 100 (fun c -> c)) |> LazyList.length) } - test "LazyList.length 1000000" { Expect.equal "length" 1000000 (LazyList.ofSeq(Seq.init 1000000 (fun c -> c)) |> LazyList.length) } - test "LazyList.length 0" { Expect.equal "length" 0 (LazyList.ofSeq(Seq.init 0 (fun c -> c)) |> LazyList.length) } - test "LazyList.map" { - Expect.equal - "map" - 1000000 - (LazyList.map (fun x -> x + 1) (LazyList.ofSeq(Seq.init 1000000 (fun c -> c))) - |> Seq.length) - } - test "LazyList.filter" { - Expect.equal - "filter" - 500000 - (LazyList.filter (fun x -> x % 2 = 0) (LazyList.ofSeq(Seq.init 1000000 (fun c -> c))) - |> Seq.length) - } - test "LazyList.iter 0" { - Expect.equal - "iter" - 0 - (let count = ref 0 in - LazyList.iter (fun x -> incr count) (LazyList.ofSeq(Seq.init 0 (fun c -> c))) - !count) - } - test "LazyList.iter" { - Expect.equal - "iter" - 1000000 - (let count = ref 0 in - LazyList.iter (fun x -> incr count) (LazyList.ofSeq(Seq.init 1000000 (fun c -> c))) - !count) - } - test "LazyList.toList" { - Expect.equal - "toList" - 200000 - (LazyList.toList(LazyList.ofSeq(Seq.init 200000 (fun c -> c))) - |> Seq.length) - } - test "LazyList.toArray" { - Expect.equal - "toArray" - 200000 - (LazyList.toArray(LazyList.ofSeq(Seq.init 200000 (fun c -> c))) - |> Seq.length) - } - - // check exists on an infinite stream terminates - test "IEnumerableTest.exists 1" { Expect.isTrue "exists" (Seq.exists ((=) "a") (LazyList.repeat "a" |> LazyList.toSeq)) } - // test a succeeding 'exists' on a concat of an infinite number of finite streams terminates - test "IEnumerableTest.exists 2" { - Expect.isTrue "exists" (Seq.exists ((=) "a") (Seq.concat(LazyList.repeat [| "a"; "b" |] |> LazyList.toSeq))) - } - // test a succeeding 'exists' on a concat of an infinite number of infinite streams terminates - test "IEnumerableTest.exists 3" { - Expect.isTrue - "exists" - (Seq.exists - ((=) "a") - (Seq.concat( - LazyList.repeat(LazyList.repeat "a" |> LazyList.toSeq) - |> LazyList.toSeq - ))) - } - // test a failing for_all on an infinite stream terminates - test "IEnumerableTest.exists 4" { Expect.isFalse "exists" (Seq.forall ((=) "a" >> not) (LazyList.repeat "a" |> LazyList.toSeq)) } - // test a failing for_all on a concat of an infinite number of finite streams terminates - test "IEnumerableTest.exists 5" { - Expect.isFalse "exists" (Seq.forall ((=) "a" >> not) (Seq.concat(LazyList.repeat [| "a"; "b" |] |> LazyList.toSeq))) - } - test "IEnumerableTest.append, infinite, infinite, then take 2" { - Expect.equal - "append, infinite, infinite, then take" - [ "a"; "a" ] - (Seq.take 2 (Seq.append (LazyList.repeat "a" |> LazyList.toSeq) (LazyList.repeat "b" |> LazyList.toSeq)) - |> Seq.toList) - } - - // test exists on an infinite stream terminates - test "IEnumerableTest.exists 6" { - let numActiveEnumerators = ref 0 - - Expect.isTrue - "exists" - (Seq.exists - ((=) "a") - (LazyList.repeat "a" - |> LazyList.toSeq - |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators)) - - Expect.equal "" 0 !numActiveEnumerators - } - - // test a succeeding 'exists' on a concat of an infinite number of finite streams terminates - test "IEnumerableTest.exists 7" { - let numActiveEnumerators = ref 0 - - Expect.isTrue - "" - (Seq.exists - ((=) "a") - (Seq.concat( - LazyList.repeat [| "a"; "b" |] - |> LazyList.toSeq - |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators - ))) - - Expect.equal "" 0 !numActiveEnumerators - } - - // test a succeeding 'exists' on a concat of an infinite number of infinite streams terminates - test "IEnumerableTest.exists 8" { - let numActiveEnumerators = ref 0 - - Expect.isTrue - "" - (Seq.exists - ((=) "a") - (Seq.concat( - LazyList.repeat(LazyList.repeat "a" |> LazyList.toSeq) - |> LazyList.toSeq - |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators - ))) - - Expect.equal "" 0 !numActiveEnumerators - } - - // test a failing for_all on an infinite stream terminates - test "IEnumerableTest.exists 9" { - let numActiveEnumerators = ref 0 - - Expect.isFalse - "exists" - (Seq.forall - ((=) "a" >> not) - (LazyList.repeat "a" - |> LazyList.toSeq - |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators)) - - Expect.equal "" 0 !numActiveEnumerators - } - - // check a failing for_all on a concat of an infinite number of finite streams terminates - test "IEnumerableTest.exists 10" { - let numActiveEnumerators = ref 0 - - Expect.isFalse - "exists" - (Seq.forall - ((=) "a" >> not) - (Seq.concat( - LazyList.repeat [| "a"; "b" |] - |> LazyList.toSeq - |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators - ))) - - Expect.equal "exists" 0 !numActiveEnumerators - } - - test "IEnumerableTest.append, repeat" { - let numActiveEnumerators = ref 0 - - Expect.equal - "" - [ "a"; "a" ] - (Seq.take 2 (Seq.append (LazyList.repeat "a" |> LazyList.toSeq) (LazyList.repeat "b" |> LazyList.toSeq)) - |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd numActiveEnumerators - |> Seq.toList) - - Expect.equal "exists" 0 !numActiveEnumerators - } - - test "pairReduce" { - Expect.equal "pairReduce" [ 1; 5; 9; 13; 17; 21; 25; 29; 33; 37 ] - <| LazyList.toList(LazyList.take 10 (pairReduce inf)) - } - - test "scan 3" { Expect.equal "scan" [ 0; 1; 3 ] (LazyList.scan (+) 0 (LazyList.ofList [ 1; 2 ]) |> LazyList.toList) } - test "scan 0" { Expect.equal "scan" [ 0 ] (LazyList.scan (+) 0 (LazyList.ofList []) |> LazyList.toList) } - ] + testList + "LazyList" + [ + + test "test2398984: LazyList.toSeq" { + let l = LazyList.ofList [ 1; 2; 3 ] in + let res = ref 2 in + + for i in (LazyList.toSeq l) do + res := !res + i + + Expect.equal "LazyList.toSeq" 8 !res + } + + test "test2398984: LazyList.toSeq 2" { + let l = LazyList.ofList [ 1; 2; 3 ] in + let res = ref 2 in + + for i in LazyList.toSeq l do + res := !res + i + + Expect.equal "LazyList.toSeq" 8 !res + } + + test "test2398994: foreach, LazyList.toSeq" { + let l = LazyList.ofList [ 1; 2; 3 ] in + let res = ref 2 in + Seq.iter (fun i -> res := !res + i) (LazyList.toSeq l) + Expect.equal "LazyList.toSeq" 8 !res + } + + test "se1" { Expect.isTrue "isEmpty" <| LazyList.isEmpty LazyList.empty } + test "se2" { + Expect.isFalse "cons" + <| LazyList.isEmpty(LazyList.cons 1 LazyList.empty) + } + test "se3" { Expect.isFalse "repeat" <| LazyList.isEmpty(LazyList.repeat 1) } + test "se4" { + Expect.isFalse "unfold" + <| LazyList.isEmpty(LazyList.unfold (fun z -> Some(z, z + 1)) 0) + } + + test "seq1" { Expect.equal "cons" 1 <| LazyList.head(LazyList.cons 1 LazyList.empty) } + test "seq2" { + Expect.equal "cons" 1 + <| LazyList.head(LazyList.cons 1 (LazyList.cons 2 LazyList.empty)) + } + test "seq3" { + Expect.equal "cons" 2 + <| LazyList.head(LazyList.tail(LazyList.cons 1 (LazyList.cons 2 LazyList.empty))) + } + + test "tryHead empty" { Expect.isNone "tryHead" <| LazyList.tryHead LazyList.empty } + test "tryHead seq1" { Expect.equal "tryHead" 1 (LazyList.tryHead(LazyList.cons 1 LazyList.empty)).Value } + test "tryHead seq2" { Expect.equal "tryHead" 1 (LazyList.tryHead(LazyList.cons 1 (LazyList.cons 2 LazyList.empty))).Value } + + test "tryTail empty" { Expect.isNone "tryTail" (LazyList.tryTail LazyList.empty) } + test "tryTail seq1" { + Expect.isTrue "tryTail" + <| LazyList.isEmpty (LazyList.tryTail(LazyList.cons 1 LazyList.empty)).Value + } + test "tryTail seq2" { + Expect.equal "tryTail" [ 2 ] + <| LazyList.toList((LazyList.tryTail(LazyList.cons 1 (LazyList.cons 2 LazyList.empty))).Value) + } + test "tryTail seq3" { + Expect.equal "tryTail" [ 2; 3 ] + <| LazyList.toList((LazyList.tryTail(LazyList.cons 1 (LazyList.cons 2 (LazyList.cons 3 LazyList.empty)))).Value) + } + + test "take1" { + Expect.equal "take1" [ 0; 1; 2; 3 ] + <| LazyList.toList(LazyList.take 4 nats) + } + test "skip 4" { Expect.equal "drop1" 4 <| LazyList.head(LazyList.skip 4 nats) } + test "skip 0" { Expect.equal "drop1" 0 <| LazyList.head(LazyList.skip 0 nats) } + + test "tryTake empty" { Expect.isNone "tryTake" <| LazyList.tryTake 4 LazyList.empty } + test "tryTake0" { + Expect.isTrue "tryTake0" + <| LazyList.isEmpty (LazyList.tryTake 0 LazyList.empty).Value + } + test "tryTake1" { + Expect.equal "tryTake1" [ 0 ] + <| LazyList.toList (LazyList.tryTake 1 nats).Value + } + test "tryTake4" { + Expect.equal "tryTake4" [ 0; 1; 2; 3 ] + <| LazyList.toList (LazyList.tryTake 4 nats).Value + } + test "tryTake4 from list of 3" { + Expect.equal "" [ 0; 1; 2 ] + <| LazyList.toList (LazyList.tryTake 4 (LazyList.tryTake 3 nats).Value).Value + } + + test "trySkip 0" { Expect.equal "" 0 <| LazyList.head (LazyList.trySkip 0 nats).Value } + test "trySkip 4" { Expect.equal "" 4 <| LazyList.head (LazyList.trySkip 4 nats).Value } + test "trySkip -1" { Expect.isNone "" <| LazyList.trySkip -1 nats } + test "trySkip 4 from list of 3" { Expect.isNone "" <| LazyList.trySkip 4 (LazyList.tryTake 3 nats).Value } + + test "tryUncons empty" { Expect.isNone "" <| LazyList.tryUncons LazyList.empty } + + test "tryUncons 1" { + let x, y = (LazyList.tryUncons(LazyList.take 1 nats)).Value + Expect.equal "tryUncons" (0, true) (x, (LazyList.isEmpty y)) + } + + test "tryUncons take 2" { + let x2, y2 = (LazyList.tryUncons(LazyList.take 2 nats)).Value + Expect.equal "tryUncons" (0, [ 1 ]) (x2, (LazyList.toList y2)) + } + + test "tryUncons take 3" { + let x3, y3 = (LazyList.tryUncons(LazyList.take 3 nats)).Value + Expect.equal "tryUncons" (0, [ 1; 2 ]) (x3, (LazyList.toList y3)) + } + + test "uncons 1" { + let xa, ya = LazyList.uncons(LazyList.take 1 nats) + Expect.equal "uncons" (0, true) (xa, (LazyList.isEmpty ya)) + } + + test "uncons take 2" { + let xa2, ya2 = LazyList.uncons(LazyList.take 2 nats) + Expect.equal "uncons" (0, [ 1 ]) (xa2, (LazyList.toList ya2)) + } + + test "uncons take 3" { + let xa3, ya3 = LazyList.uncons(LazyList.take 3 nats) + Expect.equal "uncons" (0, [ 1; 2 ]) (xa3, (LazyList.toList ya3)) + } + + test "mapAccum" { + let ll = LazyList.ofList [ -5 .. -1 ] + let expected = (15, [ 5; 4; 3; 2; 1 ]) + let x, y = LazyList.mapAccum (fun a b -> let c = abs b in (a + c, c)) 0 ll + Expect.equal "mapAccum" expected (x, (LazyList.toList y)) + } + + test "fold" { + let ll = LazyList.ofList [ -5 .. -1 ] + let expected = 15 + + Expect.equal "fold" expected + <| LazyList.fold (fun a b -> a + abs b) 0 ll + } + + test "repeat" { + Expect.equal "take repeat" [ 1; 1; 1; 1 ] + <| LazyList.toList(LazyList.take 4 (LazyList.repeat 1)) + } + test "append" { + Expect.equal "append" [ 77; 0; 1; 2 ] + <| LazyList.toList(LazyList.take 4 (LazyList.append (LazyList.cons 77 (LazyList.empty)) nats)) + } + test "zip" { + Expect.equal "zip" [ 0, 6; 1, 7; 2, 8 ] + <| LazyList.toList(LazyList.take 3 (LazyList.zip nats (LazyList.skip 6 nats))) + } + test "firstS" { + Expect.equal "tryFind" (Some 8) + <| LazyList.tryFind (fun x -> x >= 8) nats + } + test "firstN" { + Expect.isNone "take" + <| LazyList.tryFind (fun x -> x >= 8) (LazyList.take 5 nats) + } + test "find S" { Expect.equal "find" 8 <| LazyList.find (fun x -> x >= 8) nats } + + test "find N" { + Expect.throwsT "find N" (fun () -> LazyList.find (fun x -> x >= 8) (LazyList.take 5 nats) |> ignore) + } + + test "consfA" { + Expect.equal "consDelayed" 1 + <| LazyList.head(LazyList.consDelayed 1 diverge) + } + test "consfB" { Expect.isTrue "divergence" (let ss = LazyList.tail(LazyList.consDelayed 1 diverge) in true) } (* testing for lazy divergence *) + test "dropDiverge1" { Expect.isTrue "divergence" (let ss = LazyList.skip 1 (LazyList.consDelayed 1 diverge) in true) } (* testing for lazy divergence *) + test "dropDiverge0" { Expect.isTrue "divergence" (let ss = LazyList.skip 0 (LazyList.delayed(fun () -> failwith "errors")) in true) } (* testing for lazy divergence *) + + test "takedrop" { + Expect.equal "takedrop" [ 4; 5; 6 ] + <| LazyList.toList(LazyList.take 3 (LazyList.skip 4 nats)) + } + test "filter" { + Expect.equal "filter" [ 0; 2; 4; 6 ] + <| LazyList.toList(LazyList.take 4 (LazyList.filter (fun x -> x % 2 = 0) nats)) + } + test "map" { + Expect.equal "map" [ 1; 2; 3; 4 ] + <| LazyList.toList(LazyList.take 4 (LazyList.map (fun x -> x + 1) nats)) + } + test "map2" { + Expect.equal "map2" [ 0 * 1; 1 * 2; 2 * 3; 3 * 4 ] + <| LazyList.toList(LazyList.take 4 (LazyList.map2 (fun x y -> x * y) nats (LazyList.tail nats))) + } + + test "array take6" { + Expect.equal "array" (LazyList.toList(LazyList.take 6 nats)) + <| Array.toList(LazyList.toArray(LazyList.take 6 nats)) + } + test "array list" { + Expect.equal "array" (LazyList.toList(LazyList.ofArray [| 1; 2; 3; 4 |])) + <| LazyList.toList(LazyList.ofList [ 1; 2; 3; 4 ]) + } + + test "equalsWith" { + Expect.isTrue "equalsWith" + <| LazyList.equalsWith (=) (LazyList.ofList [ 1; 2; 3; 4; 5 ]) (LazyList.ofList [ 1..5 ]) + } + test "compareWith" { + Expect.equal "compareWith" -1 + <| LazyList.compareWith Unchecked.compare (LazyList.ofList [ 1; 2; 3; 4 ]) (LazyList.ofList [ 1..5 ]) + } + + // This checks that LazyList.map, LazyList.length etc. are tail recursive + test "LazyList.length 100" { Expect.equal "length" 100 (LazyList.ofSeq(Seq.init 100 (fun c -> c)) |> LazyList.length) } + test "LazyList.length 1000000" { Expect.equal "length" 1000000 (LazyList.ofSeq(Seq.init 1000000 (fun c -> c)) |> LazyList.length) } + test "LazyList.length 0" { Expect.equal "length" 0 (LazyList.ofSeq(Seq.init 0 (fun c -> c)) |> LazyList.length) } + test "LazyList.map" { + Expect.equal + "map" + 1000000 + (LazyList.map (fun x -> x + 1) (LazyList.ofSeq(Seq.init 1000000 (fun c -> c))) + |> Seq.length) + } + test "LazyList.filter" { + Expect.equal + "filter" + 500000 + (LazyList.filter (fun x -> x % 2 = 0) (LazyList.ofSeq(Seq.init 1000000 (fun c -> c))) + |> Seq.length) + } + test "LazyList.iter 0" { + Expect.equal + "iter" + 0 + (let count = ref 0 in + LazyList.iter (fun x -> incr count) (LazyList.ofSeq(Seq.init 0 (fun c -> c))) + !count) + } + test "LazyList.iter" { + Expect.equal + "iter" + 1000000 + (let count = ref 0 in + LazyList.iter (fun x -> incr count) (LazyList.ofSeq(Seq.init 1000000 (fun c -> c))) + !count) + } + test "LazyList.toList" { + Expect.equal + "toList" + 200000 + (LazyList.toList(LazyList.ofSeq(Seq.init 200000 (fun c -> c))) + |> Seq.length) + } + test "LazyList.toArray" { + Expect.equal + "toArray" + 200000 + (LazyList.toArray(LazyList.ofSeq(Seq.init 200000 (fun c -> c))) + |> Seq.length) + } + + // check exists on an infinite stream terminates + test "IEnumerableTest.exists 1" { Expect.isTrue "exists" (Seq.exists ((=) "a") (LazyList.repeat "a" |> LazyList.toSeq)) } + // test a succeeding 'exists' on a concat of an infinite number of finite streams terminates + test "IEnumerableTest.exists 2" { + Expect.isTrue "exists" (Seq.exists ((=) "a") (Seq.concat(LazyList.repeat [| "a"; "b" |] |> LazyList.toSeq))) + } + // test a succeeding 'exists' on a concat of an infinite number of infinite streams terminates + test "IEnumerableTest.exists 3" { + Expect.isTrue + "exists" + (Seq.exists + ((=) "a") + (Seq.concat( + LazyList.repeat(LazyList.repeat "a" |> LazyList.toSeq) + |> LazyList.toSeq + ))) + } + // test a failing for_all on an infinite stream terminates + test "IEnumerableTest.exists 4" { Expect.isFalse "exists" (Seq.forall ((=) "a" >> not) (LazyList.repeat "a" |> LazyList.toSeq)) } + // test a failing for_all on a concat of an infinite number of finite streams terminates + test "IEnumerableTest.exists 5" { + Expect.isFalse "exists" (Seq.forall ((=) "a" >> not) (Seq.concat(LazyList.repeat [| "a"; "b" |] |> LazyList.toSeq))) + } + test "IEnumerableTest.append, infinite, infinite, then take 2" { + Expect.equal + "append, infinite, infinite, then take" + [ "a"; "a" ] + (Seq.take 2 (Seq.append (LazyList.repeat "a" |> LazyList.toSeq) (LazyList.repeat "b" |> LazyList.toSeq)) + |> Seq.toList) + } + + // test exists on an infinite stream terminates + test "IEnumerableTest.exists 6" { + let numActiveEnumerators = ref 0 + + Expect.isTrue + "exists" + (Seq.exists + ((=) "a") + (LazyList.repeat "a" + |> LazyList.toSeq + |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators)) + + Expect.equal "" 0 !numActiveEnumerators + } + + // test a succeeding 'exists' on a concat of an infinite number of finite streams terminates + test "IEnumerableTest.exists 7" { + let numActiveEnumerators = ref 0 + + Expect.isTrue + "" + (Seq.exists + ((=) "a") + (Seq.concat( + LazyList.repeat [| "a"; "b" |] + |> LazyList.toSeq + |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators + ))) + + Expect.equal "" 0 !numActiveEnumerators + } + + // test a succeeding 'exists' on a concat of an infinite number of infinite streams terminates + test "IEnumerableTest.exists 8" { + let numActiveEnumerators = ref 0 + + Expect.isTrue + "" + (Seq.exists + ((=) "a") + (Seq.concat( + LazyList.repeat(LazyList.repeat "a" |> LazyList.toSeq) + |> LazyList.toSeq + |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators + ))) + + Expect.equal "" 0 !numActiveEnumerators + } + + // test a failing for_all on an infinite stream terminates + test "IEnumerableTest.exists 9" { + let numActiveEnumerators = ref 0 + + Expect.isFalse + "exists" + (Seq.forall + ((=) "a" >> not) + (LazyList.repeat "a" + |> LazyList.toSeq + |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators)) + + Expect.equal "" 0 !numActiveEnumerators + } + + // check a failing for_all on a concat of an infinite number of finite streams terminates + test "IEnumerableTest.exists 10" { + let numActiveEnumerators = ref 0 + + Expect.isFalse + "exists" + (Seq.forall + ((=) "a" >> not) + (Seq.concat( + LazyList.repeat [| "a"; "b" |] + |> LazyList.toSeq + |> countEnumeratorsAndCheckedDisposedAtMostOnce numActiveEnumerators + ))) + + Expect.equal "exists" 0 !numActiveEnumerators + } + + test "IEnumerableTest.append, repeat" { + let numActiveEnumerators = ref 0 + + Expect.equal + "" + [ "a"; "a" ] + (Seq.take 2 (Seq.append (LazyList.repeat "a" |> LazyList.toSeq) (LazyList.repeat "b" |> LazyList.toSeq)) + |> countEnumeratorsAndCheckedDisposedAtMostOnceAtEnd numActiveEnumerators + |> Seq.toList) + + Expect.equal "exists" 0 !numActiveEnumerators + } + + test "pairReduce" { + Expect.equal "pairReduce" [ 1; 5; 9; 13; 17; 21; 25; 29; 33; 37 ] + <| LazyList.toList(LazyList.take 10 (pairReduce inf)) + } + + test "scan 3" { Expect.equal "scan" [ 0; 1; 3 ] (LazyList.scan (+) 0 (LazyList.ofList [ 1; 2 ]) |> LazyList.toList) } + test "scan 0" { Expect.equal "scan" [ 0 ] (LazyList.scan (+) 0 (LazyList.ofList []) |> LazyList.toList) } ] diff --git a/tests/FSharpx.Collections.Tests/ListExtensionsTest.fs b/tests/FSharpx.Collections.Tests/ListExtensionsTest.fs index 5edbd239..5a2244c4 100644 --- a/tests/FSharpx.Collections.Tests/ListExtensionsTest.fs +++ b/tests/FSharpx.Collections.Tests/ListExtensionsTest.fs @@ -9,77 +9,78 @@ module ListExtensionsTests = [] let testListExtensions = - testList "ListExtensions" [ - - test "test List_split correctly breaks the list on the specified predicate" { - let str = List.ofSeq "Howdy! Want to play?" - let expected = (List.ofSeq "Howdy!", List.ofSeq " Want to play?") - Expect.equal "split" expected <| List.split (fun c -> c = ' ') str - } - - test "test List_splitAt correctly breaks the list on the specified index" { - let str = List.ofSeq "Howdy! Want to play?" - let expected = (List.ofSeq "Howdy!", List.ofSeq " Want to play?") - Expect.equal "splitAt" expected <| List.splitAt 6 str - } - - test "Can splitAt 3" { - let list = [ 1..5 ] - let expected = [ 1; 2; 3 ], [ 4; 5 ] - Expect.equal "splitAt" expected <| List.splitAt 3 list - } - - test "Can split at 3" { - let list = [ 1..5 ] - let expected = [ 1; 2 ], [ 3; 4; 5 ] - Expect.equal "split" expected <| List.split ((=) 3) list - } - - test "Can split at 0" { - let l1, l2 = List.split ((=) 0) [ 1..5 ] - Expect.equal "split" [ 1..5 ] l1 - Expect.equal "split" [] l2 - } - - test "test List_span correctly breaks the list on the specified predicate" { - let str = List.ofSeq "Howdy! Want to play?" - let expected = (List.ofSeq "Howdy!", List.ofSeq " Want to play?") - Expect.equal "span" expected <| List.span (fun c -> c <> ' ') str - } - - test "lift2" { - Expect.equal "lift2" [ 0; 2; 1; 3 ] - <| List.lift2 (+) [ 0; 1 ] [ 0; 2 ] - } - - test "mapAccum" { - let list = [ -5 .. -1 ] - let expected = (15, [ 5; 4; 3; 2; 1 ]) - - Expect.equal "mapAccum" expected - <| List.mapAccum (fun a b -> let c = abs b in (a + c, c)) 0 list - } - - test "Should be able to merge to lists" { - let a, b = [ 1; 2; 3; 4; 5 ], [ 6; 7; 8; 9; 10 ] - - Expect.equal "merge" [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] - <| List.mergeBy id a b - } - - test "Should be able to merge two lists II" { - let a, b = [ 1; 2; 3; 4; 5 ], [ 6; 7; 8; 9; 10 ] - - Expect.equal "merge" [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] - <| List.merge a b - } - - test "I should be able to transpose a list" { - let a = [ [ 1; 2; 3 ]; [ 4; 5; 6 ] ] - let expected = [ [ 1; 4 ]; [ 2; 5 ]; [ 3; 6 ] ] - Expect.equal "transpose" expected (a |> List.transpose) - } - ] + testList + "ListExtensions" + [ + + test "test List_split correctly breaks the list on the specified predicate" { + let str = List.ofSeq "Howdy! Want to play?" + let expected = (List.ofSeq "Howdy!", List.ofSeq " Want to play?") + Expect.equal "split" expected <| List.split (fun c -> c = ' ') str + } + + test "test List_splitAt correctly breaks the list on the specified index" { + let str = List.ofSeq "Howdy! Want to play?" + let expected = (List.ofSeq "Howdy!", List.ofSeq " Want to play?") + Expect.equal "splitAt" expected <| List.splitAt 6 str + } + + test "Can splitAt 3" { + let list = [ 1..5 ] + let expected = [ 1; 2; 3 ], [ 4; 5 ] + Expect.equal "splitAt" expected <| List.splitAt 3 list + } + + test "Can split at 3" { + let list = [ 1..5 ] + let expected = [ 1; 2 ], [ 3; 4; 5 ] + Expect.equal "split" expected <| List.split ((=) 3) list + } + + test "Can split at 0" { + let l1, l2 = List.split ((=) 0) [ 1..5 ] + Expect.equal "split" [ 1..5 ] l1 + Expect.equal "split" [] l2 + } + + test "test List_span correctly breaks the list on the specified predicate" { + let str = List.ofSeq "Howdy! Want to play?" + let expected = (List.ofSeq "Howdy!", List.ofSeq " Want to play?") + Expect.equal "span" expected <| List.span (fun c -> c <> ' ') str + } + + test "lift2" { + Expect.equal "lift2" [ 0; 2; 1; 3 ] + <| List.lift2 (+) [ 0; 1 ] [ 0; 2 ] + } + + test "mapAccum" { + let list = [ -5 .. -1 ] + let expected = (15, [ 5; 4; 3; 2; 1 ]) + + Expect.equal "mapAccum" expected + <| List.mapAccum (fun a b -> let c = abs b in (a + c, c)) 0 list + } + + test "Should be able to merge to lists" { + let a, b = [ 1; 2; 3; 4; 5 ], [ 6; 7; 8; 9; 10 ] + + Expect.equal "merge" [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] + <| List.mergeBy id a b + } + + test "Should be able to merge two lists II" { + let a, b = [ 1; 2; 3; 4; 5 ], [ 6; 7; 8; 9; 10 ] + + Expect.equal "merge" [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] + <| List.merge a b + } + + test "I should be able to transpose a list" { + let a = [ [ 1; 2; 3 ]; [ 4; 5; 6 ] ] + let expected = [ [ 1; 4 ]; [ 2; 5 ]; [ 3; 6 ] ] + Expect.equal "transpose" expected (a |> List.transpose) + } ] [] let propertyTestListExtensions = @@ -99,8 +100,8 @@ module ListExtensionsTests = else List.length padded = List.length list - testList "ListExtensions property tests" [ - testPropertyWithConfig config10k "fill a list" fill + testList + "ListExtensions property tests" + [ testPropertyWithConfig config10k "fill a list" fill - testPropertyWithConfig config10k "pad a list" pad - ] + testPropertyWithConfig config10k "pad a list" pad ] diff --git a/tests/FSharpx.Collections.Tests/MapExtensionsTest.fs b/tests/FSharpx.Collections.Tests/MapExtensionsTest.fs index 1802aa22..c022c5bf 100644 --- a/tests/FSharpx.Collections.Tests/MapExtensionsTest.fs +++ b/tests/FSharpx.Collections.Tests/MapExtensionsTest.fs @@ -7,45 +7,45 @@ open Expecto.Flip module MapExtensionsTests = [] let testMapExtensions = - testList "MapExtensions" [ - test "map insertWith" { - let a = Map.ofList [ 1, "one"; 2, "two" ] - Expect.equal "insertWith" [ 1, "new one"; 2, "two" ] (a |> Map.insertWith (+) 1 "new " |> Map.toList) - } + testList + "MapExtensions" + [ test "map insertWith" { + let a = Map.ofList [ 1, "one"; 2, "two" ] + Expect.equal "insertWith" [ 1, "new one"; 2, "two" ] (a |> Map.insertWith (+) 1 "new " |> Map.toList) + } - test "map updateWith should update value if (f x) is Some" { - let f x = - if x = "one" then Some "new one" else None + test "map updateWith should update value if (f x) is Some" { + let f x = + if x = "one" then Some "new one" else None - let a = Map.ofList [ 1, "one"; 2, "two" ] - Expect.equal "updateWith" [ 1, "new one"; 2, "two" ] (a |> Map.updateWith f 1 |> Map.toList) - } + let a = Map.ofList [ 1, "one"; 2, "two" ] + Expect.equal "updateWith" [ 1, "new one"; 2, "two" ] (a |> Map.updateWith f 1 |> Map.toList) + } - test "map updateWith should delete element if (f x) is None" { - let f x = - if x = "one" then Some "new one" else None + test "map updateWith should delete element if (f x) is None" { + let f x = + if x = "one" then Some "new one" else None - let a = Map.ofList [ 1, "one"; 2, "two" ] - Expect.equal "updateWith" [ 1, "one" ] (a |> Map.updateWith f 2 |> Map.toList) - } + let a = Map.ofList [ 1, "one"; 2, "two" ] + Expect.equal "updateWith" [ 1, "one" ] (a |> Map.updateWith f 2 |> Map.toList) + } - test "test Map_splitWithKey correctly breaks the dictionary on the specified predicate" { - let a = Map.ofList [ 0, "zero"; 1, "one"; 2, "two"; 3, "three"; 4, "four" ] - let v1, v2 = a |> Map.splitWithKey((>=) 2) + test "test Map_splitWithKey correctly breaks the dictionary on the specified predicate" { + let a = Map.ofList [ 0, "zero"; 1, "one"; 2, "two"; 3, "three"; 4, "four" ] + let v1, v2 = a |> Map.splitWithKey((>=) 2) - Expect.equal "splitWithKey" [ 0, "zero"; 1, "one"; 2, "two" ] - <| Map.toList v1 + Expect.equal "splitWithKey" [ 0, "zero"; 1, "one"; 2, "two" ] + <| Map.toList v1 - Expect.equal "splitWithKey" [ 3, "three"; 4, "four" ] <| Map.toList v2 - } + Expect.equal "splitWithKey" [ 3, "three"; 4, "four" ] <| Map.toList v2 + } - test "test Map_spanWithKey correctly breaks the dictionary on the specified predicate" { - let a = Map.ofList [ 0, "zero"; 1, "one"; 2, "two"; 3, "three"; 4, "four" ] - let v1, v2 = a |> Map.spanWithKey((<) 2) + test "test Map_spanWithKey correctly breaks the dictionary on the specified predicate" { + let a = Map.ofList [ 0, "zero"; 1, "one"; 2, "two"; 3, "three"; 4, "four" ] + let v1, v2 = a |> Map.spanWithKey((<) 2) - Expect.equal "spanWithKey" [ 0, "zero"; 1, "one"; 2, "two" ] - <| Map.toList v1 + Expect.equal "spanWithKey" [ 0, "zero"; 1, "one"; 2, "two" ] + <| Map.toList v1 - Expect.equal "spanWithKey" [ 3, "three"; 4, "four" ] <| Map.toList v2 - } - ] + Expect.equal "spanWithKey" [ 3, "three"; 4, "four" ] <| Map.toList v2 + } ] diff --git a/tests/FSharpx.Collections.Tests/MapTests.fs b/tests/FSharpx.Collections.Tests/MapTests.fs index 6434a6b3..be806934 100644 --- a/tests/FSharpx.Collections.Tests/MapTests.fs +++ b/tests/FSharpx.Collections.Tests/MapTests.fs @@ -8,44 +8,43 @@ open Expecto.Flip module MapTests = let data = - [ - (1, 1) - (2, 2) - (3, 3) - (4, 4) - (5, 5) - (6, 6) - (7, 7) - (8, 8) - (9, 9) - (10, 10) - ] + [ (1, 1) + (2, 2) + (3, 3) + (4, 4) + (5, 5) + (6, 6) + (7, 7) + (8, 8) + (9, 9) + (10, 10) ] |> Map.ofList [] let testMap = - testList "Map" [ - - test "I should be able to choose elements from a map" { - let expected = [ (2, 2); (4, 4); (6, 6); (8, 8); (10, 10) ] |> Map.ofList - - Expect.equal "choose" expected - <| Map.choose (fun k _ -> if k % 2 = 0 then Some k else None) data - } - - test "I should be able to remove elements by key" { - let toRemove = [ 1; 2; 3; 4; 5 ] - let expected = [ (6, 6); (7, 7); (8, 8); (9, 9); (10, 10) ] |> Map.ofList - Expect.equal "removeMany" expected <| Map.removeMany toRemove data - } - - test "I should be able to extract values from a map" { - let expected = [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] |> Seq.ofList - Expect.sequenceEqual "values" expected <| Map.values data - } - - test "I should be able to extract keys from a map" { - let expected = [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] |> Seq.ofList - Expect.sequenceEqual "keys" expected <| Map.keys data - } - ] + testList + "Map" + [ + + test "I should be able to choose elements from a map" { + let expected = [ (2, 2); (4, 4); (6, 6); (8, 8); (10, 10) ] |> Map.ofList + + Expect.equal "choose" expected + <| Map.choose (fun k _ -> if k % 2 = 0 then Some k else None) data + } + + test "I should be able to remove elements by key" { + let toRemove = [ 1; 2; 3; 4; 5 ] + let expected = [ (6, 6); (7, 7); (8, 8); (9, 9); (10, 10) ] |> Map.ofList + Expect.equal "removeMany" expected <| Map.removeMany toRemove data + } + + test "I should be able to extract values from a map" { + let expected = [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] |> Seq.ofList + Expect.sequenceEqual "values" expected <| Map.values data + } + + test "I should be able to extract keys from a map" { + let expected = [ 1; 2; 3; 4; 5; 6; 7; 8; 9; 10 ] |> Seq.ofList + Expect.sequenceEqual "keys" expected <| Map.keys data + } ] diff --git a/tests/FSharpx.Collections.Tests/NameValueCollectionTests.fs b/tests/FSharpx.Collections.Tests/NameValueCollectionTests.fs index 8c5d69d9..243c4720 100644 --- a/tests/FSharpx.Collections.Tests/NameValueCollectionTests.fs +++ b/tests/FSharpx.Collections.Tests/NameValueCollectionTests.fs @@ -15,82 +15,83 @@ module NameValueCollectionTests = let assertKeyIs (l: ILookup<_, _>) a key = Expect.equal "assertKeyIs" a (l.[key] |> Seq.toList) - testList "NameValueCollection" [ - - test "ofSeq" { - let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] - let n2 = NameValueCollection() - n2.Add("1", "uno") - n2.Add("1", "one") - n2.Add("2", "two") - - Expect.equal "ofSeq" n1.AllKeys n2.AllKeys - Expect.equal "ofSeq" (n1.GetValues("1")) (n2.GetValues("1")) - } - - test "toSeq" { - let r = [ "1", "uno"; "1", "one"; "2", "two" ] - let a = NameValueCollection.ofSeq r - let s = NameValueCollection.toSeq a - Expect.sequenceEqual "toSeq" (List.toSeq r) s - } - - test "toArray" { - let r = [| "1", "uno"; "1", "one"; "2", "two" |] - let a = NameValueCollection.ofSeq r - let s = NameValueCollection.toArray a - Expect.equal "toArray" r s - } - - test "toList" { - let r = [ "1", "uno"; "1", "one"; "2", "two" ] - let a = NameValueCollection.ofSeq r - let s = NameValueCollection.toList a - Expect.equal "toList" r s - } - - test "concat" { - let a = NameValueCollection() - a.Add("1", "uno") - a.Add("2", "dos") - let b = NameValueCollection() - b.Add("1", "one") - b.Add("2", "two") - let c = NameValueCollection.concat a b - - Expect.equal "concat" [ ("1", "uno"); ("1", "one"); ("2", "dos"); ("2", "two") ] - <| NameValueCollection.toList c - - Expect.equal "ofSeq" [| "1"; "2" |] c.AllKeys - } - - test "toLookup" { - let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] - let l = NameValueCollection.toLookup n1 - "1" |> assertKeyIs l [ "uno"; "one" ] - "2" |> assertKeyIs l [ "two" ] - "3" |> assertKeyIs l [] - n1.Add("3", "three") - "3" |> assertKeyIs l [] - } - - test "asLookup" { - let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] - let l = NameValueCollection.asLookup n1 - "1" |> assertKeyIs l [ "uno"; "one" ] - "2" |> assertKeyIs l [ "two" ] - "3" |> assertKeyIs l [] - n1.Add("3", "three") - "3" |> assertKeyIs l [ "three" ] - } - - test "asDictionary" { - let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] - let d = NameValueCollection.asDictionary n1 - Expect.equal "asDictionary" [| "uno"; "one" |] d.["1"] - Expect.equal "asDictionary" [| "two" |] d.["2"] - Expect.throwsT "asDictionary" (fun () -> ignore d.["3"] |> ignore) - n1.Add("3", "three") - Expect.equal "asDictionary" [| "three" |] d.["3"] - } - ] + testList + "NameValueCollection" + [ + + test "ofSeq" { + let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] + let n2 = NameValueCollection() + n2.Add("1", "uno") + n2.Add("1", "one") + n2.Add("2", "two") + + Expect.equal "ofSeq" n1.AllKeys n2.AllKeys + Expect.equal "ofSeq" (n1.GetValues("1")) (n2.GetValues("1")) + } + + test "toSeq" { + let r = [ "1", "uno"; "1", "one"; "2", "two" ] + let a = NameValueCollection.ofSeq r + let s = NameValueCollection.toSeq a + Expect.sequenceEqual "toSeq" (List.toSeq r) s + } + + test "toArray" { + let r = [| "1", "uno"; "1", "one"; "2", "two" |] + let a = NameValueCollection.ofSeq r + let s = NameValueCollection.toArray a + Expect.equal "toArray" r s + } + + test "toList" { + let r = [ "1", "uno"; "1", "one"; "2", "two" ] + let a = NameValueCollection.ofSeq r + let s = NameValueCollection.toList a + Expect.equal "toList" r s + } + + test "concat" { + let a = NameValueCollection() + a.Add("1", "uno") + a.Add("2", "dos") + let b = NameValueCollection() + b.Add("1", "one") + b.Add("2", "two") + let c = NameValueCollection.concat a b + + Expect.equal "concat" [ ("1", "uno"); ("1", "one"); ("2", "dos"); ("2", "two") ] + <| NameValueCollection.toList c + + Expect.equal "ofSeq" [| "1"; "2" |] c.AllKeys + } + + test "toLookup" { + let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] + let l = NameValueCollection.toLookup n1 + "1" |> assertKeyIs l [ "uno"; "one" ] + "2" |> assertKeyIs l [ "two" ] + "3" |> assertKeyIs l [] + n1.Add("3", "three") + "3" |> assertKeyIs l [] + } + + test "asLookup" { + let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] + let l = NameValueCollection.asLookup n1 + "1" |> assertKeyIs l [ "uno"; "one" ] + "2" |> assertKeyIs l [ "two" ] + "3" |> assertKeyIs l [] + n1.Add("3", "three") + "3" |> assertKeyIs l [ "three" ] + } + + test "asDictionary" { + let n1 = NameValueCollection.ofSeq [ "1", "uno"; "1", "one"; "2", "two" ] + let d = NameValueCollection.asDictionary n1 + Expect.equal "asDictionary" [| "uno"; "one" |] d.["1"] + Expect.equal "asDictionary" [| "two" |] d.["2"] + Expect.throwsT "asDictionary" (fun () -> ignore d.["3"] |> ignore) + n1.Add("3", "three") + Expect.equal "asDictionary" [| "three" |] d.["3"] + } ] diff --git a/tests/FSharpx.Collections.Tests/NonEmptyListTests.fs b/tests/FSharpx.Collections.Tests/NonEmptyListTests.fs index 1a6de67c..acb77c36 100644 --- a/tests/FSharpx.Collections.Tests/NonEmptyListTests.fs +++ b/tests/FSharpx.Collections.Tests/NonEmptyListTests.fs @@ -37,10 +37,11 @@ module NonEmptyListTests = } |> Arb.fromGen - let nonEmptyListGen() = gen { - let! ne = (Gen.apply (Gen.apply (gen.Return NonEmptyList.create) Arb.generate) (Arb.generate |> Gen.filter(fun l -> l.Length < 10))) - return ne - } + let nonEmptyListGen() = + gen { + let! ne = (Gen.apply (Gen.apply (gen.Return NonEmptyList.create) Arb.generate) (Arb.generate |> Gen.filter(fun l -> l.Length < 10))) + return ne + } let twoDifferentLengths() = gen { @@ -113,144 +114,147 @@ module NonEmptyListTests = let inline (>>=) m f = NonEmptyList.collect f m - testList "NonEmptyList" [ - testPropertyWithConfig - config10k - "NonEmptyList functor laws: preserves identity" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun value -> map id value = value) - - testPropertyWithConfig - config10k - "NonEmptyList functor laws: preserves composition" - (Prop.forAll(arbitraryMapMapNE()) - <| fun (f, g, value) -> map (f << g) value = (map f << map g) value) - - testPropertyWithConfig config10k "NonEmptyList monad laws: left identity" (Prop.forAll(leftIdentity()) <| fun (f, a) -> ret a >>= f = f a) - - testPropertyWithConfig config10k "NonEmptyList monad laws: right identity" (Prop.forAll(neListOfInt()) <| fun x -> x >>= ret = x) - - testPropertyWithConfig - config10k - "NonEmptyList monad laws: associativity" - (Prop.forAll(associativity()) - <| fun (f, g, v) -> - let a = (v >>= f) >>= g - let b = v >>= (fun x -> f x >>= g) - a = b) - - testPropertyWithConfig - config10k - "toList gives non-empty list" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> NonEmptyList.toList nel |> List.length > 0) - - testPropertyWithConfig - config10k - "toArray gives non-empty array" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> NonEmptyList.toArray nel |> Array.length > 0) - - testPropertyWithConfig - config10k - "toList is same length as non-empty list" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> NonEmptyList.toList nel |> List.length = nel.Length) - - testPropertyWithConfig - config10k - "toArray is same length as non-empty list" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> NonEmptyList.toArray nel |> Array.length = nel.Length) - - testPropertyWithConfig config10k "ofArray" - <| fun arr -> - try - Seq.forall2 (=) (NonEmptyList.ofArray arr) arr - with :? System.ArgumentException -> - arr.Length = 0 - - testPropertyWithConfig config10k "ofList" - <| fun l -> - try - Seq.forall2 (=) (NonEmptyList.ofList l) l - with :? System.ArgumentException -> - l = [] - - testPropertyWithConfig - config10k - "ofSeq" - (Prop.forAll(Gen.ArbitrarySeq()) - <| fun s -> - try - Seq.forall2 (=) (NonEmptyList.ofSeq s) s - with :? System.ArgumentException -> - Seq.isEmpty s) - - testPropertyWithConfig - config10k - "reverse . reverse = id" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> (NonEmptyList.rev << NonEmptyList.rev) nel = nel) - - testPropertyWithConfig - config10k - "last . reverse = head" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> (NonEmptyList.last << NonEmptyList.rev) nel = NonEmptyList.head nel) - - testPropertyWithConfig - config10k - "head . reverse = last" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> (NonEmptyList.head << NonEmptyList.rev) nel = NonEmptyList.last nel) - - testPropertyWithConfig - config10k - "last is last and never fails" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> - let actualLast = NonEmptyList.last nel - - let expectedLast = - let l = NonEmptyList.toList nel - l.[l.Length - 1] - - expectedLast = actualLast) - - testPropertyWithConfig config10k "append has combined length" - <| fun (a: _ list) (b: _ list) -> - if a.IsEmpty || b.IsEmpty then - // we don't test non-empty lists here. - true - else - let neA = NonEmptyList.create a.Head a.Tail - let neB = NonEmptyList.create b.Head b.Tail - (NonEmptyList.append neA neB).Length = neA.Length + neB.Length - - testPropertyWithConfig - config10k - "reduce" - (Prop.forAll(NonEmptyListGen.NonEmptyList()) - <| fun nel -> - let actual = NonEmptyList.reduce (+) nel - let expected = nel |> NonEmptyList.toList |> List.sum - expected = actual) - - testPropertyWithConfig - config10k - "zip" - (Prop.forAll(EqualLengthNELGen()) - <| fun (nel1, nel2) -> - let actual = NonEmptyList.zip nel1 nel2 |> NonEmptyList.toList - let expected = List.zip <| NonEmptyList.toList nel1 <| NonEmptyList.toList nel2 - expected = actual) - - testPropertyWithConfig - config10k - "zip on lists with different lengths raises an exception" - (Prop.forAll(twoDifferentLengths()) - <| fun (nel1, nel2) -> - Expect.throwsT (sprintf "length %i; length %i" nel1.Length nel2.Length) (fun () -> - NonEmptyList.zip nel1 nel2 |> ignore)) - ] + testList + "NonEmptyList" + [ testPropertyWithConfig + config10k + "NonEmptyList functor laws: preserves identity" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun value -> map id value = value) + + testPropertyWithConfig + config10k + "NonEmptyList functor laws: preserves composition" + (Prop.forAll(arbitraryMapMapNE()) + <| fun (f, g, value) -> map (f << g) value = (map f << map g) value) + + testPropertyWithConfig + config10k + "NonEmptyList monad laws: left identity" + (Prop.forAll(leftIdentity()) <| fun (f, a) -> ret a >>= f = f a) + + testPropertyWithConfig config10k "NonEmptyList monad laws: right identity" (Prop.forAll(neListOfInt()) <| fun x -> x >>= ret = x) + + testPropertyWithConfig + config10k + "NonEmptyList monad laws: associativity" + (Prop.forAll(associativity()) + <| fun (f, g, v) -> + let a = (v >>= f) >>= g + let b = v >>= (fun x -> f x >>= g) + a = b) + + testPropertyWithConfig + config10k + "toList gives non-empty list" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> NonEmptyList.toList nel |> List.length > 0) + + testPropertyWithConfig + config10k + "toArray gives non-empty array" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> NonEmptyList.toArray nel |> Array.length > 0) + + testPropertyWithConfig + config10k + "toList is same length as non-empty list" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> NonEmptyList.toList nel |> List.length = nel.Length) + + testPropertyWithConfig + config10k + "toArray is same length as non-empty list" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> NonEmptyList.toArray nel |> Array.length = nel.Length) + + testPropertyWithConfig config10k "ofArray" + <| fun arr -> + try + Seq.forall2 (=) (NonEmptyList.ofArray arr) arr + with :? System.ArgumentException -> + arr.Length = 0 + + testPropertyWithConfig config10k "ofList" + <| fun l -> + try + Seq.forall2 (=) (NonEmptyList.ofList l) l + with :? System.ArgumentException -> + l = [] + + testPropertyWithConfig + config10k + "ofSeq" + (Prop.forAll(Gen.ArbitrarySeq()) + <| fun s -> + try + Seq.forall2 (=) (NonEmptyList.ofSeq s) s + with :? System.ArgumentException -> + Seq.isEmpty s) + + testPropertyWithConfig + config10k + "reverse . reverse = id" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> (NonEmptyList.rev << NonEmptyList.rev) nel = nel) + + testPropertyWithConfig + config10k + "last . reverse = head" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> (NonEmptyList.last << NonEmptyList.rev) nel = NonEmptyList.head nel) + + testPropertyWithConfig + config10k + "head . reverse = last" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> (NonEmptyList.head << NonEmptyList.rev) nel = NonEmptyList.last nel) + + testPropertyWithConfig + config10k + "last is last and never fails" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> + let actualLast = NonEmptyList.last nel + + let expectedLast = + let l = NonEmptyList.toList nel + l.[l.Length - 1] + + expectedLast = actualLast) + + testPropertyWithConfig config10k "append has combined length" + <| fun (a: _ list) (b: _ list) -> + if a.IsEmpty || b.IsEmpty then + // we don't test non-empty lists here. + true + else + let neA = NonEmptyList.create a.Head a.Tail + let neB = NonEmptyList.create b.Head b.Tail + (NonEmptyList.append neA neB).Length = neA.Length + neB.Length + + testPropertyWithConfig + config10k + "reduce" + (Prop.forAll(NonEmptyListGen.NonEmptyList()) + <| fun nel -> + let actual = NonEmptyList.reduce (+) nel + let expected = nel |> NonEmptyList.toList |> List.sum + expected = actual) + + testPropertyWithConfig + config10k + "zip" + (Prop.forAll(EqualLengthNELGen()) + <| fun (nel1, nel2) -> + let actual = NonEmptyList.zip nel1 nel2 |> NonEmptyList.toList + let expected = List.zip <| NonEmptyList.toList nel1 <| NonEmptyList.toList nel2 + expected = actual) + + testPropertyWithConfig + config10k + "zip on lists with different lengths raises an exception" + (Prop.forAll(twoDifferentLengths()) + <| fun (nel1, nel2) -> + Expect.throwsT (sprintf "length %i; length %i" nel1.Length nel2.Length) (fun () -> + NonEmptyList.zip nel1 nel2 |> ignore)) ] diff --git a/tests/FSharpx.Collections.Tests/PersistentHashMapTest.fs b/tests/FSharpx.Collections.Tests/PersistentHashMapTest.fs index 7fc40661..f43a614e 100644 --- a/tests/FSharpx.Collections.Tests/PersistentHashMapTest.fs +++ b/tests/FSharpx.Collections.Tests/PersistentHashMapTest.fs @@ -10,306 +10,307 @@ module PersistentHashMapTests = [] let testPersistentHashMap = - testList "PersistentHashMap" [ - - test "PersistentHashMap.empty map should be PersistentHashMap.empty" { - let x = PersistentHashMap.empty - Expect.equal "length" 0 <| PersistentHashMap.length x - } - - test "PersistentHashMap.empty map should not contain key 0" { - let x = PersistentHashMap.empty - - Expect.isFalse "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey 1 x - } - - test "can PersistentHashMap.add null entry to PersistentHashMap.empty map" { - Expect.isFalse "PersistentHashMap.empty" - <| PersistentHashMap.containsKey "value" PersistentHashMap.empty - - Expect.isFalse "PersistentHashMap.empty" - <| PersistentHashMap.containsKey null PersistentHashMap.empty - - Expect.isTrue - "PersistentHashMap.empty" - (PersistentHashMap.add null "Hello" PersistentHashMap.empty - |> PersistentHashMap.containsKey null) - } - - //https://github.com/fsprojects/FSharpx.Collections/issues/85 - ptest "can add None value to empty map" { - let x = PersistentHashMap.Empty () - - Expect.isTrue "PersistentHashMap.containsKey" (x.Add("Hello", None) |> PersistentHashMap.containsKey "Hello") - } - - test "can PersistentHashMap.add PersistentHashMap.empty string as key to PersistentHashMap.empty map" { - Expect.isFalse "PersistentHashMap.empty" - <| PersistentHashMap.containsKey "" PersistentHashMap.empty - - Expect.isFalse - "PersistentHashMap.empty" - (PersistentHashMap.add "" "Hello" PersistentHashMap.empty - |> PersistentHashMap.containsKey null) - - Expect.isTrue - "PersistentHashMap.empty" - (PersistentHashMap.add "" "Hello" PersistentHashMap.empty - |> PersistentHashMap.containsKey "") - - Expect.equal - "PersistentHashMap.empty" - 1 - (PersistentHashMap.add "" "Hello" PersistentHashMap.empty - |> PersistentHashMap.length) - } - - test "can PersistentHashMap.add some integers to PersistentHashMap.empty map" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - - Expect.isTrue "PersistentHashMap.add" - <| PersistentHashMap.containsKey 1 x - - Expect.isTrue "PersistentHashMap.add" - <| PersistentHashMap.containsKey 5 x - - Expect.isFalse "PersistentHashMap.add" - <| PersistentHashMap.containsKey 6 x - - Expect.equal "PersistentHashMap.add" 5 <| PersistentHashMap.length x - } - - test "PersistentHashMap.add operates immutable" { - let y = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - - let x = y |> PersistentHashMap.add 4 "l" |> PersistentHashMap.add 5 "o" - - Expect.equal "" 3 <| PersistentHashMap.length y - Expect.equal "" 5 <| PersistentHashMap.length x - } - - test "can remove some integers from a map" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - |> PersistentHashMap.remove 1 - |> PersistentHashMap.remove 4 - - Expect.isFalse "PersistentHashMap.add remove" - <| PersistentHashMap.containsKey 1 x - - Expect.isFalse "PersistentHashMap.add remove" - <| PersistentHashMap.containsKey 4 x - - Expect.isTrue "PersistentHashMap.add remove" - <| PersistentHashMap.containsKey 5 x - - Expect.isFalse "PersistentHashMap.add remove" - <| PersistentHashMap.containsKey 6 x - - Expect.equal "PersistentHashMap.add remove" 3 - <| PersistentHashMap.length x - } - - test "remove operates" { - let y = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - - let x = y |> PersistentHashMap.remove 1 |> PersistentHashMap.remove 4 - - Expect.equal "remove" 3 <| PersistentHashMap.length x - Expect.equal "PersistentHashMap.add" 5 <| PersistentHashMap.length y - } - - test "can find integers in a map" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - - Expect.equal "PersistentHashMap.add" "h" <| PersistentHashMap.find 1 x - Expect.equal "PersistentHashMap.add" "l" <| PersistentHashMap.find 4 x - Expect.equal "PersistentHashMap.add" "o" <| PersistentHashMap.find 5 x - } - - test "can lookup integers from a map" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - - Expect.equal "lookup" "h" x.[1] - Expect.equal "lookup" "l" x.[4] - Expect.equal "lookup" "o" x.[5] - } - - test "can PersistentHashMap.add the same key multiple to a map" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - |> PersistentHashMap.add 3 "a" - |> PersistentHashMap.add 4 "a" - - Expect.equal "find" "h" <| PersistentHashMap.find 1 x - Expect.equal "find" "a" <| PersistentHashMap.find 4 x - Expect.equal "find" "o" <| PersistentHashMap.find 5 x - Expect.equal "length" 5 <| PersistentHashMap.length x - } - - test "can iterate through a map" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 "h" - |> PersistentHashMap.add 2 "a" - |> PersistentHashMap.add 3 "l" - |> PersistentHashMap.add 4 "l" - |> PersistentHashMap.add 5 "o" - - Expect.equal "find" "h" <| PersistentHashMap.find 1 x - Expect.equal "find" "l" <| PersistentHashMap.find 4 x - Expect.equal "find" "o" <| PersistentHashMap.find 5 x - } - - test "can convert a seq to a map" { - let list = [ 1, "h"; 2, "a"; 3, "l"; 4, "l"; 5, "o" ] - - Expect.equal - "ofSeq" - [ 1, "h"; 2, "a"; 3, "l"; 4, "l"; 5, "o" ] - (PersistentHashMap.ofSeq list |> PersistentHashMap.toSeq |> Seq.toList) - } - - test "a map is always sorter" { - let list = [ 4, "l"; 5, "o"; 2, "a"; 1, "h"; 3, "l" ] - - Expect.equal - "toSeq" - [ 1, "h"; 2, "a"; 3, "l"; 4, "l"; 5, "o" ] - (PersistentHashMap.ofSeq list |> PersistentHashMap.toSeq |> Seq.toList) - } - - test "can map a HashMap" { - let x = - PersistentHashMap.empty - |> PersistentHashMap.add 1 1 - |> PersistentHashMap.add 2 2 - |> PersistentHashMap.add 3 3 - |> PersistentHashMap.add 4 4 - |> PersistentHashMap.add 5 5 - - Expect.equal "map" [ 1, 2; 2, 3; 3, 4; 4, 5; 5, 6 ] (x |> PersistentHashMap.map(fun x -> x + 1) |> Seq.toList) - } - - test "can PersistentHashMap.add tons of integers to PersistentHashMap.empty map" { - let x = ref PersistentHashMap.empty - let counter = 1000 - - for i in 0..counter do - x := PersistentHashMap.add i i !x - - for i in 0..counter do - !x - |> PersistentHashMap.containsKey i - |> Expect.isTrue "PersistentHashMap.containsKey" - } - - test "can find tons of integers in a map" { - let x = ref PersistentHashMap.empty - let counter = 1000 - - for i in 0..counter do - x := PersistentHashMap.add i i !x - - for i in 0..counter do - !x |> PersistentHashMap.find i |> Expect.equal "find" i - } - - test "can PersistentHashMap.add keys with colliding hashes to PersistentHashMap.empty map" { - let x = { Name = "Test" } - let y = { Name = "Test1" } - - let map = - PersistentHashMap.empty - |> PersistentHashMap.add x x.Name - |> PersistentHashMap.add y y.Name - - Expect.isTrue "" <| PersistentHashMap.containsKey x map - Expect.isTrue "" <| PersistentHashMap.containsKey y map - - Expect.isFalse "" - <| PersistentHashMap.containsKey y PersistentHashMap.empty - } - - test "can lookup keys with colliding hashes from map" { - let x = { Name = "Test" } - let y = { Name = "Test1" } - - let map = - PersistentHashMap.empty - |> PersistentHashMap.add x x - |> PersistentHashMap.add y y - - Expect.equal "colliding hashes" { Name = "Test" } - <| PersistentHashMap.find x map - - Expect.equal "colliding hashes" { Name = "Test1" } - <| PersistentHashMap.find y map - } - - test "can PersistentHashMap.add lots of keys with colliding hashes to PersistentHashMap.empty map" { - let x = ref PersistentHashMap.empty - let counter = 1000 - - for i in 0..counter do - x := PersistentHashMap.add { Name = i.ToString() } i !x - - for i in 0..counter do - !x - |> PersistentHashMap.containsKey { Name = i.ToString() } - |> Expect.isTrue "colliding hashes" - } - - test "can find tons of strings in a map" { - let x = ref PersistentHashMap.empty - let n = 10000 - let r = new Random() - - for i in 0..n do - x := PersistentHashMap.add (i.ToString()) i !x - - for i in 0..1000000 do - !x - |> PersistentHashMap.containsKey((r.Next n).ToString()) - |> Expect.isTrue "Next" - } - ] + testList + "PersistentHashMap" + [ + + test "PersistentHashMap.empty map should be PersistentHashMap.empty" { + let x = PersistentHashMap.empty + Expect.equal "length" 0 <| PersistentHashMap.length x + } + + test "PersistentHashMap.empty map should not contain key 0" { + let x = PersistentHashMap.empty + + Expect.isFalse "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey 1 x + } + + test "can PersistentHashMap.add null entry to PersistentHashMap.empty map" { + Expect.isFalse "PersistentHashMap.empty" + <| PersistentHashMap.containsKey "value" PersistentHashMap.empty + + Expect.isFalse "PersistentHashMap.empty" + <| PersistentHashMap.containsKey null PersistentHashMap.empty + + Expect.isTrue + "PersistentHashMap.empty" + (PersistentHashMap.add null "Hello" PersistentHashMap.empty + |> PersistentHashMap.containsKey null) + } + + //https://github.com/fsprojects/FSharpx.Collections/issues/85 + ptest "can add None value to empty map" { + let x = PersistentHashMap.Empty() + + Expect.isTrue "PersistentHashMap.containsKey" (x.Add("Hello", None) |> PersistentHashMap.containsKey "Hello") + } + + test "can PersistentHashMap.add PersistentHashMap.empty string as key to PersistentHashMap.empty map" { + Expect.isFalse "PersistentHashMap.empty" + <| PersistentHashMap.containsKey "" PersistentHashMap.empty + + Expect.isFalse + "PersistentHashMap.empty" + (PersistentHashMap.add "" "Hello" PersistentHashMap.empty + |> PersistentHashMap.containsKey null) + + Expect.isTrue + "PersistentHashMap.empty" + (PersistentHashMap.add "" "Hello" PersistentHashMap.empty + |> PersistentHashMap.containsKey "") + + Expect.equal + "PersistentHashMap.empty" + 1 + (PersistentHashMap.add "" "Hello" PersistentHashMap.empty + |> PersistentHashMap.length) + } + + test "can PersistentHashMap.add some integers to PersistentHashMap.empty map" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + + Expect.isTrue "PersistentHashMap.add" + <| PersistentHashMap.containsKey 1 x + + Expect.isTrue "PersistentHashMap.add" + <| PersistentHashMap.containsKey 5 x + + Expect.isFalse "PersistentHashMap.add" + <| PersistentHashMap.containsKey 6 x + + Expect.equal "PersistentHashMap.add" 5 <| PersistentHashMap.length x + } + + test "PersistentHashMap.add operates immutable" { + let y = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + + let x = y |> PersistentHashMap.add 4 "l" |> PersistentHashMap.add 5 "o" + + Expect.equal "" 3 <| PersistentHashMap.length y + Expect.equal "" 5 <| PersistentHashMap.length x + } + + test "can remove some integers from a map" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + |> PersistentHashMap.remove 1 + |> PersistentHashMap.remove 4 + + Expect.isFalse "PersistentHashMap.add remove" + <| PersistentHashMap.containsKey 1 x + + Expect.isFalse "PersistentHashMap.add remove" + <| PersistentHashMap.containsKey 4 x + + Expect.isTrue "PersistentHashMap.add remove" + <| PersistentHashMap.containsKey 5 x + + Expect.isFalse "PersistentHashMap.add remove" + <| PersistentHashMap.containsKey 6 x + + Expect.equal "PersistentHashMap.add remove" 3 + <| PersistentHashMap.length x + } + + test "remove operates" { + let y = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + + let x = y |> PersistentHashMap.remove 1 |> PersistentHashMap.remove 4 + + Expect.equal "remove" 3 <| PersistentHashMap.length x + Expect.equal "PersistentHashMap.add" 5 <| PersistentHashMap.length y + } + + test "can find integers in a map" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + + Expect.equal "PersistentHashMap.add" "h" <| PersistentHashMap.find 1 x + Expect.equal "PersistentHashMap.add" "l" <| PersistentHashMap.find 4 x + Expect.equal "PersistentHashMap.add" "o" <| PersistentHashMap.find 5 x + } + + test "can lookup integers from a map" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + + Expect.equal "lookup" "h" x.[1] + Expect.equal "lookup" "l" x.[4] + Expect.equal "lookup" "o" x.[5] + } + + test "can PersistentHashMap.add the same key multiple to a map" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + |> PersistentHashMap.add 3 "a" + |> PersistentHashMap.add 4 "a" + + Expect.equal "find" "h" <| PersistentHashMap.find 1 x + Expect.equal "find" "a" <| PersistentHashMap.find 4 x + Expect.equal "find" "o" <| PersistentHashMap.find 5 x + Expect.equal "length" 5 <| PersistentHashMap.length x + } + + test "can iterate through a map" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 "h" + |> PersistentHashMap.add 2 "a" + |> PersistentHashMap.add 3 "l" + |> PersistentHashMap.add 4 "l" + |> PersistentHashMap.add 5 "o" + + Expect.equal "find" "h" <| PersistentHashMap.find 1 x + Expect.equal "find" "l" <| PersistentHashMap.find 4 x + Expect.equal "find" "o" <| PersistentHashMap.find 5 x + } + + test "can convert a seq to a map" { + let list = [ 1, "h"; 2, "a"; 3, "l"; 4, "l"; 5, "o" ] + + Expect.equal + "ofSeq" + [ 1, "h"; 2, "a"; 3, "l"; 4, "l"; 5, "o" ] + (PersistentHashMap.ofSeq list |> PersistentHashMap.toSeq |> Seq.toList) + } + + test "a map is always sorter" { + let list = [ 4, "l"; 5, "o"; 2, "a"; 1, "h"; 3, "l" ] + + Expect.equal + "toSeq" + [ 1, "h"; 2, "a"; 3, "l"; 4, "l"; 5, "o" ] + (PersistentHashMap.ofSeq list |> PersistentHashMap.toSeq |> Seq.toList) + } + + test "can map a HashMap" { + let x = + PersistentHashMap.empty + |> PersistentHashMap.add 1 1 + |> PersistentHashMap.add 2 2 + |> PersistentHashMap.add 3 3 + |> PersistentHashMap.add 4 4 + |> PersistentHashMap.add 5 5 + + Expect.equal "map" [ 1, 2; 2, 3; 3, 4; 4, 5; 5, 6 ] (x |> PersistentHashMap.map(fun x -> x + 1) |> Seq.toList) + } + + test "can PersistentHashMap.add tons of integers to PersistentHashMap.empty map" { + let x = ref PersistentHashMap.empty + let counter = 1000 + + for i in 0..counter do + x := PersistentHashMap.add i i !x + + for i in 0..counter do + !x + |> PersistentHashMap.containsKey i + |> Expect.isTrue "PersistentHashMap.containsKey" + } + + test "can find tons of integers in a map" { + let x = ref PersistentHashMap.empty + let counter = 1000 + + for i in 0..counter do + x := PersistentHashMap.add i i !x + + for i in 0..counter do + !x |> PersistentHashMap.find i |> Expect.equal "find" i + } + + test "can PersistentHashMap.add keys with colliding hashes to PersistentHashMap.empty map" { + let x = { Name = "Test" } + let y = { Name = "Test1" } + + let map = + PersistentHashMap.empty + |> PersistentHashMap.add x x.Name + |> PersistentHashMap.add y y.Name + + Expect.isTrue "" <| PersistentHashMap.containsKey x map + Expect.isTrue "" <| PersistentHashMap.containsKey y map + + Expect.isFalse "" + <| PersistentHashMap.containsKey y PersistentHashMap.empty + } + + test "can lookup keys with colliding hashes from map" { + let x = { Name = "Test" } + let y = { Name = "Test1" } + + let map = + PersistentHashMap.empty + |> PersistentHashMap.add x x + |> PersistentHashMap.add y y + + Expect.equal "colliding hashes" { Name = "Test" } + <| PersistentHashMap.find x map + + Expect.equal "colliding hashes" { Name = "Test1" } + <| PersistentHashMap.find y map + } + + test "can PersistentHashMap.add lots of keys with colliding hashes to PersistentHashMap.empty map" { + let x = ref PersistentHashMap.empty + let counter = 1000 + + for i in 0..counter do + x := PersistentHashMap.add { Name = i.ToString() } i !x + + for i in 0..counter do + !x + |> PersistentHashMap.containsKey { Name = i.ToString() } + |> Expect.isTrue "colliding hashes" + } + + test "can find tons of strings in a map" { + let x = ref PersistentHashMap.empty + let n = 10000 + let r = new Random() + + for i in 0..n do + x := PersistentHashMap.add (i.ToString()) i !x + + for i in 0..1000000 do + !x + |> PersistentHashMap.containsKey((r.Next n).ToString()) + |> Expect.isTrue "Next" + } ] diff --git a/tests/FSharpx.Collections.Tests/PersistentVectorTest.fs b/tests/FSharpx.Collections.Tests/PersistentVectorTest.fs index 764fffcd..851fda98 100644 --- a/tests/FSharpx.Collections.Tests/PersistentVectorTest.fs +++ b/tests/FSharpx.Collections.Tests/PersistentVectorTest.fs @@ -9,595 +9,598 @@ module PersistentVectorTests = [] let testPersistentVector = - testList "PersistentVector" [ - test "PersistentVector.empty vector should be PersistentVector.empty" { - let x = PersistentVector.empty - Expect.equal "PersistentVector.empty" 0 (x |> PersistentVector.length) - } - - test "multiple cons to an PersistentVector.empty vector should increase the count" { - Expect.equal - "cons" - 3 - (PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 - |> PersistentVector.length) - } - - test "cons to an PersistentVector.empty vector should create a singleton vector" { - Expect.equal - "cons" - 1 - (PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.nth 0) - } - - test "multiple cons to an PersistentVector.empty vector should create a vector" { - Expect.equal - "cons" - 4 - (PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 - |> PersistentVector.nth 1) - } - - test "multiple assoc to the end should work like cons and create a vector" { - let v = - PersistentVector.empty - |> PersistentVector.update 0 1 - |> PersistentVector.update 1 4 - |> PersistentVector.update 2 25 - - Expect.equal "assoc" 1 (v |> PersistentVector.nth 0) - Expect.equal "assoc" 4 (v |> PersistentVector.nth 1) - Expect.equal "assoc" 25 (v |> PersistentVector.nth 2) - } - - test "300 cons to an PersistentVector.empty vector should create a vector" { - let vector = ref PersistentVector.empty - - for i in 1..300 do - vector := PersistentVector.conj i (!vector) - - Expect.equal "" 101 (!vector |> PersistentVector.nth 100) - Expect.equal "" 201 (!vector |> PersistentVector.nth 200) - } - - test "assoc an element to a nonempty vector should not change the original vector" { - let v = - PersistentVector.empty - |> PersistentVector.conj "1" - |> PersistentVector.conj "4" - |> PersistentVector.conj "25" - - Expect.equal "assoc" "5" (v |> PersistentVector.update 2 "5" |> PersistentVector.nth 2) - Expect.equal "assoc" "25" (v |> PersistentVector.nth 2) - } - - test "vector should should be convertable to a seq" { - Expect.equal - "" - [ 1; 4; 25 ] - (PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 - |> Seq.toList) - } - - test "vector with 300 elements should be convertable to a seq" { - let vector = ref PersistentVector.empty - - for i in 1..300 do - vector := PersistentVector.conj i (!vector) - - let a = !vector |> Seq.toArray - - for i in 1..300 do - i |> Expect.equal "toSeq toArray" a.[i - 1] - } - - test "vector can be created from a seq" { - let xs = [ 7; 88; 1; 4; 25; 30 ] - Expect.equal "" xs (PersistentVector.ofSeq xs |> Seq.toList) - } - - test "vector with 300 elements should allow assocN" { - let vector = ref PersistentVector.empty - - for i in 1..300 do - vector := PersistentVector.conj i (!vector) - - for i in 1..300 do - vector := PersistentVector.update (i - 1) (i * 2) (!vector) - - let a = !vector |> Seq.toArray - - for i in 1..300 do - i * 2 |> Expect.equal "assocN" a.[i - 1] - } - - test "vector of vectors can be accessed with PersistentVector.nthNth" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.equal "" 3 (outer |> PersistentVector.nthNth 0 2) - Expect.equal "" 5 (outer |> PersistentVector.nthNth 1 4) - } - - test "PersistentVector.nthNth throws exception for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth 2 2 outer |> ignore) - - Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth 1 5 outer |> ignore) - - Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth -1 2 outer |> ignore) - - Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth 1 -2 outer |> ignore) - } - - test "vector of vectors can be accessed with PersistentVector.tryNthNth" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.equal "" (Some 3) (outer |> PersistentVector.tryNthNth 0 2) - Expect.equal "" (Some 5) (outer |> PersistentVector.tryNthNth 1 4) - } - - test "PersistentVector.tryNthNth returns None for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth 2 2) - Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth 1 5) - Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth -1 2) - Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth 1 -2) - } - - test "vector of vectors can be updated with PersistentVector.updateNth" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.equal - "PersistentVector.updateNth" - 7 - (outer - |> PersistentVector.updateNth 0 2 7 - |> PersistentVector.nthNth 0 2) - - Expect.equal - "PersistentVector.updateNth" - 9 - (outer - |> PersistentVector.updateNth 1 4 9 - |> PersistentVector.nthNth 1 4) - } - - test "PersistentVector.updateNth should not change the original vector" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - let outer = ref PersistentVector.empty - outer := PersistentVector.conj inner (!outer) - outer := PersistentVector.conj inner (!outer) - - Expect.equal - "PersistentVector.updateNth" - 7 - (!outer - |> PersistentVector.updateNth 0 2 7 - |> PersistentVector.nthNth 0 2) - - Expect.equal "PersistentVector.updateNth" 3 (!outer |> PersistentVector.nthNth 0 2) - - Expect.equal - "PersistentVector.updateNth" - 9 - (!outer - |> PersistentVector.updateNth 1 4 9 - |> PersistentVector.nthNth 1 4) - - Expect.equal "PersistentVector.updateNth" 5 (!outer |> PersistentVector.nthNth 1 4) - } - - test "PersistentVector.updateNth throws exception for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.throwsT "PersistentVector.updateNth" (fun () -> - PersistentVector.updateNth 0 6 7 outer |> ignore) - - Expect.throwsT "PersistentVector.updateNth" (fun () -> - PersistentVector.updateNth 9 2 7 outer |> ignore) - - Expect.throwsT "PersistentVector.updateNth" (fun () -> - PersistentVector.updateNth 1 -4 7 outer |> ignore) - - Expect.throwsT "PersistentVector.updateNth" (fun () -> - PersistentVector.updateNth -1 4 7 outer |> ignore) - } - - test "PersistentVector.tryUpdateNth returns None for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - Expect.isNone "" (PersistentVector.tryUpdateNth 0 6 7 outer) - Expect.isNone "" (PersistentVector.tryUpdateNth 9 2 7 outer) - Expect.isNone "" (PersistentVector.tryUpdateNth 1 -4 7 outer) - Expect.isNone "" (PersistentVector.tryUpdateNth -1 4 7 outer) - } - - test "PersistentVector.tryUpdateNth is like PersistentVector.updateNth but returns option" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - - let outer = - PersistentVector.empty - |> PersistentVector.conj inner - |> PersistentVector.conj inner - - let result = outer |> PersistentVector.tryUpdateNth 0 2 7 - Expect.isSome "PersistentVector.tryUpdateNth" result - Expect.equal "PersistentVector.tryUpdateNth" 7 (result |> Option.get |> PersistentVector.nthNth 0 2) - - let result2 = outer |> PersistentVector.tryUpdateNth 1 4 9 - Expect.isSome "PersistentVector.tryUpdateNth" result2 - Expect.equal "PersistentVector.tryUpdateNth" 9 (result2 |> Option.get |> PersistentVector.nthNth 1 4) - } - - test "PersistentVector.tryUpdateNth should not change the original vector" { - let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq - let outer = ref PersistentVector.empty - outer := PersistentVector.conj inner (!outer) - outer := PersistentVector.conj inner (!outer) - - Expect.equal - "PersistentVector.tryUpdateNth" - 7 - (!outer - |> PersistentVector.tryUpdateNth 0 2 7 - |> Option.get - |> PersistentVector.nthNth 0 2) - - Expect.equal "PersistentVector.tryUpdateNth" 3 (!outer |> PersistentVector.nthNth 0 2) - - Expect.equal - "PersistentVector.tryUpdateNth" - 9 - (!outer - |> PersistentVector.tryUpdateNth 1 4 9 - |> Option.get - |> PersistentVector.nthNth 1 4) - - Expect.equal "PersistentVector.tryUpdateNth" 5 (!outer |> PersistentVector.nthNth 1 4) - } + testList + "PersistentVector" + [ test "PersistentVector.empty vector should be PersistentVector.empty" { + let x = PersistentVector.empty + Expect.equal "PersistentVector.empty" 0 (x |> PersistentVector.length) + } + + test "multiple cons to an PersistentVector.empty vector should increase the count" { + Expect.equal + "cons" + 3 + (PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 + |> PersistentVector.length) + } + + test "cons to an PersistentVector.empty vector should create a singleton vector" { + Expect.equal + "cons" + 1 + (PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.nth 0) + } + + test "multiple cons to an PersistentVector.empty vector should create a vector" { + Expect.equal + "cons" + 4 + (PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 + |> PersistentVector.nth 1) + } + + test "multiple assoc to the end should work like cons and create a vector" { + let v = + PersistentVector.empty + |> PersistentVector.update 0 1 + |> PersistentVector.update 1 4 + |> PersistentVector.update 2 25 + + Expect.equal "assoc" 1 (v |> PersistentVector.nth 0) + Expect.equal "assoc" 4 (v |> PersistentVector.nth 1) + Expect.equal "assoc" 25 (v |> PersistentVector.nth 2) + } + + test "300 cons to an PersistentVector.empty vector should create a vector" { + let vector = ref PersistentVector.empty + + for i in 1..300 do + vector := PersistentVector.conj i (!vector) + + Expect.equal "" 101 (!vector |> PersistentVector.nth 100) + Expect.equal "" 201 (!vector |> PersistentVector.nth 200) + } + + test "assoc an element to a nonempty vector should not change the original vector" { + let v = + PersistentVector.empty + |> PersistentVector.conj "1" + |> PersistentVector.conj "4" + |> PersistentVector.conj "25" + + Expect.equal "assoc" "5" (v |> PersistentVector.update 2 "5" |> PersistentVector.nth 2) + Expect.equal "assoc" "25" (v |> PersistentVector.nth 2) + } + + test "vector should should be convertable to a seq" { + Expect.equal + "" + [ 1; 4; 25 ] + (PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 + |> Seq.toList) + } + + test "vector with 300 elements should be convertable to a seq" { + let vector = ref PersistentVector.empty + + for i in 1..300 do + vector := PersistentVector.conj i (!vector) + + let a = !vector |> Seq.toArray + + for i in 1..300 do + i |> Expect.equal "toSeq toArray" a.[i - 1] + } + + test "vector can be created from a seq" { + let xs = [ 7; 88; 1; 4; 25; 30 ] + Expect.equal "" xs (PersistentVector.ofSeq xs |> Seq.toList) + } + + test "vector with 300 elements should allow assocN" { + let vector = ref PersistentVector.empty + + for i in 1..300 do + vector := PersistentVector.conj i (!vector) + + for i in 1..300 do + vector := PersistentVector.update (i - 1) (i * 2) (!vector) + + let a = !vector |> Seq.toArray + + for i in 1..300 do + i * 2 |> Expect.equal "assocN" a.[i - 1] + } + + test "vector of vectors can be accessed with PersistentVector.nthNth" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.equal "" 3 (outer |> PersistentVector.nthNth 0 2) + Expect.equal "" 5 (outer |> PersistentVector.nthNth 1 4) + } + + test "PersistentVector.nthNth throws exception for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth 2 2 outer |> ignore) + + Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth 1 5 outer |> ignore) + + Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth -1 2 outer |> ignore) + + Expect.throwsT "PersistentVector.nthNth" (fun () -> PersistentVector.nthNth 1 -2 outer |> ignore) + } + + test "vector of vectors can be accessed with PersistentVector.tryNthNth" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.equal "" (Some 3) (outer |> PersistentVector.tryNthNth 0 2) + Expect.equal "" (Some 5) (outer |> PersistentVector.tryNthNth 1 4) + } + + test "PersistentVector.tryNthNth returns None for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth 2 2) + Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth 1 5) + Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth -1 2) + Expect.isNone "PersistentVector.tryNthNth" (outer |> PersistentVector.tryNthNth 1 -2) + } + + test "vector of vectors can be updated with PersistentVector.updateNth" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.equal + "PersistentVector.updateNth" + 7 + (outer + |> PersistentVector.updateNth 0 2 7 + |> PersistentVector.nthNth 0 2) + + Expect.equal + "PersistentVector.updateNth" + 9 + (outer + |> PersistentVector.updateNth 1 4 9 + |> PersistentVector.nthNth 1 4) + } + + test "PersistentVector.updateNth should not change the original vector" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + let outer = ref PersistentVector.empty + outer := PersistentVector.conj inner (!outer) + outer := PersistentVector.conj inner (!outer) + + Expect.equal + "PersistentVector.updateNth" + 7 + (!outer + |> PersistentVector.updateNth 0 2 7 + |> PersistentVector.nthNth 0 2) + + Expect.equal "PersistentVector.updateNth" 3 (!outer |> PersistentVector.nthNth 0 2) + + Expect.equal + "PersistentVector.updateNth" + 9 + (!outer + |> PersistentVector.updateNth 1 4 9 + |> PersistentVector.nthNth 1 4) + + Expect.equal "PersistentVector.updateNth" 5 (!outer |> PersistentVector.nthNth 1 4) + } + + test "PersistentVector.updateNth throws exception for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.throwsT "PersistentVector.updateNth" (fun () -> + PersistentVector.updateNth 0 6 7 outer |> ignore) + + Expect.throwsT "PersistentVector.updateNth" (fun () -> + PersistentVector.updateNth 9 2 7 outer |> ignore) + + Expect.throwsT "PersistentVector.updateNth" (fun () -> + PersistentVector.updateNth 1 -4 7 outer |> ignore) + + Expect.throwsT "PersistentVector.updateNth" (fun () -> + PersistentVector.updateNth -1 4 7 outer |> ignore) + } + + test "PersistentVector.tryUpdateNth returns None for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + Expect.isNone "" (PersistentVector.tryUpdateNth 0 6 7 outer) + Expect.isNone "" (PersistentVector.tryUpdateNth 9 2 7 outer) + Expect.isNone "" (PersistentVector.tryUpdateNth 1 -4 7 outer) + Expect.isNone "" (PersistentVector.tryUpdateNth -1 4 7 outer) + } + + test "PersistentVector.tryUpdateNth is like PersistentVector.updateNth but returns option" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + + let outer = + PersistentVector.empty + |> PersistentVector.conj inner + |> PersistentVector.conj inner + + let result = outer |> PersistentVector.tryUpdateNth 0 2 7 + Expect.isSome "PersistentVector.tryUpdateNth" result + Expect.equal "PersistentVector.tryUpdateNth" 7 (result |> Option.get |> PersistentVector.nthNth 0 2) + + let result2 = outer |> PersistentVector.tryUpdateNth 1 4 9 + Expect.isSome "PersistentVector.tryUpdateNth" result2 + Expect.equal "PersistentVector.tryUpdateNth" 9 (result2 |> Option.get |> PersistentVector.nthNth 1 4) + } + + test "PersistentVector.tryUpdateNth should not change the original vector" { + let inner = [ 1; 2; 3; 4; 5 ] |> PersistentVector.ofSeq + let outer = ref PersistentVector.empty + outer := PersistentVector.conj inner (!outer) + outer := PersistentVector.conj inner (!outer) + + Expect.equal + "PersistentVector.tryUpdateNth" + 7 + (!outer + |> PersistentVector.tryUpdateNth 0 2 7 + |> Option.get + |> PersistentVector.nthNth 0 2) + + Expect.equal "PersistentVector.tryUpdateNth" 3 (!outer |> PersistentVector.nthNth 0 2) + + Expect.equal + "PersistentVector.tryUpdateNth" + 9 + (!outer + |> PersistentVector.tryUpdateNth 1 4 9 + |> Option.get + |> PersistentVector.nthNth 1 4) + + Expect.equal "PersistentVector.tryUpdateNth" 5 (!outer |> PersistentVector.nthNth 1 4) + } - test "can peek elements from a vector" { - let vector = - PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 + test "can peek elements from a vector" { + let vector = + PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 - Expect.equal "last" 25 (vector |> PersistentVector.last) - } + Expect.equal "last" 25 (vector |> PersistentVector.last) + } - test "can pop elements from a vector" { - let vector = - PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 + test "can pop elements from a vector" { + let vector = + PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 - Expect.equal "last" 25 (vector |> PersistentVector.last) - Expect.equal "last" 4 (vector |> PersistentVector.initial |> PersistentVector.last) + Expect.equal "last" 25 (vector |> PersistentVector.last) + Expect.equal "last" 4 (vector |> PersistentVector.initial |> PersistentVector.last) - Expect.equal - "last" - 1 - (vector - |> PersistentVector.initial - |> PersistentVector.initial - |> PersistentVector.last) + Expect.equal + "last" + 1 + (vector + |> PersistentVector.initial + |> PersistentVector.initial + |> PersistentVector.last) - Expect.equal "last" 3 (vector |> PersistentVector.length) - Expect.equal "last" 2 (vector |> PersistentVector.initial |> PersistentVector.length) + Expect.equal "last" 3 (vector |> PersistentVector.length) + Expect.equal "last" 2 (vector |> PersistentVector.initial |> PersistentVector.length) - Expect.equal - "last" - 1 - (vector - |> PersistentVector.initial - |> PersistentVector.initial - |> PersistentVector.length) - } + Expect.equal + "last" + 1 + (vector + |> PersistentVector.initial + |> PersistentVector.initial + |> PersistentVector.length) + } - test "vector with 300 elements should allow pop" { - let vector = ref PersistentVector.empty + test "vector with 300 elements should allow pop" { + let vector = ref PersistentVector.empty - for i in 1..300 do - vector := PersistentVector.conj i (!vector) + for i in 1..300 do + vector := PersistentVector.conj i (!vector) - for i in 1..300 do - vector := PersistentVector.initial(!vector) + for i in 1..300 do + vector := PersistentVector.initial(!vector) - Expect.equal "PersistentVector.initial" [] (!vector |> Seq.toList) - } + Expect.equal "PersistentVector.initial" [] (!vector |> Seq.toList) + } - test "vector with 3 elements can compute hashcodes" { - let vector1 = ref PersistentVector.empty + test "vector with 3 elements can compute hashcodes" { + let vector1 = ref PersistentVector.empty - for i in 1..3 do - vector1 := PersistentVector.conj i (!vector1) + for i in 1..3 do + vector1 := PersistentVector.conj i (!vector1) - let vector2 = ref PersistentVector.empty + let vector2 = ref PersistentVector.empty - for i in 1..3 do - vector2 := PersistentVector.conj i (!vector2) + for i in 1..3 do + vector2 := PersistentVector.conj i (!vector2) - let vector3 = ref PersistentVector.empty + let vector3 = ref PersistentVector.empty - for i in 1..3 do - vector3 := PersistentVector.conj (2 * i) (!vector3) + for i in 1..3 do + vector3 := PersistentVector.conj (2 * i) (!vector3) - Expect.equal "GetHashCode" (vector2.GetHashCode()) (vector1.GetHashCode()) - Expect.equal "GetHashCode" (vector2.GetHashCode()) (vector1.GetHashCode()) - } + Expect.equal "GetHashCode" (vector2.GetHashCode()) (vector1.GetHashCode()) + Expect.equal "GetHashCode" (vector2.GetHashCode()) (vector1.GetHashCode()) + } - test "vector with 3 elements can be compared" { - let vector1 = ref PersistentVector.empty + test "vector with 3 elements can be compared" { + let vector1 = ref PersistentVector.empty - for i in 1..3 do - vector1 := PersistentVector.conj i (!vector1) + for i in 1..3 do + vector1 := PersistentVector.conj i (!vector1) - let vector2 = ref PersistentVector.empty + let vector2 = ref PersistentVector.empty - for i in 1..3 do - vector2 := PersistentVector.conj i (!vector2) + for i in 1..3 do + vector2 := PersistentVector.conj i (!vector2) - let vector3 = ref PersistentVector.empty + let vector3 = ref PersistentVector.empty - for i in 1..3 do - vector3 := PersistentVector.conj (2 * i) (!vector3) + for i in 1..3 do + vector3 := PersistentVector.conj (2 * i) (!vector3) - Expect.equal "compare" vector1 vector1 - Expect.equal "compare" vector1 vector2 - Expect.notEqual "compare" vector1 vector3 - } + Expect.equal "compare" vector1 vector1 + Expect.equal "compare" vector1 vector2 + Expect.notEqual "compare" vector1 vector3 + } - test "appending two vectors keeps order of items" { - let vector1 = ref PersistentVector.empty + test "appending two vectors keeps order of items" { + let vector1 = ref PersistentVector.empty - for i in 1..3 do - vector1 := PersistentVector.conj i (!vector1) + for i in 1..3 do + vector1 := PersistentVector.conj i (!vector1) - let vector2 = ref PersistentVector.empty + let vector2 = ref PersistentVector.empty - for i in 7..9 do - vector2 := PersistentVector.conj i (!vector2) + for i in 7..9 do + vector2 := PersistentVector.conj i (!vector2) - Expect.equal - "append" - [ 1; 2; 3; 7; 8; 9 ] - (PersistentVector.append (!vector1) (!vector2) - |> PersistentVector.toSeq - |> Seq.toList) - } + Expect.equal + "append" + [ 1; 2; 3; 7; 8; 9 ] + (PersistentVector.append (!vector1) (!vector2) + |> PersistentVector.toSeq + |> Seq.toList) + } - test "vector should allow map" { - let vector = ref PersistentVector.empty + test "vector should allow map" { + let vector = ref PersistentVector.empty - for i in 1..300 do - vector := PersistentVector.conj i (!vector) + for i in 1..300 do + vector := PersistentVector.conj i (!vector) - let vector2 = PersistentVector.map (fun x -> x * 2) (!vector) + let vector2 = PersistentVector.map (fun x -> x * 2) (!vector) - let a = vector2 |> Seq.toArray + let a = vector2 |> Seq.toArray - for i in 1..300 do - i * 2 |> Expect.equal "map" a.[i - 1] - } + for i in 1..300 do + i * 2 |> Expect.equal "map" a.[i - 1] + } - test "vector should allow mapi" { - let vector = ref PersistentVector.empty + test "vector should allow mapi" { + let vector = ref PersistentVector.empty - for i in 1..300 do - vector := PersistentVector.conj i (!vector) + for i in 1..300 do + vector := PersistentVector.conj i (!vector) - let vector2 = PersistentVector.mapi (fun index x -> index + x * 2) (!vector) + let vector2 = PersistentVector.mapi (fun index x -> index + x * 2) (!vector) - let a = vector2 |> Seq.toArray + let a = vector2 |> Seq.toArray - for i in 1..300 do - (i - 1) + i * 2 |> Expect.equal "map" a.[i - 1] - } + for i in 1..300 do + (i - 1) + i * 2 |> Expect.equal "map" a.[i - 1] + } - test "vector should allow init" { - let vector = PersistentVector.init 5 (fun x -> x * 2) - let s = Seq.init 5 (fun x -> x * 2) - - Expect.equal "init" [ 0; 2; 4; 6; 8 ] (s |> Seq.toList) - Expect.equal "init" [ 0; 2; 4; 6; 8 ] (vector |> Seq.toList) - } - - test "windowSeq should keep every value from its original list" { - let seq30 = seq { - for i in 1..30 do - yield i - } - - let fullVec = PersistentVector.ofSeq seq30 - - for i in 1..35 do - let vecs = PersistentVector.windowSeq i seq30 - - Expect.equal - "windowSeq" - fullVec - (vecs - |> PersistentVector.fold PersistentVector.append PersistentVector.empty) - } - - test "windowSeq should return vectors of equal length if possible" { - let seq30 = seq { - for i in 1..30 do - yield i - } - - let len3vecs = PersistentVector.windowSeq 3 seq30 - let len5vecs = PersistentVector.windowSeq 5 seq30 - let len6vecs = PersistentVector.windowSeq 6 seq30 - - Expect.equal "windowSeq" 10 (len3vecs |> PersistentVector.length) - Expect.equal "windowSeq" 6 (len5vecs |> PersistentVector.length) - Expect.equal "windowSeq" 5 (len6vecs |> PersistentVector.length) - - Expect.equal - "windowSeq" - [ 3; 3; 3; 3; 3; 3; 3; 3; 3; 3 ] - (len3vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - - Expect.equal - "windowSeq" - [ 5; 5; 5; 5; 5; 5 ] - (len5vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - - Expect.equal - "windowSeq" - [ 6; 6; 6; 6; 6 ] - (len6vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - } - - test "windowSeq should return vectors all of equal length except the last" { - let seq30 = seq { - for i in 1..30 do - yield i - } - - let len4vecs = PersistentVector.windowSeq 4 seq30 - let len7vecs = PersistentVector.windowSeq 7 seq30 - let len8vecs = PersistentVector.windowSeq 8 seq30 - let len17vecs = PersistentVector.windowSeq 17 seq30 - - Expect.equal "windowSeq" 8 (len4vecs |> PersistentVector.length) - Expect.equal "windowSeq" 5 (len7vecs |> PersistentVector.length) - Expect.equal "windowSeq" 4 (len8vecs |> PersistentVector.length) - Expect.equal "windowSeq" 2 (len17vecs |> PersistentVector.length) - - Expect.equal - "windowSeq" - [ 4; 4; 4; 4; 4; 4; 4; 2 ] - (len4vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - - Expect.equal - "windowSeq" - [ 7; 7; 7; 7; 2 ] - (len7vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - - Expect.equal - "windowSeq" - [ 8; 8; 8; 6 ] - (len8vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - - Expect.equal - "windowSeq" - [ 17; 13 ] - (len17vecs - |> PersistentVector.map PersistentVector.length - |> PersistentVector.toSeq - |> Seq.toList) - } - - testList "rangedIterator" [ - test "0..count is same as toSeq" { - let vector = PersistentVector.init 3 id - let expected = PersistentVector.toSeq vector |> List.ofSeq - let actual = PersistentVector.rangedIterator 0 3 vector |> List.ofSeq - Expect.equal "0..count is same as toSeq" expected actual - } - - test "0..0 is empty" { - let vector = PersistentVector.init 3 id - let expected = List.empty - let actual = PersistentVector.rangedIterator 0 0 vector |> List.ofSeq - Expect.equal "should be empty" expected actual - } - - test "1..length-1 skips first and last" { - let l = [ 0; 1; 2 ] - let vector = PersistentVector.ofSeq l - let expected = [ 1 ] - let actual = PersistentVector.rangedIterator 1 2 vector |> List.ofSeq - Expect.equal "should be [1]" expected actual - } - - test "-1..-2 (negative empty range) throws before iteration starts" { - let vector = PersistentVector.init 3 id - - Expect.throwsT "should throw" (fun () -> PersistentVector.rangedIterator -1 -2 vector |> ignore) - } - - test "-2..-1 (1 element range, but before start) throws before iteration starts" { - let vector = PersistentVector.init 3 id - - Expect.throwsT "should throw" (fun () -> PersistentVector.rangedIterator -2 -1 vector |> ignore) - } - - test "n..length+m throws when iterating outside bounds" { - let vector = PersistentVector.init 3 id - let actual = PersistentVector.rangedIterator 0 10 vector // Doesn't throw on creation - - Expect.throwsT "should throw" (fun () -> actual |> List.ofSeq |> ignore) - } - ] - ] + test "vector should allow init" { + let vector = PersistentVector.init 5 (fun x -> x * 2) + let s = Seq.init 5 (fun x -> x * 2) + + Expect.equal "init" [ 0; 2; 4; 6; 8 ] (s |> Seq.toList) + Expect.equal "init" [ 0; 2; 4; 6; 8 ] (vector |> Seq.toList) + } + + test "windowSeq should keep every value from its original list" { + let seq30 = + seq { + for i in 1..30 do + yield i + } + + let fullVec = PersistentVector.ofSeq seq30 + + for i in 1..35 do + let vecs = PersistentVector.windowSeq i seq30 + + Expect.equal + "windowSeq" + fullVec + (vecs + |> PersistentVector.fold PersistentVector.append PersistentVector.empty) + } + + test "windowSeq should return vectors of equal length if possible" { + let seq30 = + seq { + for i in 1..30 do + yield i + } + + let len3vecs = PersistentVector.windowSeq 3 seq30 + let len5vecs = PersistentVector.windowSeq 5 seq30 + let len6vecs = PersistentVector.windowSeq 6 seq30 + + Expect.equal "windowSeq" 10 (len3vecs |> PersistentVector.length) + Expect.equal "windowSeq" 6 (len5vecs |> PersistentVector.length) + Expect.equal "windowSeq" 5 (len6vecs |> PersistentVector.length) + + Expect.equal + "windowSeq" + [ 3; 3; 3; 3; 3; 3; 3; 3; 3; 3 ] + (len3vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + + Expect.equal + "windowSeq" + [ 5; 5; 5; 5; 5; 5 ] + (len5vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + + Expect.equal + "windowSeq" + [ 6; 6; 6; 6; 6 ] + (len6vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + } + + test "windowSeq should return vectors all of equal length except the last" { + let seq30 = + seq { + for i in 1..30 do + yield i + } + + let len4vecs = PersistentVector.windowSeq 4 seq30 + let len7vecs = PersistentVector.windowSeq 7 seq30 + let len8vecs = PersistentVector.windowSeq 8 seq30 + let len17vecs = PersistentVector.windowSeq 17 seq30 + + Expect.equal "windowSeq" 8 (len4vecs |> PersistentVector.length) + Expect.equal "windowSeq" 5 (len7vecs |> PersistentVector.length) + Expect.equal "windowSeq" 4 (len8vecs |> PersistentVector.length) + Expect.equal "windowSeq" 2 (len17vecs |> PersistentVector.length) + + Expect.equal + "windowSeq" + [ 4; 4; 4; 4; 4; 4; 4; 2 ] + (len4vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + + Expect.equal + "windowSeq" + [ 7; 7; 7; 7; 2 ] + (len7vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + + Expect.equal + "windowSeq" + [ 8; 8; 8; 6 ] + (len8vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + + Expect.equal + "windowSeq" + [ 17; 13 ] + (len17vecs + |> PersistentVector.map PersistentVector.length + |> PersistentVector.toSeq + |> Seq.toList) + } + + testList + "rangedIterator" + [ test "0..count is same as toSeq" { + let vector = PersistentVector.init 3 id + let expected = PersistentVector.toSeq vector |> List.ofSeq + let actual = PersistentVector.rangedIterator 0 3 vector |> List.ofSeq + Expect.equal "0..count is same as toSeq" expected actual + } + + test "0..0 is empty" { + let vector = PersistentVector.init 3 id + let expected = List.empty + let actual = PersistentVector.rangedIterator 0 0 vector |> List.ofSeq + Expect.equal "should be empty" expected actual + } + + test "1..length-1 skips first and last" { + let l = [ 0; 1; 2 ] + let vector = PersistentVector.ofSeq l + let expected = [ 1 ] + let actual = PersistentVector.rangedIterator 1 2 vector |> List.ofSeq + Expect.equal "should be [1]" expected actual + } + + test "-1..-2 (negative empty range) throws before iteration starts" { + let vector = PersistentVector.init 3 id + + Expect.throwsT "should throw" (fun () -> PersistentVector.rangedIterator -1 -2 vector |> ignore) + } + + test "-2..-1 (1 element range, but before start) throws before iteration starts" { + let vector = PersistentVector.init 3 id + + Expect.throwsT "should throw" (fun () -> PersistentVector.rangedIterator -2 -1 vector |> ignore) + } + + test "n..length+m throws when iterating outside bounds" { + let vector = PersistentVector.init 3 id + let actual = PersistentVector.rangedIterator 0 10 vector // Doesn't throw on creation + + Expect.throwsT "should throw" (fun () -> actual |> List.ofSeq |> ignore) + } ] ] diff --git a/tests/FSharpx.Collections.Tests/PriorityQueueTest.fs b/tests/FSharpx.Collections.Tests/PriorityQueueTest.fs index 0690ccd0..f5130a4d 100644 --- a/tests/FSharpx.Collections.Tests/PriorityQueueTest.fs +++ b/tests/FSharpx.Collections.Tests/PriorityQueueTest.fs @@ -8,104 +8,104 @@ module PriorityQueueTests = [] let testPriorityQueue = - testList "PriorityQueue" [ - test "empty queue should be empty" { - let pq = PriorityQueue.empty false - - Expect.isTrue "empty" <| PriorityQueue.isEmpty pq - Expect.isNone "empty" <| PriorityQueue.tryPeek pq - Expect.isNone "empty" <| PriorityQueue.tryPop pq - } - - test "After adding an element to the PQ it shouldn't be empty" { - let pq = PriorityQueue.empty false |> PriorityQueue.insert 1 - Expect.isFalse "PriorityQueue.insert" <| PriorityQueue.isEmpty pq - } - - test "After adding an element to the PQ the element should be the smallest" { - let pq = PriorityQueue.empty false |> PriorityQueue.insert 1 - - Expect.equal "PriorityQueue.insert" (Some 1) - <| PriorityQueue.tryPeek pq - - Expect.equal "PriorityQueue.insert" 1 <| PriorityQueue.peek pq - } - - test "After adding an element to the PQ and popping it the PQ should be empty" { - let pq = PriorityQueue.empty false |> PriorityQueue.insert 1 - - let element, newPQ = PriorityQueue.pop pq - Expect.equal "PriorityQueue.pop" 1 element - Expect.isTrue "PriorityQueue.pop" <| PriorityQueue.isEmpty newPQ - - let element, newPQ = (PriorityQueue.tryPop pq).Value - Expect.equal "PriorityQueue.tryPop" 1 element - Expect.isTrue "PriorityQueue.tryPop" <| PriorityQueue.isEmpty newPQ - } - - test "Adding multiple elements to the PQ should allow to PriorityQueue.pop the smallest" { - let pq = - PriorityQueue.empty false - |> PriorityQueue.insert 1 - |> PriorityQueue.insert 3 - |> PriorityQueue.insert 0 - |> PriorityQueue.insert 4 - |> PriorityQueue.insert -3 - - let element, newPQ = PriorityQueue.pop pq - Expect.equal "PriorityQueue.pop" -3 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 0 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 1 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 3 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 4 element - - Expect.isTrue "PriorityQueue.pop" <| PriorityQueue.isEmpty newPQ - } - - test "Adding multiple elements to a MaxPriorityQueue should allow to PriorityQueue.pop the smallest" { - let pq = - PriorityQueue.empty true - |> PriorityQueue.insert 1 - |> PriorityQueue.insert 3 - |> PriorityQueue.insert 0 - |> PriorityQueue.insert 4 - |> PriorityQueue.insert -3 - - let element, newPQ = PriorityQueue.pop pq - Expect.equal "PriorityQueue.pop" 4 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 3 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 1 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" 0 element - - let element, newPQ = PriorityQueue.pop newPQ - Expect.equal "PriorityQueue.pop" -3 element - - Expect.isTrue "PriorityQueue.pop" <| PriorityQueue.isEmpty newPQ - } - - test "Can use a PQ as a seq" { - let pq = - PriorityQueue.empty false - |> PriorityQueue.insert 15 - |> PriorityQueue.insert 3 - |> PriorityQueue.insert 0 - |> PriorityQueue.insert 4 - |> PriorityQueue.insert -3 - - Expect.equal "" [ -3; 0; 3; 4; 15 ] (pq |> Seq.toList) - } - ] + testList + "PriorityQueue" + [ test "empty queue should be empty" { + let pq = PriorityQueue.empty false + + Expect.isTrue "empty" <| PriorityQueue.isEmpty pq + Expect.isNone "empty" <| PriorityQueue.tryPeek pq + Expect.isNone "empty" <| PriorityQueue.tryPop pq + } + + test "After adding an element to the PQ it shouldn't be empty" { + let pq = PriorityQueue.empty false |> PriorityQueue.insert 1 + Expect.isFalse "PriorityQueue.insert" <| PriorityQueue.isEmpty pq + } + + test "After adding an element to the PQ the element should be the smallest" { + let pq = PriorityQueue.empty false |> PriorityQueue.insert 1 + + Expect.equal "PriorityQueue.insert" (Some 1) + <| PriorityQueue.tryPeek pq + + Expect.equal "PriorityQueue.insert" 1 <| PriorityQueue.peek pq + } + + test "After adding an element to the PQ and popping it the PQ should be empty" { + let pq = PriorityQueue.empty false |> PriorityQueue.insert 1 + + let element, newPQ = PriorityQueue.pop pq + Expect.equal "PriorityQueue.pop" 1 element + Expect.isTrue "PriorityQueue.pop" <| PriorityQueue.isEmpty newPQ + + let element, newPQ = (PriorityQueue.tryPop pq).Value + Expect.equal "PriorityQueue.tryPop" 1 element + Expect.isTrue "PriorityQueue.tryPop" <| PriorityQueue.isEmpty newPQ + } + + test "Adding multiple elements to the PQ should allow to PriorityQueue.pop the smallest" { + let pq = + PriorityQueue.empty false + |> PriorityQueue.insert 1 + |> PriorityQueue.insert 3 + |> PriorityQueue.insert 0 + |> PriorityQueue.insert 4 + |> PriorityQueue.insert -3 + + let element, newPQ = PriorityQueue.pop pq + Expect.equal "PriorityQueue.pop" -3 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 0 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 1 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 3 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 4 element + + Expect.isTrue "PriorityQueue.pop" <| PriorityQueue.isEmpty newPQ + } + + test "Adding multiple elements to a MaxPriorityQueue should allow to PriorityQueue.pop the smallest" { + let pq = + PriorityQueue.empty true + |> PriorityQueue.insert 1 + |> PriorityQueue.insert 3 + |> PriorityQueue.insert 0 + |> PriorityQueue.insert 4 + |> PriorityQueue.insert -3 + + let element, newPQ = PriorityQueue.pop pq + Expect.equal "PriorityQueue.pop" 4 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 3 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 1 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" 0 element + + let element, newPQ = PriorityQueue.pop newPQ + Expect.equal "PriorityQueue.pop" -3 element + + Expect.isTrue "PriorityQueue.pop" <| PriorityQueue.isEmpty newPQ + } + + test "Can use a PQ as a seq" { + let pq = + PriorityQueue.empty false + |> PriorityQueue.insert 15 + |> PriorityQueue.insert 3 + |> PriorityQueue.insert 0 + |> PriorityQueue.insert 4 + |> PriorityQueue.insert -3 + + Expect.equal "" [ -3; 0; 3; 4; 15 ] (pq |> Seq.toList) + } ] diff --git a/tests/FSharpx.Collections.Tests/QueueTest.fs b/tests/FSharpx.Collections.Tests/QueueTest.fs index 71e1bd12..b942dfd3 100644 --- a/tests/FSharpx.Collections.Tests/QueueTest.fs +++ b/tests/FSharpx.Collections.Tests/QueueTest.fs @@ -12,72 +12,76 @@ module QueueTests = [] let testQueue = - testList "Queue" [ - test "allow to dequeue" { Expect.isTrue "tail Queue.isEmpty" (emptyQueue |> Queue.conj 1 |> Queue.tail |> Queue.isEmpty) } + testList + "Queue" + [ test "allow to dequeue" { Expect.isTrue "tail Queue.isEmpty" (emptyQueue |> Queue.conj 1 |> Queue.tail |> Queue.isEmpty) } - test "allow to enqueue" { Expect.isFalse "tail" (emptyQueue |> Queue.conj 1 |> Queue.conj 2 |> Queue.isEmpty) } + test "allow to enqueue" { Expect.isFalse "tail" (emptyQueue |> Queue.conj 1 |> Queue.conj 2 |> Queue.isEmpty) } - test "cons pattern discriminator - Queue" { - let q = Queue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "cons pattern discriminator - Queue" { + let q = Queue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let h1, t1 = - match q with - | Queue.Cons(h, t) -> h, t - | _ -> "x", q + let h1, t1 = + match q with + | Queue.Cons(h, t) -> h, t + | _ -> "x", q - Expect.isTrue "cons pattern discriminator" ((h1 = "f") && (t1.Length = 5)) - } + Expect.isTrue "cons pattern discriminator" ((h1 = "f") && (t1.Length = 5)) + } - test "empty queue should be empty" { Expect.isTrue "empty" (emptyQueue |> Queue.isEmpty) } + test "empty queue should be empty" { Expect.isTrue "empty" (emptyQueue |> Queue.isEmpty) } - test "fail if there is no head in the queue" { Expect.throwsT "no head" (fun () -> emptyQueue |> Queue.head |> ignore) } + test "fail if there is no head in the queue" { + Expect.throwsT "no head" (fun () -> emptyQueue |> Queue.head |> ignore) + } - test "fail if there is no tail in the queue" { Expect.throwsT "no tail" (fun () -> emptyQueue |> Queue.tail |> ignore) } + test "fail if there is no tail in the queue" { + Expect.throwsT "no tail" (fun () -> emptyQueue |> Queue.tail |> ignore) + } - test "give None if there is no head in the queue" { Expect.isNone "no head" (emptyQueue |> Queue.tryHead) } + test "give None if there is no head in the queue" { Expect.isNone "no head" (emptyQueue |> Queue.tryHead) } - test "give None if there is no tail in the queue" { Expect.isNone "no tail" (emptyQueue |> Queue.tryTail) } + test "give None if there is no tail in the queue" { Expect.isNone "no tail" (emptyQueue |> Queue.tryTail) } - test "toSeq to list" { - let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] - let q = Queue.ofSeq l + test "toSeq to list" { + let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] + let q = Queue.ofSeq l - Expect.equal "toSeq" l (q |> Queue.toSeq |> List.ofSeq) - } + Expect.equal "toSeq" l (q |> Queue.toSeq |> List.ofSeq) + } - test "TryUncons wind-down to None" { - let q = Queue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "TryUncons wind-down to None" { + let q = Queue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let rec loop(q': Queue) = - match (q'.TryUncons) with - | Some(_, tl) -> loop tl - | None -> None + let rec loop(q': Queue) = + match (q'.TryUncons) with + | Some(_, tl) -> loop tl + | None -> None - Expect.isNone "TryUncons" <| loop q - } + Expect.isNone "TryUncons" <| loop q + } - test "Uncons wind-down to None" { - let q = Queue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + test "Uncons wind-down to None" { + let q = Queue.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - let rec loop(q': Queue) = - match (q'.Uncons) with - | _, tl when tl.IsEmpty -> true - | _, tl -> loop tl + let rec loop(q': Queue) = + match (q'.Uncons) with + | _, tl when tl.IsEmpty -> true + | _, tl -> loop tl - Expect.isTrue "Uncons" <| loop q - } + Expect.isTrue "Uncons" <| loop q + } - test "structural equality" { - let l1 = Queue.ofSeq [ 1..100 ] - let l2 = Queue.ofSeq [ 1..100 ] + test "structural equality" { + let l1 = Queue.ofSeq [ 1..100 ] + let l2 = Queue.ofSeq [ 1..100 ] - Expect.equal "structural equality" l1 l2 + Expect.equal "structural equality" l1 l2 - let l3 = Queue.ofSeq [ 1..99 ] |> Queue.conj 7 + let l3 = Queue.ofSeq [ 1..99 ] |> Queue.conj 7 - Expect.notEqual "" l1 l3 - } - ] + Expect.notEqual "" l1 l3 + } ] [] let propertyTestQueue = @@ -95,50 +99,56 @@ module QueueTests = (* non-IQueue generators from random ofList *) - let queueOfListGen = gen { - let! n = Gen.length2thru12 - let! x = Gen.listInt n - return ((Queue.ofList x), x) - } + let queueOfListGen = + gen { + let! n = Gen.length2thru12 + let! x = Gen.listInt n + return ((Queue.ofList x), x) + } (* IQueue generators from random Queue.ofSeq and/or Queue.conj elements from random list *) - let queueIntGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((Queue.ofSeq x |> enqueueThruList y), (x @ y)) - } - - let queueIntOfSeqGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Queue.ofSeq x), x) - } - - let queueIntConjGen = gen { - let! n = Gen.length1thru12 - let! x = Gen.listInt n - return ((Queue.empty |> enqueueThruList x), x) - } - - let queueObjGen = gen { - let! n = Gen.length2thru12 - let! n2 = Gen.length1thru12 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((Queue.ofSeq x |> enqueueThruList y), (x @ y)) - } - - let queueStringGen = gen { - let! n = Gen.length1thru12 - let! n2 = Gen.length2thru12 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((Queue.ofSeq x |> enqueueThruList y), (x @ y)) - } + let queueIntGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((Queue.ofSeq x |> enqueueThruList y), (x @ y)) + } + + let queueIntOfSeqGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Queue.ofSeq x), x) + } + + let queueIntConjGen = + gen { + let! n = Gen.length1thru12 + let! x = Gen.listInt n + return ((Queue.empty |> enqueueThruList x), x) + } + + let queueObjGen = + gen { + let! n = Gen.length2thru12 + let! n2 = Gen.length1thru12 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((Queue.ofSeq x |> enqueueThruList y), (x @ y)) + } + + let queueStringGen = + gen { + let! n = Gen.length1thru12 + let! n2 = Gen.length2thru12 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((Queue.ofSeq x |> enqueueThruList y), (x @ y)) + } let intGens start = let v = Array.create 3 queueIntGen @@ -150,159 +160,160 @@ module QueueTests = let intGensStart2 = intGens 2 // this will accept 11 out of 12 - testList "Queue property tests" [ - - testPropertyWithConfig - config10k - "fold matches build list rev" - (Prop.forAll(Arb.fromGen queueIntGen) - <| fun (q, l) -> - q |> Queue.fold (fun l' elem -> elem :: l') [] = (List.rev l) - |> classifyCollect q q.Length) - - testPropertyWithConfig - config10k - "Queue OfSeq fold matches build list rev" - (Prop.forAll(Arb.fromGen queueIntOfSeqGen) - <| fun (q, l) -> q |> Queue.fold (fun l' elem -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "Queue Conj fold matches build list rev" - (Prop.forAll(Arb.fromGen queueIntConjGen) - <| fun (q, l) -> q |> Queue.fold (fun l' elem -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "Queue foldback matches build list" - (Prop.forAll(Arb.fromGen queueIntGen) - <| fun (q, l) -> Queue.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - " Queue OfSeqfoldback matches build list" - (Prop.forAll(Arb.fromGen queueIntOfSeqGen) - <| fun (q, l) -> - Queue.foldBack (fun elem l' -> elem :: l') q [] = l - |> classifyCollect q q.Length) - - testPropertyWithConfig - config10k - "Queue Conj foldback matches build list" - (Prop.forAll(Arb.fromGen queueIntConjGen) - <| fun (q, l) -> Queue.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "get head from queue 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> (Queue.head q) = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get head from queue 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> (Queue.head q) = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get head from queue 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> (Queue.head q) = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get head from queue safely 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> (Queue.tryHead q).Value = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get head from queue safely 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> (Queue.tryHead q).Value = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get head from queue safely 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> (Queue.tryHead q).Value = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get tail from queue 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get tail from queue 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get tail from queue 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get tail from queue safely 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get tail from queue safely 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get tail from queue safely 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "int queue builds and serializes 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int queue builds and serializes 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int queue builds and serializes 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "obj queue builds and serializes" - (Prop.forAll(Arb.fromGen queueObjGen) - <| fun (q: Queue, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "string queue builds and serializes" - (Prop.forAll(Arb.fromGen queueStringGen) - <| fun (q: Queue, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "reverse . reverse = id" - (Prop.forAll(Arb.fromGen queueObjGen) - <| fun (q, l) -> q |> Queue.rev |> Queue.rev |> Seq.toList = (q |> Seq.toList)) - - testPropertyWithConfig - config10k - "ofList build and serialize" - (Prop.forAll(Arb.fromGen queueOfListGen) - <| fun (q, l) -> q |> Seq.toList = l) - ] + testList + "Queue property tests" + [ + + testPropertyWithConfig + config10k + "fold matches build list rev" + (Prop.forAll(Arb.fromGen queueIntGen) + <| fun (q, l) -> + q |> Queue.fold (fun l' elem -> elem :: l') [] = (List.rev l) + |> classifyCollect q q.Length) + + testPropertyWithConfig + config10k + "Queue OfSeq fold matches build list rev" + (Prop.forAll(Arb.fromGen queueIntOfSeqGen) + <| fun (q, l) -> q |> Queue.fold (fun l' elem -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "Queue Conj fold matches build list rev" + (Prop.forAll(Arb.fromGen queueIntConjGen) + <| fun (q, l) -> q |> Queue.fold (fun l' elem -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "Queue foldback matches build list" + (Prop.forAll(Arb.fromGen queueIntGen) + <| fun (q, l) -> Queue.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + " Queue OfSeqfoldback matches build list" + (Prop.forAll(Arb.fromGen queueIntOfSeqGen) + <| fun (q, l) -> + Queue.foldBack (fun elem l' -> elem :: l') q [] = l + |> classifyCollect q q.Length) + + testPropertyWithConfig + config10k + "Queue Conj foldback matches build list" + (Prop.forAll(Arb.fromGen queueIntConjGen) + <| fun (q, l) -> Queue.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "get head from queue 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> (Queue.head q) = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get head from queue 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> (Queue.head q) = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get head from queue 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> (Queue.head q) = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get head from queue safely 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> (Queue.tryHead q).Value = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get head from queue safely 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> (Queue.tryHead q).Value = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get head from queue safely 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> (Queue.tryHead q).Value = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get tail from queue 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get tail from queue 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get tail from queue 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get tail from queue safely 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get tail from queue safely 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get tail from queue safely 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "int queue builds and serializes 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int queue builds and serializes 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int queue builds and serializes 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "obj queue builds and serializes" + (Prop.forAll(Arb.fromGen queueObjGen) + <| fun (q: Queue, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "string queue builds and serializes" + (Prop.forAll(Arb.fromGen queueStringGen) + <| fun (q: Queue, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "reverse . reverse = id" + (Prop.forAll(Arb.fromGen queueObjGen) + <| fun (q, l) -> q |> Queue.rev |> Queue.rev |> Seq.toList = (q |> Seq.toList)) + + testPropertyWithConfig + config10k + "ofList build and serialize" + (Prop.forAll(Arb.fromGen queueOfListGen) + <| fun (q, l) -> q |> Seq.toList = l) ] diff --git a/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs b/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs index b2b90515..3bd78c9e 100644 --- a/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs +++ b/tests/FSharpx.Collections.Tests/RandomAccessListTest.fs @@ -18,1601 +18,1605 @@ module RandomAccessListTest = [] let testRandomAccessList = - testList "RandomAccessList" [ - - test "fail if there is no RandomAccessList.head in the RandomAccessList" { - Expect.throwsT "no RandomAccessList.head" (fun () -> emptyRandomAccessList |> RandomAccessList.head |> ignore) - } - - test "fail if there is no RandomAccessList.tail in the RandomAccessList" { - Expect.throwsT "no RandomAccessList.tail" (fun () -> emptyRandomAccessList |> RandomAccessList.tail |> ignore) - } - - test "RandomAccessList.foldBack matches build list 2" { - let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - Expect.equal "RandomAccessList.foldBack" (List.ofSeq q) - <| RandomAccessList.foldBack (fun (elem: string) (l': string list) -> elem :: l') q [] - } - - test "RandomAccessList.fold matches build list rev 2" { - let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - Expect.equal "RandomAccessList.fold" (List.rev(List.ofSeq q)) - <| RandomAccessList.fold (fun (l': string list) (elem: string) -> elem :: l') [] q - } - - test "TryUncons wind-down to None" { - let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - let rec loop(q': RandomAccessList) = - match (q'.TryUncons) with - | Some(hd, tl) -> loop tl - | None -> None - - Expect.isNone "TryUncons" <| loop q - } - - test "Uncons wind-down to None" { - let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - let rec loop(q': RandomAccessList) = - match (q'.Uncons) with - | hd, tl when tl.IsEmpty -> true - | hd, tl -> loop tl - - Expect.isTrue "Uncons" <| loop q - } - - test "RandomAccessList.empty list should be RandomAccessList.empty" { - Expect.isTrue "RandomAccessList.empty" (RandomAccessList.empty |> RandomAccessList.isEmpty) - } - - test "RandomAccessList.cons works" { - Expect.isFalse - "RandomAccessList.cons" - (RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.isEmpty) - } - - test "RandomAccessList.uncons 1 element" { - let x, _ = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.uncons - - Expect.equal "RandomAccessList.uncons" 1 x - } - - test "RandomAccessList.uncons 2 elements" { - let x, _ = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.uncons - - Expect.equal "RandomAccessList.uncons" 2 x - } - - test "RandomAccessList.uncons 3 elements" { - let x, _ = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.cons 3 - |> RandomAccessList.uncons - - Expect.equal "RandomAccessList.uncons" 3 x - } - - test "RandomAccessList.tryUncons 1 element" { - let x = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.tryUncons - - Expect.equal "RandomAccessList.tryUncons" 1 <| fst x.Value - } - - test "RandomAccessList.tryUncons 2 elements" { - let x = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.tryUncons - - Expect.equal "RandomAccessList.tryUncons" 2 <| fst x.Value - } - - test "RandomAccessList.tryUncons 3 elements" { - let x = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.cons 3 - |> RandomAccessList.tryUncons - - Expect.equal "RandomAccessList.tryUncons" 3 <| fst x.Value - } - - test "RandomAccessList.tryUncons RandomAccessList.empty" { - Expect.isNone "RandomAccessList.tryUncons" (RandomAccessList.empty |> RandomAccessList.tryUncons) - } - - test "RandomAccessList.head should return" { - Expect.equal - "RandomAccessList.head" - 2 - (RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.head) - } - - test "RandomAccessList.tryHead should return" { - Expect.equal - "RandomAccessList.tryHead" - 2 - (RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.tryHead) - .Value - } - - test "RandomAccessList.tryHead on RandomAccessList.empty should return None" { - Expect.isNone "RandomAccessList.tryHead" (RandomAccessList.empty |> RandomAccessList.tryHead) - } - - test "RandomAccessList.tryTail on RandomAccessList.empty should return None" { - Expect.isNone "RandomAccessList.tryTail" (RandomAccessList.empty |> RandomAccessList.tryTail) - } - - test "RandomAccessList.tryTail on len 1 should return Some RandomAccessList.empty" { - let x = - (RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.tryTail) - .Value - - Expect.isTrue "RandomAccessList.tryTail" (x |> RandomAccessList.isEmpty) - } - - test "RandomAccessList.tail on len 2 should return" { - Expect.equal - "RandomAccessList.tail" - 1 - (RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.tail - |> RandomAccessList.head) - } - - test "RandomAccessList.tryTail on len 2 should return" { - let a = - RandomAccessList.empty - |> RandomAccessList.cons 1 - |> RandomAccessList.cons 2 - |> RandomAccessList.tryTail - - Expect.equal "RandomAccessList.tryTail" 1 - <| RandomAccessList.head a.Value - } - - test "randomAccessList of randomAccessLists constructed by consing RandomAccessList.tail" { - - let windowFun windowLength = - fun (v: RandomAccessList>) t -> - if v.Head.Length = windowLength then - RandomAccessList.cons (RandomAccessList.empty.Cons(t)) v - else - RandomAccessList.tail v - |> RandomAccessList.cons(RandomAccessList.cons t (RandomAccessList.head v)) - - let windowed = - seq { 1..100 } - |> Seq.fold (windowFun 5) (RandomAccessList.empty.Cons RandomAccessList.empty) - - Expect.equal "windowed" 20 windowed.Length - Expect.equal "windowed" 5 windowed.[2].Length - } - - test "RandomAccessList.windowSeq should keep every value from its original list" { - let seq30 = seq { - for i in 1..30 do - yield i - } - - let fullVec = RandomAccessList.ofSeq seq30 - - for i in 1..35 do - let lists = RandomAccessList.windowSeq i seq30 - - Expect.equal - "RandomAccessList.windowSeq" - fullVec - (lists - |> RandomAccessList.fold RandomAccessList.append RandomAccessList.empty) - - Expect.equal - "RandomAccessList.windowSeq" - [ 1; 2; 3; 4; 5 ] - (lists - |> RandomAccessList.fold RandomAccessList.append RandomAccessList.empty - |> RandomAccessList.toSeq - |> Seq.take 5 - |> Seq.toList) - } - - test "RandomAccessList.windowSeq should return vectors of equal RandomAccessList.length if possible" { - let seq30 = seq { - for i in 1..30 do - yield i - } - - let len3lists = RandomAccessList.windowSeq 3 seq30 - let len5lists = RandomAccessList.windowSeq 5 seq30 - let len6lists = RandomAccessList.windowSeq 6 seq30 - - Expect.equal "RandomAccessList.windowSeq" 10 (len3lists |> RandomAccessList.length) - Expect.equal "RandomAccessList.windowSeq" 6 (len5lists |> RandomAccessList.length) - Expect.equal "RandomAccessList.windowSeq" 5 (len6lists |> RandomAccessList.length) - - Expect.equal - "RandomAccessList.windowSeq" - [ 3; 3; 3; 3; 3; 3; 3; 3; 3; 3 ] - (len3lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) - - Expect.equal - "RandomAccessList.windowSeq" - [ 5; 5; 5; 5; 5; 5 ] - (len5lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) - - Expect.equal - "RandomAccessList.windowSeq" - [ 6; 6; 6; 6; 6 ] - (len6lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) - } - - test "RandomAccessList.windowSeq should return vectors all of equal RandomAccessList.length except the first" { - let seq30 = seq { - for i in 1..30 do - yield i - } - - let len4lists = RandomAccessList.windowSeq 4 seq30 - let len7lists = RandomAccessList.windowSeq 7 seq30 - let len8lists = RandomAccessList.windowSeq 8 seq30 - let len17lists = RandomAccessList.windowSeq 17 seq30 - - Expect.equal "" 8 (len4lists |> RandomAccessList.length) - Expect.equal "" 5 (len7lists |> RandomAccessList.length) - Expect.equal "" 4 (len8lists |> RandomAccessList.length) - Expect.equal "" 2 (len17lists |> RandomAccessList.length) - - Expect.equal - "" - [ 2; 4; 4; 4; 4; 4; 4; 4 ] - (len4lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) (*[4;4;4;4;4;4;4;2]*) - - Expect.equal - "" - [ 2; 7; 7; 7; 7 ] - (len7lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) - - Expect.equal - "" - [ 6; 8; 8; 8 ] - (len8lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) - - Expect.equal - "" - [ 13; 17 ] - (len17lists - |> RandomAccessList.map RandomAccessList.length - |> RandomAccessList.toSeq - |> Seq.toList) - } - - test "RandomAccessList.nth on RandomAccessList.empty list should throw" { - Expect.throwsT "RandomAccessList.empty list" (fun () -> - RandomAccessList.empty |> RandomAccessList.nth 0 |> ignore) - } - - test "RandomAccessList.nth RandomAccessList.length 1" { - let x = RandomAccessList.empty |> RandomAccessList.cons "a" - Expect.equal "RandomAccessList.nth" "a" (x |> RandomAccessList.nth 0) - } - - test "appending two lists keeps order of items" { - let list1 = ref RandomAccessList.empty - - for i in 3..-1..1 do - list1 := RandomAccessList.cons i (!list1) - - let list2 = ref RandomAccessList.empty - - for i in 9..-1..7 do - list2 := RandomAccessList.cons i (!list2) - - Expect.equal - "" - [ 1; 2; 3; 7; 8; 9 ] - (RandomAccessList.append (!list1) (!list2) - |> RandomAccessList.toSeq - |> Seq.toList) - } - - test "rev RandomAccessList.empty" { - Expect.isTrue "rev RandomAccessList.empty" - <| RandomAccessList.isEmpty(RandomAccessList.empty |> RandomAccessList.rev) - } - - test "rev elements RandomAccessList.length 5" { - let a = RandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e" ] - let b = RandomAccessList.rev a - - let c = List.ofSeq b - Expect.equal "rev" "a" a.Head - Expect.equal "rev" "e" b.Head - Expect.equal "rev" "e" c.Head - Expect.equal "rev" ([ "a"; "b"; "c"; "d"; "e" ] |> List.rev) (b |> List.ofSeq) - } - - test "rev elements RandomAccessList.length 15" { - let a = - RandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"; "l"; "m"; "n"; "o"; "p" ] - - let b = RandomAccessList.rev a - - Expect.equal - "rev" - ([ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"; "l"; "m"; "n"; "o"; "p" ] - |> List.rev) - (b |> List.ofSeq) - } - - test "rev 300" { - let x = RandomAccessList.ofSeq [ 1..300 ] - Expect.equal "rev" (List.rev [ 1..300 ]) (x.Rev() |> List.ofSeq) - } - - test "RandomAccessList.nth RandomAccessList.length 2" { - Expect.isTrue - "" - (((RandomAccessList.empty + testList + "RandomAccessList" + [ + + test "fail if there is no RandomAccessList.head in the RandomAccessList" { + Expect.throwsT "no RandomAccessList.head" (fun () -> emptyRandomAccessList |> RandomAccessList.head |> ignore) + } + + test "fail if there is no RandomAccessList.tail in the RandomAccessList" { + Expect.throwsT "no RandomAccessList.tail" (fun () -> emptyRandomAccessList |> RandomAccessList.tail |> ignore) + } + + test "RandomAccessList.foldBack matches build list 2" { + let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + Expect.equal "RandomAccessList.foldBack" (List.ofSeq q) + <| RandomAccessList.foldBack (fun (elem: string) (l': string list) -> elem :: l') q [] + } + + test "RandomAccessList.fold matches build list rev 2" { + let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + Expect.equal "RandomAccessList.fold" (List.rev(List.ofSeq q)) + <| RandomAccessList.fold (fun (l': string list) (elem: string) -> elem :: l') [] q + } + + test "TryUncons wind-down to None" { + let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + let rec loop(q': RandomAccessList) = + match (q'.TryUncons) with + | Some(hd, tl) -> loop tl + | None -> None + + Expect.isNone "TryUncons" <| loop q + } + + test "Uncons wind-down to None" { + let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + let rec loop(q': RandomAccessList) = + match (q'.Uncons) with + | hd, tl when tl.IsEmpty -> true + | hd, tl -> loop tl + + Expect.isTrue "Uncons" <| loop q + } + + test "RandomAccessList.empty list should be RandomAccessList.empty" { + Expect.isTrue "RandomAccessList.empty" (RandomAccessList.empty |> RandomAccessList.isEmpty) + } + + test "RandomAccessList.cons works" { + Expect.isFalse + "RandomAccessList.cons" + (RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.isEmpty) + } + + test "RandomAccessList.uncons 1 element" { + let x, _ = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.uncons + + Expect.equal "RandomAccessList.uncons" 1 x + } + + test "RandomAccessList.uncons 2 elements" { + let x, _ = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.uncons + + Expect.equal "RandomAccessList.uncons" 2 x + } + + test "RandomAccessList.uncons 3 elements" { + let x, _ = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.cons 3 + |> RandomAccessList.uncons + + Expect.equal "RandomAccessList.uncons" 3 x + } + + test "RandomAccessList.tryUncons 1 element" { + let x = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.tryUncons + + Expect.equal "RandomAccessList.tryUncons" 1 <| fst x.Value + } + + test "RandomAccessList.tryUncons 2 elements" { + let x = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.tryUncons + + Expect.equal "RandomAccessList.tryUncons" 2 <| fst x.Value + } + + test "RandomAccessList.tryUncons 3 elements" { + let x = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.cons 3 + |> RandomAccessList.tryUncons + + Expect.equal "RandomAccessList.tryUncons" 3 <| fst x.Value + } + + test "RandomAccessList.tryUncons RandomAccessList.empty" { + Expect.isNone "RandomAccessList.tryUncons" (RandomAccessList.empty |> RandomAccessList.tryUncons) + } + + test "RandomAccessList.head should return" { + Expect.equal + "RandomAccessList.head" + 2 + (RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.head) + } + + test "RandomAccessList.tryHead should return" { + Expect.equal + "RandomAccessList.tryHead" + 2 + (RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.tryHead) + .Value + } + + test "RandomAccessList.tryHead on RandomAccessList.empty should return None" { + Expect.isNone "RandomAccessList.tryHead" (RandomAccessList.empty |> RandomAccessList.tryHead) + } + + test "RandomAccessList.tryTail on RandomAccessList.empty should return None" { + Expect.isNone "RandomAccessList.tryTail" (RandomAccessList.empty |> RandomAccessList.tryTail) + } + + test "RandomAccessList.tryTail on len 1 should return Some RandomAccessList.empty" { + let x = + (RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.tryTail) + .Value + + Expect.isTrue "RandomAccessList.tryTail" (x |> RandomAccessList.isEmpty) + } + + test "RandomAccessList.tail on len 2 should return" { + Expect.equal + "RandomAccessList.tail" + 1 + (RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.tail + |> RandomAccessList.head) + } + + test "RandomAccessList.tryTail on len 2 should return" { + let a = + RandomAccessList.empty + |> RandomAccessList.cons 1 + |> RandomAccessList.cons 2 + |> RandomAccessList.tryTail + + Expect.equal "RandomAccessList.tryTail" 1 + <| RandomAccessList.head a.Value + } + + test "randomAccessList of randomAccessLists constructed by consing RandomAccessList.tail" { + + let windowFun windowLength = + fun (v: RandomAccessList>) t -> + if v.Head.Length = windowLength then + RandomAccessList.cons (RandomAccessList.empty.Cons(t)) v + else + RandomAccessList.tail v + |> RandomAccessList.cons(RandomAccessList.cons t (RandomAccessList.head v)) + + let windowed = + seq { 1..100 } + |> Seq.fold (windowFun 5) (RandomAccessList.empty.Cons RandomAccessList.empty) + + Expect.equal "windowed" 20 windowed.Length + Expect.equal "windowed" 5 windowed.[2].Length + } + + test "RandomAccessList.windowSeq should keep every value from its original list" { + let seq30 = + seq { + for i in 1..30 do + yield i + } + + let fullVec = RandomAccessList.ofSeq seq30 + + for i in 1..35 do + let lists = RandomAccessList.windowSeq i seq30 + + Expect.equal + "RandomAccessList.windowSeq" + fullVec + (lists + |> RandomAccessList.fold RandomAccessList.append RandomAccessList.empty) + + Expect.equal + "RandomAccessList.windowSeq" + [ 1; 2; 3; 4; 5 ] + (lists + |> RandomAccessList.fold RandomAccessList.append RandomAccessList.empty + |> RandomAccessList.toSeq + |> Seq.take 5 + |> Seq.toList) + } + + test "RandomAccessList.windowSeq should return vectors of equal RandomAccessList.length if possible" { + let seq30 = + seq { + for i in 1..30 do + yield i + } + + let len3lists = RandomAccessList.windowSeq 3 seq30 + let len5lists = RandomAccessList.windowSeq 5 seq30 + let len6lists = RandomAccessList.windowSeq 6 seq30 + + Expect.equal "RandomAccessList.windowSeq" 10 (len3lists |> RandomAccessList.length) + Expect.equal "RandomAccessList.windowSeq" 6 (len5lists |> RandomAccessList.length) + Expect.equal "RandomAccessList.windowSeq" 5 (len6lists |> RandomAccessList.length) + + Expect.equal + "RandomAccessList.windowSeq" + [ 3; 3; 3; 3; 3; 3; 3; 3; 3; 3 ] + (len3lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) + + Expect.equal + "RandomAccessList.windowSeq" + [ 5; 5; 5; 5; 5; 5 ] + (len5lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) + + Expect.equal + "RandomAccessList.windowSeq" + [ 6; 6; 6; 6; 6 ] + (len6lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) + } + + test "RandomAccessList.windowSeq should return vectors all of equal RandomAccessList.length except the first" { + let seq30 = + seq { + for i in 1..30 do + yield i + } + + let len4lists = RandomAccessList.windowSeq 4 seq30 + let len7lists = RandomAccessList.windowSeq 7 seq30 + let len8lists = RandomAccessList.windowSeq 8 seq30 + let len17lists = RandomAccessList.windowSeq 17 seq30 + + Expect.equal "" 8 (len4lists |> RandomAccessList.length) + Expect.equal "" 5 (len7lists |> RandomAccessList.length) + Expect.equal "" 4 (len8lists |> RandomAccessList.length) + Expect.equal "" 2 (len17lists |> RandomAccessList.length) + + Expect.equal + "" + [ 2; 4; 4; 4; 4; 4; 4; 4 ] + (len4lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) (*[4;4;4;4;4;4;4;2]*) + + Expect.equal + "" + [ 2; 7; 7; 7; 7 ] + (len7lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) + + Expect.equal + "" + [ 6; 8; 8; 8 ] + (len8lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) + + Expect.equal + "" + [ 13; 17 ] + (len17lists + |> RandomAccessList.map RandomAccessList.length + |> RandomAccessList.toSeq + |> Seq.toList) + } + + test "RandomAccessList.nth on RandomAccessList.empty list should throw" { + Expect.throwsT "RandomAccessList.empty list" (fun () -> + RandomAccessList.empty |> RandomAccessList.nth 0 |> ignore) + } + + test "RandomAccessList.nth RandomAccessList.length 1" { + let x = RandomAccessList.empty |> RandomAccessList.cons "a" + Expect.equal "RandomAccessList.nth" "a" (x |> RandomAccessList.nth 0) + } + + test "appending two lists keeps order of items" { + let list1 = ref RandomAccessList.empty + + for i in 3..-1..1 do + list1 := RandomAccessList.cons i (!list1) + + let list2 = ref RandomAccessList.empty + + for i in 9..-1..7 do + list2 := RandomAccessList.cons i (!list2) + + Expect.equal + "" + [ 1; 2; 3; 7; 8; 9 ] + (RandomAccessList.append (!list1) (!list2) + |> RandomAccessList.toSeq + |> Seq.toList) + } + + test "rev RandomAccessList.empty" { + Expect.isTrue "rev RandomAccessList.empty" + <| RandomAccessList.isEmpty(RandomAccessList.empty |> RandomAccessList.rev) + } + + test "rev elements RandomAccessList.length 5" { + let a = RandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e" ] + let b = RandomAccessList.rev a + + let c = List.ofSeq b + Expect.equal "rev" "a" a.Head + Expect.equal "rev" "e" b.Head + Expect.equal "rev" "e" c.Head + Expect.equal "rev" ([ "a"; "b"; "c"; "d"; "e" ] |> List.rev) (b |> List.ofSeq) + } + + test "rev elements RandomAccessList.length 15" { + let a = + RandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"; "l"; "m"; "n"; "o"; "p" ] + + let b = RandomAccessList.rev a + + Expect.equal + "rev" + ([ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j"; "l"; "m"; "n"; "o"; "p" ] + |> List.rev) + (b |> List.ofSeq) + } + + test "rev 300" { + let x = RandomAccessList.ofSeq [ 1..300 ] + Expect.equal "rev" (List.rev [ 1..300 ]) (x.Rev() |> List.ofSeq) + } + + test "RandomAccessList.nth RandomAccessList.length 2" { + Expect.isTrue + "" + (((RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.nth 0) = "b") + && ((RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.nth 1) = "a")) + } + + test "RandomAccessList.nth RandomAccessList.length 3" { + let len3 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + + (((len3 |> RandomAccessList.nth 0) = "c") + && ((len3 |> RandomAccessList.nth 1) = "b") + && ((len3 |> RandomAccessList.nth 2) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.nth RandomAccessList.length 4" { + let len4 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + + Expect.isTrue + "RandomAccessList.nth" + (((len4 |> RandomAccessList.nth 0) = "d") + && ((len4 |> RandomAccessList.nth 1) = "c") + && ((len4 |> RandomAccessList.nth 2) = "b") + && ((len4 |> RandomAccessList.nth 3) = "a")) + } + + test "RandomAccessList.nth RandomAccessList.length 5" { + let len5 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + + (((len5 |> RandomAccessList.nth 0) = "e") + && ((len5 |> RandomAccessList.nth 1) = "d") + && ((len5 |> RandomAccessList.nth 2) = "c") + && ((len5 |> RandomAccessList.nth 3) = "b") + && ((len5 |> RandomAccessList.nth 4) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.nth RandomAccessList.length 6" { + let len6 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + + (((len6 |> RandomAccessList.nth 0) = "f") + && ((len6 |> RandomAccessList.nth 1) = "e") + && ((len6 |> RandomAccessList.nth 2) = "d") + && ((len6 |> RandomAccessList.nth 3) = "c") + && ((len6 |> RandomAccessList.nth 4) = "b") + && ((len6 |> RandomAccessList.nth 5) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.nth RandomAccessList.length 7" { + let len7 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + + (((len7 |> RandomAccessList.nth 0) = "g") + && ((len7 |> RandomAccessList.nth 1) = "f") + && ((len7 |> RandomAccessList.nth 2) = "e") + && ((len7 |> RandomAccessList.nth 3) = "d") + && ((len7 |> RandomAccessList.nth 4) = "c") + && ((len7 |> RandomAccessList.nth 5) = "b") + && ((len7 |> RandomAccessList.nth 6) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.nth RandomAccessList.length 8" { + let len8 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + + (((len8 |> RandomAccessList.nth 0) = "h") + && ((len8 |> RandomAccessList.nth 1) = "g") + && ((len8 |> RandomAccessList.nth 2) = "f") + && ((len8 |> RandomAccessList.nth 3) = "e") + && ((len8 |> RandomAccessList.nth 4) = "d") + && ((len8 |> RandomAccessList.nth 5) = "c") + && ((len8 |> RandomAccessList.nth 6) = "b") + && ((len8 |> RandomAccessList.nth 7) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.nth RandomAccessList.length 9" { + let len9 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + + (((len9 |> RandomAccessList.nth 0) = "i") + && ((len9 |> RandomAccessList.nth 1) = "h") + && ((len9 |> RandomAccessList.nth 2) = "g") + && ((len9 |> RandomAccessList.nth 3) = "f") + && ((len9 |> RandomAccessList.nth 4) = "e") + && ((len9 |> RandomAccessList.nth 5) = "d") + && ((len9 |> RandomAccessList.nth 6) = "c") + && ((len9 |> RandomAccessList.nth 7) = "b") + && ((len9 |> RandomAccessList.nth 8) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.nth RandomAccessList.length 10" { + let lena = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + |> RandomAccessList.cons "j" + + (((lena |> RandomAccessList.nth 0) = "j") + && ((lena |> RandomAccessList.nth 1) = "i") + && ((lena |> RandomAccessList.nth 2) = "h") + && ((lena |> RandomAccessList.nth 3) = "g") + && ((lena |> RandomAccessList.nth 4) = "f") + && ((lena |> RandomAccessList.nth 5) = "e") + && ((lena |> RandomAccessList.nth 6) = "d") + && ((lena |> RandomAccessList.nth 7) = "c") + && ((lena |> RandomAccessList.nth 8) = "b") + && ((lena |> RandomAccessList.nth 9) = "a")) + |> Expect.isTrue "RandomAccessList.nth" + } + + test "RandomAccessList.tryNth RandomAccessList.length 1" { + let a = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.tryNth 0 + + Expect.equal "RandomAccessList.tryNth" "a" a.Value + } + + test "RandomAccessList.tryNth RandomAccessList.length 2" { + let len2 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + + let b = len2 |> RandomAccessList.tryNth 0 + let a = len2 |> RandomAccessList.tryNth 1 + Expect.isTrue "RandomAccessList.tryNth" ((b.Value = "b") && (a.Value = "a")) + } + + test "RandomAccessList.tryNth RandomAccessList.length 3" { + let len3 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + + let c = len3 |> RandomAccessList.tryNth 0 + let b = len3 |> RandomAccessList.tryNth 1 + let a = len3 |> RandomAccessList.tryNth 2 + Expect.isTrue "RandomAccessList.tryNth" ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) + } + + test "RandomAccessList.tryNth RandomAccessList.length 4" { + let len4 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + + let d = len4 |> RandomAccessList.tryNth 0 + let c = len4 |> RandomAccessList.tryNth 1 + let b = len4 |> RandomAccessList.tryNth 2 + let a = len4 |> RandomAccessList.tryNth 3 + + Expect.isTrue + "RandomAccessList.tryNth" + ((d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + } + + test "RandomAccessList.tryNth RandomAccessList.length 5" { + let len5 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + + let e = len5 |> RandomAccessList.tryNth 0 + let d = len5 |> RandomAccessList.tryNth 1 + let c = len5 |> RandomAccessList.tryNth 2 + let b = len5 |> RandomAccessList.tryNth 3 + let a = len5 |> RandomAccessList.tryNth 4 + + Expect.isTrue + "RandomAccessList.tryNth" + ((e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + } + + test "RandomAccessList.tryNth RandomAccessList.length 6" { + let len6 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + + let f = len6 |> RandomAccessList.tryNth 0 + let e = len6 |> RandomAccessList.tryNth 1 + let d = len6 |> RandomAccessList.tryNth 2 + let c = len6 |> RandomAccessList.tryNth 3 + let b = len6 |> RandomAccessList.tryNth 4 + let a = len6 |> RandomAccessList.tryNth 5 + + Expect.isTrue + "RandomAccessList.tryNth" + ((f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + } + + test "RandomAccessList.tryNth RandomAccessList.length 7" { + let len7 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + + let g = len7 |> RandomAccessList.tryNth 0 + let f = len7 |> RandomAccessList.tryNth 1 + let e = len7 |> RandomAccessList.tryNth 2 + let d = len7 |> RandomAccessList.tryNth 3 + let c = len7 |> RandomAccessList.tryNth 4 + let b = len7 |> RandomAccessList.tryNth 5 + let a = len7 |> RandomAccessList.tryNth 6 + + ((g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "RandomAccessList.tryNth" + } + + test "RandomAccessList.tryNth RandomAccessList.length 8" { + let len8 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + + let h = len8 |> RandomAccessList.tryNth 0 + let g = len8 |> RandomAccessList.tryNth 1 + let f = len8 |> RandomAccessList.tryNth 2 + let e = len8 |> RandomAccessList.tryNth 3 + let d = len8 |> RandomAccessList.tryNth 4 + let c = len8 |> RandomAccessList.tryNth 5 + let b = len8 |> RandomAccessList.tryNth 6 + let a = len8 |> RandomAccessList.tryNth 7 + + ((h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "RandomAccessList.tryNth" + } + + test "RandomAccessList.tryNth RandomAccessList.length 9" { + let len9 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + + let i = len9 |> RandomAccessList.tryNth 0 + let h = len9 |> RandomAccessList.tryNth 1 + let g = len9 |> RandomAccessList.tryNth 2 + let f = len9 |> RandomAccessList.tryNth 3 + let e = len9 |> RandomAccessList.tryNth 4 + let d = len9 |> RandomAccessList.tryNth 5 + let c = len9 |> RandomAccessList.tryNth 6 + let b = len9 |> RandomAccessList.tryNth 7 + let a = len9 |> RandomAccessList.tryNth 8 + + ((i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "RandomAccessList.tryNth" + } + + test "RandomAccessList.tryNth RandomAccessList.length 10" { + let lena = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + |> RandomAccessList.cons "j" + + let j = lena |> RandomAccessList.tryNth 0 + let i = lena |> RandomAccessList.tryNth 1 + let h = lena |> RandomAccessList.tryNth 2 + let g = lena |> RandomAccessList.tryNth 3 + let f = lena |> RandomAccessList.tryNth 4 + let e = lena |> RandomAccessList.tryNth 5 + let d = lena |> RandomAccessList.tryNth 6 + let c = lena |> RandomAccessList.tryNth 7 + let b = lena |> RandomAccessList.tryNth 8 + let a = lena |> RandomAccessList.tryNth 9 + + ((j.Value = "j") + && (i.Value = "i") + && (h.Value = "h") + && (g.Value = "g") + && (f.Value = "f") + && (e.Value = "e") + && (d.Value = "d") + && (c.Value = "c") + && (b.Value = "b") + && (a.Value = "a")) + |> Expect.isTrue "RandomAccessList.tryNth" + } + + test "RandomAccessList.tryNth not found" { + let lena = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + |> RandomAccessList.cons "j" + + Expect.isNone "RandomAccessList.tryNth" (lena |> RandomAccessList.tryNth 10) + } + + test "list of lists can be accessed with RandomAccessList.nthNth" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.equal "RandomAccessList.nthNth" 3 (outer |> RandomAccessList.nthNth 0 2) + Expect.equal "RandomAccessList.nthNth" 5 (outer |> RandomAccessList.nthNth 1 4) + } + + test "RandomAccessList.nthNth throws exception for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth 2 2 outer |> ignore) + + Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth 1 5 outer |> ignore) + + Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth -1 2 outer |> ignore) + + Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth 1 -2 outer |> ignore) + } + + test "list of lists can be accessed with RandomAccessList.tryNthNth" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.equal "RandomAccessList.tryNthNth" (Some 3) (outer |> RandomAccessList.tryNthNth 0 2) + Expect.equal "RandomAccessList.tryNthNth" (Some 5) (outer |> RandomAccessList.tryNthNth 1 4) + } + + test "RandomAccessList.tryNthNth returns None for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth 2 2) + Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth 1 5) + Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth -1 2) + Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth 1 -2) + } + + test "list of lists can be RandomAccessList.updated with RandomAccessList.updateNth" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.equal + "RandomAccessList.updateNth" + 7 + (outer + |> RandomAccessList.updateNth 0 2 7 + |> RandomAccessList.nthNth 0 2) + + Expect.equal + "RandomAccessList.updateNth" + 9 + (outer + |> RandomAccessList.updateNth 1 4 9 + |> RandomAccessList.nthNth 1 4) + } + + test "RandomAccessList.updateNth should not change the original list" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + let outer = ref RandomAccessList.empty + outer := RandomAccessList.cons inner (!outer) + outer := RandomAccessList.cons inner (!outer) + + Expect.equal + "RandomAccessList.updateNth" + 7 + (!outer + |> RandomAccessList.updateNth 0 2 7 + |> RandomAccessList.nthNth 0 2) + + Expect.equal "RandomAccessList.updateNth" 3 (!outer |> RandomAccessList.nthNth 0 2) + + Expect.equal + "RandomAccessList.updateNth" + 9 + (!outer + |> RandomAccessList.updateNth 1 4 9 + |> RandomAccessList.nthNth 1 4) + + Expect.equal "RandomAccessList.updateNth" 5 (!outer |> RandomAccessList.nthNth 1 4) + } + + test "RandomAccessList.updateNth throws exception for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.throwsT "RandomAccessList.updateNth" (fun () -> + RandomAccessList.updateNth 0 6 7 outer |> ignore) + + Expect.throwsT "RandomAccessList.updateNth" (fun () -> + RandomAccessList.updateNth 9 2 7 outer |> ignore) + + Expect.throwsT "RandomAccessList.updateNth" (fun () -> + RandomAccessList.updateNth 1 -4 7 outer |> ignore) + + Expect.throwsT "RandomAccessList.updateNth" (fun () -> + RandomAccessList.updateNth -1 4 7 outer |> ignore) + } + + test "RandomAccessList.tryUpdateNth returns None for out-of-bounds indices" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + Expect.isNone "RandomAccessList.tryUpdateNth" + <| RandomAccessList.tryUpdateNth 0 6 7 outer + + Expect.isNone "RandomAccessList.tryUpdateNth" + <| RandomAccessList.tryUpdateNth 9 2 7 outer + + Expect.isNone "RandomAccessList.tryUpdateNth" + <| RandomAccessList.tryUpdateNth 1 -4 7 outer + + Expect.isNone "RandomAccessList.tryUpdateNth" + <| RandomAccessList.tryUpdateNth -1 4 7 outer + } + + test "RandomAccessList.tryUpdateNth is like RandomAccessList.updateNth but returns option" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + + let outer = + RandomAccessList.empty + |> RandomAccessList.cons inner + |> RandomAccessList.cons inner + + let result = outer |> RandomAccessList.tryUpdateNth 0 2 7 + Expect.isTrue "RandomAccessList.tryUpdateNth" (result |> Option.isSome) + Expect.equal "RandomAccessList.tryUpdateNth" 7 (result |> Option.get |> RandomAccessList.nthNth 0 2) + + let result2 = outer |> RandomAccessList.tryUpdateNth 1 4 9 + Expect.isTrue "RandomAccessList.tryUpdateNth" (result2 |> Option.isSome) + Expect.equal "RandomAccessList.tryUpdateNth" 9 (result2 |> Option.get |> RandomAccessList.nthNth 1 4) + } + + test "RandomAccessList.tryUpdateNth should not change the original list" { + let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq + let outer = ref RandomAccessList.empty + outer := RandomAccessList.cons inner (!outer) + outer := RandomAccessList.cons inner (!outer) + + Expect.equal + "" + 7 + (!outer + |> RandomAccessList.tryUpdateNth 0 2 7 + |> Option.get + |> RandomAccessList.nthNth 0 2) + + Expect.equal "RandomAccessList.tryUpdateNth" 3 (!outer |> RandomAccessList.nthNth 0 2) + + Expect.equal + "" + 9 + (!outer + |> RandomAccessList.tryUpdateNth 1 4 9 + |> Option.get + |> RandomAccessList.nthNth 1 4) + + Expect.equal "RandomAccessList.tryUpdateNth" 5 (!outer |> RandomAccessList.nthNth 1 4) + } + + test "RandomAccessList.update RandomAccessList.length 1" { + Expect.equal + "RandomAccessList.update" + "aa" + (RandomAccessList.empty |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.nth 0) = "b") - && ((RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.nth 1) = "a")) - } - - test "RandomAccessList.nth RandomAccessList.length 3" { - let len3 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - - (((len3 |> RandomAccessList.nth 0) = "c") - && ((len3 |> RandomAccessList.nth 1) = "b") - && ((len3 |> RandomAccessList.nth 2) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.nth RandomAccessList.length 4" { - let len4 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - - Expect.isTrue - "RandomAccessList.nth" - (((len4 |> RandomAccessList.nth 0) = "d") - && ((len4 |> RandomAccessList.nth 1) = "c") - && ((len4 |> RandomAccessList.nth 2) = "b") - && ((len4 |> RandomAccessList.nth 3) = "a")) - } - - test "RandomAccessList.nth RandomAccessList.length 5" { - let len5 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - - (((len5 |> RandomAccessList.nth 0) = "e") - && ((len5 |> RandomAccessList.nth 1) = "d") - && ((len5 |> RandomAccessList.nth 2) = "c") - && ((len5 |> RandomAccessList.nth 3) = "b") - && ((len5 |> RandomAccessList.nth 4) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.nth RandomAccessList.length 6" { - let len6 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - - (((len6 |> RandomAccessList.nth 0) = "f") - && ((len6 |> RandomAccessList.nth 1) = "e") - && ((len6 |> RandomAccessList.nth 2) = "d") - && ((len6 |> RandomAccessList.nth 3) = "c") - && ((len6 |> RandomAccessList.nth 4) = "b") - && ((len6 |> RandomAccessList.nth 5) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.nth RandomAccessList.length 7" { - let len7 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - - (((len7 |> RandomAccessList.nth 0) = "g") - && ((len7 |> RandomAccessList.nth 1) = "f") - && ((len7 |> RandomAccessList.nth 2) = "e") - && ((len7 |> RandomAccessList.nth 3) = "d") - && ((len7 |> RandomAccessList.nth 4) = "c") - && ((len7 |> RandomAccessList.nth 5) = "b") - && ((len7 |> RandomAccessList.nth 6) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.nth RandomAccessList.length 8" { - let len8 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - - (((len8 |> RandomAccessList.nth 0) = "h") - && ((len8 |> RandomAccessList.nth 1) = "g") - && ((len8 |> RandomAccessList.nth 2) = "f") - && ((len8 |> RandomAccessList.nth 3) = "e") - && ((len8 |> RandomAccessList.nth 4) = "d") - && ((len8 |> RandomAccessList.nth 5) = "c") - && ((len8 |> RandomAccessList.nth 6) = "b") - && ((len8 |> RandomAccessList.nth 7) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.nth RandomAccessList.length 9" { - let len9 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - - (((len9 |> RandomAccessList.nth 0) = "i") - && ((len9 |> RandomAccessList.nth 1) = "h") - && ((len9 |> RandomAccessList.nth 2) = "g") - && ((len9 |> RandomAccessList.nth 3) = "f") - && ((len9 |> RandomAccessList.nth 4) = "e") - && ((len9 |> RandomAccessList.nth 5) = "d") - && ((len9 |> RandomAccessList.nth 6) = "c") - && ((len9 |> RandomAccessList.nth 7) = "b") - && ((len9 |> RandomAccessList.nth 8) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.nth RandomAccessList.length 10" { - let lena = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - |> RandomAccessList.cons "j" - - (((lena |> RandomAccessList.nth 0) = "j") - && ((lena |> RandomAccessList.nth 1) = "i") - && ((lena |> RandomAccessList.nth 2) = "h") - && ((lena |> RandomAccessList.nth 3) = "g") - && ((lena |> RandomAccessList.nth 4) = "f") - && ((lena |> RandomAccessList.nth 5) = "e") - && ((lena |> RandomAccessList.nth 6) = "d") - && ((lena |> RandomAccessList.nth 7) = "c") - && ((lena |> RandomAccessList.nth 8) = "b") - && ((lena |> RandomAccessList.nth 9) = "a")) - |> Expect.isTrue "RandomAccessList.nth" - } - - test "RandomAccessList.tryNth RandomAccessList.length 1" { - let a = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.tryNth 0 - - Expect.equal "RandomAccessList.tryNth" "a" a.Value - } - - test "RandomAccessList.tryNth RandomAccessList.length 2" { - let len2 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - - let b = len2 |> RandomAccessList.tryNth 0 - let a = len2 |> RandomAccessList.tryNth 1 - Expect.isTrue "RandomAccessList.tryNth" ((b.Value = "b") && (a.Value = "a")) - } - - test "RandomAccessList.tryNth RandomAccessList.length 3" { - let len3 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - - let c = len3 |> RandomAccessList.tryNth 0 - let b = len3 |> RandomAccessList.tryNth 1 - let a = len3 |> RandomAccessList.tryNth 2 - Expect.isTrue "RandomAccessList.tryNth" ((c.Value = "c") && (b.Value = "b") && (a.Value = "a")) - } - - test "RandomAccessList.tryNth RandomAccessList.length 4" { - let len4 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - - let d = len4 |> RandomAccessList.tryNth 0 - let c = len4 |> RandomAccessList.tryNth 1 - let b = len4 |> RandomAccessList.tryNth 2 - let a = len4 |> RandomAccessList.tryNth 3 - - Expect.isTrue - "RandomAccessList.tryNth" - ((d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - } - - test "RandomAccessList.tryNth RandomAccessList.length 5" { - let len5 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - - let e = len5 |> RandomAccessList.tryNth 0 - let d = len5 |> RandomAccessList.tryNth 1 - let c = len5 |> RandomAccessList.tryNth 2 - let b = len5 |> RandomAccessList.tryNth 3 - let a = len5 |> RandomAccessList.tryNth 4 - - Expect.isTrue - "RandomAccessList.tryNth" - ((e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - } - - test "RandomAccessList.tryNth RandomAccessList.length 6" { - let len6 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - - let f = len6 |> RandomAccessList.tryNth 0 - let e = len6 |> RandomAccessList.tryNth 1 - let d = len6 |> RandomAccessList.tryNth 2 - let c = len6 |> RandomAccessList.tryNth 3 - let b = len6 |> RandomAccessList.tryNth 4 - let a = len6 |> RandomAccessList.tryNth 5 - - Expect.isTrue - "RandomAccessList.tryNth" - ((f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - } - - test "RandomAccessList.tryNth RandomAccessList.length 7" { - let len7 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - - let g = len7 |> RandomAccessList.tryNth 0 - let f = len7 |> RandomAccessList.tryNth 1 - let e = len7 |> RandomAccessList.tryNth 2 - let d = len7 |> RandomAccessList.tryNth 3 - let c = len7 |> RandomAccessList.tryNth 4 - let b = len7 |> RandomAccessList.tryNth 5 - let a = len7 |> RandomAccessList.tryNth 6 - - ((g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "RandomAccessList.tryNth" - } - - test "RandomAccessList.tryNth RandomAccessList.length 8" { - let len8 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - - let h = len8 |> RandomAccessList.tryNth 0 - let g = len8 |> RandomAccessList.tryNth 1 - let f = len8 |> RandomAccessList.tryNth 2 - let e = len8 |> RandomAccessList.tryNth 3 - let d = len8 |> RandomAccessList.tryNth 4 - let c = len8 |> RandomAccessList.tryNth 5 - let b = len8 |> RandomAccessList.tryNth 6 - let a = len8 |> RandomAccessList.tryNth 7 - - ((h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "RandomAccessList.tryNth" - } - - test "RandomAccessList.tryNth RandomAccessList.length 9" { - let len9 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - - let i = len9 |> RandomAccessList.tryNth 0 - let h = len9 |> RandomAccessList.tryNth 1 - let g = len9 |> RandomAccessList.tryNth 2 - let f = len9 |> RandomAccessList.tryNth 3 - let e = len9 |> RandomAccessList.tryNth 4 - let d = len9 |> RandomAccessList.tryNth 5 - let c = len9 |> RandomAccessList.tryNth 6 - let b = len9 |> RandomAccessList.tryNth 7 - let a = len9 |> RandomAccessList.tryNth 8 - - ((i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "RandomAccessList.tryNth" - } - - test "RandomAccessList.tryNth RandomAccessList.length 10" { - let lena = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - |> RandomAccessList.cons "j" - - let j = lena |> RandomAccessList.tryNth 0 - let i = lena |> RandomAccessList.tryNth 1 - let h = lena |> RandomAccessList.tryNth 2 - let g = lena |> RandomAccessList.tryNth 3 - let f = lena |> RandomAccessList.tryNth 4 - let e = lena |> RandomAccessList.tryNth 5 - let d = lena |> RandomAccessList.tryNth 6 - let c = lena |> RandomAccessList.tryNth 7 - let b = lena |> RandomAccessList.tryNth 8 - let a = lena |> RandomAccessList.tryNth 9 - - ((j.Value = "j") - && (i.Value = "i") - && (h.Value = "h") - && (g.Value = "g") - && (f.Value = "f") - && (e.Value = "e") - && (d.Value = "d") - && (c.Value = "c") - && (b.Value = "b") - && (a.Value = "a")) - |> Expect.isTrue "RandomAccessList.tryNth" - } - - test "RandomAccessList.tryNth not found" { - let lena = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - |> RandomAccessList.cons "j" - - Expect.isNone "RandomAccessList.tryNth" (lena |> RandomAccessList.tryNth 10) - } - - test "list of lists can be accessed with RandomAccessList.nthNth" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.equal "RandomAccessList.nthNth" 3 (outer |> RandomAccessList.nthNth 0 2) - Expect.equal "RandomAccessList.nthNth" 5 (outer |> RandomAccessList.nthNth 1 4) - } - - test "RandomAccessList.nthNth throws exception for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth 2 2 outer |> ignore) - - Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth 1 5 outer |> ignore) - - Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth -1 2 outer |> ignore) - - Expect.throwsT "RandomAccessList.nthNth" (fun () -> RandomAccessList.nthNth 1 -2 outer |> ignore) - } - - test "list of lists can be accessed with RandomAccessList.tryNthNth" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.equal "RandomAccessList.tryNthNth" (Some 3) (outer |> RandomAccessList.tryNthNth 0 2) - Expect.equal "RandomAccessList.tryNthNth" (Some 5) (outer |> RandomAccessList.tryNthNth 1 4) - } - - test "RandomAccessList.tryNthNth returns None for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth 2 2) - Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth 1 5) - Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth -1 2) - Expect.isNone "RandomAccessList.tryNthNth" (outer |> RandomAccessList.tryNthNth 1 -2) - } - - test "list of lists can be RandomAccessList.updated with RandomAccessList.updateNth" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.equal - "RandomAccessList.updateNth" - 7 - (outer - |> RandomAccessList.updateNth 0 2 7 - |> RandomAccessList.nthNth 0 2) - - Expect.equal - "RandomAccessList.updateNth" - 9 - (outer - |> RandomAccessList.updateNth 1 4 9 - |> RandomAccessList.nthNth 1 4) - } - - test "RandomAccessList.updateNth should not change the original list" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - let outer = ref RandomAccessList.empty - outer := RandomAccessList.cons inner (!outer) - outer := RandomAccessList.cons inner (!outer) - - Expect.equal - "RandomAccessList.updateNth" - 7 - (!outer - |> RandomAccessList.updateNth 0 2 7 - |> RandomAccessList.nthNth 0 2) - - Expect.equal "RandomAccessList.updateNth" 3 (!outer |> RandomAccessList.nthNth 0 2) - - Expect.equal - "RandomAccessList.updateNth" - 9 - (!outer - |> RandomAccessList.updateNth 1 4 9 - |> RandomAccessList.nthNth 1 4) - - Expect.equal "RandomAccessList.updateNth" 5 (!outer |> RandomAccessList.nthNth 1 4) - } - - test "RandomAccessList.updateNth throws exception for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.throwsT "RandomAccessList.updateNth" (fun () -> - RandomAccessList.updateNth 0 6 7 outer |> ignore) - - Expect.throwsT "RandomAccessList.updateNth" (fun () -> - RandomAccessList.updateNth 9 2 7 outer |> ignore) - - Expect.throwsT "RandomAccessList.updateNth" (fun () -> - RandomAccessList.updateNth 1 -4 7 outer |> ignore) - - Expect.throwsT "RandomAccessList.updateNth" (fun () -> - RandomAccessList.updateNth -1 4 7 outer |> ignore) - } - - test "RandomAccessList.tryUpdateNth returns None for out-of-bounds indices" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - Expect.isNone "RandomAccessList.tryUpdateNth" - <| RandomAccessList.tryUpdateNth 0 6 7 outer - - Expect.isNone "RandomAccessList.tryUpdateNth" - <| RandomAccessList.tryUpdateNth 9 2 7 outer - - Expect.isNone "RandomAccessList.tryUpdateNth" - <| RandomAccessList.tryUpdateNth 1 -4 7 outer - - Expect.isNone "RandomAccessList.tryUpdateNth" - <| RandomAccessList.tryUpdateNth -1 4 7 outer - } - - test "RandomAccessList.tryUpdateNth is like RandomAccessList.updateNth but returns option" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - - let outer = - RandomAccessList.empty - |> RandomAccessList.cons inner - |> RandomAccessList.cons inner - - let result = outer |> RandomAccessList.tryUpdateNth 0 2 7 - Expect.isTrue "RandomAccessList.tryUpdateNth" (result |> Option.isSome) - Expect.equal "RandomAccessList.tryUpdateNth" 7 (result |> Option.get |> RandomAccessList.nthNth 0 2) - - let result2 = outer |> RandomAccessList.tryUpdateNth 1 4 9 - Expect.isTrue "RandomAccessList.tryUpdateNth" (result2 |> Option.isSome) - Expect.equal "RandomAccessList.tryUpdateNth" 9 (result2 |> Option.get |> RandomAccessList.nthNth 1 4) - } - - test "RandomAccessList.tryUpdateNth should not change the original list" { - let inner = [ 1; 2; 3; 4; 5 ] |> RandomAccessList.ofSeq - let outer = ref RandomAccessList.empty - outer := RandomAccessList.cons inner (!outer) - outer := RandomAccessList.cons inner (!outer) - - Expect.equal - "" - 7 - (!outer - |> RandomAccessList.tryUpdateNth 0 2 7 - |> Option.get - |> RandomAccessList.nthNth 0 2) - - Expect.equal "RandomAccessList.tryUpdateNth" 3 (!outer |> RandomAccessList.nthNth 0 2) - - Expect.equal - "" - 9 - (!outer - |> RandomAccessList.tryUpdateNth 1 4 9 - |> Option.get - |> RandomAccessList.nthNth 1 4) - - Expect.equal "RandomAccessList.tryUpdateNth" 5 (!outer |> RandomAccessList.nthNth 1 4) - } - - test "RandomAccessList.update RandomAccessList.length 1" { - Expect.equal - "RandomAccessList.update" - "aa" - (RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.update 0 "aa" - |> RandomAccessList.nth 0) - } - - test "RandomAccessList.update RandomAccessList.length 2" { - let len2 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - - Expect.isTrue - "RandomAccessList.update" - (((len2 |> RandomAccessList.update 0 "bb" |> RandomAccessList.nth 0) = "bb") - && ((len2 |> RandomAccessList.update 1 "aa" |> RandomAccessList.nth 1) = "aa")) - } - - test "RandomAccessList.update RandomAccessList.length 3" { - let len3 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - - (((len3 |> RandomAccessList.update 0 "cc" |> RandomAccessList.nth 0) = "cc") - && ((len3 |> RandomAccessList.update 1 "bb" |> RandomAccessList.nth 1) = "bb") - && ((len3 |> RandomAccessList.update 2 "aa" |> RandomAccessList.nth 2) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 4" { - let len4 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - - (((len4 |> RandomAccessList.update 0 "dd" |> RandomAccessList.nth 0) = "dd") - && ((len4 |> RandomAccessList.update 1 "cc" |> RandomAccessList.nth 1) = "cc") - && ((len4 |> RandomAccessList.update 2 "bb" |> RandomAccessList.nth 2) = "bb") - && ((len4 |> RandomAccessList.update 3 "aa" |> RandomAccessList.nth 3) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 5" { - let len5 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - - (((len5 |> RandomAccessList.update 0 "ee" |> RandomAccessList.nth 0) = "ee") - && ((len5 |> RandomAccessList.update 1 "dd" |> RandomAccessList.nth 1) = "dd") - && ((len5 |> RandomAccessList.update 2 "cc" |> RandomAccessList.nth 2) = "cc") - && ((len5 |> RandomAccessList.update 3 "bb" |> RandomAccessList.nth 3) = "bb") - && ((len5 |> RandomAccessList.update 4 "aa" |> RandomAccessList.nth 4) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 6" { - let len6 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - - (((len6 |> RandomAccessList.update 0 "ff" |> RandomAccessList.nth 0) = "ff") - && ((len6 |> RandomAccessList.update 1 "ee" |> RandomAccessList.nth 1) = "ee") - && ((len6 |> RandomAccessList.update 2 "dd" |> RandomAccessList.nth 2) = "dd") - && ((len6 |> RandomAccessList.update 3 "cc" |> RandomAccessList.nth 3) = "cc") - && ((len6 |> RandomAccessList.update 4 "bb" |> RandomAccessList.nth 4) = "bb") - && ((len6 |> RandomAccessList.update 5 "aa" |> RandomAccessList.nth 5) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 7" { - let len7 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - - (((len7 |> RandomAccessList.update 0 "gg" |> RandomAccessList.nth 0) = "gg") - && ((len7 |> RandomAccessList.update 1 "ff" |> RandomAccessList.nth 1) = "ff") - && ((len7 |> RandomAccessList.update 2 "ee" |> RandomAccessList.nth 2) = "ee") - && ((len7 |> RandomAccessList.update 3 "dd" |> RandomAccessList.nth 3) = "dd") - && ((len7 |> RandomAccessList.update 4 "cc" |> RandomAccessList.nth 4) = "cc") - && ((len7 |> RandomAccessList.update 5 "bb" |> RandomAccessList.nth 5) = "bb") - && ((len7 |> RandomAccessList.update 6 "aa" |> RandomAccessList.nth 6) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 8" { - let len8 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - - (((len8 |> RandomAccessList.update 0 "hh" |> RandomAccessList.nth 0) = "hh") - && ((len8 |> RandomAccessList.update 1 "gg" |> RandomAccessList.nth 1) = "gg") - && ((len8 |> RandomAccessList.update 2 "ff" |> RandomAccessList.nth 2) = "ff") - && ((len8 |> RandomAccessList.update 3 "ee" |> RandomAccessList.nth 3) = "ee") - && ((len8 |> RandomAccessList.update 4 "dd" |> RandomAccessList.nth 4) = "dd") - && ((len8 |> RandomAccessList.update 5 "cc" |> RandomAccessList.nth 5) = "cc") - && ((len8 |> RandomAccessList.update 6 "bb" |> RandomAccessList.nth 6) = "bb") - && ((len8 |> RandomAccessList.update 7 "aa" |> RandomAccessList.nth 7) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 9" { - let len9 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - - (((len9 |> RandomAccessList.update 0 "ii" |> RandomAccessList.nth 0) = "ii") - && ((len9 |> RandomAccessList.update 1 "hh" |> RandomAccessList.nth 1) = "hh") - && ((len9 |> RandomAccessList.update 2 "gg" |> RandomAccessList.nth 2) = "gg") - && ((len9 |> RandomAccessList.update 3 "ff" |> RandomAccessList.nth 3) = "ff") - && ((len9 |> RandomAccessList.update 4 "ee" |> RandomAccessList.nth 4) = "ee") - && ((len9 |> RandomAccessList.update 5 "dd" |> RandomAccessList.nth 5) = "dd") - && ((len9 |> RandomAccessList.update 6 "cc" |> RandomAccessList.nth 6) = "cc") - && ((len9 |> RandomAccessList.update 7 "bb" |> RandomAccessList.nth 7) = "bb") - && ((len9 |> RandomAccessList.update 8 "aa" |> RandomAccessList.nth 8) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.update RandomAccessList.length 10" { - let lena = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - |> RandomAccessList.cons "j" - - (((lena |> RandomAccessList.update 0 "jj" |> RandomAccessList.nth 0) = "jj") - && ((lena |> RandomAccessList.update 1 "ii" |> RandomAccessList.nth 1) = "ii") - && ((lena |> RandomAccessList.update 2 "hh" |> RandomAccessList.nth 2) = "hh") - && ((lena |> RandomAccessList.update 3 "gg" |> RandomAccessList.nth 3) = "gg") - && ((lena |> RandomAccessList.update 4 "ff" |> RandomAccessList.nth 4) = "ff") - && ((lena |> RandomAccessList.update 5 "ee" |> RandomAccessList.nth 5) = "ee") - && ((lena |> RandomAccessList.update 6 "dd" |> RandomAccessList.nth 6) = "dd") - && ((lena |> RandomAccessList.update 7 "cc" |> RandomAccessList.nth 7) = "cc") - && ((lena |> RandomAccessList.update 8 "bb" |> RandomAccessList.nth 8) = "bb") - && ((lena |> RandomAccessList.update 9 "aa" |> RandomAccessList.nth 9) = "aa")) - |> Expect.isTrue "RandomAccessList.update" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 1" { - let a = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.tryUpdate 0 "aa" - - ((a.Value |> RandomAccessList.nth 0) = "aa") - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 2" { - let len2 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - - let b = len2 |> RandomAccessList.tryUpdate 0 "bb" - let a = len2 |> RandomAccessList.tryUpdate 1 "aa" - - (((b.Value |> RandomAccessList.nth 0) = "bb") - && ((a.Value |> RandomAccessList.nth 1) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 3" { - let len3 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - - let c = len3 |> RandomAccessList.tryUpdate 0 "cc" - let b = len3 |> RandomAccessList.tryUpdate 1 "bb" - let a = len3 |> RandomAccessList.tryUpdate 2 "aa" - - (((c.Value |> RandomAccessList.nth 0) = "cc") - && ((b.Value |> RandomAccessList.nth 1) = "bb") - && ((a.Value |> RandomAccessList.nth 2) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 4" { - let len4 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - - let d = len4 |> RandomAccessList.tryUpdate 0 "dd" - let c = len4 |> RandomAccessList.tryUpdate 1 "cc" - let b = len4 |> RandomAccessList.tryUpdate 2 "bb" - let a = len4 |> RandomAccessList.tryUpdate 3 "aa" - - (((d.Value |> RandomAccessList.nth 0) = "dd") - && ((c.Value |> RandomAccessList.nth 1) = "cc") - && ((b.Value |> RandomAccessList.nth 2) = "bb") - && ((a.Value |> RandomAccessList.nth 3) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 5" { - let len5 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - - let e = len5 |> RandomAccessList.tryUpdate 0 "ee" - let d = len5 |> RandomAccessList.tryUpdate 1 "dd" - let c = len5 |> RandomAccessList.tryUpdate 2 "cc" - let b = len5 |> RandomAccessList.tryUpdate 3 "bb" - let a = len5 |> RandomAccessList.tryUpdate 4 "aa" - - (((e.Value |> RandomAccessList.nth 0) = "ee") - && ((d.Value |> RandomAccessList.nth 1) = "dd") - && ((c.Value |> RandomAccessList.nth 2) = "cc") - && ((b.Value |> RandomAccessList.nth 3) = "bb") - && ((a.Value |> RandomAccessList.nth 4) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 6" { - let len6 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - - let f = len6 |> RandomAccessList.tryUpdate 0 "ff" - let e = len6 |> RandomAccessList.tryUpdate 1 "ee" - let d = len6 |> RandomAccessList.tryUpdate 2 "dd" - let c = len6 |> RandomAccessList.tryUpdate 3 "cc" - let b = len6 |> RandomAccessList.tryUpdate 4 "bb" - let a = len6 |> RandomAccessList.tryUpdate 5 "aa" - - (((f.Value |> RandomAccessList.nth 0) = "ff") - && ((e.Value |> RandomAccessList.nth 1) = "ee") - && ((d.Value |> RandomAccessList.nth 2) = "dd") - && ((c.Value |> RandomAccessList.nth 3) = "cc") - && ((b.Value |> RandomAccessList.nth 4) = "bb") - && ((a.Value |> RandomAccessList.nth 5) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 7" { - let len7 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - - let g = len7 |> RandomAccessList.tryUpdate 0 "gg" - let f = len7 |> RandomAccessList.tryUpdate 1 "ff" - let e = len7 |> RandomAccessList.tryUpdate 2 "ee" - let d = len7 |> RandomAccessList.tryUpdate 3 "dd" - let c = len7 |> RandomAccessList.tryUpdate 4 "cc" - let b = len7 |> RandomAccessList.tryUpdate 5 "bb" - let a = len7 |> RandomAccessList.tryUpdate 6 "aa" - - (((g.Value |> RandomAccessList.nth 0) = "gg") - && ((f.Value |> RandomAccessList.nth 1) = "ff") - && ((e.Value |> RandomAccessList.nth 2) = "ee") - && ((d.Value |> RandomAccessList.nth 3) = "dd") - && ((c.Value |> RandomAccessList.nth 4) = "cc") - && ((b.Value |> RandomAccessList.nth 5) = "bb") - && ((a.Value |> RandomAccessList.nth 6) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 8" { - let len8 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - - let h = len8 |> RandomAccessList.tryUpdate 0 "hh" - let g = len8 |> RandomAccessList.tryUpdate 1 "gg" - let f = len8 |> RandomAccessList.tryUpdate 2 "ff" - let e = len8 |> RandomAccessList.tryUpdate 3 "ee" - let d = len8 |> RandomAccessList.tryUpdate 4 "dd" - let c = len8 |> RandomAccessList.tryUpdate 5 "cc" - let b = len8 |> RandomAccessList.tryUpdate 6 "bb" - let a = len8 |> RandomAccessList.tryUpdate 7 "aa" - - (((h.Value |> RandomAccessList.nth 0) = "hh") - && ((g.Value |> RandomAccessList.nth 1) = "gg") - && ((f.Value |> RandomAccessList.nth 2) = "ff") - && ((e.Value |> RandomAccessList.nth 3) = "ee") - && ((d.Value |> RandomAccessList.nth 4) = "dd") - && ((c.Value |> RandomAccessList.nth 5) = "cc") - && ((b.Value |> RandomAccessList.nth 6) = "bb") - && ((a.Value |> RandomAccessList.nth 7) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 9" { - let len9 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - - let i = len9 |> RandomAccessList.tryUpdate 0 "ii" - let h = len9 |> RandomAccessList.tryUpdate 1 "hh" - let g = len9 |> RandomAccessList.tryUpdate 2 "gg" - let f = len9 |> RandomAccessList.tryUpdate 3 "ff" - let e = len9 |> RandomAccessList.tryUpdate 4 "ee" - let d = len9 |> RandomAccessList.tryUpdate 5 "dd" - let c = len9 |> RandomAccessList.tryUpdate 6 "cc" - let b = len9 |> RandomAccessList.tryUpdate 7 "bb" - let a = len9 |> RandomAccessList.tryUpdate 8 "aa" - - (((i.Value |> RandomAccessList.nth 0) = "ii") - && ((h.Value |> RandomAccessList.nth 1) = "hh") - && ((g.Value |> RandomAccessList.nth 2) = "gg") - && ((f.Value |> RandomAccessList.nth 3) = "ff") - && ((e.Value |> RandomAccessList.nth 4) = "ee") - && ((d.Value |> RandomAccessList.nth 5) = "dd") - && ((c.Value |> RandomAccessList.nth 6) = "cc") - && ((b.Value |> RandomAccessList.nth 7) = "bb") - && ((a.Value |> RandomAccessList.nth 8) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "RandomAccessList.tryUpdate RandomAccessList.length 10" { - let lena = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - |> RandomAccessList.cons "j" - - let j = lena |> RandomAccessList.tryUpdate 0 "jj" - let i = lena |> RandomAccessList.tryUpdate 1 "ii" - let h = lena |> RandomAccessList.tryUpdate 2 "hh" - let g = lena |> RandomAccessList.tryUpdate 3 "gg" - let f = lena |> RandomAccessList.tryUpdate 4 "ff" - let e = lena |> RandomAccessList.tryUpdate 5 "ee" - let d = lena |> RandomAccessList.tryUpdate 6 "dd" - let c = lena |> RandomAccessList.tryUpdate 7 "cc" - let b = lena |> RandomAccessList.tryUpdate 8 "bb" - let a = lena |> RandomAccessList.tryUpdate 9 "aa" - - (((j.Value |> RandomAccessList.nth 0) = "jj") - && ((i.Value |> RandomAccessList.nth 1) = "ii") - && ((h.Value |> RandomAccessList.nth 2) = "hh") - && ((g.Value |> RandomAccessList.nth 3) = "gg") - && ((f.Value |> RandomAccessList.nth 4) = "ff") - && ((e.Value |> RandomAccessList.nth 5) = "ee") - && ((d.Value |> RandomAccessList.nth 6) = "dd") - && ((c.Value |> RandomAccessList.nth 7) = "cc") - && ((b.Value |> RandomAccessList.nth 8) = "bb") - && ((a.Value |> RandomAccessList.nth 9) = "aa")) - |> Expect.isTrue "RandomAccessList.tryUpdate" - } - - test "tryRandomAccessList.update of long RAL" { - let v = RandomAccessList.ofSeq [ 1..100 ] - Expect.equal "RandomAccessList.tryUpdate" 5 (v |> RandomAccessList.update 99 5 |> RandomAccessList.nth 99) - } - - test "RandomAccessList.length of RandomAccessList.empty is 0" { Expect.equal "" 0 (RandomAccessList.empty |> RandomAccessList.length) } - - test "RandomAccessList.length of 1 - 10 good" { - let len1 = RandomAccessList.empty |> RandomAccessList.cons "a" - - let len2 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - - let len3 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - - let len4 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - - let len5 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - - let len6 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - - let len7 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - - let len8 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - - let len9 = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - - let lena = - RandomAccessList.empty - |> RandomAccessList.cons "a" - |> RandomAccessList.cons "b" - |> RandomAccessList.cons "c" - |> RandomAccessList.cons "d" - |> RandomAccessList.cons "e" - |> RandomAccessList.cons "f" - |> RandomAccessList.cons "g" - |> RandomAccessList.cons "h" - |> RandomAccessList.cons "i" - |> RandomAccessList.cons "j" - - (((RandomAccessList.length len1) = 1) - && ((RandomAccessList.length len2) = 2) - && ((RandomAccessList.length len3) = 3) - && ((RandomAccessList.length len4) = 4) - && ((RandomAccessList.length len5) = 5) - && ((RandomAccessList.length len6) = 6) - && ((RandomAccessList.length len7) = 7) - && ((RandomAccessList.length len8) = 8) - && ((RandomAccessList.length len9) = 9) - && ((RandomAccessList.length lena) = 10)) - |> Expect.isTrue "RandomAccessList.length" - } - - test "allow map" { - let x = RandomAccessList.ofSeq [ 1..300 ] - let randomAccessList2 = RandomAccessList.map (fun x -> x * 2) x - Expect.equal "map" [ for i in 1..300 -> i * 2 ] (randomAccessList2 |> Seq.toList) - } - - test "RandomAccessList.cons pattern discriminator - randomAccessList" { - let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] - - let h1, t1 = - match q with - | RandomAccessList.Cons(h, t) -> h, t - | _ -> "x", q - - Expect.isTrue "RandomAccessList.cons pattern discriminato" ((h1 = "f") && (t1.Length = 5)) - } - - test "structural equality" { - let l1 = RandomAccessList.ofSeq [ 1..100 ] - let l2 = RandomAccessList.ofSeq [ 1..100 ] - - Expect.isTrue "structural equality" (l1 = l2) - - let l3 = l2 |> RandomAccessList.update 98 7 - - Expect.isFalse "structural equality" (l1 = l3) - } - - test "RandomAccessList.ofSeq random access list" { - let x = RandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] - - (((x |> RandomAccessList.nth 0) = "a") - && ((x |> RandomAccessList.nth 1) = "b") - && ((x |> RandomAccessList.nth 2) = "c") - && ((x |> RandomAccessList.nth 3) = "d") - && ((x |> RandomAccessList.nth 4) = "e") - && ((x |> RandomAccessList.nth 5) = "f") - && ((x |> RandomAccessList.nth 6) = "g") - && ((x |> RandomAccessList.nth 7) = "h") - && ((x |> RandomAccessList.nth 8) = "i") - && ((x |> RandomAccessList.nth 9) = "j")) - |> Expect.isTrue "RandomAccessList.ofSeq" - } - - test "allow init" { - let randomAccessList = RandomAccessList.init 5 (fun x -> x * 2) - let s = Seq.init 5 (fun x -> x * 2) - - s |> Seq.toList |> Expect.equal "" [ 0; 2; 4; 6; 8 ] - Expect.equal "init" [ 0; 2; 4; 6; 8 ] (randomAccessList |> Seq.toList) - } - - test "RandomAccessList.toSeq to list" { - let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] - let rl = RandomAccessList.ofSeq l - - Expect.equal "RandomAccessList.toSeq" l (rl |> RandomAccessList.toSeq |> List.ofSeq) - } - - test "enumerate RandomAccessList.empty" { - for i in RandomAccessList.empty do - ignore() - - Expect.isTrue "enumerate RandomAccessList.empty" true - } - ] + |> RandomAccessList.update 0 "aa" + |> RandomAccessList.nth 0) + } + + test "RandomAccessList.update RandomAccessList.length 2" { + let len2 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + + Expect.isTrue + "RandomAccessList.update" + (((len2 |> RandomAccessList.update 0 "bb" |> RandomAccessList.nth 0) = "bb") + && ((len2 |> RandomAccessList.update 1 "aa" |> RandomAccessList.nth 1) = "aa")) + } + + test "RandomAccessList.update RandomAccessList.length 3" { + let len3 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + + (((len3 |> RandomAccessList.update 0 "cc" |> RandomAccessList.nth 0) = "cc") + && ((len3 |> RandomAccessList.update 1 "bb" |> RandomAccessList.nth 1) = "bb") + && ((len3 |> RandomAccessList.update 2 "aa" |> RandomAccessList.nth 2) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 4" { + let len4 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + + (((len4 |> RandomAccessList.update 0 "dd" |> RandomAccessList.nth 0) = "dd") + && ((len4 |> RandomAccessList.update 1 "cc" |> RandomAccessList.nth 1) = "cc") + && ((len4 |> RandomAccessList.update 2 "bb" |> RandomAccessList.nth 2) = "bb") + && ((len4 |> RandomAccessList.update 3 "aa" |> RandomAccessList.nth 3) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 5" { + let len5 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + + (((len5 |> RandomAccessList.update 0 "ee" |> RandomAccessList.nth 0) = "ee") + && ((len5 |> RandomAccessList.update 1 "dd" |> RandomAccessList.nth 1) = "dd") + && ((len5 |> RandomAccessList.update 2 "cc" |> RandomAccessList.nth 2) = "cc") + && ((len5 |> RandomAccessList.update 3 "bb" |> RandomAccessList.nth 3) = "bb") + && ((len5 |> RandomAccessList.update 4 "aa" |> RandomAccessList.nth 4) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 6" { + let len6 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + + (((len6 |> RandomAccessList.update 0 "ff" |> RandomAccessList.nth 0) = "ff") + && ((len6 |> RandomAccessList.update 1 "ee" |> RandomAccessList.nth 1) = "ee") + && ((len6 |> RandomAccessList.update 2 "dd" |> RandomAccessList.nth 2) = "dd") + && ((len6 |> RandomAccessList.update 3 "cc" |> RandomAccessList.nth 3) = "cc") + && ((len6 |> RandomAccessList.update 4 "bb" |> RandomAccessList.nth 4) = "bb") + && ((len6 |> RandomAccessList.update 5 "aa" |> RandomAccessList.nth 5) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 7" { + let len7 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + + (((len7 |> RandomAccessList.update 0 "gg" |> RandomAccessList.nth 0) = "gg") + && ((len7 |> RandomAccessList.update 1 "ff" |> RandomAccessList.nth 1) = "ff") + && ((len7 |> RandomAccessList.update 2 "ee" |> RandomAccessList.nth 2) = "ee") + && ((len7 |> RandomAccessList.update 3 "dd" |> RandomAccessList.nth 3) = "dd") + && ((len7 |> RandomAccessList.update 4 "cc" |> RandomAccessList.nth 4) = "cc") + && ((len7 |> RandomAccessList.update 5 "bb" |> RandomAccessList.nth 5) = "bb") + && ((len7 |> RandomAccessList.update 6 "aa" |> RandomAccessList.nth 6) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 8" { + let len8 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + + (((len8 |> RandomAccessList.update 0 "hh" |> RandomAccessList.nth 0) = "hh") + && ((len8 |> RandomAccessList.update 1 "gg" |> RandomAccessList.nth 1) = "gg") + && ((len8 |> RandomAccessList.update 2 "ff" |> RandomAccessList.nth 2) = "ff") + && ((len8 |> RandomAccessList.update 3 "ee" |> RandomAccessList.nth 3) = "ee") + && ((len8 |> RandomAccessList.update 4 "dd" |> RandomAccessList.nth 4) = "dd") + && ((len8 |> RandomAccessList.update 5 "cc" |> RandomAccessList.nth 5) = "cc") + && ((len8 |> RandomAccessList.update 6 "bb" |> RandomAccessList.nth 6) = "bb") + && ((len8 |> RandomAccessList.update 7 "aa" |> RandomAccessList.nth 7) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 9" { + let len9 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + + (((len9 |> RandomAccessList.update 0 "ii" |> RandomAccessList.nth 0) = "ii") + && ((len9 |> RandomAccessList.update 1 "hh" |> RandomAccessList.nth 1) = "hh") + && ((len9 |> RandomAccessList.update 2 "gg" |> RandomAccessList.nth 2) = "gg") + && ((len9 |> RandomAccessList.update 3 "ff" |> RandomAccessList.nth 3) = "ff") + && ((len9 |> RandomAccessList.update 4 "ee" |> RandomAccessList.nth 4) = "ee") + && ((len9 |> RandomAccessList.update 5 "dd" |> RandomAccessList.nth 5) = "dd") + && ((len9 |> RandomAccessList.update 6 "cc" |> RandomAccessList.nth 6) = "cc") + && ((len9 |> RandomAccessList.update 7 "bb" |> RandomAccessList.nth 7) = "bb") + && ((len9 |> RandomAccessList.update 8 "aa" |> RandomAccessList.nth 8) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.update RandomAccessList.length 10" { + let lena = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + |> RandomAccessList.cons "j" + + (((lena |> RandomAccessList.update 0 "jj" |> RandomAccessList.nth 0) = "jj") + && ((lena |> RandomAccessList.update 1 "ii" |> RandomAccessList.nth 1) = "ii") + && ((lena |> RandomAccessList.update 2 "hh" |> RandomAccessList.nth 2) = "hh") + && ((lena |> RandomAccessList.update 3 "gg" |> RandomAccessList.nth 3) = "gg") + && ((lena |> RandomAccessList.update 4 "ff" |> RandomAccessList.nth 4) = "ff") + && ((lena |> RandomAccessList.update 5 "ee" |> RandomAccessList.nth 5) = "ee") + && ((lena |> RandomAccessList.update 6 "dd" |> RandomAccessList.nth 6) = "dd") + && ((lena |> RandomAccessList.update 7 "cc" |> RandomAccessList.nth 7) = "cc") + && ((lena |> RandomAccessList.update 8 "bb" |> RandomAccessList.nth 8) = "bb") + && ((lena |> RandomAccessList.update 9 "aa" |> RandomAccessList.nth 9) = "aa")) + |> Expect.isTrue "RandomAccessList.update" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 1" { + let a = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.tryUpdate 0 "aa" + + ((a.Value |> RandomAccessList.nth 0) = "aa") + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 2" { + let len2 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + + let b = len2 |> RandomAccessList.tryUpdate 0 "bb" + let a = len2 |> RandomAccessList.tryUpdate 1 "aa" + + (((b.Value |> RandomAccessList.nth 0) = "bb") + && ((a.Value |> RandomAccessList.nth 1) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 3" { + let len3 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + + let c = len3 |> RandomAccessList.tryUpdate 0 "cc" + let b = len3 |> RandomAccessList.tryUpdate 1 "bb" + let a = len3 |> RandomAccessList.tryUpdate 2 "aa" + + (((c.Value |> RandomAccessList.nth 0) = "cc") + && ((b.Value |> RandomAccessList.nth 1) = "bb") + && ((a.Value |> RandomAccessList.nth 2) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 4" { + let len4 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + + let d = len4 |> RandomAccessList.tryUpdate 0 "dd" + let c = len4 |> RandomAccessList.tryUpdate 1 "cc" + let b = len4 |> RandomAccessList.tryUpdate 2 "bb" + let a = len4 |> RandomAccessList.tryUpdate 3 "aa" + + (((d.Value |> RandomAccessList.nth 0) = "dd") + && ((c.Value |> RandomAccessList.nth 1) = "cc") + && ((b.Value |> RandomAccessList.nth 2) = "bb") + && ((a.Value |> RandomAccessList.nth 3) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 5" { + let len5 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + + let e = len5 |> RandomAccessList.tryUpdate 0 "ee" + let d = len5 |> RandomAccessList.tryUpdate 1 "dd" + let c = len5 |> RandomAccessList.tryUpdate 2 "cc" + let b = len5 |> RandomAccessList.tryUpdate 3 "bb" + let a = len5 |> RandomAccessList.tryUpdate 4 "aa" + + (((e.Value |> RandomAccessList.nth 0) = "ee") + && ((d.Value |> RandomAccessList.nth 1) = "dd") + && ((c.Value |> RandomAccessList.nth 2) = "cc") + && ((b.Value |> RandomAccessList.nth 3) = "bb") + && ((a.Value |> RandomAccessList.nth 4) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 6" { + let len6 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + + let f = len6 |> RandomAccessList.tryUpdate 0 "ff" + let e = len6 |> RandomAccessList.tryUpdate 1 "ee" + let d = len6 |> RandomAccessList.tryUpdate 2 "dd" + let c = len6 |> RandomAccessList.tryUpdate 3 "cc" + let b = len6 |> RandomAccessList.tryUpdate 4 "bb" + let a = len6 |> RandomAccessList.tryUpdate 5 "aa" + + (((f.Value |> RandomAccessList.nth 0) = "ff") + && ((e.Value |> RandomAccessList.nth 1) = "ee") + && ((d.Value |> RandomAccessList.nth 2) = "dd") + && ((c.Value |> RandomAccessList.nth 3) = "cc") + && ((b.Value |> RandomAccessList.nth 4) = "bb") + && ((a.Value |> RandomAccessList.nth 5) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 7" { + let len7 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + + let g = len7 |> RandomAccessList.tryUpdate 0 "gg" + let f = len7 |> RandomAccessList.tryUpdate 1 "ff" + let e = len7 |> RandomAccessList.tryUpdate 2 "ee" + let d = len7 |> RandomAccessList.tryUpdate 3 "dd" + let c = len7 |> RandomAccessList.tryUpdate 4 "cc" + let b = len7 |> RandomAccessList.tryUpdate 5 "bb" + let a = len7 |> RandomAccessList.tryUpdate 6 "aa" + + (((g.Value |> RandomAccessList.nth 0) = "gg") + && ((f.Value |> RandomAccessList.nth 1) = "ff") + && ((e.Value |> RandomAccessList.nth 2) = "ee") + && ((d.Value |> RandomAccessList.nth 3) = "dd") + && ((c.Value |> RandomAccessList.nth 4) = "cc") + && ((b.Value |> RandomAccessList.nth 5) = "bb") + && ((a.Value |> RandomAccessList.nth 6) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 8" { + let len8 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + + let h = len8 |> RandomAccessList.tryUpdate 0 "hh" + let g = len8 |> RandomAccessList.tryUpdate 1 "gg" + let f = len8 |> RandomAccessList.tryUpdate 2 "ff" + let e = len8 |> RandomAccessList.tryUpdate 3 "ee" + let d = len8 |> RandomAccessList.tryUpdate 4 "dd" + let c = len8 |> RandomAccessList.tryUpdate 5 "cc" + let b = len8 |> RandomAccessList.tryUpdate 6 "bb" + let a = len8 |> RandomAccessList.tryUpdate 7 "aa" + + (((h.Value |> RandomAccessList.nth 0) = "hh") + && ((g.Value |> RandomAccessList.nth 1) = "gg") + && ((f.Value |> RandomAccessList.nth 2) = "ff") + && ((e.Value |> RandomAccessList.nth 3) = "ee") + && ((d.Value |> RandomAccessList.nth 4) = "dd") + && ((c.Value |> RandomAccessList.nth 5) = "cc") + && ((b.Value |> RandomAccessList.nth 6) = "bb") + && ((a.Value |> RandomAccessList.nth 7) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 9" { + let len9 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + + let i = len9 |> RandomAccessList.tryUpdate 0 "ii" + let h = len9 |> RandomAccessList.tryUpdate 1 "hh" + let g = len9 |> RandomAccessList.tryUpdate 2 "gg" + let f = len9 |> RandomAccessList.tryUpdate 3 "ff" + let e = len9 |> RandomAccessList.tryUpdate 4 "ee" + let d = len9 |> RandomAccessList.tryUpdate 5 "dd" + let c = len9 |> RandomAccessList.tryUpdate 6 "cc" + let b = len9 |> RandomAccessList.tryUpdate 7 "bb" + let a = len9 |> RandomAccessList.tryUpdate 8 "aa" + + (((i.Value |> RandomAccessList.nth 0) = "ii") + && ((h.Value |> RandomAccessList.nth 1) = "hh") + && ((g.Value |> RandomAccessList.nth 2) = "gg") + && ((f.Value |> RandomAccessList.nth 3) = "ff") + && ((e.Value |> RandomAccessList.nth 4) = "ee") + && ((d.Value |> RandomAccessList.nth 5) = "dd") + && ((c.Value |> RandomAccessList.nth 6) = "cc") + && ((b.Value |> RandomAccessList.nth 7) = "bb") + && ((a.Value |> RandomAccessList.nth 8) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "RandomAccessList.tryUpdate RandomAccessList.length 10" { + let lena = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + |> RandomAccessList.cons "j" + + let j = lena |> RandomAccessList.tryUpdate 0 "jj" + let i = lena |> RandomAccessList.tryUpdate 1 "ii" + let h = lena |> RandomAccessList.tryUpdate 2 "hh" + let g = lena |> RandomAccessList.tryUpdate 3 "gg" + let f = lena |> RandomAccessList.tryUpdate 4 "ff" + let e = lena |> RandomAccessList.tryUpdate 5 "ee" + let d = lena |> RandomAccessList.tryUpdate 6 "dd" + let c = lena |> RandomAccessList.tryUpdate 7 "cc" + let b = lena |> RandomAccessList.tryUpdate 8 "bb" + let a = lena |> RandomAccessList.tryUpdate 9 "aa" + + (((j.Value |> RandomAccessList.nth 0) = "jj") + && ((i.Value |> RandomAccessList.nth 1) = "ii") + && ((h.Value |> RandomAccessList.nth 2) = "hh") + && ((g.Value |> RandomAccessList.nth 3) = "gg") + && ((f.Value |> RandomAccessList.nth 4) = "ff") + && ((e.Value |> RandomAccessList.nth 5) = "ee") + && ((d.Value |> RandomAccessList.nth 6) = "dd") + && ((c.Value |> RandomAccessList.nth 7) = "cc") + && ((b.Value |> RandomAccessList.nth 8) = "bb") + && ((a.Value |> RandomAccessList.nth 9) = "aa")) + |> Expect.isTrue "RandomAccessList.tryUpdate" + } + + test "tryRandomAccessList.update of long RAL" { + let v = RandomAccessList.ofSeq [ 1..100 ] + Expect.equal "RandomAccessList.tryUpdate" 5 (v |> RandomAccessList.update 99 5 |> RandomAccessList.nth 99) + } + + test "RandomAccessList.length of RandomAccessList.empty is 0" { Expect.equal "" 0 (RandomAccessList.empty |> RandomAccessList.length) } + + test "RandomAccessList.length of 1 - 10 good" { + let len1 = RandomAccessList.empty |> RandomAccessList.cons "a" + + let len2 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + + let len3 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + + let len4 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + + let len5 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + + let len6 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + + let len7 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + + let len8 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + + let len9 = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + + let lena = + RandomAccessList.empty + |> RandomAccessList.cons "a" + |> RandomAccessList.cons "b" + |> RandomAccessList.cons "c" + |> RandomAccessList.cons "d" + |> RandomAccessList.cons "e" + |> RandomAccessList.cons "f" + |> RandomAccessList.cons "g" + |> RandomAccessList.cons "h" + |> RandomAccessList.cons "i" + |> RandomAccessList.cons "j" + + (((RandomAccessList.length len1) = 1) + && ((RandomAccessList.length len2) = 2) + && ((RandomAccessList.length len3) = 3) + && ((RandomAccessList.length len4) = 4) + && ((RandomAccessList.length len5) = 5) + && ((RandomAccessList.length len6) = 6) + && ((RandomAccessList.length len7) = 7) + && ((RandomAccessList.length len8) = 8) + && ((RandomAccessList.length len9) = 9) + && ((RandomAccessList.length lena) = 10)) + |> Expect.isTrue "RandomAccessList.length" + } + + test "allow map" { + let x = RandomAccessList.ofSeq [ 1..300 ] + let randomAccessList2 = RandomAccessList.map (fun x -> x * 2) x + Expect.equal "map" [ for i in 1..300 -> i * 2 ] (randomAccessList2 |> Seq.toList) + } + + test "RandomAccessList.cons pattern discriminator - randomAccessList" { + let q = RandomAccessList.ofSeq [ "f"; "e"; "d"; "c"; "b"; "a" ] + + let h1, t1 = + match q with + | RandomAccessList.Cons(h, t) -> h, t + | _ -> "x", q + + Expect.isTrue "RandomAccessList.cons pattern discriminato" ((h1 = "f") && (t1.Length = 5)) + } + + test "structural equality" { + let l1 = RandomAccessList.ofSeq [ 1..100 ] + let l2 = RandomAccessList.ofSeq [ 1..100 ] + + Expect.isTrue "structural equality" (l1 = l2) + + let l3 = l2 |> RandomAccessList.update 98 7 + + Expect.isFalse "structural equality" (l1 = l3) + } + + test "RandomAccessList.ofSeq random access list" { + let x = RandomAccessList.ofSeq [ "a"; "b"; "c"; "d"; "e"; "f"; "g"; "h"; "i"; "j" ] + + (((x |> RandomAccessList.nth 0) = "a") + && ((x |> RandomAccessList.nth 1) = "b") + && ((x |> RandomAccessList.nth 2) = "c") + && ((x |> RandomAccessList.nth 3) = "d") + && ((x |> RandomAccessList.nth 4) = "e") + && ((x |> RandomAccessList.nth 5) = "f") + && ((x |> RandomAccessList.nth 6) = "g") + && ((x |> RandomAccessList.nth 7) = "h") + && ((x |> RandomAccessList.nth 8) = "i") + && ((x |> RandomAccessList.nth 9) = "j")) + |> Expect.isTrue "RandomAccessList.ofSeq" + } + + test "allow init" { + let randomAccessList = RandomAccessList.init 5 (fun x -> x * 2) + let s = Seq.init 5 (fun x -> x * 2) + + s |> Seq.toList |> Expect.equal "" [ 0; 2; 4; 6; 8 ] + Expect.equal "init" [ 0; 2; 4; 6; 8 ] (randomAccessList |> Seq.toList) + } + + test "RandomAccessList.toSeq to list" { + let l = [ "f"; "e"; "d"; "c"; "b"; "a" ] + let rl = RandomAccessList.ofSeq l + + Expect.equal "RandomAccessList.toSeq" l (rl |> RandomAccessList.toSeq |> List.ofSeq) + } + + test "enumerate RandomAccessList.empty" { + for i in RandomAccessList.empty do + ignore() + + Expect.isTrue "enumerate RandomAccessList.empty" true + } ] [] let propertyTestRandomAccessList = @@ -1629,50 +1633,56 @@ module RandomAccessListTest = (* non-IRandomAccessList generators from random ofList *) - let RandomAccessListOfListGen = gen { - let! n = Gen.length2thru100 - let! x = Gen.listInt n - return ((RandomAccessList.ofSeq x), x) - } + let RandomAccessListOfListGen = + gen { + let! n = Gen.length2thru100 + let! x = Gen.listInt n + return ((RandomAccessList.ofSeq x), x) + } (* IRandomAccessList generators from random RandomAccessList.ofSeq and/or conj elements from random list *) - let RandomAccessListIntGen = gen { - let! n = Gen.length1thru100 - let! n2 = Gen.length2thru100 - let! x = Gen.listInt n - let! y = Gen.listInt n2 - return ((RandomAccessList.ofSeq x |> consThruList y), ((List.rev y) @ x)) - } - - let RandomAccessListIntOfSeqGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listInt n - return ((RandomAccessList.ofSeq x), x) - } - - let RandomAccessListIntConsGen = gen { - let! n = Gen.length1thru100 - let! x = Gen.listInt n - return ((RandomAccessList.empty |> consThruList x), List.rev x) - } - - let RandomAccessListObjGen = gen { - let! n = Gen.length2thru100 - let! n2 = Gen.length1thru100 - let! x = Gen.listObj n - let! y = Gen.listObj n2 - return ((RandomAccessList.ofSeq x |> consThruList y), ((List.rev y) @ x)) - } - - let RandomAccessListStringGen = gen { - let! n = Gen.length1thru100 - let! n2 = Gen.length2thru100 - let! x = Gen.listString n - let! y = Gen.listString n2 - return ((RandomAccessList.ofSeq x |> consThruList y), ((List.rev y) @ x)) - } + let RandomAccessListIntGen = + gen { + let! n = Gen.length1thru100 + let! n2 = Gen.length2thru100 + let! x = Gen.listInt n + let! y = Gen.listInt n2 + return ((RandomAccessList.ofSeq x |> consThruList y), ((List.rev y) @ x)) + } + + let RandomAccessListIntOfSeqGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listInt n + return ((RandomAccessList.ofSeq x), x) + } + + let RandomAccessListIntConsGen = + gen { + let! n = Gen.length1thru100 + let! x = Gen.listInt n + return ((RandomAccessList.empty |> consThruList x), List.rev x) + } + + let RandomAccessListObjGen = + gen { + let! n = Gen.length2thru100 + let! n2 = Gen.length1thru100 + let! x = Gen.listObj n + let! y = Gen.listObj n2 + return ((RandomAccessList.ofSeq x |> consThruList y), ((List.rev y) @ x)) + } + + let RandomAccessListStringGen = + gen { + let! n = Gen.length1thru100 + let! n2 = Gen.length2thru100 + let! x = Gen.listString n + let! y = Gen.listString n2 + return ((RandomAccessList.ofSeq x |> consThruList y), ((List.rev y) @ x)) + } let intGens start = let v = Array.create 3 RandomAccessListIntGen @@ -1692,161 +1702,162 @@ module RandomAccessListTest = let intGensStart2 = intGens 2 // this will accept 11 out of 12 - testList "RandomAccessList property tests" [ - testPropertyWithConfig - config10k - "RandomAccessList.fold matches build list rev" - (Prop.forAll(Arb.fromGen RandomAccessListIntGen) - <| fun (q, l) -> q |> RandomAccessList.fold (fun l' elem -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "RandomAccessList OfSeq RandomAccessList.fold matches build list rev" - (Prop.forAll(Arb.fromGen RandomAccessListIntOfSeqGen) - <| fun (q, l) -> q |> RandomAccessList.fold (fun l' elem -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "andomAccessList Consfold matches build list rev" - (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) - <| fun (q, l) -> q |> RandomAccessList.fold (fun l' elem -> elem :: l') [] = (List.rev l)) - - testPropertyWithConfig - config10k - "RandomAccessList.foldBack matches build list" - (Prop.forAll(Arb.fromGen RandomAccessListIntGen) - <| fun (q, l) -> RandomAccessList.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "OfSeq RandomAccessList.foldBack matches build list" - (Prop.forAll(Arb.fromGen RandomAccessListIntOfSeqGen) - <| fun (q, l) -> RandomAccessList.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "Conj RandomAccessList.foldBack matches build list" - (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) - <| fun (q, l) -> RandomAccessList.foldBack (fun elem l' -> elem :: l') q [] = l) - - testPropertyWithConfig - config10k - "get RandomAccessList.head from RandomAccessList 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> (RandomAccessList.head q) = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.head from RandomAccessList 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> (RandomAccessList.head q) = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.head from RandomAccessList 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> (RandomAccessList.head q) = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.head from RandomAccessList safely 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> (RandomAccessList.tryHead q).Value = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.head from RandomAccessList safely 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> (RandomAccessList.tryHead q).Value = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.head from RandomAccessList safely 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> (RandomAccessList.tryHead q).Value = (List.item 0 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.tail from RandomAccessList 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.tail from RandomAccessList 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.tail from RandomAccessList 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.tail from RandomAccessList safely 0" - (Prop.forAll(Arb.fromGen intGensStart2.[0]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.tail from RandomAccessList safely 1" - (Prop.forAll(Arb.fromGen intGensStart2.[1]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "get RandomAccessList.tail from RandomAccessList safely 2" - (Prop.forAll(Arb.fromGen intGensStart2.[2]) - <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) - - testPropertyWithConfig - config10k - "int RandomAccessList builds and serializes 0" - (Prop.forAll(Arb.fromGen intGensStart1.[0]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int RandomAccessList builds and serializes 1" - (Prop.forAll(Arb.fromGen intGensStart1.[1]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "int RandomAccessList builds and serializes 2" - (Prop.forAll(Arb.fromGen intGensStart1.[2]) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "obj RandomAccessList builds and serializes" - (Prop.forAll(Arb.fromGen RandomAccessListObjGen) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "string RandomAccessList builds and serializes" - (Prop.forAll(Arb.fromGen RandomAccessListStringGen) - <| fun (q, l) -> q |> Seq.toList = l) - - testPropertyWithConfig - config10k - "rev matches build list rev" - (Prop.forAll(Arb.fromGen RandomAccessListIntGen) - <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) - - testPropertyWithConfig - config10k - "OfSeq rev matches build list rev" - (Prop.forAll(Arb.fromGen RandomAccessListIntOfSeqGen) - <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) - - testPropertyWithConfig - config10k - "Cons rev matches build list rev" - (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) - <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) - - ] + testList + "RandomAccessList property tests" + [ testPropertyWithConfig + config10k + "RandomAccessList.fold matches build list rev" + (Prop.forAll(Arb.fromGen RandomAccessListIntGen) + <| fun (q, l) -> q |> RandomAccessList.fold (fun l' elem -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "RandomAccessList OfSeq RandomAccessList.fold matches build list rev" + (Prop.forAll(Arb.fromGen RandomAccessListIntOfSeqGen) + <| fun (q, l) -> q |> RandomAccessList.fold (fun l' elem -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "andomAccessList Consfold matches build list rev" + (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) + <| fun (q, l) -> q |> RandomAccessList.fold (fun l' elem -> elem :: l') [] = (List.rev l)) + + testPropertyWithConfig + config10k + "RandomAccessList.foldBack matches build list" + (Prop.forAll(Arb.fromGen RandomAccessListIntGen) + <| fun (q, l) -> RandomAccessList.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "OfSeq RandomAccessList.foldBack matches build list" + (Prop.forAll(Arb.fromGen RandomAccessListIntOfSeqGen) + <| fun (q, l) -> RandomAccessList.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "Conj RandomAccessList.foldBack matches build list" + (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) + <| fun (q, l) -> RandomAccessList.foldBack (fun elem l' -> elem :: l') q [] = l) + + testPropertyWithConfig + config10k + "get RandomAccessList.head from RandomAccessList 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> (RandomAccessList.head q) = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.head from RandomAccessList 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> (RandomAccessList.head q) = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.head from RandomAccessList 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> (RandomAccessList.head q) = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.head from RandomAccessList safely 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> (RandomAccessList.tryHead q).Value = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.head from RandomAccessList safely 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> (RandomAccessList.tryHead q).Value = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.head from RandomAccessList safely 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> (RandomAccessList.tryHead q).Value = (List.item 0 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.tail from RandomAccessList 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.tail from RandomAccessList 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.tail from RandomAccessList 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun ((q), l) -> q.Tail.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.tail from RandomAccessList safely 0" + (Prop.forAll(Arb.fromGen intGensStart2.[0]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.tail from RandomAccessList safely 1" + (Prop.forAll(Arb.fromGen intGensStart2.[1]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "get RandomAccessList.tail from RandomAccessList safely 2" + (Prop.forAll(Arb.fromGen intGensStart2.[2]) + <| fun (q, l) -> q.TryTail.Value.Head = (List.item 1 l)) + + testPropertyWithConfig + config10k + "int RandomAccessList builds and serializes 0" + (Prop.forAll(Arb.fromGen intGensStart1.[0]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int RandomAccessList builds and serializes 1" + (Prop.forAll(Arb.fromGen intGensStart1.[1]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "int RandomAccessList builds and serializes 2" + (Prop.forAll(Arb.fromGen intGensStart1.[2]) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "obj RandomAccessList builds and serializes" + (Prop.forAll(Arb.fromGen RandomAccessListObjGen) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "string RandomAccessList builds and serializes" + (Prop.forAll(Arb.fromGen RandomAccessListStringGen) + <| fun (q, l) -> q |> Seq.toList = l) + + testPropertyWithConfig + config10k + "rev matches build list rev" + (Prop.forAll(Arb.fromGen RandomAccessListIntGen) + <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) + + testPropertyWithConfig + config10k + "OfSeq rev matches build list rev" + (Prop.forAll(Arb.fromGen RandomAccessListIntOfSeqGen) + <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) + + testPropertyWithConfig + config10k + "Cons rev matches build list rev" + (Prop.forAll(Arb.fromGen RandomAccessListIntConsGen) + <| fun (q, l) -> q |> RandomAccessList.rev |> List.ofSeq = (List.rev l)) + + ] diff --git a/tests/FSharpx.Collections.Tests/ResizeArrayTests.fs b/tests/FSharpx.Collections.Tests/ResizeArrayTests.fs index 61369f5d..effbfac2 100644 --- a/tests/FSharpx.Collections.Tests/ResizeArrayTests.fs +++ b/tests/FSharpx.Collections.Tests/ResizeArrayTests.fs @@ -15,296 +15,296 @@ module ResizeArrayTests = [] let testResizeArray = - testList "ResizeArray" [ - test "ra_exists2_a" { - Expect.isTrue "exists2" - <| ResizeArray.exists2 (=) (ra [ 1; 2; 3; 4; 5; 6 ]) (ra [ 2; 3; 4; 5; 6; 6 ]) - } - - test "exists2_b" { - Expect.isFalse "exists2" - <| ResizeArray.exists2 (=) (ra [ 1; 2; 3; 4; 5; 6 ]) (ra [ 2; 3; 4; 5; 6; 7 ]) - } - - test "ra_findIndex_a" { - Expect.equal "findIndex" 4 - <| ResizeArray.findIndex (fun i -> i >= 4) (ra [ 0..10 ]) - } - - test "ra_findIndex_b" { - Expect.throwsT "findIndex" (fun () -> ResizeArray.findIndex (fun i -> i >= 20) (ra [ 0..10 ]) |> ignore) - } - - test "ra_find_indexi_a" { - Expect.equal "findIndexi" 3 - <| ResizeArray.findIndexi (=) (ra [ 1; 2; 3; 3; 2; 1 ]) - } - - test "ra_find_indexi_b" { - Expect.throwsT "findIndexi" (fun () -> ResizeArray.findIndexi (=) (ra [ 1..10 ]) |> ignore) - } - - test "ra_forall2_a" { - Expect.isTrue "forall2" - <| ResizeArray.forall2 (=) (ra [ 1..10 ]) (ra [ 1..10 ]) - } - - test "ra_forall2_b" { - Expect.isFalse "forall2" - <| ResizeArray.forall2 (=) (ra [ 1; 2; 3; 4; 5 ]) (ra [ 1; 2; 3; 0; 5 ]) - } - - test "ra_isEmpty_a" { Expect.isTrue "isEmpty" <| ResizeArray.isEmpty(ra []) } - - test "ra_isEmpty_b" { Expect.isFalse "isEmpty" <| ResizeArray.isEmpty(ra [ 1; 2 ]) } - - test "ra_mapi2" { - Expect.isTrue - "mapi2" - (ResizeArray.mapi2 (fun i j k -> i + j + k) (ra [ 1..10 ]) (ra [ 1..10 ]) - =? [ 2..+3..29 ]) - } - - test "ra_mapi2_b" { - Expect.throwsT "mapi2" (fun () -> - ResizeArray.mapi2 (fun i j k -> i + j + k) (ra []) (ra [ 1..10 ]) - |> ignore) - } - - - test "ra_iteri2" { - Expect.equal "iteri2" (6 + 60 + 3) - <| (let c = ref 0 - ResizeArray.iteri2 (fun i j k -> c := !c + i + j + k) (ra [ 1; 2; 3 ]) (ra [ 10; 20; 30 ]) - !c) - } - - test "ra_singleton" { Expect.isTrue "singleton" (ResizeArray.singleton 42 =? [ 42 ]) } - - test "ra_zip" { - Expect.isTrue - "zip" - (ResizeArray.zip (ra [ 1..10 ]) (ra [ 1..10 ]) - =? [ for i in 1..10 -> i, i ]) - } - - test "ra_unzip" { - Expect.isTrue "unzip" - <| (let unzip1, unzip2 = ResizeArray.unzip <| ra [ for i in 1..10 -> i, i + 1 ] - unzip1 =? [ 1..10 ] && unzip2 =? [ 2..11 ]) - } - - test "ra_reduce_left" { Expect.equal "reduce" 8 <| ResizeArray.reduce (+) (ra [ 2; 2; 2; 2 ]) } - - test "ra_reduce_right" { - Expect.equal "reduceBack" 8 - <| ResizeArray.reduceBack (+) (ra [ 2; 2; 2; 2 ]) - } - - test "ra_fold2" { - Expect.equal "fold2" 112 - <| ResizeArray.fold2 (fun i j k -> i + j + k) 100 (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) - } + testList + "ResizeArray" + [ test "ra_exists2_a" { + Expect.isTrue "exists2" + <| ResizeArray.exists2 (=) (ra [ 1; 2; 3; 4; 5; 6 ]) (ra [ 2; 3; 4; 5; 6; 6 ]) + } + + test "exists2_b" { + Expect.isFalse "exists2" + <| ResizeArray.exists2 (=) (ra [ 1; 2; 3; 4; 5; 6 ]) (ra [ 2; 3; 4; 5; 6; 7 ]) + } + + test "ra_findIndex_a" { + Expect.equal "findIndex" 4 + <| ResizeArray.findIndex (fun i -> i >= 4) (ra [ 0..10 ]) + } + + test "ra_findIndex_b" { + Expect.throwsT "findIndex" (fun () -> ResizeArray.findIndex (fun i -> i >= 20) (ra [ 0..10 ]) |> ignore) + } + + test "ra_find_indexi_a" { + Expect.equal "findIndexi" 3 + <| ResizeArray.findIndexi (=) (ra [ 1; 2; 3; 3; 2; 1 ]) + } + + test "ra_find_indexi_b" { + Expect.throwsT "findIndexi" (fun () -> ResizeArray.findIndexi (=) (ra [ 1..10 ]) |> ignore) + } + + test "ra_forall2_a" { + Expect.isTrue "forall2" + <| ResizeArray.forall2 (=) (ra [ 1..10 ]) (ra [ 1..10 ]) + } + + test "ra_forall2_b" { + Expect.isFalse "forall2" + <| ResizeArray.forall2 (=) (ra [ 1; 2; 3; 4; 5 ]) (ra [ 1; 2; 3; 0; 5 ]) + } + + test "ra_isEmpty_a" { Expect.isTrue "isEmpty" <| ResizeArray.isEmpty(ra []) } + + test "ra_isEmpty_b" { Expect.isFalse "isEmpty" <| ResizeArray.isEmpty(ra [ 1; 2 ]) } + + test "ra_mapi2" { + Expect.isTrue + "mapi2" + (ResizeArray.mapi2 (fun i j k -> i + j + k) (ra [ 1..10 ]) (ra [ 1..10 ]) + =? [ 2..+3..29 ]) + } + + test "ra_mapi2_b" { + Expect.throwsT "mapi2" (fun () -> + ResizeArray.mapi2 (fun i j k -> i + j + k) (ra []) (ra [ 1..10 ]) + |> ignore) + } + + + test "ra_iteri2" { + Expect.equal "iteri2" (6 + 60 + 3) + <| (let c = ref 0 + ResizeArray.iteri2 (fun i j k -> c := !c + i + j + k) (ra [ 1; 2; 3 ]) (ra [ 10; 20; 30 ]) + !c) + } + + test "ra_singleton" { Expect.isTrue "singleton" (ResizeArray.singleton 42 =? [ 42 ]) } + + test "ra_zip" { + Expect.isTrue + "zip" + (ResizeArray.zip (ra [ 1..10 ]) (ra [ 1..10 ]) + =? [ for i in 1..10 -> i, i ]) + } + + test "ra_unzip" { + Expect.isTrue "unzip" + <| (let unzip1, unzip2 = ResizeArray.unzip <| ra [ for i in 1..10 -> i, i + 1 ] + unzip1 =? [ 1..10 ] && unzip2 =? [ 2..11 ]) + } + + test "ra_reduce_left" { Expect.equal "reduce" 8 <| ResizeArray.reduce (+) (ra [ 2; 2; 2; 2 ]) } + + test "ra_reduce_right" { + Expect.equal "reduceBack" 8 + <| ResizeArray.reduceBack (+) (ra [ 2; 2; 2; 2 ]) + } + + test "ra_fold2" { + Expect.equal "fold2" 112 + <| ResizeArray.fold2 (fun i j k -> i + j + k) 100 (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) + } + + test "ra_fold2_b" { + Expect.equal "fold2" (100 - 12) + <| ResizeArray.fold2 (fun i j k -> i - j - k) 100 (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) + } + + test "ra_foldBack2" { + Expect.equal "foldBack2" 112 + <| ResizeArray.foldBack2 (fun i j k -> i + j + k) (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) 100 + } + + test "ra_foldBack2_b" { + Expect.equal "foldBack2" (100 - 12) + <| ResizeArray.foldBack2 (fun i j k -> k - i - j) (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) 100 + } - test "ra_fold2_b" { - Expect.equal "fold2" (100 - 12) - <| ResizeArray.fold2 (fun i j k -> i - j - k) 100 (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) - } + test "ra_scan" { Expect.isTrue "scan" (ResizeArray.scan (+) 0 (ra [ 1..5 ]) =? [ 0; 1; 3; 6; 10; 15 ]) } - test "ra_foldBack2" { - Expect.equal "foldBack2" 112 - <| ResizeArray.foldBack2 (fun i j k -> i + j + k) (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) 100 - } - - test "ra_foldBack2_b" { - Expect.equal "foldBack2" (100 - 12) - <| ResizeArray.foldBack2 (fun i j k -> k - i - j) (ra [ 1; 2; 3 ]) (ra [ 1; 2; 3 ]) 100 - } + test "ra_scanBack" { Expect.isTrue "scanBack" (ResizeArray.scanBack (+) (ra [ 1..5 ]) 0 =? [ 15; 14; 12; 9; 5; 0 ]) } - test "ra_scan" { Expect.isTrue "scan" (ResizeArray.scan (+) 0 (ra [ 1..5 ]) =? [ 0; 1; 3; 6; 10; 15 ]) } + test "ra_tryfind_index" { + Expect.equal "tryFindIndex" (Some 4) + <| ResizeArray.tryFindIndex (fun x -> x = 4) (ra [ 0..10 ]) + } - test "ra_scanBack" { Expect.isTrue "scanBack" (ResizeArray.scanBack (+) (ra [ 1..5 ]) 0 =? [ 15; 14; 12; 9; 5; 0 ]) } + test "ra_tryfind_index_b" { + Expect.isNone "tryFindIndex" + <| ResizeArray.tryFindIndex (fun x -> x = 42) (ra [ 0..10 ]) + } - test "ra_tryfind_index" { - Expect.equal "tryFindIndex" (Some 4) - <| ResizeArray.tryFindIndex (fun x -> x = 4) (ra [ 0..10 ]) - } + test "ra_tryfind_indexi" { + Expect.equal "tryFindIndexi" (Some 4) + <| ResizeArray.tryFindIndexi (=) (ra [ 1; 2; 3; 4; 4; 3; 2; 1 ]) + } - test "ra_tryfind_index_b" { - Expect.isNone "tryFindIndex" - <| ResizeArray.tryFindIndex (fun x -> x = 42) (ra [ 0..10 ]) - } + test "ra_tryfind_indexi_b" { + Expect.isNone "tryFindIndexi" + <| ResizeArray.tryFindIndexi (=) (ra [ 1..10 ]) + } - test "ra_tryfind_indexi" { - Expect.equal "tryFindIndexi" (Some 4) - <| ResizeArray.tryFindIndexi (=) (ra [ 1; 2; 3; 4; 4; 3; 2; 1 ]) - } + test "ra_iter" { + Expect.equal "iter" 100 + <| (let c = ref -1 - test "ra_tryfind_indexi_b" { - Expect.isNone "tryFindIndexi" - <| ResizeArray.tryFindIndexi (=) (ra [ 1..10 ]) - } + ResizeArray.iter + (fun x -> + incr c + Expect.equal "ra_iter" x !c) + (ra [ 0..100 ]) - test "ra_iter" { - Expect.equal "iter" 100 - <| (let c = ref -1 + !c) + } - ResizeArray.iter - (fun x -> - incr c - Expect.equal "ra_iter" x !c) - (ra [ 0..100 ]) + test "ra_map" { Expect.isTrue "map" (ra [ 1..100 ] |> ResizeArray.map((+) 1) =? [ 2..101 ]) } - !c) - } + test "ra_mapi" { Expect.isTrue "mapi" (ra [ 0..100 ] |> ResizeArray.mapi (+) =? [ 0..+2..200 ]) } - test "ra_map" { Expect.isTrue "map" (ra [ 1..100 ] |> ResizeArray.map((+) 1) =? [ 2..101 ]) } + test "ra_iteri" { + Expect.equal "iteri" 100 + <| (let c = ref -1 - test "ra_mapi" { Expect.isTrue "mapi" (ra [ 0..100 ] |> ResizeArray.mapi (+) =? [ 0..+2..200 ]) } + ResizeArray.iteri + (fun i x -> + incr c + Expect.isTrue "ra_iteri" (x = !c && i = !c)) + (ra [ 0..100 ]) - test "ra_iteri" { - Expect.equal "iteri" 100 - <| (let c = ref -1 + !c) + } - ResizeArray.iteri - (fun i x -> - incr c - Expect.isTrue "ra_iteri" (x = !c && i = !c)) - (ra [ 0..100 ]) + test "ra_exists" { Expect.isTrue "exists" (ra [ 1..100 ] |> ResizeArray.exists((=) 50)) } - !c) - } + test "ra_exists b" { Expect.isFalse "exists" (ra [ 1..100 ] |> ResizeArray.exists((=) 150)) } - test "ra_exists" { Expect.isTrue "exists" (ra [ 1..100 ] |> ResizeArray.exists((=) 50)) } - - test "ra_exists b" { Expect.isFalse "exists" (ra [ 1..100 ] |> ResizeArray.exists((=) 150)) } - - test "ra_forall" { Expect.isTrue "forall" (ra [ 1..100 ] |> ResizeArray.forall(fun x -> x < 150)) } - - test "ra_forall b" { Expect.isFalse "forall" (ra [ 1..100 ] |> ResizeArray.forall(fun x -> x < 80)) } - - test "ra_find" { - Expect.equal "find" 51 - <| (ra [ 1..100 ] |> ResizeArray.find(fun x -> x > 50)) - } - - test "ra_find b" { Expect.throwsT "find" (fun () -> ra [ 1..100 ] |> ResizeArray.find(fun x -> x > 180) |> ignore) } - - test "ra_first" { - Expect.equal - "tryPick" - (Some(51 * 51)) - (ra [ 1..100 ] - |> ResizeArray.tryPick(fun x -> if x > 50 then Some(x * x) else None)) - } - - test "ra_first b" { Expect.isNone "tryPick" (ra [ 1..100 ] |> ResizeArray.tryPick(fun x -> None)) } - - test "ra_first c" { Expect.isNone "tryPick" (ra [] |> ResizeArray.tryPick(fun _ -> Some 42)) } - - test "ra_tryfind" { Expect.equal "tryFind" (Some 51) (ra [ 1..100 ] |> ResizeArray.tryFind(fun x -> x > 50)) } - - test "ra_tryfind b" { Expect.isNone "tryFind" (ra [ 1..100 ] |> ResizeArray.tryFind(fun x -> x > 180)) } - - test "ra_iter2" { - Expect.equal "iter2" 100 - <| (let c = ref -1 - - ResizeArray.iter2 - (fun x y -> - incr c - Expect.isTrue "ra_iter2" (!c = x && !c = y)) - (ra [ 0..100 ]) - (ra [ 0..100 ]) - - !c) - } - - test "ra_map2" { Expect.isTrue "map2" (ResizeArray.map2 (+) (ra [ 0..100 ]) (ra [ 0..100 ]) =? [ 0..+2..200 ]) } - - test "ra_choose" { - Expect.isTrue - "choose" - (ResizeArray.choose (fun x -> if x % 2 = 0 then Some(x / 2) else None) (ra [ 0..100 ]) - =? [ 0..50 ]) - } - - test "ra_filter" { - Expect.isTrue - "filter" - (ResizeArray.filter (fun x -> x % 2 = 0) (ra [ 0..100 ]) - =? [ 0..+2..100 ]) - } - - test "ra_filter b" { Expect.isTrue "filter" (ResizeArray.filter (fun x -> false) (ra [ 0..100 ]) =? []) } - - test "ra_filter c" { Expect.isTrue "filter" (ResizeArray.filter (fun x -> true) (ra [ 0..100 ]) =? [ 0..100 ]) } - - test "ra_partition" { - Expect.isTrue - "partition" - (let p1, p2 = ResizeArray.partition (fun x -> x % 2 = 0) (ra [ 0..100 ]) - p1 =? [ 0..+2..100 ] && p2 =? [ 1..+2..100 ]) - } - - test "ra_rev" { Expect.isTrue "rev" (ResizeArray.rev(ra [ 0..100 ]) =? [ 100..-1..0 ]) } - - test "ra_rev b" { Expect.isTrue "rev" (ResizeArray.rev(ra [ 1 ]) =? [ 1 ]) } - - test "ra_rev c" { Expect.isTrue "rev" (ResizeArray.rev(ra []) =? []) } - - test "ra_rev d" { Expect.isTrue "rev" (ResizeArray.rev(ra [ 1; 2 ]) =? [ 2; 1 ]) } - - test "ra_concat ra ra" { - Expect.isTrue - "concat" - (ResizeArray.concat(ra [ ra [ 1; 2 ]; ra [ 3 ]; ra [ 4; 5; 6 ]; ra []; ra [ 7 ] ]) - =? [ 1; 2; 3; 4; 5; 6; 7 ]) - } - - test "ra_concat list ra" { - Expect.isTrue - "concat" - (ResizeArray.concat [ ra [ 1; 2 ]; ra [ 3 ]; ra [ 4; 5; 6 ]; ra []; ra [ 7 ] ] - =? [ 1; 2; 3; 4; 5; 6; 7 ]) - } - - test "ra_concat concat" { - Expect.isTrue - "concat" - (ResizeArray.concat(ra [ ra [ 1; 2 ]; ra [ 3 ]; ra [ 4; 5; 6 ]; ra []; ra [ 7 ] ]) - =? (ResizeArray.concat( - Seq.ofList[ra [ 1; 2 ] - ra [ 3 ] - ra [ 4; 5; 6 ] - ra [] - ra [ 7 ]] - ) - |> List.ofSeq)) - } - - test "ra_distinct a" { - Expect.isTrue - "distinct" - (let ar = [ - for i = 1 to 100 do - yield rng.Next(0, 10) - ] in - - (ar |> Seq.distinct |> Seq.toArray) = (ar |> ra |> ResizeArray.distinct |> ResizeArray.toArray)) - } - - test "ra_distinctBy a" { - Expect.isTrue - "distinctBy" - (let ar = [ - for i = 1 to 100 do - yield rng.Next(0, 10), rng.Next(0, 10) - ] in - - (ar |> Seq.distinctBy(fun (x, _) -> x) |> Seq.toArray) = (ar - |> ra - |> ResizeArray.distinctBy(fun (x, _) -> x) - |> ResizeArray.toArray)) - } - ] + test "ra_forall" { Expect.isTrue "forall" (ra [ 1..100 ] |> ResizeArray.forall(fun x -> x < 150)) } + + test "ra_forall b" { Expect.isFalse "forall" (ra [ 1..100 ] |> ResizeArray.forall(fun x -> x < 80)) } + + test "ra_find" { + Expect.equal "find" 51 + <| (ra [ 1..100 ] |> ResizeArray.find(fun x -> x > 50)) + } + + test "ra_find b" { + Expect.throwsT "find" (fun () -> ra [ 1..100 ] |> ResizeArray.find(fun x -> x > 180) |> ignore) + } + + test "ra_first" { + Expect.equal + "tryPick" + (Some(51 * 51)) + (ra [ 1..100 ] + |> ResizeArray.tryPick(fun x -> if x > 50 then Some(x * x) else None)) + } + + test "ra_first b" { Expect.isNone "tryPick" (ra [ 1..100 ] |> ResizeArray.tryPick(fun x -> None)) } + + test "ra_first c" { Expect.isNone "tryPick" (ra [] |> ResizeArray.tryPick(fun _ -> Some 42)) } + + test "ra_tryfind" { Expect.equal "tryFind" (Some 51) (ra [ 1..100 ] |> ResizeArray.tryFind(fun x -> x > 50)) } + + test "ra_tryfind b" { Expect.isNone "tryFind" (ra [ 1..100 ] |> ResizeArray.tryFind(fun x -> x > 180)) } + + test "ra_iter2" { + Expect.equal "iter2" 100 + <| (let c = ref -1 + + ResizeArray.iter2 + (fun x y -> + incr c + Expect.isTrue "ra_iter2" (!c = x && !c = y)) + (ra [ 0..100 ]) + (ra [ 0..100 ]) + + !c) + } + + test "ra_map2" { Expect.isTrue "map2" (ResizeArray.map2 (+) (ra [ 0..100 ]) (ra [ 0..100 ]) =? [ 0..+2..200 ]) } + + test "ra_choose" { + Expect.isTrue + "choose" + (ResizeArray.choose (fun x -> if x % 2 = 0 then Some(x / 2) else None) (ra [ 0..100 ]) + =? [ 0..50 ]) + } + + test "ra_filter" { + Expect.isTrue + "filter" + (ResizeArray.filter (fun x -> x % 2 = 0) (ra [ 0..100 ]) + =? [ 0..+2..100 ]) + } + + test "ra_filter b" { Expect.isTrue "filter" (ResizeArray.filter (fun x -> false) (ra [ 0..100 ]) =? []) } + + test "ra_filter c" { Expect.isTrue "filter" (ResizeArray.filter (fun x -> true) (ra [ 0..100 ]) =? [ 0..100 ]) } + + test "ra_partition" { + Expect.isTrue + "partition" + (let p1, p2 = ResizeArray.partition (fun x -> x % 2 = 0) (ra [ 0..100 ]) + p1 =? [ 0..+2..100 ] && p2 =? [ 1..+2..100 ]) + } + + test "ra_rev" { Expect.isTrue "rev" (ResizeArray.rev(ra [ 0..100 ]) =? [ 100..-1..0 ]) } + + test "ra_rev b" { Expect.isTrue "rev" (ResizeArray.rev(ra [ 1 ]) =? [ 1 ]) } + + test "ra_rev c" { Expect.isTrue "rev" (ResizeArray.rev(ra []) =? []) } + + test "ra_rev d" { Expect.isTrue "rev" (ResizeArray.rev(ra [ 1; 2 ]) =? [ 2; 1 ]) } + + test "ra_concat ra ra" { + Expect.isTrue + "concat" + (ResizeArray.concat(ra [ ra [ 1; 2 ]; ra [ 3 ]; ra [ 4; 5; 6 ]; ra []; ra [ 7 ] ]) + =? [ 1; 2; 3; 4; 5; 6; 7 ]) + } + + test "ra_concat list ra" { + Expect.isTrue + "concat" + (ResizeArray.concat [ ra [ 1; 2 ]; ra [ 3 ]; ra [ 4; 5; 6 ]; ra []; ra [ 7 ] ] + =? [ 1; 2; 3; 4; 5; 6; 7 ]) + } + + test "ra_concat concat" { + Expect.isTrue + "concat" + (ResizeArray.concat(ra [ ra [ 1; 2 ]; ra [ 3 ]; ra [ 4; 5; 6 ]; ra []; ra [ 7 ] ]) + =? (ResizeArray.concat( + Seq.ofList[ra [ 1; 2 ] + ra [ 3 ] + ra [ 4; 5; 6 ] + ra [] + ra [ 7 ]] + ) + |> List.ofSeq)) + } + + test "ra_distinct a" { + Expect.isTrue + "distinct" + (let ar = + [ for i = 1 to 100 do + yield rng.Next(0, 10) ] in + + (ar |> Seq.distinct |> Seq.toArray) = (ar |> ra |> ResizeArray.distinct |> ResizeArray.toArray)) + } + + test "ra_distinctBy a" { + Expect.isTrue + "distinctBy" + (let ar = + [ for i = 1 to 100 do + yield rng.Next(0, 10), rng.Next(0, 10) ] in + + (ar |> Seq.distinctBy(fun (x, _) -> x) |> Seq.toArray) = (ar + |> ra + |> ResizeArray.distinctBy(fun (x, _) -> x) + |> ResizeArray.toArray)) + } ] diff --git a/tests/FSharpx.Collections.Tests/SeqTests.fs b/tests/FSharpx.Collections.Tests/SeqTests.fs index 855043d4..1d334e63 100644 --- a/tests/FSharpx.Collections.Tests/SeqTests.fs +++ b/tests/FSharpx.Collections.Tests/SeqTests.fs @@ -21,228 +21,227 @@ module SeqTests = else Seq.length interpersed = (Seq.length list) * 2 - 1 - testList "Seq" [ - - test "index " { - let a = { 'a' .. 'z' } - Expect.equal "index" [ 0, 'a'; 1, 'b'; 2, 'c'; 3, 'd'; 4, 'e' ] (Seq.index a |> Seq.take 5 |> Seq.toList) - } - - test "tryFindWithIndex_None" { - let a = { 1..10 } - Expect.isNone "tryFindWithIndex" (Seq.tryFindWithIndex ((<) 10) a) - } - - test "tryFindWithIndex_Some" { - let a = { 'a' .. 'z' } - Expect.equal "" (Some(4, 'e')) (Seq.tryFindWithIndex ((=) 'e') a) - } - - test "lift2" { Expect.equal "" [ 0; 2; 1; 3 ] (Seq.lift2 (+) [ 0; 1 ] [ 0; 2 ] |> Seq.toList) } - - test "I should be able to break the iteration of a seq based on a predicate" { - let result = ref [] - - Seq.iterBreak - (fun a -> - result := a :: !result - a <= 5.) - data - - Expect.equal "iterBreak" [ 1.; 2.; 3.; 4.; 5.; 6. ] (!result |> List.rev) - } - - test "If I tryAverage an empty seq I should get none" { Seq.empty |> Seq.tryAverage |> Expect.isNone "tryAverage" } - - test "If I tryAverage a none empty seq I should get the average" { data |> Seq.tryAverage |> Expect.equal "tryAverage" (Some(5.5)) } - - test "If I tryHeadTail and I don't have a head, I should return None" { - Seq.empty |> Seq.tryHeadTail |> Expect.isNone "tryHeadTail" - } - - test "If I tryHeadTail a non-empty seq, I should return both head and tail" { - let data = [ 1; 2; 3 ] - let actual = data |> Seq.tryHeadTail - Expect.isSome "tryHeadTail" actual - - match actual with - | Some(head, tail) -> - Expect.equal "tryHeadTail" 1 head - Expect.sequenceEqual "tryHeadTail" [ 2; 3 ] tail - | _ -> failwith "Unreachable" - } - - test "I should be a to split a seq at an index" { - let (a, b) = Seq.splitAt 5 data - Expect.sequenceEqual "splitAt" (List.toSeq [ 1.; 2.; 3.; 4.; 5. ]) a - Expect.sequenceEqual "splitAt" (List.toSeq [ 6.; 7.; 8.; 9.; 10. ]) b - } - - test "I should be able to turn a stream reader into a sequence" { - use data = new IO.MemoryStream(Text.Encoding.UTF8.GetBytes("1\r\n2\r\n3\r\n")) - use reader = new IO.StreamReader(data) - let expected = List.toSeq [ "1"; "2"; "3" ] - let actual = Seq.ofStreamReader reader - Expect.isTrue "ofStreamReader" (expected.SequenceEqual(actual)) - } - - test "I should be able to turn a stream into a sequence of bytes" { - let bytes = Text.Encoding.UTF8.GetBytes("1\r\n2\r\n3\r\n") - use stream = new IO.MemoryStream(bytes) - let expected = Array.toSeq bytes - let actual = Seq.ofStreamByByte stream |> Seq.map(fun x -> byte x) - Expect.isTrue "ofStreamByByte" (expected.SequenceEqual(actual)) - } - - test "I should be able to turn a stream into a chunked sequence of bytes" { - let bytes = Text.Encoding.UTF8.GetBytes("1\r\n2\r\n3\r\n") - use stream = new IO.MemoryStream(bytes) - - Seq.ofStreamByChunk 3 stream - |> Expect.sequenceEqual - "ofStreamByChunk" - ([ - Text.Encoding.UTF8.GetBytes("1\r\n") - Text.Encoding.UTF8.GetBytes("2\r\n") - Text.Encoding.UTF8.GetBytes("3\r\n") - ] - |> List.toSeq) - } - - test "I should be able to create a infinite seq of values" { - let data = [ 1; 2 ] - - Seq.asCircular [ 1; 2 ] - |> Seq.take 4 - |> Expect.sequenceEqual "asCircular" (List.toSeq [ 1; 2; 1; 2 ]) - } - - test "I should be able to create a infinite seq of values and have none in between each iteration" { - let data = [ 1; 2 ] - - Seq.asCircularWithBreak [ 1; 2 ] - |> Seq.take 5 - |> Expect.sequenceEqual "asCircularWithBreak" (List.toSeq [ Some 1; Some 2; None; Some 1; Some 2 ]) - } - - test "I should be able to create a infinite seq of values and call function when seq exhusted" { - let called = ref false - let data = [ 1; 2 ] - - Seq.asCircularOnLoop (fun () -> called := true) [ 1; 2 ] - |> Seq.take 4 - |> Expect.sequenceEqual "asCircularOnLoop" (List.toSeq [ 1; 2; 1; 2 ]) - } - - test "I should get none if try to get a index outside the seq" { Seq.tryNth 20 data |> Expect.isNone "tryNth" } - - test "I should get some if try to get a index inside the seq" { Seq.tryNth 2 data |> Expect.equal "tryNth" (Some(3.)) } - - test "I should get none when trySkip past the end of the seq" { Seq.skipNoFail 20 data |> Expect.sequenceEqual "skipNoFail" Seq.empty } - - test "I should get Some when trySkip" { - Seq.skipNoFail 5 data - |> Expect.sequenceEqual "skipNoFail" (List.toSeq [ 6.; 7.; 8.; 9.; 10. ]) - } - - test "I should be able to repeat a single value infinitely" { - Seq.repeat 1 - |> Seq.take 5 - |> Expect.sequenceEqual "repeat" (List.toSeq [ 1; 1; 1; 1; 1 ]) - } - - test "I should be able to get the tail of a sequence" { - Seq.tail [ 1; 2; 3; 4 ] - |> Expect.sequenceEqual "tail" (List.toSeq [ 2; 3; 4 ]) - } - - ptest "I should not be able to get the tail of a empty sequence" { Expect.throwsT<_> "empty tail" (fun () -> Seq.tail [] |> ignore) } - - test "I should be able to get the tail of a empty sequence without a fail" { - Seq.tailNoFail [] |> Expect.sequenceEqual "tailNoFail" Seq.empty - } - - test "I should be able to contract a seq taking every nth value" { - Seq.contract 5 data - |> Expect.sequenceEqual "contract" (List.toSeq [ 5.; 10. ]) - } - - test "I should be able to contract a seq sequence by a given ratio" { - let actual = Seq.contract 2 (Seq.init 72 (fun i -> 0)) |> Seq.toList - let expected = Seq.init 36 (fun i -> 0) |> Seq.toList - Expect.sequenceEqual "contract" expected actual - } - - test "I should be able to contract an empty sequence" { - Expect.sequenceEqual "contract" Seq.empty - <| Seq.contract 5 (Seq.empty) - } - - test "I should be able to contract a infinite sequence" { - let actual = Seq.contract 5 (Seq.initInfinite(fun i -> i + 1)) - Expect.sequenceEqual "contract" (List.toSeq [ 5; 10; 15; 20; 25 ]) (actual |> Seq.take 5) - } - - test "Should be able to combine two sequences" { - let a, b = [ 1; 2; 3; 4; 5 ], [ 6; 7; 8; 9; 10 ] - - Seq.combine (+) a b - |> Expect.sequenceEqual "combine" (List.toSeq [ 7; 9; 11; 13; 15 ]) - } - - test "Should be able to combine two empty sequences" { - let a, b = [], [] - Expect.sequenceEqual "combine" Seq.empty <| Seq.combine (+) a b - } - - test "Should be able to combine two sequences when one is infinite" { - let a, b = [ 1; 2; 3; 4; 5 ], (Seq.initInfinite(fun i -> i + 6)) - - Seq.combine (+) a b - |> Seq.take 5 - |> Expect.sequenceEqual "combine" (List.toSeq [ 7; 9; 11; 13; 15 ]) - } - - test "Should be able to combine two sequences when both are infinite" { - let a, b = (Seq.initInfinite(fun i -> i + 1)), (Seq.initInfinite(fun i -> i + 6)) + testList + "Seq" + [ + + test "index " { + let a = { 'a' .. 'z' } + Expect.equal "index" [ 0, 'a'; 1, 'b'; 2, 'c'; 3, 'd'; 4, 'e' ] (Seq.index a |> Seq.take 5 |> Seq.toList) + } + + test "tryFindWithIndex_None" { + let a = { 1..10 } + Expect.isNone "tryFindWithIndex" (Seq.tryFindWithIndex ((<) 10) a) + } + + test "tryFindWithIndex_Some" { + let a = { 'a' .. 'z' } + Expect.equal "" (Some(4, 'e')) (Seq.tryFindWithIndex ((=) 'e') a) + } + + test "lift2" { Expect.equal "" [ 0; 2; 1; 3 ] (Seq.lift2 (+) [ 0; 1 ] [ 0; 2 ] |> Seq.toList) } + + test "I should be able to break the iteration of a seq based on a predicate" { + let result = ref [] + + Seq.iterBreak + (fun a -> + result := a :: !result + a <= 5.) + data + + Expect.equal "iterBreak" [ 1.; 2.; 3.; 4.; 5.; 6. ] (!result |> List.rev) + } + + test "If I tryAverage an empty seq I should get none" { Seq.empty |> Seq.tryAverage |> Expect.isNone "tryAverage" } + + test "If I tryAverage a none empty seq I should get the average" { data |> Seq.tryAverage |> Expect.equal "tryAverage" (Some(5.5)) } + + test "If I tryHeadTail and I don't have a head, I should return None" { + Seq.empty |> Seq.tryHeadTail |> Expect.isNone "tryHeadTail" + } + + test "If I tryHeadTail a non-empty seq, I should return both head and tail" { + let data = [ 1; 2; 3 ] + let actual = data |> Seq.tryHeadTail + Expect.isSome "tryHeadTail" actual + + match actual with + | Some(head, tail) -> + Expect.equal "tryHeadTail" 1 head + Expect.sequenceEqual "tryHeadTail" [ 2; 3 ] tail + | _ -> failwith "Unreachable" + } + + test "I should be a to split a seq at an index" { + let (a, b) = Seq.splitAt 5 data + Expect.sequenceEqual "splitAt" (List.toSeq [ 1.; 2.; 3.; 4.; 5. ]) a + Expect.sequenceEqual "splitAt" (List.toSeq [ 6.; 7.; 8.; 9.; 10. ]) b + } + + test "I should be able to turn a stream reader into a sequence" { + use data = new IO.MemoryStream(Text.Encoding.UTF8.GetBytes("1\r\n2\r\n3\r\n")) + use reader = new IO.StreamReader(data) + let expected = List.toSeq [ "1"; "2"; "3" ] + let actual = Seq.ofStreamReader reader + Expect.isTrue "ofStreamReader" (expected.SequenceEqual(actual)) + } + + test "I should be able to turn a stream into a sequence of bytes" { + let bytes = Text.Encoding.UTF8.GetBytes("1\r\n2\r\n3\r\n") + use stream = new IO.MemoryStream(bytes) + let expected = Array.toSeq bytes + let actual = Seq.ofStreamByByte stream |> Seq.map(fun x -> byte x) + Expect.isTrue "ofStreamByByte" (expected.SequenceEqual(actual)) + } + + test "I should be able to turn a stream into a chunked sequence of bytes" { + let bytes = Text.Encoding.UTF8.GetBytes("1\r\n2\r\n3\r\n") + use stream = new IO.MemoryStream(bytes) + + Seq.ofStreamByChunk 3 stream + |> Expect.sequenceEqual + "ofStreamByChunk" + ([ Text.Encoding.UTF8.GetBytes("1\r\n") + Text.Encoding.UTF8.GetBytes("2\r\n") + Text.Encoding.UTF8.GetBytes("3\r\n") ] + |> List.toSeq) + } + + test "I should be able to create a infinite seq of values" { + let data = [ 1; 2 ] + + Seq.asCircular [ 1; 2 ] + |> Seq.take 4 + |> Expect.sequenceEqual "asCircular" (List.toSeq [ 1; 2; 1; 2 ]) + } + + test "I should be able to create a infinite seq of values and have none in between each iteration" { + let data = [ 1; 2 ] + + Seq.asCircularWithBreak [ 1; 2 ] + |> Seq.take 5 + |> Expect.sequenceEqual "asCircularWithBreak" (List.toSeq [ Some 1; Some 2; None; Some 1; Some 2 ]) + } + + test "I should be able to create a infinite seq of values and call function when seq exhusted" { + let called = ref false + let data = [ 1; 2 ] + + Seq.asCircularOnLoop (fun () -> called := true) [ 1; 2 ] + |> Seq.take 4 + |> Expect.sequenceEqual "asCircularOnLoop" (List.toSeq [ 1; 2; 1; 2 ]) + } + + test "I should get none if try to get a index outside the seq" { Seq.tryNth 20 data |> Expect.isNone "tryNth" } + + test "I should get some if try to get a index inside the seq" { Seq.tryNth 2 data |> Expect.equal "tryNth" (Some(3.)) } + + test "I should get none when trySkip past the end of the seq" { Seq.skipNoFail 20 data |> Expect.sequenceEqual "skipNoFail" Seq.empty } + + test "I should get Some when trySkip" { + Seq.skipNoFail 5 data + |> Expect.sequenceEqual "skipNoFail" (List.toSeq [ 6.; 7.; 8.; 9.; 10. ]) + } + + test "I should be able to repeat a single value infinitely" { + Seq.repeat 1 + |> Seq.take 5 + |> Expect.sequenceEqual "repeat" (List.toSeq [ 1; 1; 1; 1; 1 ]) + } + + test "I should be able to get the tail of a sequence" { + Seq.tail [ 1; 2; 3; 4 ] + |> Expect.sequenceEqual "tail" (List.toSeq [ 2; 3; 4 ]) + } + + ptest "I should not be able to get the tail of a empty sequence" { Expect.throwsT<_> "empty tail" (fun () -> Seq.tail [] |> ignore) } + + test "I should be able to get the tail of a empty sequence without a fail" { + Seq.tailNoFail [] |> Expect.sequenceEqual "tailNoFail" Seq.empty + } + + test "I should be able to contract a seq taking every nth value" { + Seq.contract 5 data + |> Expect.sequenceEqual "contract" (List.toSeq [ 5.; 10. ]) + } + + test "I should be able to contract a seq sequence by a given ratio" { + let actual = Seq.contract 2 (Seq.init 72 (fun i -> 0)) |> Seq.toList + let expected = Seq.init 36 (fun i -> 0) |> Seq.toList + Expect.sequenceEqual "contract" expected actual + } + + test "I should be able to contract an empty sequence" { + Expect.sequenceEqual "contract" Seq.empty + <| Seq.contract 5 (Seq.empty) + } + + test "I should be able to contract a infinite sequence" { + let actual = Seq.contract 5 (Seq.initInfinite(fun i -> i + 1)) + Expect.sequenceEqual "contract" (List.toSeq [ 5; 10; 15; 20; 25 ]) (actual |> Seq.take 5) + } + + test "Should be able to combine two sequences" { + let a, b = [ 1; 2; 3; 4; 5 ], [ 6; 7; 8; 9; 10 ] + + Seq.combine (+) a b + |> Expect.sequenceEqual "combine" (List.toSeq [ 7; 9; 11; 13; 15 ]) + } + + test "Should be able to combine two empty sequences" { + let a, b = [], [] + Expect.sequenceEqual "combine" Seq.empty <| Seq.combine (+) a b + } - Seq.combine (+) a b - |> Seq.take 5 - |> Expect.sequenceEqual "combine" (List.toSeq [ 7; 9; 11; 13; 15 ]) - } + test "Should be able to combine two sequences when one is infinite" { + let a, b = [ 1; 2; 3; 4; 5 ], (Seq.initInfinite(fun i -> i + 6)) + + Seq.combine (+) a b + |> Seq.take 5 + |> Expect.sequenceEqual "combine" (List.toSeq [ 7; 9; 11; 13; 15 ]) + } - test "I should be able to expand a seq" { - let a = [ 1; 2; 3; 4; 5 ] + test "Should be able to combine two sequences when both are infinite" { + let a, b = (Seq.initInfinite(fun i -> i + 1)), (Seq.initInfinite(fun i -> i + 6)) - Seq.grow 2 a - |> Expect.sequenceEqual "grow" (List.toSeq [ 1; 1; 2; 2; 3; 3; 4; 4; 5; 5 ]) - } + Seq.combine (+) a b + |> Seq.take 5 + |> Expect.sequenceEqual "combine" (List.toSeq [ 7; 9; 11; 13; 15 ]) + } - test "I should be able to page a seq" { - Seq.page 0 2 data - |> Expect.sequenceEqual "page" (List.toSeq [ 1.; 2. ]) + test "I should be able to expand a seq" { + let a = [ 1; 2; 3; 4; 5 ] - Seq.page 1 2 data - |> Expect.sequenceEqual "page" (List.toSeq [ 3.; 4. ]) + Seq.grow 2 a + |> Expect.sequenceEqual "grow" (List.toSeq [ 1; 1; 2; 2; 3; 3; 4; 4; 5; 5 ]) + } - Seq.page 2 2 data - |> Expect.sequenceEqual "page" (List.toSeq [ 5.; 6. ]) - } + test "I should be able to page a seq" { + Seq.page 0 2 data + |> Expect.sequenceEqual "page" (List.toSeq [ 1.; 2. ]) - test "I should intersperse a seq" { - let a = "foobar".ToCharArray() + Seq.page 1 2 data + |> Expect.sequenceEqual "page" (List.toSeq [ 3.; 4. ]) - let expected = - [ 'f'; ','; 'o'; ','; 'o'; ','; 'b'; ','; 'a'; ','; 'r' ] - |> List.toSeq + Seq.page 2 2 data + |> Expect.sequenceEqual "page" (List.toSeq [ 5.; 6. ]) + } - Expect.sequenceEqual "" expected (a |> Seq.intersperse ',') - } - - test "I shouldn't interperse an empty list" { - let a = Seq.empty - Expect.sequenceEqual "" a (a |> Seq.intersperse ',') - } + test "I should intersperse a seq" { + let a = "foobar".ToCharArray() - testPropertyWithConfig config10k "I should interperse always 2n-1 elements" intersperse - ] + let expected = + [ 'f'; ','; 'o'; ','; 'o'; ','; 'b'; ','; 'a'; ','; 'r' ] + |> List.toSeq + + Expect.sequenceEqual "" expected (a |> Seq.intersperse ',') + } + + test "I shouldn't interperse an empty list" { + let a = Seq.empty + Expect.sequenceEqual "" a (a |> Seq.intersperse ',') + } + + testPropertyWithConfig config10k "I should interperse always 2n-1 elements" intersperse ] diff --git a/tests/FSharpx.Collections.Tests/TransientHashMapTest.fs b/tests/FSharpx.Collections.Tests/TransientHashMapTest.fs index 189152e7..78fdfa2f 100644 --- a/tests/FSharpx.Collections.Tests/TransientHashMapTest.fs +++ b/tests/FSharpx.Collections.Tests/TransientHashMapTest.fs @@ -8,9 +8,7 @@ open Expecto.Flip module TransientHashMapTests = [] type AlwaysSameHash = - { - Name: string - } + { Name: string } interface System.IComparable with member this.CompareTo{ Name = name } = @@ -36,227 +34,200 @@ module TransientHashMapTests = [] let testTransientHashMap = - testList "TransientHashMap" [ - - test "two AlwaysSameHash have same hash" { - Expect.equal "AlwaysSameHash" (hash { Name = "Test" }) (hash { Name = "Test" }) - Expect.equal "AlwaysSameHash" { Name = "Test" } { Name = "Test" } - Expect.equal "AlwaysSameHash" (hash { Name = "Test1" }) (hash { Name = "Test" }) - Expect.notEqual "AlwaysSameHash" { Name = "Test1" } { Name = "Test" } - } - - test "empty map should be empty" { - let x = TransientHashMap.Empty () - Expect.equal "empty" 0 (x.persistent() |> PersistentHashMap.length) - } - - test "empty map should not contain key 0" { - let x = TransientHashMap.Empty () - Expect.isFalse "empty" (x.persistent() |> PersistentHashMap.containsKey 1) - } - - test "can add null entry to empty map" { - let x = TransientHashMap.Empty () - Expect.isFalse "PersistentHashMap.containsKey" (x.persistent() |> PersistentHashMap.containsKey "value") - Expect.isFalse "PersistentHashMap.containsKey" (x.persistent() |> PersistentHashMap.containsKey null) - - Expect.isTrue - "PersistentHashMap.containsKey" - (x.Add(null, "Hello").persistent() - |> PersistentHashMap.containsKey null) - } - - //https://github.com/fsprojects/FSharpx.Collections/issues/85 - ptest "can add None value to empty map" { - let x = TransientHashMap.Empty () - - Expect.isTrue - "PersistentHashMap.containsKey" - (x.Add("Hello", None).persistent() - |> PersistentHashMap.containsKey "Hello") - } - - test "can add empty string as key to empty map" { - let x = TransientHashMap.Empty () - Expect.isFalse "" (x.persistent() |> PersistentHashMap.containsKey "") - Expect.isFalse "" (x.Add("", "Hello").persistent() |> PersistentHashMap.containsKey null) - Expect.isTrue "" (x.Add("", "Hello").persistent() |> PersistentHashMap.containsKey "") - } - - test "can add some integers to empty map" { - let x = - TransientHashMap - .Empty() - .Add(1, "h") - .Add(2, "a") - .Add(3, "l") - .Add(4, "l") - .Add(5, "o") - .persistent() - - Expect.isTrue "PersistentHashMap.containsKey" (x |> PersistentHashMap.containsKey 1) - Expect.isTrue "PersistentHashMap.containsKey" (x |> PersistentHashMap.containsKey 5) - Expect.isFalse "PersistentHashMap.containsKey" (x |> PersistentHashMap.containsKey 6) - } - - test "can remove some integers from a map" { - let x = - TransientHashMap - .Empty() - .Add(1, "h") - .Add(2, "a") - .Add(3, "l") - .Add(4, "l") - .Add(5, "o") - .Remove(1) - .Remove(4) - .persistent() - - Expect.isFalse "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey 1 x - - Expect.isFalse "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey 4 x - - Expect.isTrue "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey 5 x - - Expect.isFalse "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey 6 x - } - - test "can find integers in a map" { - let x = - TransientHashMap - .Empty() - .Add(1, "h") - .Add(2, "a") - .Add(3, "l") - .Add(4, "l") - .Add(5, "o") - .persistent() - - Expect.equal "find" "h" (x |> PersistentHashMap.find 1) - Expect.equal "find" "l" (x |> PersistentHashMap.find 4) - Expect.equal "find" "o" (x |> PersistentHashMap.find 5) - } - - test "can lookup integers from a map" { - let x = - TransientHashMap - .Empty() - .Add(1, "h") - .Add(2, "a") - .Add(3, "l") - .Add(4, "l") - .Add(5, "o") - - Expect.equal "lookup" "h" x.[1] - Expect.equal "lookup" "l" x.[4] - Expect.equal "lookup" "o" x.[5] - } - - test "can add the same key multiple to a map" { - let x = - TransientHashMap - .Empty() - .Add(1, "h") - .Add(2, "a") - .Add(3, "l") - .Add(4, "l") - .Add(5, "o") - .Add(4, "a") - .Add(5, "o") - .persistent() - - Expect.equal "" "h" <| PersistentHashMap.find 1 x - Expect.equal "" "a" <| PersistentHashMap.find 4 x - Expect.equal "" "o" <| PersistentHashMap.find 5 x - } - - test "can add tons of integers to empty map" { - let x = ref(TransientHashMap.Empty ()) - let counter = 1000 - - for i in 0..counter do - x := (!x).Add(i, i) - - let x = (!x).persistent() - - for i in 0..counter do - x |> PersistentHashMap.containsKey i |> Expect.isTrue "lookup" - } - - test "can lookup tons of integers from a map" { - let x = ref(TransientHashMap.Empty ()) - let counter = 1000 - - for i in 0..counter do - x := (!x).Add(i, i) - - for i in 0..counter do - (!x).[i] |> Expect.equal "lookup" i - } - - test "can find tons of integers in a map" { - let x = ref(TransientHashMap.Empty ()) - let counter = 1000 - - for i in 0..counter do - x := (!x).Add(i, i) - - for i in 0..counter do - (!x).[i] |> Expect.equal "lookup" i - } - - test "can add keys with colliding hashes to empty map" { - let x = { Name = "Test" } - let y = { Name = "Test1" } - - let map = - TransientHashMap - .Empty() - .Add(x, x.Name) - .Add(y, y.Name) - .persistent() - - Expect.isTrue "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey x map - - Expect.isTrue "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey y map - - Expect.isFalse "PersistentHashMap.containsKey" - <| PersistentHashMap.containsKey y PersistentHashMap.empty - } - - test "can lookup keys with colliding hashes from map" { - let x = { Name = "Test" } - let y = { Name = "Test1" } - - let map = - TransientHashMap - .Empty() - .Add(x, x) - .Add(y, y) - .persistent() - - Expect.equal "find" { Name = "Test" } (map |> PersistentHashMap.find x) - Expect.equal "find" { Name = "Test1" } (map |> PersistentHashMap.find y) - } - - test "can add lots of keys with colliding hashes to empty map" { - let x = ref(TransientHashMap.Empty ()) - let counter = 1000 - - for i in 0..counter do - x := (!x).Add({ Name = i.ToString() }, i) - - let x = (!x).persistent() - - for i in 0..counter do - x - |> PersistentHashMap.containsKey { Name = i.ToString() } - |> Expect.isTrue "PersistentHashMap.containsKey" - } - ] + testList + "TransientHashMap" + [ + + test "two AlwaysSameHash have same hash" { + Expect.equal "AlwaysSameHash" (hash { Name = "Test" }) (hash { Name = "Test" }) + Expect.equal "AlwaysSameHash" { Name = "Test" } { Name = "Test" } + Expect.equal "AlwaysSameHash" (hash { Name = "Test1" }) (hash { Name = "Test" }) + Expect.notEqual "AlwaysSameHash" { Name = "Test1" } { Name = "Test" } + } + + test "empty map should be empty" { + let x = TransientHashMap.Empty() + Expect.equal "empty" 0 (x.persistent() |> PersistentHashMap.length) + } + + test "empty map should not contain key 0" { + let x = TransientHashMap.Empty() + Expect.isFalse "empty" (x.persistent() |> PersistentHashMap.containsKey 1) + } + + test "can add null entry to empty map" { + let x = TransientHashMap.Empty() + Expect.isFalse "PersistentHashMap.containsKey" (x.persistent() |> PersistentHashMap.containsKey "value") + Expect.isFalse "PersistentHashMap.containsKey" (x.persistent() |> PersistentHashMap.containsKey null) + + Expect.isTrue + "PersistentHashMap.containsKey" + (x.Add(null, "Hello").persistent() + |> PersistentHashMap.containsKey null) + } + + //https://github.com/fsprojects/FSharpx.Collections/issues/85 + ptest "can add None value to empty map" { + let x = TransientHashMap.Empty() + + Expect.isTrue + "PersistentHashMap.containsKey" + (x.Add("Hello", None).persistent() + |> PersistentHashMap.containsKey "Hello") + } + + test "can add empty string as key to empty map" { + let x = TransientHashMap.Empty() + Expect.isFalse "" (x.persistent() |> PersistentHashMap.containsKey "") + Expect.isFalse "" (x.Add("", "Hello").persistent() |> PersistentHashMap.containsKey null) + Expect.isTrue "" (x.Add("", "Hello").persistent() |> PersistentHashMap.containsKey "") + } + + test "can add some integers to empty map" { + let x = + TransientHashMap.Empty().Add(1, "h").Add(2, "a").Add(3, "l").Add(4, "l").Add(5, "o").persistent() + + Expect.isTrue "PersistentHashMap.containsKey" (x |> PersistentHashMap.containsKey 1) + Expect.isTrue "PersistentHashMap.containsKey" (x |> PersistentHashMap.containsKey 5) + Expect.isFalse "PersistentHashMap.containsKey" (x |> PersistentHashMap.containsKey 6) + } + + test "can remove some integers from a map" { + let x = + TransientHashMap + .Empty() + .Add(1, "h") + .Add(2, "a") + .Add(3, "l") + .Add(4, "l") + .Add(5, "o") + .Remove(1) + .Remove(4) + .persistent() + + Expect.isFalse "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey 1 x + + Expect.isFalse "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey 4 x + + Expect.isTrue "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey 5 x + + Expect.isFalse "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey 6 x + } + + test "can find integers in a map" { + let x = + TransientHashMap.Empty().Add(1, "h").Add(2, "a").Add(3, "l").Add(4, "l").Add(5, "o").persistent() + + Expect.equal "find" "h" (x |> PersistentHashMap.find 1) + Expect.equal "find" "l" (x |> PersistentHashMap.find 4) + Expect.equal "find" "o" (x |> PersistentHashMap.find 5) + } + + test "can lookup integers from a map" { + let x = + TransientHashMap.Empty().Add(1, "h").Add(2, "a").Add(3, "l").Add(4, "l").Add(5, "o") + + Expect.equal "lookup" "h" x.[1] + Expect.equal "lookup" "l" x.[4] + Expect.equal "lookup" "o" x.[5] + } + + test "can add the same key multiple to a map" { + let x = + TransientHashMap + .Empty() + .Add(1, "h") + .Add(2, "a") + .Add(3, "l") + .Add(4, "l") + .Add(5, "o") + .Add(4, "a") + .Add(5, "o") + .persistent() + + Expect.equal "" "h" <| PersistentHashMap.find 1 x + Expect.equal "" "a" <| PersistentHashMap.find 4 x + Expect.equal "" "o" <| PersistentHashMap.find 5 x + } + + test "can add tons of integers to empty map" { + let x = ref(TransientHashMap.Empty()) + let counter = 1000 + + for i in 0..counter do + x := (!x).Add(i, i) + + let x = (!x).persistent() + + for i in 0..counter do + x |> PersistentHashMap.containsKey i |> Expect.isTrue "lookup" + } + + test "can lookup tons of integers from a map" { + let x = ref(TransientHashMap.Empty()) + let counter = 1000 + + for i in 0..counter do + x := (!x).Add(i, i) + + for i in 0..counter do + (!x).[i] |> Expect.equal "lookup" i + } + + test "can find tons of integers in a map" { + let x = ref(TransientHashMap.Empty()) + let counter = 1000 + + for i in 0..counter do + x := (!x).Add(i, i) + + for i in 0..counter do + (!x).[i] |> Expect.equal "lookup" i + } + + test "can add keys with colliding hashes to empty map" { + let x = { Name = "Test" } + let y = { Name = "Test1" } + + let map = + TransientHashMap.Empty().Add(x, x.Name).Add(y, y.Name).persistent() + + Expect.isTrue "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey x map + + Expect.isTrue "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey y map + + Expect.isFalse "PersistentHashMap.containsKey" + <| PersistentHashMap.containsKey y PersistentHashMap.empty + } + + test "can lookup keys with colliding hashes from map" { + let x = { Name = "Test" } + let y = { Name = "Test1" } + + let map = + TransientHashMap.Empty().Add(x, x).Add(y, y).persistent() + + Expect.equal "find" { Name = "Test" } (map |> PersistentHashMap.find x) + Expect.equal "find" { Name = "Test1" } (map |> PersistentHashMap.find y) + } + + test "can add lots of keys with colliding hashes to empty map" { + let x = ref(TransientHashMap.Empty()) + let counter = 1000 + + for i in 0..counter do + x := (!x).Add({ Name = i.ToString() }, i) + + let x = (!x).persistent() + + for i in 0..counter do + x + |> PersistentHashMap.containsKey { Name = i.ToString() } + |> Expect.isTrue "PersistentHashMap.containsKey" + } ] diff --git a/tests/fable/FSharpx.Collections.Tests/Deque.test.fs b/tests/fable/FSharpx.Collections.Tests/Deque.test.fs index f2b89c1a..9552a72f 100644 --- a/tests/fable/FSharpx.Collections.Tests/Deque.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/Deque.test.fs @@ -4,16 +4,16 @@ open Fable.Mocha open FSharpx.Collections let tests = - testList "DequeTests" [ - test "NonEmptyList works" { - let d = Deque.empty + testList + "DequeTests" + [ test "NonEmptyList works" { + let d = Deque.empty - Expect.equal (Deque.isEmpty d) true "should be empty" + Expect.equal (Deque.isEmpty d) true "should be empty" - let d = d |> Deque.conj "b" |> Deque.conj "a" + let d = d |> Deque.conj "b" |> Deque.conj "a" - Expect.equal (Deque.isEmpty d) false "should not be empty anymore" - Expect.equal (Deque.head d) "b" "b should be at top" - Expect.equal (Deque.length d) 2 "Should have length 2" - } - ] + Expect.equal (Deque.isEmpty d) false "should not be empty anymore" + Expect.equal (Deque.head d) "b" "b should be at top" + Expect.equal (Deque.length d) 2 "Should have length 2" + } ] diff --git a/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs b/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs index f06cb6af..3732a8f5 100644 --- a/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/LazyList.test.fs @@ -4,19 +4,19 @@ open Fable.Mocha open FSharpx.Collections let tests = - testList "LazyListTests" [ - test "LazyList works" { - let xs = LazyList.empty + testList + "LazyListTests" + [ test "LazyList works" { + let xs = LazyList.empty - Expect.equal (LazyList.isEmpty xs) true "should be empty" + Expect.equal (LazyList.isEmpty xs) true "should be empty" - let xs = LazyList.ofList [ 1; 2; 3 ] + let xs = LazyList.ofList [ 1; 2; 3 ] - Expect.equal (LazyList.isEmpty xs) false "should not be empty" - Expect.equal (LazyList.tryHead xs) (Some 1) "should get first element" + Expect.equal (LazyList.isEmpty xs) false "should not be empty" + Expect.equal (LazyList.tryHead xs) (Some 1) "should get first element" - let xs = xs |> LazyList.tail |> LazyList.tail + let xs = xs |> LazyList.tail |> LazyList.tail - Expect.equal (LazyList.tryHead xs) (Some 3) "should reach third element" - } - ] + Expect.equal (LazyList.tryHead xs) (Some 3) "should reach third element" + } ] diff --git a/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs b/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs index 88d1e8c6..559dc25a 100644 --- a/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/NonEmptyList.test.fs @@ -4,16 +4,16 @@ open Fable.Mocha open FSharpx.Collections let tests = - testList "NonEmptyListTests" [ - test "NonEmptyList works" { - let xs = NonEmptyList.create "a" [] + testList + "NonEmptyListTests" + [ test "NonEmptyList works" { + let xs = NonEmptyList.create "a" [] - Expect.equal (NonEmptyList.length xs) 1 "should have single entry" - Expect.equal (NonEmptyList.head xs) "a" "should read head" + Expect.equal (NonEmptyList.length xs) 1 "should have single entry" + Expect.equal (NonEmptyList.head xs) "a" "should read head" - let xs = xs |> NonEmptyList.cons "b" |> NonEmptyList.cons "c" + let xs = xs |> NonEmptyList.cons "b" |> NonEmptyList.cons "c" - Expect.equal (NonEmptyList.head xs) "c" "should update head" - Expect.equal (NonEmptyList.length xs) 3 "should track length" - } - ] + Expect.equal (NonEmptyList.head xs) "c" "should update head" + Expect.equal (NonEmptyList.length xs) 3 "should track length" + } ] diff --git a/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs b/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs index 9d584ec9..3f5fea1d 100644 --- a/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/PersistentVector.test.fs @@ -4,41 +4,41 @@ open Fable.Mocha open FSharpx.Collections let tests = - testList "PersistentVectorTests" [ - test "PersistentVector.empty works as expected" { - let v = PersistentVector.empty + testList + "PersistentVectorTests" + [ test "PersistentVector.empty works as expected" { + let v = PersistentVector.empty - Expect.equal (PersistentVector.isEmpty v) true "should be empty" - Expect.equal (PersistentVector.length v) 0 "should have zero length" - } + Expect.equal (PersistentVector.isEmpty v) true "should be empty" + Expect.equal (PersistentVector.length v) 0 "should have zero length" + } - test "PersistentVector.conj works as expected" { - let v = PersistentVector.empty |> PersistentVector.conj "a" + test "PersistentVector.conj works as expected" { + let v = PersistentVector.empty |> PersistentVector.conj "a" - Expect.equal (PersistentVector.nth 0 v) "a" "should hold first value" + Expect.equal (PersistentVector.nth 0 v) "a" "should hold first value" - let v = v |> PersistentVector.conj "b" |> PersistentVector.conj "c" + let v = v |> PersistentVector.conj "b" |> PersistentVector.conj "c" - Expect.equal (PersistentVector.nth 0 v) "a" "should preserve first element" - Expect.equal (PersistentVector.nth 1 v) "b" "should add second element" - Expect.equal (PersistentVector.nth 2 v) "c" "should add third element" - } + Expect.equal (PersistentVector.nth 0 v) "a" "should preserve first element" + Expect.equal (PersistentVector.nth 1 v) "b" "should add second element" + Expect.equal (PersistentVector.nth 2 v) "c" "should add third element" + } - test "PersistentVector implements seq as expected" { - let v = - PersistentVector.empty - |> PersistentVector.conj 1 - |> PersistentVector.conj 4 - |> PersistentVector.conj 25 + test "PersistentVector implements seq as expected" { + let v = + PersistentVector.empty + |> PersistentVector.conj 1 + |> PersistentVector.conj 4 + |> PersistentVector.conj 25 - Expect.equal (Seq.toList v) [ 1; 4; 25 ] "should convert to list" - } + Expect.equal (Seq.toList v) [ 1; 4; 25 ] "should convert to list" + } - test "PersistentVector.map works as expected" { - let v = - PersistentVector.ofSeq [ 1..4 ] - |> PersistentVector.map(fun x -> x * 2) + test "PersistentVector.map works as expected" { + let v = + PersistentVector.ofSeq [ 1..4 ] + |> PersistentVector.map(fun x -> x * 2) - Expect.equal (Seq.toList v) [ 2; 4; 6; 8 ] "should map over items" - } - ] + Expect.equal (Seq.toList v) [ 2; 4; 6; 8 ] "should map over items" + } ] diff --git a/tests/fable/FSharpx.Collections.Tests/Program.fs b/tests/fable/FSharpx.Collections.Tests/Program.fs index 71872c82..615c9483 100644 --- a/tests/fable/FSharpx.Collections.Tests/Program.fs +++ b/tests/fable/FSharpx.Collections.Tests/Program.fs @@ -3,13 +3,13 @@ module Program open Fable.Mocha let allTests = - testList "All" [ - QueueTests.tests - PersistentVectorTests.tests - NonEmptyListTests.tests - LazyListTests.tests - DequeTests.tests - ] + testList + "All" + [ QueueTests.tests + PersistentVectorTests.tests + NonEmptyListTests.tests + LazyListTests.tests + DequeTests.tests ] [] let main args = diff --git a/tests/fable/FSharpx.Collections.Tests/Queue.test.fs b/tests/fable/FSharpx.Collections.Tests/Queue.test.fs index 1c1d07bf..0b0db268 100644 --- a/tests/fable/FSharpx.Collections.Tests/Queue.test.fs +++ b/tests/fable/FSharpx.Collections.Tests/Queue.test.fs @@ -4,31 +4,31 @@ open Fable.Mocha open FSharpx.Collections let tests = - testList "QueueTests" [ - test "Queue works" { - let q = Queue.empty + testList + "QueueTests" + [ test "Queue works" { + let q = Queue.empty - Expect.equal (Queue.isEmpty q) true "should start empty" + Expect.equal (Queue.isEmpty q) true "should start empty" - let q = Queue.conj "a" q + let q = Queue.conj "a" q - Expect.equal (Queue.isEmpty q) false "should no longer be empty" - Expect.equal (Queue.tryHead q) (Some "a") "should read first element" + Expect.equal (Queue.isEmpty q) false "should no longer be empty" + Expect.equal (Queue.tryHead q) (Some "a") "should read first element" - let q = Queue.conj "b" q + let q = Queue.conj "b" q - Expect.equal (Queue.tryHead q) (Some "a") "should preserve head" + Expect.equal (Queue.tryHead q) (Some "a") "should preserve head" - let q = Queue.conj "c" q + let q = Queue.conj "c" q - Expect.equal (Queue.tryTail q) (Queue.empty |> Queue.conj "b" |> Queue.conj "c" |> Some) "should drop head" + Expect.equal (Queue.tryTail q) (Queue.empty |> Queue.conj "b" |> Queue.conj "c" |> Some) "should drop head" - let popped, q = Queue.uncons q + let popped, q = Queue.uncons q - Expect.equal popped "a" "should pop in order" + Expect.equal popped "a" "should pop in order" - let popped, _ = Queue.uncons q + let popped, _ = Queue.uncons q - Expect.equal popped "b" "should pop second" - } - ] + Expect.equal popped "b" "should pop second" + } ] From 3521b00aecd2d8380933341d05543ff94c8ef628 Mon Sep 17 00:00:00 2001 From: gdziadkiewicz Date: Fri, 16 Jan 2026 08:36:19 +0100 Subject: [PATCH 8/8] Update node version in CI --- .github/workflows/dotnet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 164edc83..aea2abe4 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -19,7 +19,7 @@ jobs: matrix: os: [ubuntu-latest, windows-latest] dotnet: [8.0.416] - node: ['14'] + node: ['24'] runs-on: ${{ matrix.os }} steps: