Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a Day type to provide better handling of day value #35

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
fspoettel merged 17 commits into fspoettel:main from tguichaoua:day
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
da04cb7
implement Day newtype
tguichaoua Nov 22, 2023
674c9cc
fix tests
tguichaoua Nov 22, 2023
dc579bf
add some docs
tguichaoua Nov 22, 2023
05edf3a
add test for the iterator
tguichaoua Nov 22, 2023
cbc44bf
update day error string
tguichaoua Nov 22, 2023
ecbe5f2
fix doc code
tguichaoua Nov 22, 2023
e60222a
update code template
tguichaoua Nov 22, 2023
27c29d7
fix typo
tguichaoua Nov 22, 2023
3b1c466
fix test
tguichaoua Nov 22, 2023
2e223f9
refactor test
tguichaoua Nov 22, 2023
e3d77e5
use day! macros instead of new + unwrap
tguichaoua Nov 22, 2023
24ab444
Update src/day.rs
tguichaoua Nov 22, 2023
bc9b0e2
Update src/day.rs
tguichaoua Nov 22, 2023
0e6ee20
Update src/day.rs
tguichaoua Nov 22, 2023
e73285f
Update src/day.rs
tguichaoua Nov 22, 2023
94c5a48
rename EveryDay into AllDays
tguichaoua Nov 22, 2023
8469726
rename test
tguichaoua Nov 22, 2023
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
Prev Previous commit
Next Next commit
use day! macros instead of new + unwrap
  • Loading branch information
tguichaoua committed Nov 22, 2023
commit e3d77e5610514ac47ffe8e813701f24dd17b6389
8 changes: 4 additions & 4 deletions src/template/commands/all.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ mod child_commands {
mod tests {
use super::parse_exec_time;

use crate::Day;
use crate::day;

#[test]
fn test_well_formed() {
Expand All @@ -214,7 +214,7 @@ mod child_commands {
"Part 2: 10 (74.13ms @ 99999 samples)".into(),
"".into(),
],
Day::new(1).unwrap(),
day!(1),
);
assert_approx_eq!(res.total_nanos, 74130074.13_f64);
assert_eq!(res.part_1.unwrap(), "74.13ns");
Expand All @@ -229,7 +229,7 @@ mod child_commands {
"Part 2: 10s (100ms @ 1 samples)".into(),
"".into(),
],
Day::new(1).unwrap(),
day!(1),
);
assert_approx_eq!(res.total_nanos, 2100000000_f64);
assert_eq!(res.part_1.unwrap(), "2s");
Expand All @@ -244,7 +244,7 @@ mod child_commands {
"Part 2: ✖ ".into(),
"".into(),
],
Day::new(1).unwrap(),
day!(1),
);
assert_approx_eq!(res.total_nanos, 0_f64);
assert_eq!(res.part_1.is_none(), true);
Expand Down
8 changes: 4 additions & 4 deletions src/template/readme_benchmarks.rs
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,24 @@ pub fn update(timings: Vec<Timings>, total_millis: f64) -> Result<(), Error> {
#[cfg(feature = "test_lib")]
mod tests {
use super::{update_content, Timings, MARKER};
use crate::Day;
use crate::day;

fn get_mock_timings() -> Vec<Timings> {
vec![
Timings {
day: Day::new(1).unwrap(),
day: day!(1),
part_1: Some("10ms".into()),
part_2: Some("20ms".into()),
total_nanos: 3e+10,
},
Timings {
day: Day::new(2).unwrap(),
day: day!(2),
part_1: Some("30ms".into()),
part_2: Some("40ms".into()),
total_nanos: 7e+10,
},
Timings {
day: Day::new(4).unwrap(),
day: day!(4),
part_1: Some("40ms".into()),
part_2: Some("50ms".into()),
total_nanos: 9e+10,
Expand Down

AltStyle によって変換されたページ (->オリジナル) /