From 905d77a701104900f0de7f35d34ae14d1acd2ab4 Mon Sep 17 00:00:00 2001 From: Tommy Schaefer Date: Wed, 27 Jul 2016 21:09:19 -0500 Subject: [PATCH] binary: split error case tests * Update binary tests to make one assertion per test * Use null to indicate invalid input rather than -1 --- binary.json | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/binary.json b/binary.json index f0dc267c2c..b0544c8a34 100644 --- a/binary.json +++ b/binary.json @@ -46,14 +46,34 @@ "expected": 31 }, { - "description": "numbers other than one and zero raise an error", - "binary": ["012", "2"], - "expected": -1 + "description": "2 is not a valid binary digit", + "binary": "2", + "expected": null }, { - "description": "containing letters raises an error", - "binary": ["10nope", "nope10", "10nope10", "001 nope"], - "expected": -1 + "description": "a number containing a non-binary digit is invalid", + "binary": "01201", + "expected": null + }, + { + "description": "a number with trailing non-binary characters is invalid", + "binary": "10nope", + "expected": null + }, + { + "description": "a number with leading non-binary characters is invalid", + "binary": "nope10", + "expected": null + }, + { + "description": "a number with internal non-binary characters is invalid", + "binary": "10nope10", + "expected": null + }, + { + "description": "a number and a word whitespace spearated is invalid", + "binary": "001 nope", + "expected": null } ] }