├── .editorconfig
├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── .travis.yml
├── ExtCore.Benchmarks
├── Collections.IntMap.fs
├── Collections.IntSet.fs
├── ExtCore.Benchmarks.fsproj
└── Program.fs
├── ExtCore.Tests
├── Args.fs
├── Caching.LruCache.fs
├── Collections.Array.fs
├── Collections.ArrayView.fs
├── Collections.AsyncSeq.fs
├── Collections.Bimap.fs
├── Collections.Dict.fs
├── Collections.HashMap.fs
├── Collections.HashSet.fs
├── Collections.IntBimap.fs
├── Collections.IntMap.fs
├── Collections.IntSet.fs
├── Collections.LazyList.fs
├── Collections.List.fs
├── Collections.ListZipper.fs
├── Collections.LongBimap.fs
├── Collections.LongMap.fs
├── Collections.LongSet.fs
├── Collections.Map.fs
├── Collections.Multimap.fs
├── Collections.Multiset.fs
├── Collections.PriorityQueue.fs
├── Collections.Queue.fs
├── Collections.Range.fs
├── Collections.ResizeArray.fs
├── Collections.Seq.fs
├── Collections.Set.fs
├── Collections.Vector.fs
├── Collections.VectorView.fs
├── Control.Agents.fs
├── Control.Cps.fs
├── Control.Observable.fs
├── Control.fs
├── ControlCollections.Async.fs
├── ControlCollections.AsyncChoice.fs
├── ControlCollections.AsyncMaybe.fs
├── ControlCollections.AsyncProtectedState.fs
├── ControlCollections.AsyncState.fs
├── ControlCollections.Choice.fs
├── ControlCollections.Cont.fs
├── ControlCollections.Maybe.fs
├── ControlCollections.ProtectedState.fs
├── ControlCollections.Reader.fs
├── ControlCollections.ReaderChoice.fs
├── ControlCollections.ReaderMaybe.fs
├── ControlCollections.ReaderProtectedState.fs
├── ControlCollections.ReaderState.fs
├── ControlCollections.State.fs
├── ControlCollections.StateCont.fs
├── ControlCollections.StatefulChoice.fs
├── ExtCore.Tests.fsproj
├── IO.fs
├── NativeInterop.fs
├── Net.fs
├── Pervasive.fs
├── RefCountEnumerable.fs
├── String.fs
├── Substring.fs
├── TestHelpers.fs
├── app.config
└── packages.config
├── ExtCore.sln
├── ExtCore
├── Args.fs
├── AssemblyInfo.fs
├── Caching.LruCache.fs
├── Collections.Array.fs
├── Collections.ArrayView.fs
├── Collections.AsyncSeq.fs
├── Collections.Bimap.fs
├── Collections.Dict.fs
├── Collections.HashMap.fs
├── Collections.HashSet.fs
├── Collections.IntBimap.fs
├── Collections.IntMap.fs
├── Collections.IntSet.fs
├── Collections.LazyList.fs
├── Collections.List.fs
├── Collections.ListZipper.fs
├── Collections.LongBimap.fs
├── Collections.LongMap.fs
├── Collections.LongSet.fs
├── Collections.Map.fs
├── Collections.Multimap.fs
├── Collections.Multiset.fs
├── Collections.PriorityQueue.fs
├── Collections.Queue.fs
├── Collections.ResizeArray.fs
├── Collections.Seq.fs
├── Collections.Set.fs
├── Collections.TaggedArray.fs
├── Collections.Vector.fs
├── Collections.VectorView.fs
├── Collections.fs
├── Control.Agents.fs
├── Control.Cps.fs
├── Control.Indexed.fs
├── Control.Observable.fs
├── Control.Tasks.fs
├── Control.fs
├── ControlCollections.Async.fs
├── ControlCollections.AsyncChoice.fs
├── ControlCollections.AsyncMaybe.fs
├── ControlCollections.AsyncProtectedState.fs
├── ControlCollections.AsyncState.fs
├── ControlCollections.Choice.fs
├── ControlCollections.Cont.fs
├── ControlCollections.Maybe.fs
├── ControlCollections.ProtectedState.fs
├── ControlCollections.Reader.fs
├── ControlCollections.ReaderChoice.fs
├── ControlCollections.ReaderMaybe.fs
├── ControlCollections.ReaderProtectedState.fs
├── ControlCollections.ReaderState.fs
├── ControlCollections.State.fs
├── ControlCollections.StateCont.fs
├── ControlCollections.StatefulChoice.fs
├── ExtCore.fsproj
├── ExtraPervasives.fs
├── IO.fs
├── NativeInterop.fs
├── Net.fs
├── Pervasive.fs
├── String.fs
└── Substring.fs
├── LICENSE.txt
├── README.rst
├── _docs
├── Changelog.rst
├── References.rst
└── TODO.rst
├── appveyor.yml
├── install_dotnet.ps1
├── packages
└── repositories.config
└── proto-compile
/.editorconfig:
--------------------------------------------------------------------------------
1 | ; Top-most EditorConfig file
2 | root = true
3 |
4 | ; Global settings
5 | [*]
6 | ;end_of_line = LF ; Unix-style newlines
7 | indent_size = 4
8 | indent_style = space
9 | trim_trailing_whitespace = true
10 | insert_final_newline = true
11 |
12 | ; F# source files
13 | [*.fs]
14 | indent_style = space
15 | indent_size = 4
16 |
17 | ; F# interface specifications
18 | [*.fsi]
19 | indent_style = space
20 | indent_size = 4
21 |
22 | ; F# lexer specifications
23 | [*.fsl]
24 | indent_style = space
25 | indent_size = 4
26 |
27 | ; F# parser specifications
28 | [*.fsy]
29 | indent_style = space
30 | indent_size = 4
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # General (non-project-specific) patterns
3 | ###############################################################################
4 |
5 | # OS junk files
6 | *.DS_Store
7 | [Tt]humbs.db
8 |
9 | # Temp Files
10 | *~ # UNIX
11 | ~$* # Microsoft Office
12 |
13 | # Bindings for other source-control systems.
14 | .hg
15 | .svn
16 |
17 | # .NET / Visual Studio (Folders)
18 | ipch/
19 | obj/
20 | [Bb]in
21 | [Dd]ebug*/
22 | [Rr]elease*/
23 |
24 | # .NET / Visual Studio (Files)
25 | *_i.c
26 | *_p.c
27 | *.aps
28 | *.bak
29 | *.[Cc]ache
30 | *.exe
31 | *.gpState
32 | *.ilk
33 | *.log
34 | *.lib
35 | *.ncb
36 | *.[Oo]bj
37 | *.opensdf
38 | *.pch
39 | *.pdb
40 | *.res
41 | *.resources
42 | *.sbr
43 | *.sdf
44 | *.sln.cache
45 | *.suo
46 | *.tlb
47 | *.tlh
48 | *.user
49 | *.vspscc
50 | *.vssscc
51 | Ankh.NoLoad
52 |
53 | # NuGet
54 | !.nuget/*
55 | [Pp]ackages/*
56 | ![Pp]ackages/repositories.config
57 |
58 | # Visual Studio (Project Upgrade)
59 | Backup/
60 | _UpgradeReport_Files/
61 | UpgradeLog.htm
62 | UpgradeLog.XML
63 |
64 | # Test Results
65 | [Tt]est[Rr]esult*
66 | TestResults/
67 | TestResult.xml
68 |
69 | # 3rd-party Tools
70 | _ReSharper*/
71 | *.nvuser
72 | *.resharper
73 | *resharper.user
74 | *.sln.DotSettings
75 |
76 | # Build Output
77 | #pkg
78 | [Bb]uild
79 | /_build/*
80 |
81 |
82 | ###############################################################################
83 | # Project-specific patterns
84 | ###############################################################################
85 |
86 | # Ignore the tools folder (where e.g., NUnit.Runners is unpacked)
87 | [Tt]ools
88 |
89 | # Ignore the NuGet build folder, it's only needed when building the package
90 | _NuGetBuild/*
91 | .idea/
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jack-pappas/ExtCore/86ff5620eee77b972ee3e929b982b189c6fe355d/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/.nuget/NuGet.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildProjectDirectory)\..\
5 |
6 |
7 | false
8 |
9 |
10 | false
11 |
12 |
13 | true
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
31 | $([System.IO.Path]::Combine($(ProjectDir), "packages.config"))
32 |
33 |
34 |
35 |
36 | $(SolutionDir).nuget
37 | packages.config
38 |
39 |
40 |
41 |
42 | $(NuGetToolsPath)\NuGet.exe
43 | @(PackageSource)
44 |
45 | "$(NuGetExePath)"
46 | mono --runtime=v4.0.30319 $(NuGetExePath)
47 |
48 | $(TargetDir.Trim('\\'))
49 |
50 | -RequireConsent
51 | -NonInteractive
52 |
53 | "$(SolutionDir) "
54 | "$(SolutionDir)"
55 |
56 |
57 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)
58 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
59 |
60 |
61 |
62 | RestorePackages;
63 | $(BuildDependsOn);
64 |
65 |
66 |
67 |
68 | $(BuildDependsOn);
69 | BuildPackage;
70 |
71 |
72 |
73 |
74 |
75 |
76 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
98 |
100 |
101 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
133 |
134 |
135 |
136 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: csharp
2 |
3 | # Use container-based infrastructure with Ubuntu Trusty (14.04)
4 | os: linux
5 | dist: trusty
6 | sudo: required
7 |
8 | # TODO : Enable both mono and dotnet builds: https://docs.travis-ci.com/user/languages/csharp/#Testing-Against-Mono-and-.NET-Core
9 | mono:
10 | - latest
11 |
12 | matrix:
13 | include:
14 | - dotnet: 2.0.0
15 | env:
16 | - DOTNETLIBFW=netstandard2.0
17 | - DOTNETFW=netcoreapp2.0
18 | - MONO_BASE_PATH=/usr/lib/mono/
19 | - dotnet: 1.1.0
20 | env:
21 | - DOTNETLIBFW=netstandard1.6
22 | - DOTNETFW=netcoreapp1.1
23 | - MONO_BASE_PATH=/usr/lib/mono/
24 |
25 | install:
26 | - dotnet restore
27 |
28 | # TODO : Add before_script section to clone fsharp/fsharp repo and compile it, so fsc-proto can be used.
29 | # Cache the compiled fsharp build (using travis CI caching functionality) so it doesn't have to run every time.
30 | # TODO : Use build matrix to run two jobs; one where we build/test via the solution, and another where we build through proto-compile
31 | # https://docs.travis-ci.com/user/customizing-the-build/#Explicitly-Including-Jobs
32 |
33 | script:
34 | - dotnet build ExtCore/ExtCore.fsproj --framework $DOTNETLIBFW
35 | - FrameworkPathOverride=$MONO_BASE_PATH/4.5-api/ dotnet build ExtCore/ExtCore.fsproj --framework "net45"
36 | - dotnet test ExtCore.Tests/ExtCore.Tests.fsproj --framework $DOTNETFW
37 | # - FrameworkPathOverride=$MONO_BASE_PATH/4.5-api/ dotnet test ExtCore.Tests/ExtCore.Tests.fsproj --framework "net45"
38 | # Workaround for dotnet test on net45:
39 | - FrameworkPathOverride=$MONO_BASE_PATH/4.5-api/ dotnet build ExtCore.Tests/ExtCore.Tests.fsproj --framework "net45"
40 | - nuget install NUnit.ConsoleRunner -Version 3.7.0 -OutputDirectory $PWD/packages
41 | - mono packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe ExtCore.Tests/bin/Debug/net45/ExtCore.Tests.dll
42 |
43 |
--------------------------------------------------------------------------------
/ExtCore.Benchmarks/Collections.IntMap.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2018 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | namespace Benchmarks.ExtCore.Collections.IntMap
20 |
21 | open System
22 | open BenchmarkDotNet.Attributes
23 |
24 | //
25 | module MapData =
26 | open System.Collections.Generic
27 |
28 | //
29 | let createSequential size =
30 | Array.init size <| fun i ->
31 | KeyValuePair<_,_> (i, string i)
32 |
33 | //
34 | let createRandom size =
35 | // Create a hash set. We'll use this to check each randomly-created data point
36 | // to determine if we've already seen it; if not, we add the value (and it's string representation)
37 | // to the list of data to use for the map test.
38 | let seen = HashSet<_> ()
39 | let mutable data = ResizeArray<_> ()
40 | let rng = Random ()
41 |
42 | while seen.Count < size do
43 | let currentElement = rng.Next ()
44 |
45 | if seen.Add currentElement then
46 | data.Add (KeyValuePair<_,_> (currentElement, string currentElement))
47 |
48 | data.ToArray ()
49 |
50 |
51 | /// Benchmark of lookup (find) performance of maps / dictionaries
52 | /// using integer keys.
53 | //[]
54 | type MapFindIntKey () =
55 | let mutable mapData = Array.empty
56 | let mutable fsharpMap = Map.empty
57 | let mutable intMap = IntMap.empty
58 | let mutable dictionary = dict Array.empty
59 |
60 | []
61 | member val public Randomized = false with get, set
62 |
63 | []
64 | member val public DictSize = 0 with get, set
65 |
66 | []
67 | member self.Setup () : unit =
68 | // Create data for the test.
69 | mapData <-
70 | if self.Randomized then
71 | MapData.createRandom self.DictSize
72 | else
73 | MapData.createSequential self.DictSize
74 |
75 | // Create the data structures using the generated data.
76 | fsharpMap <-
77 | (Map.empty, mapData)
78 | ||> Array.fold (fun map (KeyValue (k, v)) ->
79 | Map.add k v map)
80 |
81 | intMap <-
82 | (IntMap.empty, mapData)
83 | ||> Array.fold (fun map (KeyValue (k, v)) ->
84 | IntMap.add k v map)
85 |
86 | dictionary <-
87 | mapData
88 | |> Seq.map (fun (KeyValue (k, v)) -> k, v)
89 | |> dict
90 |
91 | []
92 | member __.FSharpMap () : unit =
93 | // Iterate through all keys in the map data, looking each one up
94 | // in the map (to fetch the associated value).
95 | for kvp in mapData do
96 | Map.find kvp.Key fsharpMap |> ignore
97 |
98 | []
99 | member __.IntMap () : unit =
100 | // Iterate through all keys in the map data, looking each one up
101 | // in the map (to fetch the associated value).
102 | for kvp in mapData do
103 | IntMap.find kvp.Key intMap |> ignore
104 |
105 | []
106 | member __.Dictionary () : unit =
107 | // Iterate through all keys in the map data, looking each one up
108 | // in the dictionary (to fetch the associated value).
109 | for kvp in mapData do
110 | dictionary.[kvp.Key] |> ignore
111 |
112 |
113 | /// Benchmark comparing creation time of maps / dictionaries
114 | /// using integer keys.
115 | //[]
116 | type MapCreateIntKey () =
117 | let mutable mapData = Array.empty
118 |
119 | []
120 | member val public Randomized = false with get, set
121 |
122 | []
123 | member val public DictSize = 0 with get, set
124 |
125 | []
126 | member self.Setup () : unit =
127 | // Create data for the test.
128 | mapData <-
129 | if self.Randomized then
130 | MapData.createRandom self.DictSize
131 | else
132 | MapData.createSequential self.DictSize
133 |
134 | []
135 | member __.FSharpMap () : unit =
136 | // Iterate through all keys in the map data, adding each one to the map.
137 | let mutable map = Map.empty
138 | for kvp in mapData do
139 | map <- Map.add kvp.Key kvp.Value map
140 |
141 | []
142 | member __.IntMap () : unit =
143 | // Iterate through all keys in the map data, adding each one to the map.
144 | let mutable map = IntMap.empty
145 | for kvp in mapData do
146 | map <- IntMap.add kvp.Key kvp.Value map
147 |
148 | []
149 | member __.Dictionary () : unit =
150 | // Iterate through all keys in the map data, adding each one to the map.
151 | let dict = System.Collections.Generic.Dictionary<_,_>()
152 | for kvp in mapData do
153 | dict.Add(kvp.Key, kvp.Value)
154 |
--------------------------------------------------------------------------------
/ExtCore.Benchmarks/Collections.IntSet.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2018 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Benchmarks for the ExtCore.Collections.IntSet type and module.
20 | namespace Benchmarks.ExtCore.Collections.IntSet
21 |
22 | open System
23 | open System.Collections
24 | open System.Collections.Generic
25 | open BenchmarkDotNet.Attributes
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ExtCore.Benchmarks/ExtCore.Benchmarks.fsproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netcoreapp2.0;net46
4 | Exe
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ExtCore.Benchmarks/Program.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2018 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | namespace Benchmarks.ExtCore
20 |
21 | open BenchmarkDotNet
22 |
23 |
24 | module Program =
25 | open BenchmarkDotNet.Running
26 |
27 | let defaultSwitch =
28 | [| typeof;
29 | typeof;
30 | |] |> BenchmarkSwitcher
31 |
32 | //
33 | []
34 | let main args =
35 | let summaries = defaultSwitch.Run args
36 |
37 | 0
38 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Args.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Tests for the modules in the ExtCore.Args namespace.
20 | module Tests.ExtCore.Args
21 |
22 | open NUnit.Framework
23 |
24 |
25 | (* TODO *)
26 | []
27 | let dummy () =
28 | Assert.Ignore "Test not yet implemented."
29 |
30 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.AsyncSeq.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Tests for the ExtCore.Collections.AsyncSeq module.
20 | module Tests.ExtCore.Collections.AsyncSeq
21 |
22 | open NUnit.Framework
23 |
24 |
25 | []
26 | let empty () =
27 | Assert.Ignore "Test not yet implemented."
28 |
29 | []
30 | let singleton () =
31 | Assert.Ignore "Test not yet implemented."
32 |
33 | []
34 | let firstOrDefault () =
35 | Assert.Ignore "Test not yet implemented."
36 |
37 | []
38 | let lastOrDefault () =
39 | Assert.Ignore "Test not yet implemented."
40 |
41 | []
42 | let append () =
43 | Assert.Ignore "Test not yet implemented."
44 |
45 | []
46 | let collect () =
47 | Assert.Ignore "Test not yet implemented."
48 |
49 | []
50 | let map () =
51 | Assert.Ignore "Test not yet implemented."
52 |
53 | []
54 | let choose () =
55 | Assert.Ignore "Test not yet implemented."
56 |
57 | []
58 | let filter () =
59 | Assert.Ignore "Test not yet implemented."
60 |
61 | []
62 | let scan () =
63 | Assert.Ignore "Test not yet implemented."
64 |
65 | []
66 | let iter () =
67 | Assert.Ignore "Test not yet implemented."
68 |
69 | []
70 | let fold () =
71 | Assert.Ignore "Test not yet implemented."
72 |
73 | []
74 | let pairwise () =
75 | Assert.Ignore "Test not yet implemented."
76 |
77 | []
78 | let zip () =
79 | Assert.Ignore "Test not yet implemented."
80 |
81 | []
82 | let zip3 () =
83 | Assert.Ignore "Test not yet implemented."
84 |
85 | []
86 | let take () =
87 | Assert.Ignore "Test not yet implemented."
88 |
89 | []
90 | let takeWhile () =
91 | Assert.Ignore "Test not yet implemented."
92 |
93 | []
94 | let skip () =
95 | Assert.Ignore "Test not yet implemented."
96 |
97 | []
98 | let skipWhile () =
99 | Assert.Ignore "Test not yet implemented."
100 |
101 | []
102 | let cache () =
103 | Assert.Ignore "Test not yet implemented."
104 |
105 | []
106 | let ofSeq () =
107 | Assert.Ignore "Test not yet implemented."
108 |
109 | []
110 | let toSeq () =
111 | Assert.Ignore "Test not yet implemented."
112 |
113 | []
114 | let ofObservableBuffered () =
115 | Assert.Ignore "Test not yet implemented."
116 |
117 | []
118 | let ofObservable () =
119 | Assert.Ignore "Test not yet implemented."
120 |
121 | []
122 | let toObservable () =
123 | Assert.Ignore "Test not yet implemented."
124 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.Dict.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.Dict module.
20 | module Tests.ExtCore.Collections.Dict
21 |
22 | open System
23 | open System.Collections.Generic
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | []
29 | let keys () : unit =
30 | Assert.Ignore "Test not yet implemented."
31 |
32 | []
33 | let values () : unit =
34 | Assert.Ignore "Test not yet implemented."
35 |
36 | []
37 | let isEmpty () : unit =
38 | Assert.Ignore "Test not yet implemented."
39 |
40 | []
41 | let count () : unit =
42 | Assert.Ignore "Test not yet implemented."
43 |
44 | []
45 | let createMutable () : unit =
46 | Assert.Ignore "Test not yet implemented."
47 |
48 | []
49 | let containsKey () : unit =
50 | Assert.Ignore "Test not yet implemented."
51 |
52 | []
53 | let add () : unit =
54 | Assert.Ignore "Test not yet implemented."
55 |
56 | []
57 | let remove () : unit =
58 | Assert.Ignore "Test not yet implemented."
59 |
60 | []
61 | let find () : unit =
62 | Assert.Ignore "Test not yet implemented."
63 |
64 | []
65 | let tryFind () : unit =
66 | Assert.Ignore "Test not yet implemented."
67 |
68 | []
69 | let update () : unit =
70 | Assert.Ignore "Test not yet implemented."
71 |
72 | []
73 | let updateOrAdd () : unit =
74 | Assert.Ignore "Test not yet implemented."
75 |
76 | []
77 | let tryPick () : unit =
78 | Assert.Ignore "Test not yet implemented."
79 |
80 | []
81 | let pick () : unit =
82 | Assert.Ignore "Test not yet implemented."
83 |
84 | []
85 | let toSeq () : unit =
86 | Assert.Ignore "Test not yet implemented."
87 |
88 | []
89 | let iter () : unit =
90 | Assert.Ignore "Test not yet implemented."
91 |
92 | []
93 | let filter () : unit =
94 | Assert.Ignore "Test not yet implemented."
95 |
96 | []
97 | let map () : unit =
98 | Assert.Ignore "Test not yet implemented."
99 |
100 | []
101 | let choose () : unit =
102 | Assert.Ignore "Test not yet implemented."
103 |
104 | []
105 | let fold () : unit =
106 | Assert.Ignore "Test not yet implemented."
107 |
108 | []
109 | let partition () : unit =
110 | Assert.Ignore "Test not yet implemented."
111 |
112 | []
113 | let readonly () : unit =
114 | Assert.Ignore "Test not yet implemented."
115 |
116 |
117 | module Safe =
118 | []
119 | let tryFind () : unit =
120 | Assert.Ignore "Test not yet implemented."
121 |
122 | []
123 | let find () : unit =
124 | Assert.Ignore "Test not yet implemented."
125 |
126 | []
127 | let add () : unit =
128 | Assert.Ignore "Test not yet implemented."
129 |
130 | []
131 | let update () : unit =
132 | Assert.Ignore "Test not yet implemented."
133 |
134 | []
135 | let remove () : unit =
136 | Assert.Ignore "Test not yet implemented."
137 |
138 | []
139 | let updateOrAdd () : unit =
140 | Assert.Ignore "Test not yet implemented."
141 |
142 | []
143 | let immutable () : unit =
144 | Assert.Ignore "Test not yet implemented."
145 |
146 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.ListZipper.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.ListZipper type and module.
20 | module Tests.ExtCore.Collections.ListZipper
21 |
22 | open NUnit.Framework
23 |
24 |
25 | []
26 | let isEmpty () : unit =
27 | Assert.Ignore "Test not yet implemented."
28 |
29 | []
30 | let atStart () : unit =
31 | Assert.Ignore "Test not yet implemented."
32 |
33 | []
34 | let atEnd () : unit =
35 | Assert.Ignore "Test not yet implemented."
36 |
37 | []
38 | let context () : unit =
39 | Assert.Ignore "Test not yet implemented."
40 |
41 | []
42 | let current () : unit =
43 | Assert.Ignore "Test not yet implemented."
44 |
45 | []
46 | let prev () : unit =
47 | Assert.Ignore "Test not yet implemented."
48 |
49 | []
50 | let moveBack () : unit =
51 | Assert.Ignore "Test not yet implemented."
52 |
53 | []
54 | let moveNext () : unit =
55 | Assert.Ignore "Test not yet implemented."
56 |
57 | []
58 | let moveStart () : unit =
59 | Assert.Ignore "Test not yet implemented."
60 |
61 | []
62 | let moveEnd () : unit =
63 | Assert.Ignore "Test not yet implemented."
64 |
65 | []
66 | let remove () : unit =
67 | Assert.Ignore "Test not yet implemented."
68 |
69 | []
70 | let insert () : unit =
71 | Assert.Ignore "Test not yet implemented."
72 |
73 | []
74 | let update () : unit =
75 | Assert.Ignore "Test not yet implemented."
76 |
77 | []
78 | let ofList () : unit =
79 | Assert.Ignore "Test not yet implemented."
80 |
81 | []
82 | let toList () : unit =
83 | Assert.Ignore "Test not yet implemented."
84 |
85 |
86 |
87 | open FsCheck
88 |
89 | (* TODO : Implement FsCheck-based tests for ListZipper. *)
90 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.LongBimap.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2005-2009 Microsoft Corporation
4 | Copyright 2013 Jack Pappas
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | *)
19 |
20 | /// Unit tests for the ExtCore.Collections.LongBimap type and module.
21 | module Tests.ExtCore.Collections.LongBimap
22 |
23 | open System
24 | open System.Collections
25 | open System.Collections.Generic
26 | open NUnit.Framework
27 |
28 |
29 | []
30 | let dummy () : unit =
31 | Assert.Ignore "Test not yet implemented."
32 |
33 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.Multimap.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2014 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.Multimap type and module.
20 | module Tests.ExtCore.Collections.Multimap
21 |
22 | open System
23 | open System.Collections
24 | open System.Collections.Generic
25 | open NUnit.Framework
26 |
27 |
28 | //
29 | []
30 | let isEmpty () =
31 | Assert.Ignore "Test not yet implemented."
32 |
33 | //
34 | []
35 | let singleton () =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | //
39 | []
40 | let add () =
41 | Assert.Ignore "Test not yet implemented."
42 |
43 | //
44 | []
45 | let remove () =
46 | Assert.Ignore "Test not yet implemented."
47 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.Multiset.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2014 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.Multiset type and module.
20 | module Tests.ExtCore.Collections.Multiset
21 |
22 | open System
23 | open System.Collections
24 | open System.Collections.Generic
25 | open NUnit.Framework
26 |
27 |
28 | //
29 | []
30 | let isEmpty () =
31 | Assert.Ignore "Test not yet implemented."
32 |
33 | //
34 | []
35 | let count () =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | //
39 | []
40 | let countDistinct () =
41 | Assert.Ignore "Test not yet implemented."
42 |
43 | //
44 | []
45 | let contains () =
46 | Assert.Ignore "Test not yet implemented."
47 |
48 | //
49 | []
50 | let card () =
51 | Assert.Ignore "Test not yet implemented."
52 |
53 | //
54 | []
55 | let singleton () =
56 | Assert.Ignore "Test not yet implemented."
57 |
58 | //
59 | []
60 | let add () =
61 | Assert.Ignore "Test not yet implemented."
62 |
63 | //
64 | []
65 | let addMany () =
66 | Assert.Ignore "Test not yet implemented."
67 |
68 | //
69 | []
70 | let remove () =
71 | Assert.Ignore "Test not yet implemented."
72 |
73 | //
74 | []
75 | let removeMany () =
76 | Assert.Ignore "Test not yet implemented."
77 |
78 | //
79 | []
80 | let removeAll () =
81 | Assert.Ignore "Test not yet implemented."
82 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.PriorityQueue.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.PriorityQueue type and module.
20 | module Tests.ExtCore.Collections.PriorityQueue
21 |
22 | open NUnit.Framework
23 | //open FsCheck
24 |
25 |
26 | (* TODO : Implement tests for ExtCore.Collections.PriorityQueue. *)
27 |
28 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.Queue.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.Queue type and module.
20 | namespace Tests.ExtCore.Collections
21 |
22 | open NUnit.Framework
23 | //open FsCheck
24 |
25 |
26 | module QueueType =
27 | []
28 | let IsEmpty () : unit =
29 | Assert.Ignore "Test not yet implemented."
30 |
31 | []
32 | let GetLength () : unit =
33 | Assert.Ignore "Test not yet implemented."
34 |
35 | []
36 | let Dequeue () : unit =
37 | Assert.Ignore "Test not yet implemented."
38 |
39 | []
40 | let Enqueue () : unit =
41 | Assert.Ignore "Test not yet implemented."
42 |
43 | []
44 | let EnqueueFront () : unit =
45 | Assert.Ignore "Test not yet implemented."
46 |
47 | []
48 | let OfSeq () : unit =
49 | Assert.Ignore "Test not yet implemented."
50 |
51 | []
52 | let OfList () : unit =
53 | Assert.Ignore "Test not yet implemented."
54 |
55 | []
56 | let OfArray () : unit =
57 | Assert.Ignore "Test not yet implemented."
58 |
59 | []
60 | let OfVector () : unit =
61 | Assert.Ignore "Test not yet implemented."
62 |
63 | []
64 | let ToSeq () : unit =
65 | Assert.Ignore "Test not yet implemented."
66 |
67 | []
68 | let ToList () : unit =
69 | Assert.Ignore "Test not yet implemented."
70 |
71 | []
72 | let ToArray () : unit =
73 | Assert.Ignore "Test not yet implemented."
74 |
75 | []
76 | let ToVector () : unit =
77 | Assert.Ignore "Test not yet implemented."
78 |
79 | []
80 | let ``IEnumerable.GetEnumerator()`` () : unit =
81 | Assert.Ignore "Test not yet implemented."
82 |
83 | []
84 | let ``IEnumerable<'T>.GetEnumerator()`` () : unit =
85 | Assert.Ignore "Test not yet implemented."
86 |
87 |
88 | module QueueModule =
89 | []
90 | let isEmpty () : unit =
91 | Queue.empty
92 | |> Queue.isEmpty
93 | |> assertTrue
94 |
95 | Queue.empty
96 | |> Queue.enqueue "Hello"
97 | |> Queue.enqueue "World!"
98 | |> Queue.isEmpty
99 | |> assertFalse
100 |
101 | []
102 | let length () : unit =
103 | Queue.empty
104 | |> Queue.length
105 | |> assertEqual 0
106 |
107 | Queue.empty
108 | |> Queue.enqueue "foo"
109 | |> Queue.enqueue "bar"
110 | |> Queue.enqueue "baz"
111 | |> Queue.length
112 | |> assertEqual 3
113 |
114 | []
115 | let enqueue () : unit =
116 | Queue.empty
117 | |> Queue.enqueue "Hello"
118 | |> Queue.toArray
119 | |> assertEqual
120 | [| "Hello" |]
121 |
122 | [| "foo"; "bar"; "baz"; |]
123 | |> Queue.ofArray
124 | |> Queue.enqueue "cdr"
125 | |> Queue.enqueue "car"
126 | |> Queue.enqueue "bar"
127 | |> Queue.enqueue "bar"
128 | |> Queue.toArray
129 | |> assertEqual
130 | [| "foo"; "bar"; "baz"; "cdr"; "car"; "bar"; "bar"; |]
131 |
132 | // Test case for checking that the Queue is persistent as expected.
133 | do
134 | let queue = Queue.ofArray [| "foo"; "bar"; "baz"; |]
135 |
136 | queue
137 | |> Queue.enqueue "Hello"
138 | |> Queue.enqueue "World"
139 | |> Queue.toArray
140 | |> assertEqual
141 | [| "foo"; "bar"; "baz"; "Hello"; "World"; |]
142 |
143 | queue
144 | |> Queue.enqueue "cdr"
145 | |> Queue.enqueue "car"
146 | |> Queue.toArray
147 | |> assertEqual
148 | [| "foo"; "bar"; "baz"; "cdr"; "car"; |]
149 |
150 | []
151 | let enqueueFront () : unit =
152 | Queue.empty
153 | |> Queue.enqueueFront "Hello"
154 | |> Queue.toArray
155 | |> assertEqual
156 | [| "Hello" |]
157 |
158 | Queue.empty
159 | |> Queue.enqueue "foo"
160 | |> Queue.enqueue "bar"
161 | |> Queue.enqueueFront "baz"
162 | |> Queue.enqueue "cdr"
163 | |> Queue.enqueueFront "car"
164 | |> Queue.toArray
165 | |> assertEqual
166 | [| "car"; "baz"; "foo"; "bar"; "cdr"; |]
167 |
168 | // Test case for checking that the Queue is persistent as expected.
169 | do
170 | let queue = Queue.ofArray [| "foo"; "bar"; "baz"; |]
171 |
172 | queue
173 | |> Queue.enqueueFront "Hello"
174 | |> Queue.enqueueFront "World"
175 | |> Queue.toArray
176 | |> assertEqual
177 | [| "World"; "Hello"; "foo"; "bar"; "baz"; |]
178 |
179 | queue
180 | |> Queue.enqueueFront "cdr"
181 | |> Queue.enqueueFront "car"
182 | |> Queue.toArray
183 | |> assertEqual
184 | [| "car"; "cdr"; "foo"; "bar"; "baz"; |]
185 |
186 | []
187 | let dequeue () : unit =
188 | do
189 | let queue = Queue.ofArray [| "car"; "baz"; "foo"; "bar"; "cdr"; |]
190 |
191 | let result, queue = Queue.dequeue queue
192 | result |> assertEqual "car"
193 | Queue.length queue |> assertEqual 4
194 |
195 | let result, queue = Queue.dequeue queue
196 | result |> assertEqual "baz"
197 | Queue.length queue |> assertEqual 3
198 |
199 | let result, queue = Queue.dequeue queue
200 | result |> assertEqual "foo"
201 | Queue.length queue |> assertEqual 2
202 |
203 | let result, queue = Queue.dequeue queue
204 | result |> assertEqual "bar"
205 | Queue.length queue |> assertEqual 1
206 |
207 | let result, queue = Queue.dequeue queue
208 | result |> assertEqual "cdr"
209 | Queue.length queue |> assertEqual 0
210 |
211 | // Test case for checking that the Queue is persistent as expected.
212 | do
213 | let queue = Queue.ofArray [| "car"; "baz"; "foo"; "bar"; "cdr"; |]
214 |
215 | // Run a simple dequeue test.
216 | let result, queue = Queue.dequeue queue
217 | result |> assertEqual "car"
218 | Queue.length queue |> assertEqual 4
219 |
220 | let result, queue = Queue.dequeue queue
221 | result |> assertEqual "baz"
222 | Queue.length queue |> assertEqual 3
223 |
224 | // Change to queue' here, so we can use the "partial" queue later.
225 | let result, queue' = Queue.dequeue queue
226 | result |> assertEqual "foo"
227 | Queue.length queue' |> assertEqual 2
228 |
229 | let result, queue' = Queue.dequeue queue'
230 | result |> assertEqual "bar"
231 | Queue.length queue' |> assertEqual 1
232 |
233 | let result, queue' = Queue.dequeue queue'
234 | result |> assertEqual "cdr"
235 | Queue.length queue' |> assertEqual 0
236 |
237 | // Now re-run the test for the last few elements using the partial queue.
238 | let result, queue = Queue.dequeue queue
239 | result |> assertEqual "foo"
240 | Queue.length queue |> assertEqual 2
241 |
242 | let result, queue = Queue.dequeue queue
243 | result |> assertEqual "bar"
244 | Queue.length queue |> assertEqual 1
245 |
246 | let result, queue = Queue.dequeue queue
247 | result |> assertEqual "cdr"
248 | Queue.length queue |> assertEqual 0
249 |
250 | []
251 | let ``dequeue raises exn when queue is empty`` () : unit =
252 | Assert.Throws(fun () ->
253 | Queue.empty
254 | |> Queue.dequeue
255 | |> ignore) |> ignore
256 |
257 | []
258 | let ofList () : unit =
259 | List.empty
260 | |> Queue.ofList
261 | |> Queue.isEmpty
262 | |> assertTrue
263 |
264 | ["foo"; "bar"; "baz"; "cdr"; "car"]
265 | |> Queue.ofList
266 | |> Queue.toSeq
267 | |> Seq.toArray
268 | |> assertEqual
269 | [| "foo"; "bar"; "baz"; "cdr"; "car"; |]
270 |
271 | []
272 | let ofArray () : unit =
273 | List.empty
274 | |> Queue.ofList
275 | |> Queue.isEmpty
276 | |> assertTrue
277 |
278 | [| "foo"; "bar"; "baz"; "cdr"; "car"; |]
279 | |> Queue.ofArray
280 | |> Queue.toSeq
281 | |> Seq.toArray
282 | |> assertEqual
283 | [| "foo"; "bar"; "baz"; "cdr"; "car"; |]
284 |
285 | []
286 | let toSeq () : unit =
287 | Queue.empty
288 | |> Queue.toSeq
289 | |> Seq.isEmpty
290 | |> assertTrue
291 |
292 | Queue.empty
293 | |> Queue.enqueue "foo"
294 | |> Queue.enqueue "bar"
295 | |> Queue.enqueue "baz"
296 | |> Queue.dequeue
297 | |> snd
298 | |> Queue.enqueue "cdr"
299 | |> Queue.enqueue "car"
300 | |> Queue.toSeq
301 | |> Seq.toArray
302 | |> assertEqual
303 | [| "bar"; "baz"; "cdr"; "car"; |]
304 |
305 | []
306 | let toList () : unit =
307 | Queue.empty
308 | |> Queue.toList
309 | |> List.isEmpty
310 | |> assertTrue
311 |
312 | Queue.empty
313 | |> Queue.enqueue "foo"
314 | |> Queue.enqueue "bar"
315 | |> Queue.enqueue "baz"
316 | |> Queue.dequeue
317 | |> snd
318 | |> Queue.enqueue "cdr"
319 | |> Queue.enqueue "car"
320 | |> Queue.toList
321 | |> assertEqual
322 | ["bar"; "baz"; "cdr"; "car"]
323 |
324 | []
325 | let toArray () : unit =
326 | Queue.empty
327 | |> Queue.toArray
328 | |> Array.isEmpty
329 | |> assertTrue
330 |
331 | Queue.empty
332 | |> Queue.enqueue "foo"
333 | |> Queue.enqueue "bar"
334 | |> Queue.enqueue "baz"
335 | |> Queue.dequeue
336 | |> snd
337 | |> Queue.enqueue "cdr"
338 | |> Queue.enqueue "car"
339 | |> Queue.toArray
340 | |> assertEqual
341 | [| "bar"; "baz"; "cdr"; "car"; |]
342 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.Range.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Tests for the ExtCore.Collections.Range module.
20 | module Tests.ExtCore.Collections.Range
21 |
22 | open NUnit.Framework
23 |
24 |
25 | []
26 | let iter () : unit =
27 | do
28 | // Test case for an inverted range (this should
29 | // be treated just like an empty range).
30 | let elements = ResizeArray ()
31 |
32 | (5, 2)
33 | ||> Range.iter (fun x ->
34 | String.replicate x "A"
35 | |> elements.Add)
36 |
37 | ResizeArray.isEmpty elements
38 | |> assertTrue
39 |
40 | do
41 | // Test case for a single-element range.
42 | let elements = ResizeArray ()
43 |
44 | (4, 4)
45 | ||> Range.iter (fun x ->
46 | String.replicate x "A"
47 | |> elements.Add)
48 |
49 | ResizeArray.toArray elements
50 | |> Collection.assertEqual [| "AAAA"; |]
51 |
52 | do
53 | // Sample usage test case.
54 | let elements = ResizeArray ()
55 |
56 | (2, 7)
57 | ||> Range.iter (fun x ->
58 | String.replicate x "A"
59 | |> elements.Add)
60 |
61 | ResizeArray.toArray elements
62 | |> Collection.assertEqual
63 | [| "AA"; "AAA"; "AAAA"; "AAAAA"; "AAAAAA"; "AAAAAAA"; |]
64 |
65 | []
66 | let fold () : unit =
67 | /// The set of prime numbers less than 40.
68 | let primes =
69 | Set.ofArray [| 2; 3; 5; 7; 11; 13; 17; 19; 23; 29; 31; 37; |]
70 |
71 | do
72 | // Test case for an inverted range (this should
73 | // be treated just like an empty range).
74 | (5, 2, 1L)
75 | |||> Range.fold (fun checksum x ->
76 | if Set.contains x primes then
77 | checksum * int64 x
78 | else
79 | checksum + int64 x)
80 | |> assertEqual 1L
81 |
82 | do
83 | // Test cases for a single-element range.
84 | (6, 6, 1L)
85 | |||> Range.fold (fun checksum x ->
86 | if Set.contains x primes then
87 | checksum * int64 x
88 | else
89 | checksum + int64 x)
90 | |> assertEqual 7L
91 |
92 | (5, 5, 1L)
93 | |||> Range.fold (fun checksum x ->
94 | if Set.contains x primes then
95 | checksum * int64 x
96 | else
97 | checksum + int64 x)
98 | |> assertEqual 5L
99 |
100 | do
101 | // Sample usage test cases.
102 | (2, 7, 1L)
103 | |||> Range.fold (fun checksum x ->
104 | if Set.contains x primes then
105 | checksum * int64 x
106 | else
107 | checksum + int64 x)
108 | |> assertEqual 392L
109 |
110 | (20, 30, 1L)
111 | |||> Range.fold (fun checksum x ->
112 | if Set.contains x primes then
113 | checksum * int64 x
114 | else
115 | checksum + int64 x)
116 | |> assertEqual 46488L
117 |
118 | []
119 | let foldBack () : unit =
120 | /// The set of prime numbers less than 40.
121 | let primes =
122 | Set.ofArray [| 2; 3; 5; 7; 11; 13; 17; 19; 23; 29; 31; 37; |]
123 |
124 | do
125 | // Test case for an inverted range (this should
126 | // be treated just like an empty range).
127 | (5, 2, 1L)
128 | |||> Range.foldBack (fun x checksum ->
129 | if Set.contains x primes then
130 | checksum * int64 x
131 | else
132 | checksum + int64 x)
133 | |> assertEqual 1L
134 |
135 | do
136 | // Test cases for a single-element range.
137 | (6, 6, 1L)
138 | |||> Range.foldBack (fun x checksum ->
139 | if Set.contains x primes then
140 | checksum * int64 x
141 | else
142 | checksum + int64 x)
143 | |> assertEqual 7L
144 |
145 | (5, 5, 1L)
146 | |||> Range.foldBack (fun x checksum ->
147 | if Set.contains x primes then
148 | checksum * int64 x
149 | else
150 | checksum + int64 x)
151 | |> assertEqual 5L
152 |
153 | do
154 | // Sample usage test cases.
155 | (2, 7, 1L)
156 | |||> Range.foldBack (fun x checksum ->
157 | if Set.contains x primes then
158 | checksum * int64 x
159 | else
160 | checksum + int64 x)
161 | |> assertEqual 414L
162 |
163 | (20, 30, 1L)
164 | |||> Range.foldBack (fun x checksum ->
165 | if Set.contains x primes then
166 | checksum * int64 x
167 | else
168 | checksum + int64 x)
169 | |> assertEqual 23730L
170 |
171 | []
172 | let exists () : unit =
173 | /// The set of prime numbers less than 40.
174 | let primes =
175 | Set.ofArray [| 2; 3; 5; 7; 11; 13; 17; 19; 23; 29; 31; 37; |]
176 |
177 | do
178 | // Test case for an inverted range (this should
179 | // be treated just like an empty range).
180 | (5, 2)
181 | ||> Range.exists (fun x ->
182 | Set.contains x primes)
183 | |> assertFalse
184 |
185 | do
186 | // Test cases for a single-element range.
187 | (4, 4)
188 | ||> Range.exists (fun x ->
189 | Set.contains x primes)
190 | |> assertFalse
191 |
192 | (5, 5)
193 | ||> Range.exists (fun x ->
194 | Set.contains x primes)
195 | |> assertTrue
196 |
197 | do
198 | // Sample usage test case.
199 | (2, 7)
200 | ||> Range.exists (fun x ->
201 | Set.contains x primes)
202 | |> assertTrue
203 |
204 | []
205 | let forall () : unit =
206 | /// The set of prime numbers less than 40.
207 | let primes =
208 | Set.ofArray [| 2; 3; 5; 7; 11; 13; 17; 19; 23; 29; 31; 37; |]
209 |
210 | do
211 | // Test case for an inverted range (this should
212 | // be treated just like an empty range).
213 | (5, 2)
214 | ||> Range.forall (fun x ->
215 | not <| Set.contains x primes)
216 | |> assertTrue
217 |
218 | do
219 | // Test cases for a single-element range.
220 | (4, 4)
221 | ||> Range.forall (fun x ->
222 | not <| Set.contains x primes)
223 | |> assertTrue
224 |
225 | (5, 5)
226 | ||> Range.forall (fun x ->
227 | not <| Set.contains x primes)
228 | |> assertFalse
229 |
230 | do
231 | // Sample usage test cases.
232 | (14, 18)
233 | ||> Range.forall (fun x ->
234 | not <| Set.contains x primes)
235 | |> assertFalse
236 |
237 | (24, 28)
238 | ||> Range.forall (fun x ->
239 | not <| Set.contains x primes)
240 | |> assertTrue
241 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.ResizeArray.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2005-2009 Microsoft Corporation
4 | Copyright 2013 Jack Pappas
5 |
6 | Licensed under the Apache License, Version 2.0 (the "License");
7 | you may not use this file except in compliance with the License.
8 | You may obtain a copy of the License at
9 |
10 | http://www.apache.org/licenses/LICENSE-2.0
11 |
12 | Unless required by applicable law or agreed to in writing, software
13 | distributed under the License is distributed on an "AS IS" BASIS,
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | See the License for the specific language governing permissions and
16 | limitations under the License.
17 |
18 | *)
19 |
20 | (* NOTE : This file has been modified from it's original form in the F# PowerPack. *)
21 |
22 | /// Unit tests for the ExtCore.Collections.ResizeArray module.
23 | module Tests.ExtCore.Collections.ResizeArray
24 |
25 | open NUnit.Framework
26 | //open FsCheck
27 |
28 |
29 | // TODO : Remove this ASAP, replacing any uses with direct calls to Assert.IsTrue.
30 | let private test msg (condition: bool) =
31 | Assert.IsTrue (condition, sprintf "MiniTest '%s'" msg)
32 |
33 |
34 | []
35 | let ``Basic Tests`` () : unit =
36 | let ra = ResizeArray.ofList
37 | let (=?) a b = ResizeArray.toList a = b
38 |
39 | test "ra_exists2_a" <| ResizeArray.exists2 (=)
40 | (ra [1; 2; 3; 4; 5; 6])
41 | (ra [2; 3; 4; 5; 6; 6])
42 |
43 | test "exists2_b" <| not (ResizeArray.exists2 (=)
44 | (ra [1; 2; 3; 4; 5; 6])
45 | (ra [2; 3; 4; 5; 6; 7]))
46 |
47 | test "ra_findIndex_a"
48 | (ResizeArray.findIndex (fun i -> i >= 4) (ra [0..10]) = 4)
49 |
50 | test "ra_findIndex_b"
51 | (try ResizeArray.findIndex (fun i -> i >= 20) (ra [0..10]) |> ignore; false
52 | with _ -> true)
53 |
54 | test "ra_find_indexi_a"
55 | (ResizeArray.findIndexi (=) (ra [1; 2; 3; 3; 2; 1]) = 3)
56 |
57 | test "ra_find_indexi_b"
58 | (try ResizeArray.findIndexi (=) (ra [1..10]) |> ignore; false
59 | with _ -> true)
60 |
61 | test "ra_forall2_a"
62 | (ResizeArray.forall2 (=) (ra [1..10]) (ra [1..10]))
63 |
64 | test "ra_forall2_b" <| not
65 | (ResizeArray.forall2 (=) (ra [1;2;3;4;5]) (ra [1;2;3;0;5]))
66 |
67 | test "ra_isEmpty_a"
68 | (ResizeArray.isEmpty (ra []))
69 |
70 | test "ra_isEmpty_b" <| not
71 | (ResizeArray.isEmpty (ra [1; 2]))
72 |
73 | test "ra_mapi2"
74 | (ResizeArray.mapi2 (fun i j k -> i+j+k) (ra [1..10]) (ra [1..10]) =? [2..+3..29])
75 |
76 | test "ra_mapi2_b"
77 | (try ResizeArray.mapi2 (fun i j k -> i+j+k) (ra []) (ra [1..10]) |> ignore; false
78 | with _ -> true)
79 |
80 | let c = ref 0
81 | ResizeArray.iteri2 (fun i j k -> c := !c+i+j+k) (ra [1;2;3]) (ra [10;20;30])
82 | test "ra_iteri2" (!c = 6+60+3)
83 |
84 | test "ra_singleton"
85 | (ResizeArray.singleton 42 =? [42])
86 |
87 | test "ra_zip"
88 | (ResizeArray.zip (ra [1..10]) (ra [1..10]) =? [for i in 1..10 -> i, i])
89 |
90 | let unzip1, unzip2 = ResizeArray.unzip <| ra [for i in 1..10 -> i, i+1]
91 | test "ra_unzip" (unzip1 =? [1..10] && unzip2 =? [2..11])
92 |
93 | test "ra_reduce_left"
94 | (ResizeArray.reduce (+) (ra [2;2;2;2]) = 8)
95 |
96 | test "ra_reduce_right"
97 | (ResizeArray.reduceBack (+) (ra [2;2;2;2]) = 8)
98 |
99 | test "ra_fold2"
100 | (ResizeArray.fold2 (fun i j k -> i+j+k) 100 (ra [1;2;3]) (ra [1;2;3]) = 112)
101 |
102 | test "ra_fold2_b"
103 | (ResizeArray.fold2 (fun i j k -> i-j-k) 100 (ra [1;2;3]) (ra [1;2;3]) = 100-12)
104 |
105 | test "ra_foldBack2"
106 | (ResizeArray.foldBack2 (fun i j k -> i+j+k) (ra [1;2;3]) (ra [1;2;3]) 100 = 112)
107 |
108 | test "ra_foldBack2_b"
109 | (ResizeArray.foldBack2 (fun i j k -> k-i-j) (ra [1;2;3]) (ra [1;2;3]) 100 = 100-12)
110 |
111 | test "ra_scan"
112 | (ResizeArray.scan (+) 0 (ra [1..5]) =? [0; 1; 3; 6; 10; 15])
113 |
114 | test "ra_scanBack"
115 | (ResizeArray.scanBack (+) (ra [1..5]) 0 =? [15; 14; 12; 9; 5; 0])
116 |
117 | test "ra_tryfind_index"
118 | (ResizeArray.tryFindIndex (fun x -> x = 4) (ra [0..10]) = Some 4)
119 |
120 | test "ra_tryfind_index_b"
121 | (ResizeArray.tryFindIndex (fun x -> x = 42) (ra [0..10]) = None)
122 |
123 | test "ra_tryfind_indexi"
124 | (ResizeArray.tryFindIndexi (=) (ra [1;2;3;4;4;3;2;1]) = Some 4)
125 |
126 | test "ra_tryfind_indexi_b"
127 | (ResizeArray.tryFindIndexi (=) (ra [1..10]) = None)
128 |
129 | c := -1
130 | ResizeArray.iter (fun x -> incr c; test "ra_iter" (x = !c)) (ra [0..100])
131 | test "ra_iter" (!c = 100)
132 |
133 | test "ra_map"
134 | (ra [1..100] |> ResizeArray.map ((+) 1) =? [2..101])
135 |
136 | test "ra_mapi"
137 | (ra [0..100] |> ResizeArray.mapi (+) =? [0..+2..200])
138 |
139 | c := -1
140 | ResizeArray.iteri (fun i x -> incr c; test "ra_iteri" (x = !c && i = !c)) (ra [0..100])
141 | test "ra_iteri" (!c = 100)
142 |
143 | test "ra_exists"
144 | (ra [1..100] |> ResizeArray.exists ((=) 50))
145 |
146 | test "ra_exists b" <| not
147 | (ra [1..100] |> ResizeArray.exists ((=) 150))
148 |
149 | test "ra_forall"
150 | (ra [1..100] |> ResizeArray.forall (fun x -> x < 150))
151 |
152 | test "ra_forall b" <| not
153 | (ra [1..100] |> ResizeArray.forall (fun x -> x < 80))
154 |
155 | test "ra_find"
156 | (ra [1..100] |> ResizeArray.find (fun x -> x > 50) = 51)
157 |
158 | test "ra_find b"
159 | (try ra [1..100] |> ResizeArray.find (fun x -> x > 180) |> ignore; false
160 | with _ -> true)
161 |
162 | test "ra_first"
163 | (ra [1..100] |> ResizeArray.tryPick (fun x -> if x > 50 then Some (x*x) else None) = Some (51*51))
164 |
165 | test "ra_first b"
166 | (ra [1..100] |> ResizeArray.tryPick (fun x -> None) = None)
167 |
168 | test "ra_first c"
169 | (ra [] |> ResizeArray.tryPick (fun _ -> Some 42) = None)
170 |
171 | test "ra_tryfind"
172 | (ra [1..100] |> ResizeArray.tryFind (fun x -> x > 50) = Some 51)
173 |
174 | test "ra_tryfind b"
175 | (ra [1..100] |> ResizeArray.tryFind (fun x -> x > 180) = None)
176 |
177 | c := -1
178 | ResizeArray.iter2 (fun x y -> incr c; test "ra_iter2" (!c = x && !c = y)) (ra [0..100]) (ra [0..100])
179 | test "ra_iter2" (!c = 100)
180 |
181 | test "ra_map2"
182 | (ResizeArray.map2 (+) (ra [0..100]) (ra [0..100]) =? [0..+2..200])
183 |
184 | test "ra_choose"
185 | (ResizeArray.choose (fun x -> if x % 2 = 0 then Some (x/2) else None) (ra [0..100]) =? [0..50])
186 |
187 | test "ra_filter"
188 | (ResizeArray.filter (fun x -> x % 2 = 0) (ra [0..100]) =? [0..+2..100])
189 |
190 | test "ra_filter b"
191 | (ResizeArray.filter (fun x -> false) (ra [0..100]) =? [])
192 |
193 | test "ra_filter c"
194 | (ResizeArray.filter (fun x -> true) (ra [0..100]) =? [0..100])
195 |
196 | let p1, p2 = ResizeArray.partition (fun x -> x % 2 = 0) (ra [0..100])
197 | test "ra_partition"
198 | (p1 =? [0..+2..100] && p2 =? [1..+2..100])
199 |
200 | test "ra_rev"
201 | (ResizeArray.rev (ra [0..100]) =? [100..-1 ..0])
202 |
203 | test "ra_rev b"
204 | (ResizeArray.rev (ra [1]) =? [1])
205 |
206 | test "ra_rev c"
207 | (ResizeArray.rev (ra []) =? [])
208 |
209 | test "ra_rev d"
210 | (ResizeArray.rev (ra [1; 2]) =? [2; 1])
211 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.Set.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.Set module.
20 | module Tests.ExtCore.Collections.Set
21 |
22 | open System
23 | open NUnit.Framework
24 | //open FsCheck
25 |
26 |
27 | []
28 | let foldi () : unit =
29 | let colors =
30 | Set.ofArray [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
31 |
32 | ([], colors)
33 | ||> Set.foldi (fun lst idx el ->
34 | (idx, el) :: lst)
35 | |> assertEqual [
36 | 5, "Yellow";
37 | 4, "Violet";
38 | 3, "Red";
39 | 2, "Orange";
40 | 1, "Green";
41 | 0, "Blue"; ]
42 |
43 | []
44 | let mapToArray () : unit =
45 | let colors =
46 | Set.ofArray [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
47 |
48 | colors
49 | |> Set.mapToArray String.length
50 | |> assertEqual [|
51 | 4; 5; 6; 3; 6; 6 |]
52 |
53 | []
54 | let init () : unit =
55 | let expected =
56 | Set.ofArray [| 'a' .. 'z' |]
57 |
58 | Set.init 26 <| fun i ->
59 | char (int 'a' + i)
60 | |> assertEqual expected
61 |
62 | []
63 | let tryExtractMin () : unit =
64 | do
65 | let initialSet = Set.empty
66 | let minElement, remaining =
67 | Set.tryExtractMin initialSet
68 |
69 | minElement
70 | |> assertEqual None
71 |
72 | remaining
73 | |> assertEqual initialSet
74 |
75 | remaining
76 | |> assertSame initialSet
77 |
78 | do
79 | let initialSet = Set.ofArray [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
80 | let minElement, remaining =
81 | Set.tryExtractMin initialSet
82 |
83 | minElement
84 | |> assertEqual (Some "Blue")
85 |
86 | remaining
87 | |> assertEqual (Set.ofArray [| "Red"; "Orange"; "Yellow"; "Green"; "Violet" |])
88 |
89 | []
90 | let tryExtractMax () : unit =
91 | do
92 | let initialSet = Set.empty
93 | let maxElement, remaining =
94 | Set.tryExtractMax initialSet
95 |
96 | maxElement
97 | |> assertEqual None
98 |
99 | remaining
100 | |> assertEqual initialSet
101 |
102 | remaining
103 | |> assertSame initialSet
104 |
105 | do
106 | let maxElement, remaining =
107 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
108 | |> Set.ofArray
109 | |> Set.tryExtractMax
110 |
111 | maxElement
112 | |> assertEqual (Some "Yellow")
113 |
114 | remaining
115 | |> assertEqual (Set.ofArray [| "Red"; "Orange"; "Green"; "Blue"; "Violet" |])
116 |
117 | []
118 | let extractMin () : unit =
119 | let minElement, remaining =
120 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
121 | |> Set.ofArray
122 | |> Set.extractMin
123 |
124 | minElement
125 | |> assertEqual "Blue"
126 |
127 | remaining
128 | |> assertEqual (Set.ofArray [| "Red"; "Orange"; "Yellow"; "Green"; "Violet" |])
129 |
130 | []
131 | let extractMax () : unit =
132 | let maxElement, remaining =
133 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
134 | |> Set.ofArray
135 | |> Set.extractMax
136 |
137 | maxElement
138 | |> assertEqual "Yellow"
139 |
140 | remaining
141 | |> assertEqual (Set.ofArray [| "Red"; "Orange"; "Green"; "Blue"; "Violet" |])
142 |
143 | []
144 | let reduce () : unit =
145 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
146 | |> Set.ofArray
147 | |> Set.reduce (+)
148 | |> assertEqual "BlueGreenOrangeRedVioletYellow"
149 |
150 | []
151 | let reduceBack () : unit =
152 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
153 | |> Set.ofArray
154 | |> Set.reduceBack (+)
155 | |> assertEqual "BlueGreenOrangeRedVioletYellow"
156 |
157 | []
158 | let choose () : unit =
159 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
160 | |> Set.ofArray
161 | |> Set.choose (fun colorName ->
162 | let len = String.length colorName
163 | if len < 6 then Some len else None)
164 | |> assertEqual
165 | <| set [| 3; 4; 5 |]
166 |
167 | []
168 | let tryPick () : unit =
169 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
170 | |> Set.ofArray
171 | |> Set.tryPick (fun colorName ->
172 | if colorName.StartsWith "T" then Some (String.length colorName) else None)
173 | |> assertEqual None
174 |
175 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
176 | |> Set.ofArray
177 | |> Set.tryPick (fun colorName ->
178 | if colorName.StartsWith "G" then Some (String.length colorName) else None)
179 | |> assertEqual (Some 5)
180 |
181 | []
182 | let pick () : unit =
183 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
184 | |> Set.ofArray
185 | |> Set.pick (fun colorName ->
186 | if colorName.StartsWith "G" then Some (String.length colorName) else None)
187 | |> assertEqual 5
188 |
189 | []
190 | let tryFind () : unit =
191 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
192 | |> Set.ofArray
193 | |> Set.tryFind (fun colorName ->
194 | colorName.StartsWith "T")
195 | |> assertEqual None
196 |
197 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
198 | |> Set.ofArray
199 | |> Set.tryFind (fun colorName ->
200 | colorName.StartsWith "G")
201 | |> assertEqual (Some "Green")
202 |
203 | []
204 | let find () : unit =
205 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
206 | |> Set.ofArray
207 | |> Set.find (fun colorName ->
208 | colorName.StartsWith "G")
209 | |> assertEqual "Green"
210 |
211 | []
212 | let mapPartition () : unit =
213 | let left, right =
214 | [| "Red"; "Orange"; "Yellow"; "Green"; "Blue"; "Violet" |]
215 | |> Set.ofArray
216 | |> Set.mapPartition (fun colorName ->
217 | let len = String.length colorName
218 | if len % 2 = 0 then
219 | Choice1Of2 len
220 | else
221 | Choice2Of2 <| colorName.ToLower ())
222 |
223 | left
224 | |> assertEqual (Set.ofArray [| 4; 6; 6; 6 |])
225 |
226 | right
227 | |> assertEqual (Set.ofArray [| "red"; "green" |])
228 |
229 | []
230 | let symmetricDifference () : unit =
231 | Set.symmetricDifference Set.empty Set.empty
232 | |> assertEqual Set.empty
233 |
234 | Set.symmetricDifference (Set.ofArray [| 0..2..20 |]) (Set.ofArray [| 0..3..20 |])
235 | |> assertEqual (Set.ofArray [| 2; 3; 4; 8; 9; 10; 14; 15; 16; 20 |])
236 |
237 | []
238 | let cartesian () : unit =
239 | Set.cartesian Set.empty Set.empty
240 | |> assertEqual Set.empty
241 |
242 | Set.cartesian
243 | (Set.ofArray [| "Red"; "Green"; "Blue" |])
244 | (Set.ofArray [| 20; 30 |])
245 | |> assertEqual (Set.ofArray
246 | [|
247 | "Blue", 20;
248 | "Blue", 30;
249 | "Green", 20;
250 | "Green", 30;
251 | "Red", 20;
252 | "Red", 30; |])
253 |
254 | []
255 | let collect () : unit =
256 | [| 0; 1; 1; 2; 3; 5; 8 |]
257 | |> Set.ofArray
258 | |> Set.collect (fun el ->
259 | Set.ofArray [|
260 | el; el + 1; el * 2 |])
261 | |> assertEqual (Set.ofArray
262 | [| 0; 1; 2; 3; 4; 5; 6; 8; 9; 10; 16 |])
263 |
264 | []
265 | let condense () : unit =
266 | [| 7; 11; 13; 17; 19 |]
267 | |> Set.ofArray
268 | |> Set.condense (fun el ->
269 | Set.ofArray [| 0 .. el |])
270 | |> assertEqual (Set.ofArray [| 0; 1; 2; 3; 4; 5; 6; 7 |])
271 |
272 | []
273 | let disjoint () : unit =
274 | Set.disjoint Set.empty Set.empty
275 | |> assertTrue
276 |
277 | Set.disjoint (Set.ofArray [| 3; 6; 9; 12; 15 |]) (Set.ofArray [| 7; 14; 21; 28; 35 |])
278 | |> assertTrue
279 |
280 | Set.disjoint
281 | (Set.ofArray [| 0..20 |] |> Set.filter (fun el -> el % 2 = 0))
282 | (Set.ofArray [| 0..20 |] |> Set.filter (fun el -> el % 3 = 0))
283 | |> assertFalse
284 |
285 | []
286 | let countWith () : unit =
287 | // Test case for an empty set.
288 | Set.empty
289 | |> Set.countWith (fun x ->
290 | x % 7 = 0)
291 | |> assertEqual 0
292 |
293 | // Sample usage test cases.
294 | [| 0; 1; 2; 3; 4; 5; 6; 8; 9; 10; 16 |]
295 | |> Set.ofArray
296 | |> Set.countWith (fun x ->
297 | x < 0)
298 | |> assertEqual 0
299 |
300 | [| 0; 1; 2; 3; 4; 5; 6; 8; 9; 10; 16 |]
301 | |> Set.ofArray
302 | |> Set.countWith (fun x ->
303 | x % 7 = 0)
304 | |> assertEqual 1
305 |
306 | [| 0; 1; 2; 3; 4; 5; 6; 8; 9; 10; 16 |]
307 | |> Set.ofArray
308 | |> Set.countWith (fun x ->
309 | x % 3 = 0)
310 | |> assertEqual 4
311 |
312 |
313 | module Cartesian =
314 | []
315 | let fold () : unit =
316 | Assert.Ignore "Test not yet implemented."
317 |
318 | []
319 | let foldBack () : unit =
320 | Assert.Ignore "Test not yet implemented."
321 |
322 | []
323 | let iter () : unit =
324 | Assert.Ignore "Test not yet implemented."
325 |
326 | []
327 | let map () : unit =
328 | Assert.Ignore "Test not yet implemented."
329 |
330 | []
331 | let choose () : unit =
332 | Assert.Ignore "Test not yet implemented."
333 |
334 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Collections.VectorView.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Collections.VectorView module.
20 | module Tests.ExtCore.Collections.VectorView
21 |
22 | open System
23 | open NUnit.Framework
24 | //open FsCheck
25 |
26 |
27 | []
28 | let dummy () : unit =
29 | Assert.Ignore "Test not yet implemented."
30 |
31 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Control.Agents.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Tests for the ExtCore.Control.Agents module.
20 | module Tests.ExtCore.Control.Agents
21 |
22 | open NUnit.Framework
23 |
24 |
25 | (* TODO *)
26 | []
27 | let dummy () =
28 | Assert.Ignore "Test not yet implemented."
29 |
30 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Control.Cps.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | //
20 | namespace Tests.ExtCore.Control.Cps
21 |
22 | open NUnit.Framework
23 | open FsCheck
24 |
25 |
26 | (* TODO : Implement tests for the workflows and modules in ExtCore.Control.Cps *)
27 |
28 |
--------------------------------------------------------------------------------
/ExtCore.Tests/Control.Observable.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Tests for the ExtCore.Control.Observable module.
20 | module Tests.ExtCore.Control.Observable
21 |
22 | open NUnit.Framework
23 |
24 |
25 | (* TODO *)
26 | []
27 | let dummy () =
28 | Assert.Ignore "Test not yet implemented."
29 |
30 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.AsyncChoice.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.AsyncChoice module.
20 | module Tests.ExtCore.Control.Collections.AsyncChoice
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 |
26 |
27 | (* TODO : Implement tests for the AsyncChoice collections. *)
28 |
29 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.AsyncMaybe.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.AsyncMaybe module.
20 | module Tests.ExtCore.Control.Collections.AsyncMaybe
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 |
26 |
27 | (* TODO : Implement tests for the AsyncMaybe collections. *)
28 |
29 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.AsyncProtectedState.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.AsyncProtectedState module.
20 | module Tests.ExtCore.Control.Collections.AsyncProtectedState
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 |
26 |
27 |
28 | (* TODO : Implement tests for the AsyncProtectedState collections. *)
29 |
30 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.AsyncState.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.AsyncState module.
20 | module Tests.ExtCore.Control.Collections.AsyncState
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 |
26 |
27 | (* TODO : Implement tests for the AsyncState collections. *)
28 |
29 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.Cont.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.Cps.Cont module.
20 | module Tests.ExtCore.Control.Collections.Cps.Cont
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | /// Tests for the ExtCore.Control.Collections.Cps.Cont.Array module.
29 | module Array =
30 | []
31 | let map () : unit =
32 | Assert.Ignore "Test not yet implemented."
33 |
34 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.ProtectedState.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.ProtectedState module.
20 | module Tests.ExtCore.Control.Collections.ProtectedState
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | /// Tests for the ExtCore.Control.Collections.ProtectedState.Array module.
29 | module Array =
30 | []
31 | let iter () : unit =
32 | Assert.Ignore "Test not yet implemented."
33 |
34 | []
35 | let iteri () : unit =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | []
39 | let map () : unit =
40 | Assert.Ignore "Test not yet implemented."
41 |
42 | []
43 | let mapi () : unit =
44 | Assert.Ignore "Test not yet implemented."
45 |
46 |
47 | /// Tests for the ExtCore.Control.Collections.ProtectedState.List module.
48 | module List =
49 | []
50 | let map () : unit =
51 | Assert.Ignore "Test not yet implemented."
52 |
53 |
54 | /// Tests for the ExtCore.Control.Collections.ProtectedState.ArrayView module.
55 | module ArrayView =
56 | []
57 | let iter () : unit =
58 | Assert.Ignore "Test not yet implemented."
59 |
60 | []
61 | let iteri () : unit =
62 | Assert.Ignore "Test not yet implemented."
63 |
64 | []
65 | let map () : unit =
66 | Assert.Ignore "Test not yet implemented."
67 |
68 | []
69 | let mapi () : unit =
70 | Assert.Ignore "Test not yet implemented."
71 |
72 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.Reader.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.Reader module.
20 | module Tests.ExtCore.Control.Collections.Reader
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 |
26 |
27 | /// Helper functions for implementing tests.
28 | []
29 | module private ReaderTestHelpers =
30 | /// A subset of the F# language keywords.
31 | let keywords = Set.ofArray [| "if"; "then"; "elif"; "else"; "do"; "while"; "let"; "for"; |]
32 |
33 |
34 | /// Tests for the ExtCore.Control.Collections.Reader.Array module.
35 | module Array =
36 | []
37 | let iter () : unit =
38 | // Test case for an empty array.
39 | do
40 | let keywordCount = ref 0
41 |
42 | let testFunc =
43 | Array.empty
44 | |> Reader.Array.iter (fun str ->
45 | reader {
46 | let! isKeyword = Set.contains str
47 | if isKeyword then
48 | incr keywordCount
49 | })
50 | Reader.run testFunc keywords
51 |
52 | !keywordCount |> assertEqual 0
53 |
54 | // Sample usage test cases.
55 | do
56 | let keywordCount = ref 0
57 |
58 | let testFunc =
59 | [| "if"; "foo"; "<>"; "123"; "then"; |]
60 | |> Reader.Array.iter (fun str ->
61 | reader {
62 | let! isKeyword = Set.contains str
63 | if isKeyword then
64 | incr keywordCount
65 | })
66 | Reader.run testFunc keywords
67 |
68 | !keywordCount |> assertEqual 2
69 |
70 | []
71 | let iteri () : unit =
72 | // Test case for an empty array.
73 | do
74 | let keywordWeight = ref 0
75 |
76 | let testFunc =
77 | Array.empty
78 | |> Reader.Array.iteri (fun idx str ->
79 | reader {
80 | let! isKeyword = Set.contains str
81 | if isKeyword then
82 | keywordWeight := !keywordWeight + (idx + 1)
83 | })
84 | Reader.run testFunc keywords
85 |
86 | !keywordWeight |> assertEqual 0
87 |
88 | // Sample usage test cases.
89 | do
90 | let keywordWeight = ref 0
91 |
92 | let testFunc =
93 | [| "if"; "foo"; "<>"; "123"; "then"; |]
94 | |> Reader.Array.iteri (fun idx str ->
95 | reader {
96 | let! isKeyword = Set.contains str
97 | if isKeyword then
98 | keywordWeight := !keywordWeight + (idx + 1)
99 | })
100 | Reader.run testFunc keywords
101 |
102 | !keywordWeight |> assertEqual 6
103 |
104 | []
105 | let map () : unit =
106 | // Test case for an empty array.
107 | do
108 | let testFunc =
109 | Array.empty
110 | |> Reader.Array.map (fun str ->
111 | reader {
112 | return! Set.contains str
113 | })
114 |
115 | keywords
116 | |> Reader.run testFunc
117 | |> Array.isEmpty
118 | |> assertTrue
119 |
120 | // Sample usage test cases.
121 | do
122 | let testFunc =
123 | [| "if"; "foo"; "<>"; "123"; "then"; |]
124 | |> Reader.Array.map (fun str ->
125 | reader {
126 | return! Set.contains str
127 | })
128 | keywords
129 | |> Reader.run testFunc
130 | |> assertEqual
131 | [| true; false; false; false; true; |]
132 |
133 | []
134 | let mapi () : unit =
135 | // Test case for an empty array.
136 | do
137 | let testFunc =
138 | Array.empty
139 | |> Reader.Array.mapi (fun idx str ->
140 | reader {
141 | let! isKeyword = Set.contains str
142 | return
143 | if isKeyword then Some (sprintf "%i:%s" idx str) else None
144 | })
145 | keywords
146 | |> Reader.run testFunc
147 | |> Array.isEmpty
148 | |> assertTrue
149 |
150 | // Sample usage test cases.
151 | do
152 | let testFunc =
153 | [| "if"; "foo"; "<>"; "123"; "then"; |]
154 | |> Reader.Array.mapi (fun idx str ->
155 | reader {
156 | let! isKeyword = Set.contains str
157 | return
158 | if isKeyword then Some (sprintf "%i:%s" idx str) else None
159 | })
160 | keywords
161 | |> Reader.run testFunc
162 | |> assertEqual
163 | [| Some "0:if"; None; None; None; Some "4:then"; |]
164 |
165 |
166 | /// Tests for the ExtCore.Control.Collections.Reader.Set module.
167 | module Set =
168 | []
169 | let iter () : unit =
170 | Assert.Ignore "Test not yet implemented."
171 |
172 | []
173 | let iterBack () : unit =
174 | Assert.Ignore "Test not yet implemented."
175 |
176 | []
177 | let map () : unit =
178 | Assert.Ignore "Test not yet implemented."
179 |
180 | []
181 | let mapBack () : unit =
182 | Assert.Ignore "Test not yet implemented."
183 |
184 | []
185 | let fold () : unit =
186 | Assert.Ignore "Test not yet implemented."
187 |
188 | []
189 | let foldBack () : unit =
190 | Assert.Ignore "Test not yet implemented."
191 |
192 |
193 | /// Tests for the ExtCore.Control.Collections.Reader.IntSet module.
194 | module IntSet =
195 | []
196 | let iter () : unit =
197 | Assert.Ignore "Test not yet implemented."
198 |
199 | []
200 | let iterBack () : unit =
201 | Assert.Ignore "Test not yet implemented."
202 |
203 | []
204 | let map () : unit =
205 | Assert.Ignore "Test not yet implemented."
206 |
207 | []
208 | let mapBack () : unit =
209 | Assert.Ignore "Test not yet implemented."
210 |
211 | []
212 | let fold () : unit =
213 | Assert.Ignore "Test not yet implemented."
214 |
215 | []
216 | let foldBack () : unit =
217 | Assert.Ignore "Test not yet implemented."
218 |
219 |
220 | /// Tests for the ExtCore.Control.Collections.Reader.HashSet module.
221 | module HashSet =
222 | []
223 | let iter () : unit =
224 | Assert.Ignore "Test not yet implemented."
225 |
226 | []
227 | let iterBack () : unit =
228 | Assert.Ignore "Test not yet implemented."
229 |
230 | []
231 | let map () : unit =
232 | Assert.Ignore "Test not yet implemented."
233 |
234 | []
235 | let mapBack () : unit =
236 | Assert.Ignore "Test not yet implemented."
237 |
238 | []
239 | let fold () : unit =
240 | Assert.Ignore "Test not yet implemented."
241 |
242 | []
243 | let foldBack () : unit =
244 | Assert.Ignore "Test not yet implemented."
245 |
246 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.ReaderChoice.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.ReaderChoice module.
20 | module Tests.ExtCore.Control.Collections.ReaderChoice
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | /// Tests for the ExtCore.Control.Collections.ReaderChoice.Array module.
29 | module Array =
30 | []
31 | let map () : unit =
32 | Assert.Ignore "Test not yet implemented."
33 |
34 | []
35 | let mapi () : unit =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | []
39 | let map2 () : unit =
40 | Assert.Ignore "Test not yet implemented."
41 |
42 | []
43 | let fold () : unit =
44 | Assert.Ignore "Test not yet implemented."
45 |
46 | []
47 | let foldi () : unit =
48 | Assert.Ignore "Test not yet implemented."
49 |
50 | []
51 | let init () : unit =
52 | Assert.Ignore "Test not yet implemented."
53 |
54 | []
55 | let iter () : unit =
56 | Assert.Ignore "Test not yet implemented."
57 |
58 | []
59 | let iteri () : unit =
60 | Assert.Ignore "Test not yet implemented."
61 |
62 | []
63 | let reduce () : unit =
64 | Assert.Ignore "Test not yet implemented."
65 |
66 |
67 | /// Tests for the ExtCore.Control.Collections.ReaderChoice.List module.
68 | module List =
69 | []
70 | let fold () : unit =
71 | Assert.Ignore "Test not yet implemented."
72 |
73 | []
74 | let map2 () : unit =
75 | Assert.Ignore "Test not yet implemented."
76 |
77 | []
78 | let mapi2 () : unit =
79 | Assert.Ignore "Test not yet implemented."
80 |
81 | []
82 | let iter2 () : unit =
83 | Assert.Ignore "Test not yet implemented."
84 |
85 |
86 | /// Tests for the ExtCore.Control.Collections.ReaderChoice.Seq module.
87 | module Seq =
88 | []
89 | let iter () : unit =
90 | Assert.Ignore "Test not yet implemented."
91 |
92 |
93 | /// Tests for the ExtCore.Control.Collections.ReaderChoice.Set module.
94 | module Set =
95 | []
96 | let fold () : unit =
97 | Assert.Ignore "Test not yet implemented."
98 |
99 | []
100 | let mapToArray () : unit =
101 | Assert.Ignore "Test not yet implemented."
102 |
103 |
104 | /// Tests for the ExtCore.Control.Collections.ReaderChoice.ArrayView module.
105 | module ArrayView =
106 | []
107 | let fold () : unit =
108 | Assert.Ignore "Test not yet implemented."
109 |
110 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.ReaderMaybe.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.ReaderMaybe module.
20 | module Tests.ExtCore.Control.Collections.ReaderMaybe
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | /// Tests for the ExtCore.Control.Collections.ReaderMaybe.Array module.
29 | module Array =
30 | []
31 | let map () : unit =
32 | Assert.Ignore "Test not yet implemented."
33 |
34 | []
35 | let mapi () : unit =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | []
39 | let map2 () : unit =
40 | Assert.Ignore "Test not yet implemented."
41 |
42 | []
43 | let fold () : unit =
44 | Assert.Ignore "Test not yet implemented."
45 |
46 | []
47 | let foldi () : unit =
48 | Assert.Ignore "Test not yet implemented."
49 |
50 | []
51 | let init () : unit =
52 | Assert.Ignore "Test not yet implemented."
53 |
54 | []
55 | let iter () : unit =
56 | Assert.Ignore "Test not yet implemented."
57 |
58 | []
59 | let iteri () : unit =
60 | Assert.Ignore "Test not yet implemented."
61 |
62 | []
63 | let reduce () : unit =
64 | Assert.Ignore "Test not yet implemented."
65 |
66 |
67 | /// Tests for the ExtCore.Control.Collections.ReaderMaybe.List module.
68 | module List =
69 | []
70 | let fold () : unit =
71 | Assert.Ignore "Test not yet implemented."
72 |
73 | []
74 | let map2 () : unit =
75 | Assert.Ignore "Test not yet implemented."
76 |
77 | []
78 | let mapi2 () : unit =
79 | Assert.Ignore "Test not yet implemented."
80 |
81 | []
82 | let iter2 () : unit =
83 | Assert.Ignore "Test not yet implemented."
84 |
85 |
86 | /// Tests for the ExtCore.Control.Collections.ReaderMaybe.Seq module.
87 | module Seq =
88 | []
89 | let iter () : unit =
90 | Assert.Ignore "Test not yet implemented."
91 |
92 |
93 | /// Tests for the ExtCore.Control.Collections.ReaderMaybe.Set module.
94 | module Set =
95 | []
96 | let fold () : unit =
97 | Assert.Ignore "Test not yet implemented."
98 |
99 | []
100 | let mapToArray () : unit =
101 | Assert.Ignore "Test not yet implemented."
102 |
103 |
104 | /// Tests for the ExtCore.Control.Collections.ReaderMaybe.ArrayView module.
105 | module ArrayView =
106 | []
107 | let fold () : unit =
108 | Assert.Ignore "Test not yet implemented."
109 |
110 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.ReaderProtectedState.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.ReaderProtectedState module.
20 | module Tests.ExtCore.Control.Collections.ReaderProtectedState
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | /// Tests for the ExtCore.Control.Collections.ReaderProtectedState.Array module.
29 | module Array =
30 | []
31 | let iter () : unit =
32 | Assert.Ignore "Test not yet implemented."
33 |
34 | []
35 | let iteri () : unit =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | []
39 | let map () : unit =
40 | Assert.Ignore "Test not yet implemented."
41 |
42 | []
43 | let mapi () : unit =
44 | Assert.Ignore "Test not yet implemented."
45 |
46 |
47 | /// Tests for the ExtCore.Control.Collections.ReaderProtectedState.List module.
48 | module List =
49 | []
50 | let map () : unit =
51 | Assert.Ignore "Test not yet implemented."
52 |
53 |
54 | /// Tests for the ExtCore.Control.Collections.ReaderProtectedState.ArrayView module.
55 | module ArrayView =
56 | []
57 | let iter () : unit =
58 | Assert.Ignore "Test not yet implemented."
59 |
60 | []
61 | let iteri () : unit =
62 | Assert.Ignore "Test not yet implemented."
63 |
64 | []
65 | let map () : unit =
66 | Assert.Ignore "Test not yet implemented."
67 |
68 | []
69 | let mapi () : unit =
70 | Assert.Ignore "Test not yet implemented."
71 |
72 |
--------------------------------------------------------------------------------
/ExtCore.Tests/ControlCollections.ReaderState.fs:
--------------------------------------------------------------------------------
1 | (*
2 |
3 | Copyright 2013 Jack Pappas
4 |
5 | Licensed under the Apache License, Version 2.0 (the "License");
6 | you may not use this file except in compliance with the License.
7 | You may obtain a copy of the License at
8 |
9 | http://www.apache.org/licenses/LICENSE-2.0
10 |
11 | Unless required by applicable law or agreed to in writing, software
12 | distributed under the License is distributed on an "AS IS" BASIS,
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | See the License for the specific language governing permissions and
15 | limitations under the License.
16 |
17 | *)
18 |
19 | /// Unit tests for the ExtCore.Control.Collections.ReaderState module.
20 | module Tests.ExtCore.Control.Collections.ReaderState
21 |
22 | open ExtCore.Control
23 | open ExtCore.Control.Collections
24 | open NUnit.Framework
25 | //open FsCheck
26 |
27 |
28 | /// Tests for the ExtCore.Control.Collections.ReaderState.Array module.
29 | module Array =
30 | []
31 | let iter () : unit =
32 | Assert.Ignore "Test not yet implemented."
33 |
34 | []
35 | let iteri () : unit =
36 | Assert.Ignore "Test not yet implemented."
37 |
38 | []
39 | let map () : unit =
40 | Assert.Ignore "Test not yet implemented."
41 |
42 | []
43 | let mapi () : unit =
44 | Assert.Ignore "Test not yet implemented."
45 |
46 | []
47 | let mapBack () : unit =
48 | Assert.Ignore "Test not yet implemented."
49 |
50 | []
51 | let mapiBack () : unit =
52 | Assert.Ignore "Test not yet implemented."
53 |
54 | []
55 | let map2 () : unit =
56 | Assert.Ignore "Test not yet implemented."
57 |
58 | []
59 | let mapi2 () : unit =
60 | Assert.Ignore "Test not yet implemented."
61 |
62 | []
63 | let fold () : unit =
64 | Assert.Ignore "Test not yet implemented."
65 |
66 | []
67 | let foldi () : unit =
68 | Assert.Ignore "Test not yet implemented."
69 |
70 |
71 | /// Tests for the ExtCore.Control.Collections.ReaderState.TaggedArray module.
72 | module TaggedArray =
73 | []
74 | let mapi () : unit =
75 | Assert.Ignore "Test not yet implemented."
76 |
77 | []
78 | let mapiBack () : unit =
79 | Assert.Ignore "Test not yet implemented."
80 |
81 | []
82 | let foldi () : unit =
83 | Assert.Ignore "Test not yet implemented."
84 |
85 |
86 | /// Tests for the ExtCore.Control.Collections.ReaderState.ArrayView module.
87 | module ArrayView =
88 | [