From 19d0c7714ce664a1ad762af624c17f8e269fa8b2 Mon Sep 17 00:00:00 2001 From: Stuart Kent Date: Tue, 28 Feb 2017 08:57:14 -0500 Subject: [PATCH] perfect-numbers: add canonical data (#611) --- exercises/perfect-numbers/canonical-data.json | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 exercises/perfect-numbers/canonical-data.json diff --git a/exercises/perfect-numbers/canonical-data.json b/exercises/perfect-numbers/canonical-data.json new file mode 100644 index 0000000000..d5c25ddd94 --- /dev/null +++ b/exercises/perfect-numbers/canonical-data.json @@ -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." + } + } + ] + } + ] +} \ No newline at end of file