Skip to content

Commit eaad1f6

Browse files
committed
now full branch coverage
1 parent 35837ef commit eaad1f6

File tree

3 files changed

+50
-15
lines changed

3 files changed

+50
-15
lines changed

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,21 +92,19 @@ format is not supported.
9292

9393
## Testing
9494

95-
Testing is expected to be extreme. Code coverage is expected to be in
96-
excess of 99%.
95+
Test coverage of this crate is 100% as of 2025-11-27.
9796

98-
As of 2025-11-21, test coverage is 100%.
97+
Every single function, every single line, every single expression,
98+
and every single character in the entire crate is executed by at least
99+
one test.
99100

100-
Every single function, every single line, and every single expression
101-
in the entire crate is executed by at least one test. This fact is
102-
verified by both `cargo llvm-cov` and codecov.io (badge at top).
101+
Every single branch in every single function is tested by at least one
102+
concrete instantiation. (For function `Foo<T>::bar`, there exists at
103+
least one `T` for which the tests test every possible path through `bar`.)
103104

104-
The report from `cargo llvm-cov` contains a few exceptions in its summary
105-
data only (5 out of over 4300 regions), but it does not positively
106-
identify any expression in this crate that is not executed by a test.
107-
These anomalies may be small bits of code from the standard library
108-
that are inlined by the compiler and that are thus out of the control
109-
of this crate. See file NOTES.md for details about their locations.
105+
These facts are verified by both `cargo llvm-cov` and codecov.io (badge
106+
at top) across over 4500 code regions. The nightly toolchain may be
107+
used to verify branch coverage.
110108

111109
> I reviewed your flight plan. Not one error in a million keystrokes.
112110
> Phenomenal. [[Gattaca, 1997][gattaca]]
@@ -120,8 +118,8 @@ Although performance is not a primary concern, some benchmarking of
120118
this crate has been performed to measure parsing performance on a single
121119
core using synthetic data with 13 fields per record.
122120

123-
- Apple M3 Pro processor (2023) — 583,000 contacts per second
124-
- Intel Core i5 processor (2021) — 262,000 contacts per second
121+
- Apple M3 Pro processor (2023) — 544,000 contacts per second
122+
- Intel Core i5 processor (2021) — 252,000 contacts per second
125123

126124
## Author
127125

src/test.rs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,45 @@ fn as_datetime_unsupported_types() {
129129
assert!(b.as_datetime().is_none());
130130
}
131131

132+
fn assert_errs_ne(e1: Error, e2: Error, e3: Error) {
133+
assert_ne!(e1, e2);
134+
assert_ne!(e1, e3);
135+
assert_ne!(e2, e3);
136+
}
137+
132138
#[test]
133-
fn error_eq_io_errors() {
139+
fn error_eq() {
134140
let e1 = Error::Io(io::Error::new(io::ErrorKind::NotFound, "test"));
135141
let e2 = Error::Io(io::Error::new(io::ErrorKind::NotFound, "test"));
136142
let e3 = Error::Io(io::Error::new(io::ErrorKind::PermissionDenied, "test"));
137143

138144
assert_eq!(e1, e2);
139145
assert_ne!(e1, e3);
140146
assert_ne!(e1, invalid_format("msg", 1, 1, 0));
147+
148+
let e1 = invalid_format("abc", 1, 1, 0);
149+
let e2 = invalid_format("def", 1, 1, 0);
150+
let e3 = invalid_format("abc", 2, 1, 0);
151+
assert_errs_ne(e1, e2, e3);
152+
153+
let mut rec = Record::new();
154+
let e1 = duplicate_key("abc", rec.clone());
155+
let e2 = duplicate_key("def", rec.clone());
156+
rec.insert("a", "").unwrap();
157+
let e3 = duplicate_key("abc", rec);
158+
assert_errs_ne(e1, e2, e3);
159+
160+
let e1 = cannot_output("a", "a");
161+
let e2 = cannot_output("a", "b");
162+
let e3 = cannot_output("b", "a");
163+
assert_errs_ne(e1, e2, e3);
164+
165+
let mut rec = Record::new();
166+
let e1 = missing_field("abc", rec.clone());
167+
let e2 = missing_field("def", rec.clone());
168+
rec.insert("a", "").unwrap();
169+
let e3 = missing_field("abc", rec);
170+
assert_errs_ne(e1, e2, e3);
141171
}
142172

143173
#[test]

src/test/helpers.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ pub(crate) fn cannot_output(typ: &'static str, reason: &'static str) -> Error {
3232
Error::CannotOutput { typ, reason }
3333
}
3434

35+
pub(crate) fn missing_field(field: &str, record: Record) -> Error {
36+
Error::MissingField {
37+
field: field.into(),
38+
record,
39+
}
40+
}
41+
3542
pub(crate) struct TrickleReader {
3643
data: Vec<u8>,
3744
pos: usize,

0 commit comments

Comments
 (0)