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

fix(tests): remove test_ prefix in tests #621

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 18 additions & 13 deletions src/undirected/kruskal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,24 @@ fn find(parents: &mut [usize], mut node: usize) -> usize {
node
}

#[test]
fn test_path_halving() {
let mut parents = vec![0, 0, 1, 2, 3, 4, 5, 6];
assert_eq!(find(&mut parents, 7), 0);
assert_eq!(parents, vec![0, 0, 1, 1, 3, 3, 5, 5]);
assert_eq!(find(&mut parents, 7), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 3]);
assert_eq!(find(&mut parents, 7), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 0]);
assert_eq!(find(&mut parents, 6), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 3, 0]);
assert_eq!(find(&mut parents, 6), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 0, 0]);
#[cfg(test)]
mod tests {
use super::find;

#[test]
fn path_halving() {
let mut parents = vec![0, 0, 1, 2, 3, 4, 5, 6];
assert_eq!(find(&mut parents, 7), 0);
assert_eq!(parents, vec![0, 0, 1, 1, 3, 3, 5, 5]);
assert_eq!(find(&mut parents, 7), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 3]);
assert_eq!(find(&mut parents, 7), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 0]);
assert_eq!(find(&mut parents, 6), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 3, 0]);
assert_eq!(find(&mut parents, 6), 0);
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 0, 0]);
}
}

fn union(parents: &mut [usize], ranks: &mut [usize], mut a: usize, mut b: usize) {
Expand Down
4 changes: 2 additions & 2 deletions tests/cycle_detection.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use pathfinding::directed::cycle_detection::*;

#[test]
fn test_floyd() {
fn floyd_works() {
assert_eq!(floyd(-10, |x| (x + 5) % 6 + 3), (3, 6, 2));
}

#[test]
fn test_brent() {
fn brent_works() {
assert_eq!(brent(-10, |x| (x + 5) % 6 + 3), (3, 6, 2));
}
2 changes: 1 addition & 1 deletion tests/gps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn successor_distances(
}

#[test]
fn test_gps() {
fn gps() {
let coords = coords();
let successor_distances = successor_distances(&coords);
let (start, goal) = ("Paris", "Cannes");
Expand Down
4 changes: 2 additions & 2 deletions tests/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ fn remove_outside_vertex() {
}

#[test]
fn test_outside_vertex() {
fn outside_vertex() {
let mut g = Grid::new(10, 10);
assert!(!g.has_vertex((10, 10)));
g.fill();
Expand Down Expand Up @@ -585,7 +585,7 @@ fn from_matrix() {
}

#[test]
fn test_equality() {
fn equality() {
let g = [
(0, 0),
(1, 0),
Expand Down
Loading