Skip to content

Commit

Permalink
Template (#5)
Browse files Browse the repository at this point in the history
* Setup project structure

* Swtich to telemetry for traces

* Add stub test module

---------

Co-authored-by: Simon Martin <[email protected]>
  • Loading branch information
SMartinScottLogic and Simon Martin committed Nov 23, 2023
1 parent d2d99ea commit fdd41c9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ members = [
anyhow = "1.0.66"
# A dead simple ANSI terminal color painting library.
yansi = "1.0.0-gamma"
itertools = "0.11.0"
itertools = "0.12.0"
# An implementation of regular expressions for Rust. This implementation uses finite automata …
regex = "1.7.0"
# Pathfinding, flow, and graph algorithms
Expand Down
8 changes: 8 additions & 0 deletions day1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@ impl<T: std::io::Read> TryFrom<BufReader<T>> for Solution {
Ok(solution)
}
}

#[cfg(test)]
mod test {
#[test]
fn stub() {
assert_eq!(1 + 1, 2);
}
}
7 changes: 7 additions & 0 deletions template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@ impl<T: std::io::Read> TryFrom<BufReader<T>> for Solution {
Ok(solution)
}
}
#[cfg(test)]
mod test {
#[test]
fn stub() {
assert_eq!(1 + 1, 2);
}
}
10 changes: 7 additions & 3 deletions utils/src/graph.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::cmp::Eq;
use std::cmp::{Eq, PartialOrd};
use std::collections::{HashMap, HashSet, VecDeque};
use std::fmt::Debug;
use std::hash::Hash;
use std::iter::Iterator;
use std::marker::Copy;
use std::ops::Add;
use tracing::debug;

fn breadth_first_search_build_path<'a, N>(
Expand Down Expand Up @@ -71,6 +73,8 @@ where
None
}

use tracing::debug;

pub fn dijkstra<N, IS, IE, GN, NEIGH, R>(
nodes: &Vec<N>,
initial_score: IS,
Expand All @@ -82,8 +86,8 @@ where
GN: Fn(&N) -> NEIGH,
IE: Fn(&N) -> bool,
N: Debug + Eq + Copy + Hash,
R: Debug + std::cmp::PartialOrd + Copy + std::ops::Add<Output = R> + HasOne,
NEIGH: std::iter::Iterator<Item = N>,
R: Debug + PartialOrd + Copy + Add<Output = R> + HasOne,
NEIGH: Iterator<Item = N>,
{
let mut scores = HashMap::new();
for node in nodes {
Expand Down

0 comments on commit fdd41c9

Please sign in to comment.