Created
November 26, 2018 17:13
-
-
Save aloisdg/716e4b540125c03fee0bb714e12a9fa7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tests | |
open System | |
open Xunit | |
let cycle inputs = | |
let list = inputs |> Seq.skip 1 | |
let head = inputs |> Seq.head | |
Seq.append list [head] | |
[<Fact>] | |
let ``A maps to B and B to A`` () = | |
let given = ["A";"B"] | |
let expected = ["B";"A"] | |
let actual = given |> cycle | |
Assert.Equal(expected, actual) | |
[<Fact>] | |
let ``A maps to B, B to C and C to A`` () = | |
let given = ["A";"B";"C"] | |
let expected = ["B";"C";"A"] | |
let actual = given |> cycle | |
Assert.Equal(expected, actual) | |
[<Fact>] | |
let ``A maps to B, B to C, C to D and D to A`` () = | |
let given = ["A";"B";"C";"D"] | |
let expected = ["B";"C";"D";"A"] | |
let actual = given |> cycle | |
Assert.Equal(expected, actual) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment