-
Notifications
You must be signed in to change notification settings - Fork 526
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diamond: Sync tests and generate them with Tera (#2017)
[no important files changed]
- Loading branch information
Showing
3 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use diamond::*; | ||
|
||
{% for test in cases %} | ||
#[test] | ||
#[ignore] | ||
fn {{ test.description | make_ident }}() { | ||
{# | ||
rustfmt will inline array literals under a minimum length | ||
For us that means up to letter E | ||
We also exclude A to keep it inlined | ||
#} | ||
{%- if test.input.letter is matching("[B-D]") %} | ||
#[rustfmt::skip] | ||
{%- endif %} | ||
assert_eq!( | ||
get_diamond('{{ test.input.letter }}'), | ||
vec![ | ||
{%- for line in test.expected %} | ||
"{{ line }}"{% if test.expected | length > 1 %},{% endif %} | ||
{%- endfor %} | ||
] | ||
); | ||
} | ||
{% endfor %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
# This is an auto-generated file. Regular comments will be removed when this | ||
# file is regenerated. Regenerating will not touch any manually added keys, | ||
# so comments can be added in a "comment" key. | ||
# This is an auto-generated file. | ||
# | ||
# Regenerating this file via `configlet sync` will: | ||
# - Recreate every `description` key/value pair | ||
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications | ||
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) | ||
# - Preserve any other key/value pair | ||
# | ||
# As user-added comments (using the # character) will be removed when this file | ||
# is regenerated, comments can be added via a `comment` key. | ||
|
||
[202fb4cc-6a38-4883-9193-a29d5cb92076] | ||
description = "Degenerate case with a single 'A' row" | ||
|
||
[bd6a6d78-9302-42e9-8f60-ac1461e9abae] | ||
description = "Degenerate case with no row containing 3 distinct groups of spaces" | ||
|
||
[af8efb49-14ed-447f-8944-4cc59ce3fd76] | ||
description = "Smallest non-degenerate case with odd diamond side length" | ||
|
||
[e0c19a95-9888-4d05-86a0-fa81b9e70d1d] | ||
description = "Smallest non-degenerate case with even diamond side length" | ||
|
||
[82ea9aa9-4c0e-442a-b07e-40204e925944] | ||
description = "Largest possible diamond" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters