Skip to content
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: add canonical data #611

Merged
merged 1 commit into from
Feb 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions exercises/perfect-numbers/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"exercise": "perfect-numbers",
"version": "1.0.0",
"cases": [
{
"description": "Perfect numbers",
"cases": [
{
"description": "Smallest perfect number is classified correctly",
"property": "classify",
"input": 6,
"expected": "perfect"
},
{
"description": "Medium perfect number is classified correctly",
"property": "classify",
"input": 28,
"expected": "perfect"
},
{
"description": "Large perfect number is classified correctly",
"property": "classify",
"input": 33550336,
"expected": "perfect"
}
]
},
{
"description": "Abundant numbers",
"cases": [
{
"description": "Smallest abundant number is classified correctly",
"property": "classify",
"input": 12,
"expected": "abundant"
},
{
"description": "Medium abundant number is classified correctly",
"property": "classify",
"input": 30,
"expected": "abundant"
},
{
"description": "Large abundant number is classified correctly",
"property": "classify",
"input": 33550335,
"expected": "abundant"
}
]
},
{
"description": "Deficient numbers",
"cases": [
{
"description": "Smallest prime deficient number is classified correctly",
"property": "classify",
"input": 2,
"expected": "deficient"
},
{
"description": "Smallest non-prime deficient number is classified correctly",
"property": "classify",
"input": 4,
"expected": "deficient"
},
{
"description": "Medium deficient number is classified correctly",
"property": "classify",
"input": 32,
"expected": "deficient"
},
{
"description": "Large deficient number is classified correctly",
"property": "classify",
"input": 33550337,
"expected": "deficient"
},
{
"description": "Edge case (no factors other than itself) is classified correctly",
"property": "classify",
"input": 1,
"expected": "deficient"
}
]
},
{
"description": "Invalid inputs",
"cases": [
{
"description": "Non-negative integer is rejected (not a natural number)",
"property": "classify",
"input": 0,
"expected": {
"error": "Classification is only possible for natural numbers."
}
},
{
"description": "Negative integer is rejected (not a natural number)",
"property": "classify",
"input": -1,
"expected": {
"error": "Classification is only possible for natural numbers."
}
}
]
}
]
}