Skip to content
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

Add test to ensure tera templates are in sync #1879

Merged
merged 1 commit into from
Mar 28, 2024
Merged

Add test to ensure tera templates are in sync #1879

merged 1 commit into from
Mar 28, 2024

Conversation

senekor
Copy link
Contributor

@senekor senekor commented Mar 27, 2024

closes #1878

Comment on lines +4 to +13
fn test_no_items() {
let max_weight = 100;
let items = [];
let output = maximum_value(max_weight, &items);
let expected = 0;
assert_eq!(output, expected);
}

#[test]
#[ignore]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a normal update from problem-specifications.

@@ -1,4 +1,4 @@
use queen_attack::{ChessPiece, ChessPosition, Queen};
use queen_attack::*;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was inconsistent, must've been a mistake of mine. The change doesn't have any effect though.

@@ -19,7 +19,7 @@ fn {{ test.description | slugify | replace(from="-", to="_") }}() {
0x{{ byte | to_hex }},
{%- endfor -%}
];
let output = vlq::{{ fn_names[1] }}(input);
let output = vlq::from_bytes(input);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn_names[1] was failing for some reason, the explicit function name is more readable anyway.

fn {{ test.description | slugify | replace(from="-", to="_") }}() {
let input = {{ test.input | json_encode() }};
let input = {{ test.input.question | json_encode() }};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird mistake, the test generation fails completely without .question.

Comment on lines +2 to +14
{
"uuid": "88bf4b28-0de3-4883-93c7-db1b14aa806e",
"description": "exponential",
"comments": [
"This test case was added a long time ago.",
"Upstreaming it would make the exercise more difficult."
],
"property": "exponentials",
"input": {
"question": "What is 2 raised to the 5th power?"
},
"expected": 32
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These cases were in the finished test file, but test generation would remove them, because their not in canonical-data.json. I decided to keep them around, but not upstream them.

@senekor senekor merged commit 2647c06 into main Mar 28, 2024
10 checks passed
@senekor senekor deleted the tera-sync-test branch March 28, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test that templates match generated test suite
2 participants