Skip to content

Commit

Permalink
First batch
Browse files Browse the repository at this point in the history
  • Loading branch information
latkin committed May 27, 2015
1 parent 647787a commit fe8661f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ type ArrayModule() =
member this.ChunkBySize() =

// int Seq
Assert.AreEqual([| [|1..4|]; [|5..8|] |], Array.chunkBySize 4 [|1..8|])
Assert.AreEqual([| [|1..4|]; [|5..8|]; [|9..10|] |], Array.chunkBySize 4 [|1..10|])
Assert.AreEqual([| [|1|]; [|2|]; [|3|]; [|4|] |], Array.chunkBySize 1 [|1..4|])
Assert.IsTrue([| [|1..4|]; [|5..8|] |] = Array.chunkBySize 4 [|1..8|])
Assert.IsTrue([| [|1..4|]; [|5..8|]; [|9..10|] |] = Array.chunkBySize 4 [|1..10|])
Assert.IsTrue([| [|1|]; [|2|]; [|3|]; [|4|] |] = Array.chunkBySize 1 [|1..4|])

// string Seq
Assert.AreEqual([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |], Array.chunkBySize 2 [|"a";"b";"c";"d";"e"|])
Assert.IsTrue([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |] = Array.chunkBySize 2 [|"a";"b";"c";"d";"e"|])

// empty Seq
Assert.AreEqual([||], Array.chunkBySize 3 [||])
Assert.IsTrue([||] = Array.chunkBySize 3 [||])

// null Seq
let nullArr:_[] = null
Expand All @@ -172,18 +172,18 @@ type ArrayModule() =
member this.SplitInto() =

// int array
Assert.AreEqual([| [|1..4|]; [|5..7|]; [|8..10|] |], Array.splitInto 3 [|1..10|])
Assert.AreEqual([| [|1..4|]; [|5..8|]; [|9..11|] |], Array.splitInto 3 [|1..11|])
Assert.AreEqual([| [|1..4|]; [|5..8|]; [|9..12|] |], Array.splitInto 3 [|1..12|])
Assert.IsTrue([| [|1..4|]; [|5..7|]; [|8..10|] |] = Array.splitInto 3 [|1..10|])
Assert.IsTrue([| [|1..4|]; [|5..8|]; [|9..11|] |] = Array.splitInto 3 [|1..11|])
Assert.IsTrue([| [|1..4|]; [|5..8|]; [|9..12|] |] = Array.splitInto 3 [|1..12|])

Assert.AreEqual([| [|1..2|]; [|3|]; [|4|]; [|5|] |], Array.splitInto 4 [|1..5|])
Assert.AreEqual([| [|1|]; [|2|]; [|3|]; [|4|] |], Array.splitInto 20 [|1..4|])
Assert.IsTrue([| [|1..2|]; [|3|]; [|4|]; [|5|] |] = Array.splitInto 4 [|1..5|])
Assert.IsTrue([| [|1|]; [|2|]; [|3|]; [|4|] |] = Array.splitInto 20 [|1..4|])

// string array
Assert.AreEqual([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |], Array.splitInto 3 [|"a";"b";"c";"d";"e"|])
Assert.IsTrue([| [|"a"; "b"|]; [|"c";"d"|]; [|"e"|] |] = Array.splitInto 3 [|"a";"b";"c";"d";"e"|])

// empty array
Assert.AreEqual([| |], Array.splitInto 3 [| |])
Assert.IsTrue([| |] = Array.splitInto 3 [| |])

// null array
let nullArr:_[] = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ type ListModule() =
member this.ChunkBySize() =

// int list
Assert.AreEqual([ [1..4]; [5..8] ], List.chunkBySize 4 [1..8])
Assert.AreEqual([ [1..4]; [5..8]; [9..10] ], List.chunkBySize 4 [1..10])
Assert.AreEqual([ [1]; [2]; [3]; [4] ], List.chunkBySize 1 [1..4])
Assert.IsTrue([ [1..4]; [5..8] ] = List.chunkBySize 4 [1..8])
Assert.IsTrue([ [1..4]; [5..8]; [9..10] ] = List.chunkBySize 4 [1..10])
Assert.IsTrue([ [1]; [2]; [3]; [4] ] = List.chunkBySize 1 [1..4])

// string list
Assert.AreEqual([ ["a"; "b"]; ["c";"d"]; ["e"] ], List.chunkBySize 2 ["a";"b";"c";"d";"e"])
Assert.IsTrue([ ["a"; "b"]; ["c";"d"]; ["e"] ] = List.chunkBySize 2 ["a";"b";"c";"d";"e"])

