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