diff --git a/exercises/ocr-numbers/canonical-data.json b/exercises/ocr-numbers/canonical-data.json index 4d422480aa..6059cba356 100644 --- a/exercises/ocr-numbers/canonical-data.json +++ b/exercises/ocr-numbers/canonical-data.json @@ -1,187 +1,208 @@ { - "#": [ + "exercise": "ocr-numbers", + "version": "1.0.0", + "comments": [ "An expectation of -1 indicates that a failure should be raised" ], - "convert": { - "description": "Converts lines of OCR Numbers to a string of integers", - "cases": [ - { - "description": "Recognizes 0", - "input": [ - " _ ", - "| |", - "|_|", - " " - ], - "expected": "0" - }, - { - "description": "Recognizes 1", - "input": [ - " ", - " |", - " |", - " " - ], - "expected": "1" - }, - { - "description": "Unreadable but correctly sized inputs return ?", - "input": [ - " ", - " _", - " |", - " " - ], - "expected": "?" - }, - { - "description": "Input with a number of lines that is not a multiple of four raises an error", - "input": [ - " _ ", - "| |", - " " - ], - "expected": -1 - }, - { - "description": "Input with a number of columns that is not a multiple of three raises an error", - "input": [ - " ", - " |", - " |", - " " - ], - "expected": -1 - }, - { - "description": "Recognizes 110101100", - "input": [ - " _ _ _ _ ", - " | || | || | | || || |", - " | ||_| ||_| | ||_||_|", - " " - ], - "expected": "110101100" - }, - { - "description": "Garbled numbers in a string are replaced with ?", - "input": [ - " _ _ _ ", - " | || | || | || || |", - " | | _| ||_| | ||_||_|", - " " - ], - "expected": "11?10?1?0" - }, - { - "description": "Recognizes 2", - "input": [ - " _ ", - " _|", - "|_ ", - " " - ], - "expected": "2" - }, - { - "description": "Recognizes 3", - "input": [ - " _ ", - " _|", - " _|", - " " - ], - "expected": "3" - }, - { - "description": "Recognizes 4", - "input": [ - " ", - "|_|", - " |", - " " - ], - "expected": "4" - }, - { - "description": "Recognizes 5", - "input": [ - " _ ", - "|_ ", - " _|", - " " - ], - "expected": "5" - }, - { - "description": "Recognizes 6", - "input": [ - " _ ", - "|_ ", - "|_|", - " " - ], - "expected": "6" - }, - { - "description": "Recognizes 7", - "input": [ - " _ ", - " |", - " |", - " " - ], - "expected": "7" - }, - { - "description": "Recognizes 8", - "input": [ - " _ ", - "|_|", - "|_|", - " " - ], - "expected": "8" - }, - { - "description": "Recognizes 9", - "input": [ - " _ ", - "|_|", - " _|", - " " - ], - "expected": "9" - }, - { - "description": "Recognizes string of decimal numbers", - "input": [ - " _ _ _ _ _ _ _ _ ", - " | _| _||_||_ |_ ||_||_|| |", - " ||_ _| | _||_| ||_| _||_|", - " " - ], - "expected": "1234567890" - }, - { - "description": "Numbers separated by empty lines are recognized. Lines are joined by commas.", - "input": [ - " _ _ ", - " | _| _|", - " ||_ _|", - " ", - " _ _ ", - "|_||_ |_ ", - " | _||_|", - " ", - " _ _ _ ", - " ||_||_|", - " ||_| _|", - " " - ], - "expected": "123,456,789" - } - ] - } + "cases": [ + { + "description": "Converts lines of OCR Numbers to a string of integers", + "cases": [ + { + "description": "Recognizes 0", + "property": "convert", + "input": [ + " _ ", + "| |", + "|_|", + " " + ], + "expected": "0" + }, + { + "description": "Recognizes 1", + "property": "convert", + "input": [ + " ", + " |", + " |", + " " + ], + "expected": "1" + }, + { + "description": "Unreadable but correctly sized inputs return ?", + "property": "convert", + "input": [ + " ", + " _", + " |", + " " + ], + "expected": "?" + }, + { + "description": "Input with a number of lines that is not a multiple of four raises an error", + "property": "convert", + "input": [ + " _ ", + "| |", + " " + ], + "expected": -1 + }, + { + "description": "Input with a number of columns that is not a multiple of three raises an error", + "property": "convert", + "input": [ + " ", + " |", + " |", + " " + ], + "expected": -1 + }, + { + "description": "Recognizes 110101100", + "property": "convert", + "input": [ + " _ _ _ _ ", + " | || | || | | || || |", + " | ||_| ||_| | ||_||_|", + " " + ], + "expected": "110101100" + }, + { + "description": "Garbled numbers in a string are replaced with ?", + "property": "convert", + "input": [ + " _ _ _ ", + " | || | || | || || |", + " | | _| ||_| | ||_||_|", + " " + ], + "expected": "11?10?1?0" + }, + { + "description": "Recognizes 2", + "property": "convert", + "input": [ + " _ ", + " _|", + "|_ ", + " " + ], + "expected": "2" + }, + { + "description": "Recognizes 3", + "property": "convert", + "input": [ + " _ ", + " _|", + " _|", + " " + ], + "expected": "3" + }, + { + "description": "Recognizes 4", + "property": "convert", + "input": [ + " ", + "|_|", + " |", + " " + ], + "expected": "4" + }, + { + "description": "Recognizes 5", + "property": "convert", + "input": [ + " _ ", + "|_ ", + " _|", + " " + ], + "expected": "5" + }, + { + "description": "Recognizes 6", + "property": "convert", + "input": [ + " _ ", + "|_ ", + "|_|", + " " + ], + "expected": "6" + }, + { + "description": "Recognizes 7", + "property": "convert", + "input": [ + " _ ", + " |", + " |", + " " + ], + "expected": "7" + }, + { + "description": "Recognizes 8", + "property": "convert", + "input": [ + " _ ", + "|_|", + "|_|", + " " + ], + "expected": "8" + }, + { + "description": "Recognizes 9", + "property": "convert", + "input": [ + " _ ", + "|_|", + " _|", + " " + ], + "expected": "9" + }, + { + "description": "Recognizes string of decimal numbers", + "property": "convert", + "input": [ + " _ _ _ _ _ _ _ _ ", + " | _| _||_||_ |_ ||_||_|| |", + " ||_ _| | _||_| ||_| _||_|", + " " + ], + "expected": "1234567890" + }, + { + "description": "Numbers separated by empty lines are recognized. Lines are joined by commas.", + "property": "convert", + "input": [ + " _ _ ", + " | _| _|", + " ||_ _|", + " ", + " _ _ ", + "|_||_ |_ ", + " | _||_|", + " ", + " _ _ _ ", + " ||_||_|", + " ||_| _|", + " " + ], + "expected": "123,456,789" + } + ] + } + ] }