Skip to content

Commit

Permalink
perfect-numbers: add canonical data (#611)
Browse files Browse the repository at this point in the history
  • Loading branch information
stkent authored and ErikSchierboom committed Feb 28, 2017
1 parent b25a8e1 commit 19d0c77
Showing 1 changed file with 108 additions and 0 deletions.
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."
}
}
]
}
]
}

0 comments on commit 19d0c77

Please sign in to comment.