Skip to content

diamond: add canonical data #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions exercises/diamond/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"exercise": "diamond",
"version": "1.0.0",
"comments": [
" The tests contained within this canonical data file are suitable ",
" for value-based testing, in which each test case checks that the ",
" value returned by the function under test is in every way ",
" identical to a given expected value. ",
" ",
" This exercise is also amenable to property-based testing, in which ",
" each test case verifies that the value returned by the function ",
" under test exhibits a specific desired property. ",
" ",
" Several tracks (notably, C# and Go) forgo the value-based tests ",
" below in favor of property-based tests. If you are feeling ",
" adventurous and would like to use this exercise to introduce the ",
" concept of property-based testing to participants in your track, ",
" please ignore the value-based tests below and instead reference ",
" the test suites in the aforementioned tracks. "
],
"cases": [
{
"description": "Degenerate case with a single 'A' row",
"property": "rows",
"input": "A",
"expected": [
"A"
]
},
{
"description": "Degenerate case with no row containing 3 distinct groups of spaces",
"property": "rows",
"input": "B",
"expected": [
" A ",
"B B",
" A "
]
},
{
"description": "Smallest non-degenerate case with odd diamond side length",
"property": "rows",
"input": "C",
"expected": [
" A ",
" B B ",
"C C",
" B B ",
" A "
]
},
{
"description": "Smallest non-degenerate case with even diamond side length",
"property": "rows",
"input": "D",
"expected": [
" A ",
" B B ",
" C C ",
"D D",
" C C ",
" B B ",
" A "
]
},
{
"description": "Largest possible diamond",
"property": "rows",
"input": "Z",
"expected": [
" A ",
" B B ",
" C C ",
" D D ",
" E E ",
" F F ",
" G G ",
" H H ",
" I I ",
" J J ",
" K K ",
" L L ",
" M M ",
" N N ",
" O O ",
" P P ",
" Q Q ",
" R R ",
" S S ",
" T T ",
" U U ",
" V V ",
" W W ",
" X X ",
" Y Y ",
"Z Z",
" Y Y ",
" X X ",
" W W ",
" V V ",
" U U ",
" T T ",
" S S ",
" R R ",
" Q Q ",
" P P ",
" O O ",
" N N ",
" M M ",
" L L ",
" K K ",
" J J ",
" I I ",
" H H ",
" G G ",
" F F ",
" E E ",
" D D ",
" C C ",
" B B ",
" A "
]
}
]
}