1
exercism fetch fsharp perfect-numbers

PerfectNumbersTest.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
// This file was auto-generated based on version 1.0.1 of the canonical data.

module PerfectNumbersTest

open FsUnit.Xunit
open Xunit

open PerfectNumbers

[<Fact>]
let ``Smallest perfect number is classified correctly`` () =
    classify 6 |> should equal (Some Perfect)

[<Fact(Skip = "Remove to run test")>]
let ``Medium perfect number is classified correctly`` () =
    classify 28 |> should equal (Some Perfect)

[<Fact(Skip = "Remove to run test")>]
let ``Large perfect number is classified correctly`` () =
    classify 33550336 |> should equal (Some Perfect)

[<Fact(Skip = "Remove to run test")>]
let ``Smallest abundant number is classified correctly`` () =
    classify 12 |> should equal (Some Abundant)

[<Fact(Skip = "Remove to run test")>]
let ``Medium abundant number is classified correctly`` () =
    classify 30 |> should equal (Some Abundant)

[<Fact(Skip = "Remove to run test")>]
let ``Large abundant number is classified correctly`` () =
    classify 33550335 |> should equal (Some Abundant)

[<Fact(Skip = "Remove to run test")>]
let ``Smallest prime deficient number is classified correctly`` () =
    classify 2 |> should equal (Some Deficient)

[<Fact(Skip = "Remove to run test")>]
let ``Smallest non-prime deficient number is classified correctly`` () =
    classify 4 |> should equal (Some Deficient)

[<Fact(Skip = "Remove to run test")>]
let ``Medium deficient number is classified correctly`` () =
    classify 32 |> should equal (Some Deficient)

[<Fact(Skip = "Remove to run test")>]
let ``Large deficient number is classified correctly`` () =
    classify 33550337 |> should equal (Some Deficient)

[<Fact(Skip = "Remove to run test")>]
let ``Edge case (no factors other than itself) is classified correctly`` () =
    classify 1 |> should equal (Some Deficient)

[<Fact(Skip = "Remove to run test")>]
let ``Zero is rejected (not a natural number)`` () =
    classify 0 |> should equal None

[<Fact(Skip = "Remove to run test")>]
let ``Negative integer is rejected (not a natural number)`` () =
    classify -1 |> should equal None