-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perfect-numbers: add canonical data (#611)
- Loading branch information
1 parent
b25a8e1
commit 19d0c77
Showing
1 changed file
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |