Skip to content

Commit a321abc

Browse files
committed
docs(scm-bisect): add doc-comments to scm_bisect::testing
`cargo clippy` was failing in this CI run: https://github.com/arxanas/git-branchless/actions/runs/12127041277?pr=1460 Actually, I have no idea how it even resulted in this. If I understand correctly, `cfg(test)` shouldn't even be enabled here, so the `testing` module shouldn't even be checked. I was unable to reproduce the issue locally on `1.74.1` and `nightly`. Possibly it's something non-deterministic that depends on the order that crates were compiled, or some other caching issue. Regardless, it seems fine to add the doc-comments, so I've added them and now hope that CI will pass.
1 parent b3303a3 commit a321abc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scm-bisect/src/testing.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Testing utilities.
2+
13
use std::collections::{HashMap, HashSet};
24
use std::convert::Infallible;
35

@@ -7,8 +9,12 @@ use proptest::prelude::*;
79

810
use crate::basic::{BasicSourceControlGraph, BasicStrategyKind};
911

12+
/// Graph that represents a "stick" of nodes, represented as increasing
13+
/// integers. The node `n` is the immediate parent of `n + 1`.
1014
#[derive(Clone, Debug)]
1115
pub struct UsizeGraph {
16+
/// The maximum node value for this graph. Valid nodes are in `0..max` (a
17+
/// half-open [`std::ops::Range`]).
1218
pub max: usize,
1319
}
1420

@@ -27,8 +33,10 @@ impl BasicSourceControlGraph for UsizeGraph {
2733
}
2834
}
2935

36+
/// Directed acyclic graph with nodes `char` and edges `char -> char`.
3037
#[derive(Clone, Debug)]
3138
pub struct TestGraph {
39+
/// Mapping from parent to children.
3240
pub nodes: HashMap<char, HashSet<char>>,
3341
}
3442

@@ -57,6 +65,7 @@ impl BasicSourceControlGraph for TestGraph {
5765
}
5866
}
5967

68+
/// Select an arbitrary [`BasicStrategyKind`].
6069
pub fn arb_strategy() -> impl ProptestStrategy<Value = BasicStrategyKind> {
6170
prop_oneof![
6271
Just(BasicStrategyKind::Linear),
@@ -65,6 +74,7 @@ pub fn arb_strategy() -> impl ProptestStrategy<Value = BasicStrategyKind> {
6574
]
6675
}
6776

77+
/// Create an arbitrary [`TestGraph`] and an arbitrary set of failing nodes.
6878
pub fn arb_test_graph_and_nodes() -> impl ProptestStrategy<Value = (TestGraph, Vec<char>)> {
6979
let nodes = prop::collection::hash_set(
7080
prop::sample::select(vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']),

0 commit comments

Comments
 (0)