Skip to content

Commit 045eaf3

Browse files
committed
fix(tests): remove test_ prefix in tests
1 parent 1628bd2 commit 045eaf3

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed

src/undirected/kruskal.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,24 @@ fn find(parents: &mut [usize], mut node: usize) -> usize {
1414
node
1515
}
1616

17-
#[test]
18-
fn test_path_halving() {
19-
let mut parents = vec![0, 0, 1, 2, 3, 4, 5, 6];
20-
assert_eq!(find(&mut parents, 7), 0);
21-
assert_eq!(parents, vec![0, 0, 1, 1, 3, 3, 5, 5]);
22-
assert_eq!(find(&mut parents, 7), 0);
23-
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 3]);
24-
assert_eq!(find(&mut parents, 7), 0);
25-
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 0]);
26-
assert_eq!(find(&mut parents, 6), 0);
27-
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 3, 0]);
28-
assert_eq!(find(&mut parents, 6), 0);
29-
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 0, 0]);
17+
#[cfg(test)]
18+
mod tests {
19+
use super::find;
20+
21+
#[test]
22+
fn path_halving() {
23+
let mut parents = vec![0, 0, 1, 2, 3, 4, 5, 6];
24+
assert_eq!(find(&mut parents, 7), 0);
25+
assert_eq!(parents, vec![0, 0, 1, 1, 3, 3, 5, 5]);
26+
assert_eq!(find(&mut parents, 7), 0);
27+
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 3]);
28+
assert_eq!(find(&mut parents, 7), 0);
29+
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 5, 0]);
30+
assert_eq!(find(&mut parents, 6), 0);
31+
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 3, 0]);
32+
assert_eq!(find(&mut parents, 6), 0);
33+
assert_eq!(parents, vec![0, 0, 1, 0, 3, 3, 0, 0]);
34+
}
3035
}
3136

3237
fn union(parents: &mut [usize], ranks: &mut [usize], mut a: usize, mut b: usize) {

tests/cycle_detection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use pathfinding::directed::cycle_detection::*;
22

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

88
#[test]
9-
fn test_brent() {
9+
fn brent_works() {
1010
assert_eq!(brent(-10, |x| (x + 5) % 6 + 3), (3, 6, 2));
1111
}

tests/gps.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fn successor_distances(
6868
}
6969

7070
#[test]
71-
fn test_gps() {
71+
fn gps() {
7272
let coords = coords();
7373
let successor_distances = successor_distances(&coords);
7474
let (start, goal) = ("Paris", "Cannes");

tests/grid.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ fn remove_outside_vertex() {
254254
}
255255

256256
#[test]
257-
fn test_outside_vertex() {
257+
fn outside_vertex() {
258258
let mut g = Grid::new(10, 10);
259259
assert!(!g.has_vertex((10, 10)));
260260
g.fill();
@@ -585,7 +585,7 @@ fn from_matrix() {
585585
}
586586

587587
#[test]
588-
fn test_equality() {
588+
fn equality() {
589589
let g = [
590590
(0, 0),
591591
(1, 0),

0 commit comments

Comments
 (0)