Skip to content

Instantly share code, notes, and snippets.

@aloisdg
Created November 26, 2018 17:13
Show Gist options
  • Save aloisdg/716e4b540125c03fee0bb714e12a9fa7 to your computer and use it in GitHub Desktop.
Save aloisdg/716e4b540125c03fee0bb714e12a9fa7 to your computer and use it in GitHub Desktop.
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