// empty list
Assert.AreEqual([], List.chunkBySize 3 [])
Assert.IsTrue([] = List.chunkBySize 3 [])

// invalidArg
CheckThrowsArgumentException (fun () -> List.chunkBySize 0 [1..10] |> ignore)
Expand All @@ -132,18 +132,18 @@ type ListModule() =
member this.SplitInto() =

// int list
Assert.AreEqual([ [1..4]; [5..7]; [8..10] ], List.splitInto 3 [1..10])
Assert.AreEqual([ [1..4]; [5..8]; [9..11] ], List.splitInto 3 [1..11])
Assert.AreEqual([ [1..4]; [5..8]; [9..12] ], List.splitInto 3 [1..12])
Assert.IsTrue([ [1..4]; [5..7]; [8..10] ] = List.splitInto 3 [1..10])
Assert.IsTrue([ [1..4]; [5..8]; [9..11] ] = List.splitInto 3 [1..11])
Assert.IsTrue([ [1..4]; [5..8]; [9..12] ] = List.splitInto 3 [1..12])

Assert.AreEqual([ [1..2]; [3]; [4]; [5] ], List.splitInto 4 [1..5])
Assert.AreEqual([ [1]; [2]; [3]; [4] ], List.splitInto 20 [1..4])
Assert.IsTrue([ [1..2]; [3]; [4]; [5] ] = List.splitInto 4 [1..5])
Assert.IsTrue([ [1]; [2]; [3]; [4] ] = List.splitInto 20 [1..4])

// string list
Assert.AreEqual([ ["a"; "b"]; ["c";"d"]; ["e"] ], List.splitInto 3 ["a";"b";"c";"d";"e"])
Assert.IsTrue([ ["a"; "b"]; ["c";"d"]; ["e"] ] = List.splitInto 3 ["a";"b";"c";"d";"e"])

// empty list
Assert.AreEqual([], List.splitInto 3 [])
Assert.IsTrue([] = List.splitInto 3 [])

// invalidArg
CheckThrowsArgumentException (fun () -> List.splitInto 0 [1..10] |> ignore)
Expand Down Expand Up @@ -335,7 +335,7 @@ type ListModule() =
Assert.AreEqual(expectedStrList, List.except strList2 strList1)

// empty list
let emptyIntList = []
let emptyIntList : int list = []
Assert.AreEqual([1..100], List.except emptyIntList intList1)
Assert.AreEqual(emptyIntList, List.except intList1 emptyIntList)
Assert.AreEqual(emptyIntList, List.except emptyIntList emptyIntList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,12 @@ type ListModule02() =
Assert.AreEqual(["str1";"str2"], List.truncate 2 ["str1";"str2";"str3"])

// empty list
Assert.AreEqual([], List.truncate 0 [])
Assert.AreEqual([], List.truncate 1 [])
Assert.AreEqual(([] : int list), List.truncate 0 ([] : int list))
Assert.AreEqual(([] : int list), List.truncate 1 ([] : int list))

// negative count
Assert.AreEqual([], List.truncate -1 [1..5])
Assert.AreEqual([], List.truncate System.Int32.MinValue [1..5])
Assert.AreEqual(([] : int list), List.truncate -1 [1..5])
Assert.AreEqual(([] : int list), List.truncate System.Int32.MinValue [1..5])

()

Expand Down Expand Up @@ -984,7 +984,7 @@ type ListModule02() =
{
InputList = [1..10]
WindowSize = 25
ExpectedList = []
ExpectedList = ([] : int list list)
Exception = None
} |> testWindowed
{
Expand All @@ -994,15 +994,15 @@ type ListModule02() =
Exception = None
} |> testWindowed
{
InputList = []
InputList = ([] : int list)
WindowSize = 2
ExpectedList = []
ExpectedList = ([] : int list list)
Exception = None
} |> testWindowed
{
InputList = [1..10]
WindowSize = 0
ExpectedList = []
ExpectedList = ([] : int list list)
Exception = Some typeof<ArgumentException>
} |> testWindowed

Expand Down
2 changes: 1 addition & 1 deletion tests/fsharpqa/testenv/src/diff/diff.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<OpenBuild Condition=" '$(OpenBuild)' == '' ">True</OpenBuild>
<OpenDrop>..\..\..\..\..\$(Configuration)\net40\bin</OpenDrop>
<TargetFSharpCoreVersion>4.3.1.0</TargetFSharpCoreVersion>
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
<Name>HostedCompilerServer</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down

0 comments on commit fe8661f

Please sign in to comment.