test(core): every surviving mutant killed or argued equivalent
Max-testing pass, step 8. The final mutation run left 112 survivors (89% caught). Three agents triaged them by file, by the playbook's table: spec the boundary then test it, a law rather than one more pinned value, assert the real value, never weaken a test. Every expected value is hand-computed. - reports.rs (35): 28 killed, chiefly cash flow (inclusive start date, each line's sign and label, a loss on disposal moving to investing, financing designation), general ledger and members' equity date boundaries, and the balanced() checks (a real report nudged by a cent must stop balancing). 7 equivalent: four >/>= after an early return on zero; two in dead code (removed in this commit); one sign of a zero cleaned on output. - ledger.rs, kernel.rs, journal.rs, money.rs (52, plus one new): 49 killed, including every replay_* mutant at the core level (ids, accumulation, status, vendor tags, out-of-order refusal), FX rates, 0%/100% deductible boundaries, a dividend sweep with no income, the legacy member rounding at close, a bill paid on its own date, a liability-account reconciliation, mixed-currency entries (via serde), ISO 4217 minor units, Display/Debug. 3 equivalent: zero refused before a </<= check; a period whose end is in a closed period refused earlier; columns(0). - schedules, tax, analysis, payouts, assets, form1099 (25): 23 killed (schedule length 1-600, recurring end on its start, frequency parsing and stepping, cost of goods in tax net, a zero payout, disposal on the purchase date, quarter starts, labels); 2 equivalent (zero adds zero; days_held is provably >= 1). Two small production cleanups the triage surfaced: kernel::columns(0) returned a negative-zero credit that would print "-0" (regression a_zero_movement_has_no_negative_zero_column, shown to fail before); and cash_flow computed a book value it never used. Spec lines added where a boundary wasn't specified (cash flow's inclusive start and line signs, members' equity start date, payout with no deposit, disposal on the purchase date, bill paid on its own date). `just mutants` now runs core and store tests (the store's replay tests), not the whole workspace, which rebuilt the viewer for every mutant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GWVo7x3UHw5kwCUaWxiejX
This commit is contained in:
1 parent
b2b49267db
commit
bf3f5b4cdb
15 files changed
+989
-5
No files matched your search
@@ -228,3 +228,39 @@ fn forms_parse_from_common_spellings() {
|
||||
}
|
||||
assert_eq!(TaxForm::parse("990"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cost_of_goods_reduces_net_like_a_deduction() {
|
||||
let mut l = books();
|
||||
let cash = l.chart().find_by_code("1000").unwrap().id;
|
||||
let cogs = l
|
||||
.add_account("5000", "Cost of sales", AccountType::Expense, None, false)
|
||||
.unwrap();
|
||||
l.set_account_tax(cogs, Some("cost_of_goods_sold"), None)
|
||||
.unwrap();
|
||||
let e = l.create_entry(d(2, 1), "x");
|
||||
let m = Money::new(dec("1000"), Currency::USD);
|
||||
l.add_line(e, cogs, Side::Debit, m).unwrap();
|
||||
l.add_line(e, cash, Side::Credit, m).unwrap();
|
||||
l.post_entry(e).unwrap();
|
||||
let ts = tax_summary(&l, d(1, 1), d(3, 31), Some(TaxForm::Form1065)).unwrap();
|
||||
assert_eq!(ts.cost_of_goods.len(), 1);
|
||||
assert_eq!(ts.cost_of_goods[0].book, dec("1000"));
|
||||
assert_eq!(ts.cost_of_goods[0].tax, dec("1000"));
|
||||
// The fixture's nets, less 1,000 of cost of goods sold.
|
||||
assert_eq!(ts.book_net(), dec("4276.67"));
|
||||
assert_eq!(ts.tax_net(), dec("4483.33"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn forms_have_their_irs_names() {
|
||||
let labels: Vec<&str> = TaxForm::ALL.iter().map(|f| f.label()).collect();
|
||||
assert_eq!(
|
||||
labels,
|
||||
["Schedule C", "Form 1065", "Form 1120-S", "Form 1120"]
|
||||
);
|
||||
// A label parses back to its form.
|
||||
for f in TaxForm::ALL {
|
||||
assert_eq!(TaxForm::parse(f.label()), Some(f));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user