@@ -6,63 +6,67 @@ include("perfect-numbers.jl")
6
6
@testset " Perfect numbers" begin
7
7
8
8
@testset " Smallest perfect number is classified correctly" begin
9
- @test classify (6 ) == :perfect
9
+ @test isperfect (6 )
10
10
end
11
11
12
12
@testset " Medium perfect number is classified correctly" begin
13
- @test classify (28 ) == :perfect
13
+ @test isperfect (28 )
14
14
end
15
15
16
16
@testset " Large perfect number is classified correctly" begin
17
- @test classify (33550336 ) == :perfect
17
+ @test isperfect (33550336 )
18
18
end
19
19
end
20
20
21
21
@testset " Abundant numbers" begin
22
22
23
23
@testset " Smallest abundant number is classified correctly" begin
24
- @test classify (12 ) == :abundant
24
+ @test isabundant (12 )
25
25
end
26
26
27
27
@testset " Medium abundant number is classified correctly" begin
28
- @test classify (30 ) == :abundant
28
+ @test isabundant (30 )
29
29
end
30
30
31
31
@testset " Large abundant number is classified correctly" begin
32
- @test classify (33550335 ) == :abundant
32
+ @test isabundant (33550335 )
33
33
end
34
34
end
35
35
36
36
@testset " Deficient numbers" begin
37
37
38
38
@testset " Smallest prime deficient number is classified correctly" begin
39
- @test classify (2 ) == :deficient
39
+ @test isdeficient (2 )
40
40
end
41
41
42
42
@testset " Smallest non-prime deficient number is classified correctly" begin
43
- @test classify (4 ) == :deficient
43
+ @test isdeficient (4 )
44
44
end
45
45
46
46
@testset " Medium deficient number is classified correctly" begin
47
- @test classify (32 ) == :deficient
47
+ @test isdeficient (32 )
48
48
end
49
49
50
50
@testset " Large deficient number is classified correctly" begin
51
- @test classify (33550337 ) == :deficient
51
+ @test isdeficient (33550337 )
52
52
end
53
53
54
54
@testset " Edge case (no factors other than itself) is classified correctly" begin
55
- @test classify (1 ) == :deficient
55
+ @test isdeficient (1 )
56
56
end
57
57
end
58
58
59
59
@testset " Invalid inputs" begin
60
60
61
61
@testset " Zero is rejected (not a natural number)" begin
62
- @test_throws DomainError classify (0 )
62
+ @test_throws DomainError isdeficient (0 )
63
+ @test_throws DomainError isperfect (0 )
64
+ @test_throws DomainError isabundant (0 )
63
65
end
64
66
65
67
@testset " Negative integer is rejected (not a natural number)" begin
66
- @test_throws DomainError classify (- 1 )
68
+ @test_throws DomainError isdeficient (- 1 )
69
+ @test_throws DomainError isperfect (- 1 )
70
+ @test_throws DomainError isabundant (- 1 )
67
71
end
68
72
end
0 commit comments