From 4bec8d345b67365d8fc325dacb79afe017502fb6 Mon Sep 17 00:00:00 2001 From: martinfreedman Date: Mon, 8 Nov 2021 16:31:19 +0000 Subject: [PATCH 1/3] Update canonical-schema.json Added non-required `timeout` (in milliseconds) property to `labeledTest.properties` to support tests with timeouts, such as for `alphametics` and `palindrome-products` exercises. This would support automatic generation/update of the tests rather than specific track manually modification of the relevant exercise's test file. --- canonical-schema.json | 1 + 1 file changed, 1 insertion(+) diff --git a/canonical-schema.json b/canonical-schema.json index 91441e625a..061bb55921 100644 --- a/canonical-schema.json +++ b/canonical-schema.json @@ -86,6 +86,7 @@ , "property" : { "$ref": "#/definitions/property" } , "input" : { "$ref": "#/definitions/input" } , "expected" : { "$ref": "#/definitions/expected" } + , "timeout" : { "$ref": "#/definitions/timeout" } } , "additionalProperties": false }, From 06ffc905b1c7f48c06df12a09e96e74d5bfc18ac Mon Sep 17 00:00:00 2001 From: martinfreedman Date: Mon, 8 Nov 2021 18:03:51 +0000 Subject: [PATCH 2/3] Update canonical-schema.json Added description reference for timeout property --- canonical-schema.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/canonical-schema.json b/canonical-schema.json index 061bb55921..41b7148fc7 100644 --- a/canonical-schema.json +++ b/canonical-schema.json @@ -157,6 +157,11 @@ } }, + "timeout": + { "description": "Test timeout in milliseconds" + , "type" : "integer" + }, + "error": { "description": "A message describing an error condition" , "type" : "string" From d48e7357cb24e3cecd46af8d17f0f7a17a9c83e2 Mon Sep 17 00:00:00 2001 From: martinfreedman Date: Tue, 9 Nov 2021 08:50:01 +0000 Subject: [PATCH 3/3] Update README.md Added a section to give an example of using the "timeout" property --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/README.md b/README.md index 36d9eca926..cd7f19e4fa 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,69 @@ The file format is described in [canonical-schema.json](./canonical-schema.json) ] } ``` +### Test Data Format for Tests with Timeout constraints + +This example shows the possible use of the optional timeout constraint for a test, not all tests need a timeout and the timeout can vary from test to test: +```json +{ + "exercise": "alphametics", + "cases": [ + { + "uuid": "e0c08b07-9028-4d5f-91e1-d178fead8e1a", + "description": "puzzle with three letters", + "property": "solve", + "input": { + "puzzle": "I + BB == ILL" + }, + "expected": { + "I": 1, + "B": 9, + "L": 0 + } + }, + { + "uuid": "12125a75-7284-4f9a-a5fa-191471e0d44f", + "description": "puzzle with eight letters", + "property": "solve", + "input": { + "puzzle": "SEND + MORE == MONEY" + }, + "expected": { + "S": 9, + "E": 5, + "N": 6, + "D": 7, + "M": 1, + "O": 0, + "R": 8, + "Y": 2 + }, + "timeout": 2000 + }, + { + "uuid": "fb05955f-38dc-477a-a0b6-5ef78969fffa", + "description": "puzzle with ten letters", + "property": "solve", + "input": { + "puzzle": "AND + A + STRONG + OFFENSE + AS + A + GOOD == DEFENSE" + }, + "expected": { + "A": 5, + "D": 3, + "E": 4, + "F": 7, + "G": 8, + "N": 0, + "O": 2, + "R": 1, + "S": 6, + "T": 9 + }, + "timeout": 5000 + } + ] +} +``` ## Scenarios