-
Notifications
You must be signed in to change notification settings - Fork 519
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
Conversation
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] |
There was a problem hiding this comment.
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::*; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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() }}; |
There was a problem hiding this comment.
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
.
{ | ||
"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 | ||
}, |
There was a problem hiding this comment.
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.
closes #1878