Skip to content

Commit

Permalink
added messages to leap.json, and updated README.md regarding json files
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-hewitson committed Oct 13, 2015
1 parent f09bccc commit b6fe6a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ interpreted in test programs across different languages. In addition to a
mainstream implementation path, this information can also document significant
variations.

Each test uses a key name representative of the test and an object as the
value. This object has two keys, "Description" and "Cases". Description has
a list of strings as its value. Cases has a list of objects as its value.
Each case object represents a separate test case. A case object should have
a description field and fields for inputs and outputs. A test case description
should be a short phrase, suitable to be included in an error message.
Each test case has the the following keys:
description: which will be used to name each generated test
'variable names': one or more variable names with values which will be passed to the solution method
expected: the expected result (this would be -1 when we expect an exception)
msg: a nice message for the failing case

## Automated Tests

Expand Down
20 changes: 13 additions & 7 deletions leap.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,38 @@
{
"description": "leap year",
"input": 1996,
"expected": true
"expected": true,
"msg": "Yes, 1996 is a leap year"
},
{
"description": "non-leap year",
"input": 1997,
"expected": false
"expected": false,
"msg": "No, 1997 is not a leap year"
},
{
"description": "non-leap even year",
"input": 1998,
"expected": false
"expected": false,
"msg": "No, 1998 is not a leap year"
},
{
"description": "century",
"input": 1900,
"expected": false
"expected": false,
"msg": "No, 1900 is not a leap year"
},
{
"description": "fourth century",
"input": 2400,
"expected": true
"expected": true,
"msg": "Yes, 2400 is a leap year"
},
{
"description": "Y2K",
"description": "y2k",
"input": 2000,
"expected": true
"expected": true,
"msg": "Yes, 2000 is a leap year"
}
]
}

0 comments on commit b6fe6a3

Please sign in to comment.