-
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.
etl: Sync tests and generate them with Tera
Also changed the tests to use BTreeMap::from instead of the custom functions for better clarity. [no important files changed]
- Loading branch information
Showing
3 changed files
with
63 additions
and
23 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,29 @@ | ||
use std::collections::BTreeMap; | ||
|
||
{% for test in cases %} | ||
#[test] | ||
#[ignore] | ||
fn {{ test.description | make_ident }}() { | ||
let input = BTreeMap::from( | ||
[ | ||
{% for value, letters in test.input.legacy %} | ||
({{value}}, vec![ | ||
{% for letter in letters %} | ||
'{{letter}}', | ||
{% endfor %} | ||
]), | ||
{% endfor %} | ||
] | ||
); | ||
|
||
let expected = BTreeMap::from( | ||
[ | ||
{% for letter, value in test.expected %} | ||
('{{letter}}', {{ value }}), | ||
{% endfor %} | ||
] | ||
); | ||
|
||
assert_eq!(expected, etl::transform(&input)); | ||
} | ||
{% 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,22 @@ | ||
# 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. | ||
|
||
[78a7a9f9-4490-4a47-8ee9-5a38bb47d28f] | ||
description = "single letter" | ||
|
||
[60dbd000-451d-44c7-bdbb-97c73ac1f497] | ||
description = "single score with multiple letters" | ||
|
||
[f5c5de0c-301f-4fdd-a0e5-df97d4214f54] | ||
description = "multiple scores with multiple letters" | ||
|
||
[5db8ea89-ecb4-4dcd-902f-2b418cc87b9d] | ||
description = "multiple scores with differing numbers of letters" |
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