1
exercism fetch delphi perfect-numbers

uPerfectNumbersTest.pas

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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
unit uPerfectNumbersTest;

interface
uses
  DUnitX.TestFramework;

type

  [TestFixture]
  PerfectNumbersTest = class(TObject) 
  public
    [Test]
//  [Ignore('Comment the "[Ignore]" statement to run the test')]
    procedure Can_classify_3_as_deficient;

    [Test]
    [Ignore]
    procedure Can_classify_7_as_deficient;

    [Test]
    [Ignore]
    procedure Can_classify_13_as_deficient;

    [Test]
    [Ignore]
    procedure Can_classify_6_as_perfect;

    [Test]
    [Ignore]
    procedure Can_classify_28_as_perfect;

    [Test]
    [Ignore]
    procedure Can_classify_496_as_perfect;

    [Test]
    [Ignore]
    procedure Can_classify_12_as_abundant;

    [Test]
    [Ignore]
    procedure Can_classify_18_as_abundant;

    [Test]
    [Ignore]
    procedure Can_classify_20_as_abundant;
  end;

implementation
uses uPerfectNumbers;

procedure PerfectNumbersTest.Can_classify_3_as_deficient;
begin
  Assert.AreEqual(Deficient, PerfectNumber.Classify(3));
end;

procedure PerfectNumbersTest.Can_classify_7_as_deficient;
begin
  Assert.AreEqual(Deficient, PerfectNumber.Classify(7));
end;

procedure PerfectNumbersTest.Can_classify_13_as_deficient;
begin
  Assert.AreEqual(Deficient, PerfectNumber.Classify(13));
end;

procedure PerfectNumbersTest.Can_classify_6_as_perfect;
begin
  Assert.AreEqual(Perfect, PerfectNumber.Classify(6));
end;

procedure PerfectNumbersTest.Can_classify_28_as_perfect;
begin
  Assert.AreEqual(Perfect, PerfectNumber.Classify(28));
end;

procedure PerfectNumbersTest.Can_classify_496_as_perfect;
begin
  Assert.AreEqual(Perfect, PerfectNumber.Classify(496));
end;

procedure PerfectNumbersTest.Can_classify_12_as_abundant;
begin
  Assert.AreEqual(Abundant, PerfectNumber.Classify(12));
end;

procedure PerfectNumbersTest.Can_classify_18_as_abundant;
begin
  Assert.AreEqual(Abundant, PerfectNumber.Classify(18));
end;

procedure PerfectNumbersTest.Can_classify_20_as_abundant;
begin
  Assert.AreEqual(Abundant, PerfectNumber.Classify(20));
end;

initialization
  TDUnitX.RegisterTestFixture(PerfectNumbersTest);
end.