-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perfect-numbers: stub implementation passes all tests #710
Comments
Below, I've modified using Test
include("perfect-numbers.jl")
@testset "Perfect numbers" begin
@testset "Smallest perfect number is classified correctly" begin
@test isperfect(6)
end
@testset "Medium perfect number is classified correctly" begin
@test isperfect(28)
end
@testset "Large perfect number is classified correctly" begin
@test isperfect(33550336)
end
@testset "Correctly handles non-perfect numbers" begin
@test !isperfect(12)
@test !isperfect(4)
end
end
@testset "Abundant numbers" begin
@testset "Smallest abundant number is classified correctly" begin
@test isabundant(12)
end
@testset "Medium abundant number is classified correctly" begin
@test isabundant(30)
end
@testset "Large abundant number is classified correctly" begin
@test isabundant(33550335)
end
@testset "Correctly handles non-abundant numbers" begin
@test !isabundant(6)
@test !isabundant(32)
end
end
@testset "Deficient numbers" begin
@testset "Smallest prime deficient number is classified correctly" begin
@test isdeficient(2)
end
@testset "Smallest non-prime deficient number is classified correctly" begin
@test isdeficient(4)
end
@testset "Medium deficient number is classified correctly" begin
@test isdeficient(32)
end
@testset "Large deficient number is classified correctly" begin
@test isdeficient(33550337)
end
@testset "Edge case (no factors other than itself) is classified correctly" begin
@test isdeficient(1)
end
@testset "Correctly handles non-deficient numbers" begin
@test !isdeficient(28)
@test !isdeficient(30)
end
end
@testset "Invalid inputs" begin
@testset "Zero is rejected (not a natural number)" begin
@test_throws DomainError isdeficient(0)
@test_throws DomainError isperfect(0)
@test_throws DomainError isabundant(0)
end
@testset "Negative integer is rejected (not a natural number)" begin
@test_throws DomainError isdeficient(-1)
@test_throws DomainError isperfect(-1)
@test_throws DomainError isabundant(-1)
end
end
|
@depial Great. Would you be willing to submit a PR? |
@ErikSchierboom The PR can be found here. Sorry I didn't open it directly, but I wasn't aware of the process of creating a branch from my fork to submit a PR with just a single commit. A side note: the |
Hmmm, interesting. Would you be willing to take a look at that too? |
I've merged that PR. Could you rebase this PR? |
Everything should be synced now |
If I use the following stub implementation, all tests pass:
The text was updated successfully, but these errors were encountered: