1
exercism fetch fsharp sublist

SublistTest.fs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
module SublistTest

open Xunit
open FsUnit.Xunit

open Sublist

[<Fact>]
let ``Empty equals empty`` () =
    sublist [] [] |> should equal Equal

[<Fact(Skip = "Remove to run test")>]
let ``Empty is a sublist of anything`` () =
    sublist [] [1; 2; 3; 4] |> should equal Sublist

[<Fact(Skip = "Remove to run test")>]
let ``Anything is a superlist of empty`` () =
    sublist [1; 2; 3; 4] [] |> should equal Superlist

[<Fact(Skip = "Remove to run test")>]
let ``1 is not 2`` () =
    sublist [1] [2] |> should equal Unequal

[<Fact(Skip = "Remove to run test")>]
let ``Compare larger equal lists`` () =
    let xs = List.replicate 1000 'x'
    sublist xs xs |> should equal Equal

[<Fact(Skip = "Remove to run test")>]
let ``Sublist at start`` () =
    sublist [1; 2; 3] [1; 2; 3; 4; 5] |> should equal Sublist

[<Fact(Skip = "Remove to run test")>]
let ``Sublist in middle`` () =
    sublist [4; 3; 2] [5; 4; 3; 2; 1] |> should equal Sublist

[<Fact(Skip = "Remove to run test")>]
let ``Sublist at end`` () =
    sublist [3; 4; 5] [1; 2; 3; 4; 5] |> should equal Sublist

[<Fact(Skip = "Remove to run test")>]
let ``Partially matching sublist at start`` () =
    sublist [1; 1; 2] [1; 1; 1; 2] |> should equal Sublist

[<Fact(Skip = "Remove to run test")>]
let ``Sublist early in huge list`` () =
    sublist [3; 4; 5] [1 .. 1000000]  |> should equal Sublist
 
[<Fact(Skip = "Remove to run test")>]
let ``Huge sublist not in huge list`` () =
    sublist [10 .. 1000001] [1 .. 1000000] |> should equal Unequal

[<Fact(Skip = "Remove to run test")>]
let ``Superlist at start`` () =
    sublist [1; 2; 3; 4; 5] [1; 2; 3] |> should equal Superlist

[<Fact(Skip = "Remove to run test")>]
let ``Superlist in middle`` () =
    sublist [5; 4; 3; 2; 1] [4; 3; 2] |> should equal Superlist

[<Fact(Skip = "Remove to run test")>]
let ``Superlist at end`` () =
    sublist [1; 2; 3; 4; 5] [3; 4; 5] |> should equal Superlist

[<Fact(Skip = "Remove to run test")>]
let ``Partially matching superlist at start`` () =
    sublist [1; 1; 1; 2] [1; 1; 2] |> should equal Superlist

[<Fact(Skip = "Remove to run test")>]
let ``Superlist early in huge list`` () =
    sublist [1 .. 1000000] [3; 4; 5] |> should equal Superlist

[<Fact(Skip = "Remove to run test")>]
let ``Recurring values sublist`` () =
    sublist [1; 2; 1; 2; 3] [1; 2; 3; 1; 2; 1; 2; 3; 2; 1] |> should equal Sublist

[<Fact(Skip = "Remove to run test")>]
let ``Recurring values unequal`` () =
    sublist [1; 2; 1; 2; 3] [1; 2; 3; 1; 2; 3; 2; 3; 2; 1] |> should equal Unequal