docs: sub-references name bookspec's statements, invariants and scenarios
Unit S-E rewrote each `B-n` citation to its bookspec id but kept the
sub-reference after it ("item 7", "rule 11", "INVARIANT 2"). Those
numbers counted parts of the retired rules.md text, so `BS-statement-5
item 7` pointed at finished and abandoned projects, not at the snapshot
it meant. Bookspec numbers a record's parts from 1 as `statement`,
`invariant` and `scenario`; every sub-reference now says so.
The map was built by content, not by position: each old item,
INVARIANT or SCENARIO was read in `git show ca8d676d5^:docs/spec/rules.md`
(the last full rule text), found in the pinned records
(bookspec bc92cf3) and in docs/spec/claims/, and each reference was
read in its context before it was mapped. Where the old numbering still
survives as the "Rule n" labels inside bookspec's statements (the cash
flow, party totals) the new number is that statement's position; where
a record carries the whole rule differently (the asset depreciation, the
IIF file, the arap invariants) the reference follows the content. Where
bookspec keeps no counterpart, the product rule that states it is cited
instead: WB-statement-5 (a project's facts and names), -7 (the snapshot),
WB-arap-4 (the document_standing feature), -8 (the issued PDF), -15 (a
payment event names its line), WB-ledger-15 (BS-ledger-12 is retired).
A reference that had pointed at the wrong part is corrected, for example
the discount-reason references that said BS-arap-6 INVARIANT 2 (a
bound) now say invariant 6 (the discount cap and date).
Only the reference tokens and their sentence change; no paragraph is
reflowed. A reference wrapped across a comment prefix keeps its wrap.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
609e4e6b26
commit
e41cc3a161
78 files changed
+298
-302
No files matched your search
@@ -364,7 +364,7 @@ pub(crate) fn check_schedule_plan(b: &Books<'_>, x: &Expect) {
|
||||
}
|
||||
|
||||
/// Check one `register_row` expectation: the asset's row of the fixed
|
||||
/// asset register as of `as_of` (BS-asset-1 rules 7 and 8, BS-asset-3):
|
||||
/// asset register as of `as_of` (BS-asset-1 statements 23, 24 and 28, BS-asset-3):
|
||||
/// `acquired` and `in_service` (`YYYY-MM-DD`), `cost`,
|
||||
/// `accumulated_scheduled` (the schedule's), `accumulated_posted` (what
|
||||
/// the books carry), `unposted` (the one less the other), `book_value`
|
||||
|
||||
@@ -299,7 +299,7 @@ pub(crate) fn check_vendor_1099(b: &Books<'_>, x: &Expect) {
|
||||
|
||||
/// The money party shares resolve against: the cash accounts (every
|
||||
/// asset account but receivables when none are named), the cards and the
|
||||
/// financing accounts (BS-partner-3 item 5).
|
||||
/// financing accounts (BS-partner-3 statement 7).
|
||||
pub(crate) fn party_money(ex: &Example, l: &Ledger) -> MoneyAccounts {
|
||||
ledger_core::parties::money_accounts(
|
||||
l,
|
||||
@@ -368,7 +368,7 @@ pub(crate) fn check_party_part(b: &Books<'_>, x: &Expect) {
|
||||
/// Check one `party_totals` expectation: what was `paid` to and
|
||||
/// `received` from the party from `from` through `to` on `basis` (`cash`:
|
||||
/// money; `all`: money and property in kind), each entry's part on its
|
||||
/// root original's side (BS-partner-3 item 4); both given.
|
||||
/// root original's side (BS-partner-3 statement 5); both given.
|
||||
pub(crate) fn check_party_totals(b: &Books<'_>, x: &Expect) {
|
||||
let (ex, l) = (b.ex, b.l());
|
||||
assert!(
|
||||
|
||||
@@ -2317,7 +2317,7 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 9: party totals and the 1099 worksheet never
|
||||
/// BS-partner-3 statement 11: party totals and the 1099 worksheet never
|
||||
/// contradict. For books whose cash accounts are named, whose company
|
||||
/// card is recorded as a business-card payment method (or that have
|
||||
/// no card at all: without the method, 2050's name says nothing, so
|
||||
|
||||
@@ -798,7 +798,7 @@ fn cash_flow_reconciles_to_change_in_cash() {
|
||||
|
||||
// Operating, by the direct method: collected 1,500 (class (a)); paid
|
||||
// 2,500 for equipment (not a registered asset: operating,
|
||||
// BS-statement-3 rule 12's limits) and 800 rent (class (d)) = -1,800. Reconciled:
|
||||
// BS-statement-3 statement 17's limits) and 800 rent (class (d)) = -1,800. Reconciled:
|
||||
// 3,200 net income - 2,500 increase in AR (4,000 billed - 1,500
|
||||
// collected) - 2,500 increase in equipment = -1,800.
|
||||
// Financing: +10,000 owner contribution. Sum = 8,200. Reconciles.
|
||||
|
||||
@@ -278,7 +278,7 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 3: the statement of cash flows' per-entry split
|
||||
/// BS-statement-3 statement 4: the statement of cash flows' per-entry split
|
||||
/// (`kernel::entry_flows`, Kani `entry_flows_*`) is the same at both
|
||||
/// instantiations, on balanced and unbalanced lines alike.
|
||||
#[test]
|
||||
@@ -325,7 +325,7 @@ proptest! {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 11: `kernel::constructive` (what a member or
|
||||
/// BS-statement-3 statement 16: `kernel::constructive` (what a member or
|
||||
/// lender paid or received for the company; Kani
|
||||
/// `constructive_nets_to_zero`, `constructive_mirrors`) agrees at both
|
||||
/// instantiations.
|
||||
|
||||
@@ -680,7 +680,7 @@ proptest! {
|
||||
prop_assert_eq!(scheduled_book_value(a, on).unwrap(), want.book_value);
|
||||
}
|
||||
|
||||
/// BS-asset-1 rule 3 (defect 22), against arithmetic written here: through
|
||||
/// BS-asset-1 statement 4 (defect 22), against arithmetic written here: through
|
||||
/// any day k of the life's final month (its d days), accumulated is C +
|
||||
/// (D − C) × k / d rounded half up to the cent, C the exact charge of
|
||||
/// the months before (D × each month's days held over its days, over
|
||||
@@ -719,7 +719,7 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// BS-asset-1 rule 4 (depreciation_schedule INVARIANT 6; P3 depreciation brief 2.3, R1, R8): through every
|
||||
/// BS-asset-1 statement 6 (depreciation_schedule INVARIANT 6; P3 depreciation brief 2.3, R1, R8): through every
|
||||
/// month end of the life, the schedule is the pre-P3 running total
|
||||
/// (USD, a two-place currency), except where the exact cumulative is a
|
||||
/// half-cent tie, which the old 28-digit Decimal quotients could round
|
||||
@@ -937,7 +937,7 @@ proptest! {
|
||||
proptest! {
|
||||
#![proptest_config(ProptestConfig::with_cases(256))]
|
||||
|
||||
/// BS-statement-5 item 3: for any tags and any period, the projects'
|
||||
/// BS-statement-5 statement 2: for any tags and any period, the projects'
|
||||
/// figures plus the untagged lines' are the period's profit and loss
|
||||
/// (no line counted twice or lost), each through
|
||||
/// ledger_core::project_figures.
|
||||
@@ -1002,7 +1002,7 @@ proptest! {
|
||||
prop_assert_eq!(exp_sum + untagged_exp, all.total_expenses);
|
||||
}
|
||||
|
||||
/// BS-statement-5 item 7: the snapshot's contribution is
|
||||
/// WB-statement-7: the snapshot's contribution is
|
||||
/// project_to_date's net, revenue less direct costs, whatever the
|
||||
/// tags and sides (a refund debits revenue, a reimbursement credits an
|
||||
/// expense below zero): the accounts sum to the totals, each month's
|
||||
@@ -1091,7 +1091,7 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// BS-statement-5 item 3: project_entries codes its own signs, so the
|
||||
/// BS-statement-5 statement 2: project_entries codes its own signs, so the
|
||||
/// posted entries' project amounts must sum to project_to_date's net
|
||||
/// (with no entry dated after the day), whatever the tags, the sides,
|
||||
/// a tagged balance-sheet line, or drafts beside them.
|
||||
|
||||
@@ -1088,8 +1088,8 @@ fn register_of_no_assets_is_empty() {
|
||||
/// 1,000.00 and June's 10/30: 5,333.33 scheduled. Before P3 the disposed
|
||||
/// schedule ended in a plug, so the register showed 12,000.00 and 0.00.
|
||||
/// The same in the life's final month: on 2026-12-15, 11,483.87. Book
|
||||
/// value is cost less what the books carry (defect 13, BS-asset-1 rule
|
||||
/// 8): the fixture's runs, January to March, 3,000.00, so 9,000.00.
|
||||
/// value is cost less what the books carry (defect 13, BS-asset-1 statement
|
||||
/// 28): the fixture's runs, January to March, 3,000.00, so 9,000.00.
|
||||
#[test]
|
||||
fn register_as_of_a_day_before_a_same_month_disposal_is_prorated() {
|
||||
let (mut l, _, laptop, _) = register_fixture();
|
||||
|
||||
@@ -168,7 +168,7 @@ fn s(t: &str) -> String {
|
||||
t.to_string()
|
||||
}
|
||||
|
||||
/// The laws every statement keeps (BS-statement-3 rules 8 and 9): each
|
||||
/// The laws every statement keeps (BS-statement-3 statements 13 and 14): each
|
||||
/// section is its lines, and its kinds; the sections are the change in
|
||||
/// cash; net income and the reconciling items are operating.
|
||||
fn foots(cf: &CashFlowStatement) {
|
||||
@@ -205,7 +205,7 @@ fn no_distribution(cf: &CashFlowStatement) {
|
||||
/// The minimal reproduction of defect 1. Property contributed (Dr
|
||||
/// Equipment 2,340 / Cr Capital), the asset registered, the entry reversed
|
||||
/// the same day. No cash moved, and the entry and its reversal cancel
|
||||
/// (BS-statement-3 rules 1, 6): every section 0.00, no lines, no
|
||||
/// (BS-statement-3 statements 2 and 11): every section 0.00, no lines, no
|
||||
/// disclosures, footing 0 / 0 / 0. Before the fix: investing −2,340.00
|
||||
/// against a change in cash of 0.00 (the reversal's credit to the
|
||||
/// equipment account belonged to no section).
|
||||
@@ -876,7 +876,7 @@ fn a_property_contribution_is_a_noncash_disclosure() {
|
||||
assert_eq!(n.label, format!("Laptop contributed (#{e})"));
|
||||
}
|
||||
|
||||
/// D-42, BS-statement-3 rule 11 (ASC 230 is silent on a payment a third
|
||||
/// D-42, BS-statement-3 statement 16 (ASC 230 is silent on a payment a third
|
||||
/// party makes on the entity's behalf; PwC FSP 6.9.3.1, DART Roadmap 7.2
|
||||
/// and BDO Blueprint 3.4 present it by substance, as constructive receipt
|
||||
/// and disbursement). An expense a member pays personally (Dr Supplies
|
||||
@@ -1011,7 +1011,7 @@ fn equipment_a_lender_paid_for_is_borrowed_and_invested() {
|
||||
assert_eq!(cf.net_change_in_cash, x("-500.00"));
|
||||
}
|
||||
|
||||
/// The expense-to-capital case (BS-statement-3 rule 11): a member pays a
|
||||
/// The expense-to-capital case (BS-statement-3 statement 16): a member pays a
|
||||
/// vendor for the company and the books credit the member's capital (Dr
|
||||
/// Supplies 80 / Cr Capital — Member A), no cash. The member paid cash to
|
||||
/// a third party on the company's behalf, as through 2100; only the form
|
||||
@@ -1150,7 +1150,7 @@ fn equipment_on_the_sellers_credit_stays_noncash_and_flagged() {
|
||||
assert!(w.message.contains("borrowed and spent"), "{}", w.message);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 6 with rule 11: a payment a member made for the
|
||||
/// BS-statement-3 statement 11 with statement 16: a payment a member made for the
|
||||
/// company and its reversal, both in February, drop out together (their
|
||||
/// flows, constructive cash included, are exact negatives: Kani
|
||||
/// `constructive_mirrors`); no line, no disclosure, no total moves. The
|
||||
@@ -1351,7 +1351,7 @@ fn interest_and_guaranteed_payments_charged_to_a_creditor_stay_noncash() {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 6 (BS-ledger-5: a correction undoes what it corrects): an
|
||||
/// BS-statement-3 statement 11 (BS-ledger-5: a correction undoes what it corrects): an
|
||||
/// entry and its reversal both in the period drop out of every line and
|
||||
/// disclosure, and no total moves (their flows are exact negatives, Kani
|
||||
/// `entry_flows_of_a_reversal_mirror`).
|
||||
@@ -1390,7 +1390,7 @@ fn an_entry_and_its_reversal_in_the_period_drop_out() {
|
||||
assert_eq!(cf.net_change_in_cash, before.net_change_in_cash);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 6: a reversal shown alone (its original in an
|
||||
/// BS-statement-3 statement 11: a reversal shown alone (its original in an
|
||||
/// earlier period) is labelled "Reversal of #N — <N's description>" and
|
||||
/// listed under its original's kind, never as a distribution (D1-c).
|
||||
#[test]
|
||||
@@ -1414,7 +1414,7 @@ fn a_reversal_alone_is_labelled_reversal_of() {
|
||||
no_distribution(&cf);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rules 4 and 6: a reversal takes its chain root's
|
||||
/// BS-statement-3 statements 5 and 11: a reversal takes its chain root's
|
||||
/// sections, class and kind, with its own sign. Reversing January's cash
|
||||
/// sale at a 300 gain in February: investing −500 under "Proceeds from
|
||||
/// sales of property and equipment", G +300 (the gain, reversed, is still
|
||||
@@ -1766,7 +1766,7 @@ fn operating_classes_follow_asc_230_10_45_25() {
|
||||
|
||||
/// ASC 230-10-45-28(b): depreciation is an item of net income with no
|
||||
/// cash effect, a reconciling item; it is not an investing or financing
|
||||
/// activity, so nothing is disclosed (BS-statement-3 rule 7).
|
||||
/// activity, so nothing is disclosed (BS-statement-3 statement 12).
|
||||
#[test]
|
||||
fn depreciation_is_reconciling_not_disclosed() {
|
||||
let mut b = funded();
|
||||
@@ -1862,7 +1862,7 @@ fn operating_reconciliation_ties_to_operating_cash() {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-period-1 and BS-statement-3 rule 10: a period close moves earnings into
|
||||
/// BS-period-1 and BS-statement-3 statement 15: a period close moves earnings into
|
||||
/// equity; it earns and spends nothing, so it is never in the statement.
|
||||
#[test]
|
||||
fn closing_entries_never_appear() {
|
||||
@@ -1881,7 +1881,7 @@ fn closing_entries_never_appear() {
|
||||
assert!(!text.contains(&format!("entry: {close},")));
|
||||
}
|
||||
|
||||
/// The period is [start, end] inclusive (BS-statement-3 rule 1): a
|
||||
/// The period is [start, end] inclusive (BS-statement-3 statement 2): a
|
||||
/// contribution on the start date is a flow, not opening cash.
|
||||
#[test]
|
||||
fn cash_flow_starts_counting_on_the_start_date() {
|
||||
@@ -1921,8 +1921,7 @@ fn a_transfer_between_cash_accounts_is_not_a_flow() {
|
||||
assert!(cf.noncash_disclosures.is_empty());
|
||||
}
|
||||
|
||||
/// Review round 2, footing in odd shapes (BS-statement-3 rules 1, 6, 9,
|
||||
/// 11), by hand:
|
||||
/// Review round 2, footing in odd shapes (BS-statement-3 statements 2, 11, 14 and 16), by hand:
|
||||
/// - two cash accounts in one entry, a transfer less its fee (Dr Savings
|
||||
/// 99, Dr Supplies 1 / Cr Cash 100): only the net, −1, moves cash,
|
||||
/// operating (d); no investing or financing;
|
||||
@@ -2217,7 +2216,7 @@ fn financing_lists_each_members_contributions_and_distributions() {
|
||||
/// "at a minimum" apart from the other classes, so an entry's operating
|
||||
/// cash is classed kind by kind: its interest lines are (b) or (e)
|
||||
/// whatever else it settles, the rest by its structure (BS-statement-3
|
||||
/// rule 5). By hand:
|
||||
/// statement 7). By hand:
|
||||
/// - a payment of 900 on a loan the settings leave operating, with 100
|
||||
/// interest (Dr 2500 900, Dr 6200 100 / Cr cash 1,000): (d) −900 and
|
||||
/// (e) −100, not (e) −1,000;
|
||||
@@ -2547,7 +2546,7 @@ fn a_reversed_bill_payment_leaves_the_purchase_unpaid() {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Role refusals (BS-statement-3 rule 2) and the footing check (rule 9).
|
||||
// Role refusals (BS-statement-3 statement 3) and the footing check (statement 14).
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
fn refused(b: &Books, cash: &[&str], financing: &[&str], investing: &[&str]) -> String {
|
||||
@@ -2617,7 +2616,7 @@ fn a_registered_asset_account_cannot_be_cash() {
|
||||
assert!(m.contains("a registered fixed asset's account"), "{m}");
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 9: any difference between the sections and the
|
||||
/// BS-statement-3 statement 14: any difference between the sections and the
|
||||
/// change in cash is an engine error, never a statement.
|
||||
#[test]
|
||||
fn foot_refuses_any_difference() {
|
||||
@@ -3244,7 +3243,7 @@ fn a_disposals_depreciation_credit_back_is_depreciation() {
|
||||
assert_eq!(cf.cash_from_investing, x("975.00"));
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 5 (the P3 cutover review's open point 2): ASC
|
||||
/// BS-statement-3 statement 8 (the P3 cutover review's open point 2): ASC
|
||||
/// 230-10-45-17(c), "Cash payments to governments for taxes, duties,
|
||||
/// fines, and other fees or penalties", is not 45-17(b)'s "Cash payments
|
||||
/// to other suppliers and employees": a state's filing fee booked to an
|
||||
@@ -3316,7 +3315,7 @@ fn a_payment_to_a_government_is_other_operating() {
|
||||
assert_eq!((line.class, line.amount), (Some(OtherPayments), x("75.00")));
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 5: the payee decides on any account, and the tax
|
||||
/// BS-statement-3 statement 8: the payee decides on any account, and the tax
|
||||
/// category still does without one: a license on `taxes_licenses` with no
|
||||
/// party is (g). An entry naming a government and a supplier together
|
||||
/// (half each) is split by their shares, as ASC 230-10-45-22 has each
|
||||
@@ -3371,7 +3370,7 @@ fn a_government_payee_moves_a_fee_on_any_account() {
|
||||
assert_eq!(classes(&cf, shared), [(OtherPayments, x("-100.00"))]);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 5: a split by shares that leaves an odd cent rounds
|
||||
/// BS-statement-3 statement 8: a split by shares that leaves an odd cent rounds
|
||||
/// the government's part half to even, the supplier's the rest, so the
|
||||
/// line still sums to the payment; its reversal next month mirrors it to
|
||||
/// the cent. Fixed amounts split as given.
|
||||
@@ -3450,7 +3449,7 @@ fn a_shared_government_payment_splits_to_the_cent() {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 5: a reversal takes its original's payee, so the
|
||||
/// BS-statement-3 statement 8: a reversal takes its original's payee, so the
|
||||
/// pair always lands in one class and nets. A state's fee paid in
|
||||
/// February and reversed in March: (g) both. The books keep a reversal
|
||||
/// chain's parties one (Ledger::set_entry_parties INVARIANT 5): tagging
|
||||
@@ -3500,7 +3499,7 @@ fn a_reversal_takes_its_originals_payee() {
|
||||
assert_eq!(classes(&b), both(ToSuppliersAndEmployees));
|
||||
}
|
||||
|
||||
/// BS-statement-3 rules 5 and 11: a payment shared between a state and an
|
||||
/// BS-statement-3 statements 8 and 16: a payment shared between a state and an
|
||||
/// agent that a member paid personally (Dr 6000 137.00 / Cr 2100, the
|
||||
/// members' financing account) is borrowed and spent, and its spending is
|
||||
/// split by the parties' shares as a bank payment's is, the part no bank
|
||||
@@ -3577,7 +3576,7 @@ fn a_shared_government_payment_a_member_paid_splits_both_ways() {
|
||||
assert_eq!(cf.net_change_in_cash, Decimal::ZERO);
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 5 (CONVENTION): payroll keeps its structure. Taxes
|
||||
/// BS-statement-3 statement 9 (CONVENTION): payroll keeps its structure. Taxes
|
||||
/// withheld from employees and remitted to the tax agency are the
|
||||
/// employees' pay (45-17(b), "Cash payments to other suppliers and
|
||||
/// employees"), and the payroll payables mix them with the employer's
|
||||
@@ -3636,7 +3635,7 @@ fn a_payroll_remittance_to_a_tax_agency_stays_pay() {
|
||||
assert_eq!(class(employer), Some(OtherPayments));
|
||||
}
|
||||
|
||||
/// BS-statement-3 rule 5: a government selling goods or services is a
|
||||
/// BS-statement-3 statement 8: a government selling goods or services is a
|
||||
/// supplier (45-17(b), "for other goods or services"), not 45-17(c)'s
|
||||
/// taxes, fees or penalties: the post office named with the `vendor`
|
||||
/// role, postage stays (d). The roles decide, so a post office given the
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
//! An invoice's or bill's lines name their projects (BS-statement-5 item
|
||||
//! 8): the posted entry's revenue or expense side is one line per project,
|
||||
//! An invoice's or bill's lines name their projects (BS-statement-5 statement
|
||||
//! 6): the posted entry's revenue or expense side is one line per project,
|
||||
//! the untagged lines' as one; the receivable or payable line, and the
|
||||
//! payments, never take one.
|
||||
//!
|
||||
//! ```text
|
||||
//! GOAL: a client project's invoiced revenue and a contractor's billed
|
||||
//! cost count toward the project, every other figure as before.
|
||||
//! SOURCE: BS-statement-5 items 3 and 8 (job costing), BS-statement-3 (the
|
||||
//! SOURCE: BS-statement-5 statements 2 and 6 (job costing), BS-statement-3 (the
|
||||
//! projects with the untagged lines partition the P&L), BS-1099-1 and
|
||||
//! BS-partner-3 (1099 and party figures follow the money, not the tags).
|
||||
//! ```
|
||||
@@ -170,7 +170,7 @@ fn a_bills_cost_is_one_line_per_project_and_the_payable_none() {
|
||||
}
|
||||
|
||||
/// Reversing a tagged invoice's or bill's entry carries each line's
|
||||
/// project to the reversal (BS-statement-5 item 3: each line on its normal side), so
|
||||
/// project to the reversal (BS-statement-5 statement 2: each line on its normal side), so
|
||||
/// every project nets back to zero; a partial payment, cash against the
|
||||
/// receivable, moves no project figure.
|
||||
#[test]
|
||||
@@ -295,7 +295,7 @@ fn a_line_naming_an_unknown_project_is_refused_whole() {
|
||||
}
|
||||
|
||||
/// Finished and abandoned projects still take a document's lines (BS-statement-5
|
||||
/// item 5: a late cost, a final invoice).
|
||||
/// statement 7: a late cost, a final invoice).
|
||||
#[test]
|
||||
fn a_finished_project_still_takes_an_invoice() {
|
||||
let mut b = books();
|
||||
|
||||
@@ -110,7 +110,7 @@ impl Books {
|
||||
}
|
||||
|
||||
/// Every control account's tie-out holds: no difference (BS-arap-2
|
||||
/// INVARIANT 1).
|
||||
/// invariant 1).
|
||||
fn ties(&self, on: NaiveDate) {
|
||||
for c in self.l.control_check(on).unwrap() {
|
||||
assert_eq!(c.difference, Decimal::ZERO, "{c:?}");
|
||||
@@ -1067,7 +1067,7 @@ fn out_of_bounds_documents_are_listed_not_aged() {
|
||||
|
||||
/// Reversing a legacy hand line takes it off; reversing that reversal
|
||||
/// would put it back, and is refused: no command adds an untagged control
|
||||
/// line (BS-arap-2 INVARIANT 1 and item 3; first review of S1).
|
||||
/// line (BS-arap-2 invariant 2 and statement 11; first review of S1).
|
||||
#[test]
|
||||
fn putting_back_a_removed_hand_line_is_refused() {
|
||||
let mut b = books();
|
||||
@@ -1204,7 +1204,7 @@ fn a_chain_counts_in_order() {
|
||||
// Write-offs (plan P4b S7; BS-arap-5)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// BS-arap-2 SCENARIO 7 and BS-arap-5 INVARIANT 1: half of an invoice paid, the rest
|
||||
/// BS-arap-2 scenario 7 and BS-arap-5 invariant 1: half of an invoice paid, the rest
|
||||
/// written off, reads Written off with 50 paid and 50 written off, and
|
||||
/// receivables falls by the write-off alone.
|
||||
#[test]
|
||||
@@ -1261,7 +1261,7 @@ fn half_paid_rest_written_off_is_written_off() {
|
||||
assert!(check.iter().all(|c| c.difference.is_zero()));
|
||||
}
|
||||
|
||||
/// BS-arap-5 INVARIANT 3: a cash-basis company never counted the invoice as
|
||||
/// BS-arap-5 invariant 5: a cash-basis company never counted the invoice as
|
||||
/// income, so it has no basis to deduct (IRC §166; Treas. Reg.
|
||||
/// §1.166-1(e)).
|
||||
#[test]
|
||||
@@ -1308,7 +1308,7 @@ fn write_off_refused_on_cash_basis() {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-arap-5 INVARIANT 1: at most what is owed, a partial write-off allowed
|
||||
/// BS-arap-5 invariant 2 and statement 3: at most what is owed, a partial write-off allowed
|
||||
/// (Treas. Reg. §1.166-3(a)); more is refused, naming what is owed, and
|
||||
/// nothing changes.
|
||||
#[test]
|
||||
@@ -1351,7 +1351,7 @@ fn write_off_above_outstanding_refused() {
|
||||
assert_eq!((st.paid, st.written_off), (cents(4_000), cents(6_000)));
|
||||
}
|
||||
|
||||
/// D-49's same-year recovery, and BS-arap-5 INVARIANT 2: reversing the
|
||||
/// D-49's same-year recovery, and BS-arap-5 invariant 4: reversing the
|
||||
/// write-off re-instates the debt (it is not a new movement), and the
|
||||
/// payment then recorded settles it; a recovery is income, never a
|
||||
/// payment event.
|
||||
@@ -1502,7 +1502,7 @@ fn days(b: &Books) -> Vec<NaiveDate> {
|
||||
proptest! {
|
||||
#![proptest_config(ProptestConfig::with_cases(256))]
|
||||
|
||||
/// BS-arap-2 INVARIANTS 1, 2 and 6 over random histories of creates,
|
||||
/// BS-arap-2 invariants 1, 6 and 9 over random histories of creates,
|
||||
/// payments, voids, reversals of any entry and refused hand lines: at
|
||||
/// every date the control accounts equal their documents (no
|
||||
/// difference, nothing unattached: no command adds a hand line), each
|
||||
@@ -1538,9 +1538,9 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// BS-arap-2 INVARIANT 5: the aging as of a day partitions what the
|
||||
/// BS-arap-2 invariant 8: the aging as of a day partitions what the
|
||||
/// documents owe then (in books these commands write, none owes less
|
||||
/// than nothing). INVARIANT 4 (Store, replay and Snapshot agree) is
|
||||
/// than nothing). Invariant 7 (Store, replay and Snapshot agree) is
|
||||
/// ledger-store's `status_is_a_function_of_journal_and_date`.
|
||||
#[test]
|
||||
fn aging_partitions_what_documents_owe(ops in prop::collection::vec(arb_op(), 0..30)) {
|
||||
@@ -1562,7 +1562,7 @@ proptest! {
|
||||
}
|
||||
}
|
||||
|
||||
/// BS-arap-2 INVARIANT 3: reversing a tagged entry moves its documents by
|
||||
/// BS-arap-2 invariant 4: reversing a tagged entry moves its documents by
|
||||
/// exactly the opposite of the entry's own tagged lines from the
|
||||
/// reversal's day (read from the entry reversed, not from the mirror,
|
||||
/// so a mirror that lost its tag is caught); reversing that reversal
|
||||
@@ -1725,7 +1725,7 @@ fn terms_derive_due_dates() {
|
||||
assert!(Terms::new(TermsKind::NetEom(3_651), None).is_err());
|
||||
}
|
||||
|
||||
/// BS-arap-3 INVARIANT 2: the discount's bound, its date, and the terms that
|
||||
/// BS-arap-3 invariant 2: the discount's bound, its date, and the terms that
|
||||
/// cannot carry one.
|
||||
#[test]
|
||||
fn discount_bounds_and_late_reason() {
|
||||
@@ -1795,7 +1795,7 @@ fn discount_bounds_and_late_reason() {
|
||||
assert_eq!(kernel::discount_max(cents(-1), 200), None);
|
||||
}
|
||||
|
||||
/// BS-arap-3 INVARIANT 3: the canonical spellings read back as they print.
|
||||
/// BS-arap-3 invariant 3: the canonical spellings read back as they print.
|
||||
#[test]
|
||||
fn terms_describe_and_parse_round_trip() {
|
||||
for text in [
|
||||
@@ -2286,7 +2286,7 @@ fn bill_on_terms_with_discount() {
|
||||
}
|
||||
|
||||
/// A discount taken after the discount date needs a reason (BS-arap-6
|
||||
/// INVARIANT 2); a bill with an asset or prepaid line refuses one with the
|
||||
/// invariant 6); a bill with an asset or prepaid line refuses one with the
|
||||
/// D-49 remedy, and none of the refusals changes the books.
|
||||
#[test]
|
||||
fn late_discount_needs_a_reason() {
|
||||
@@ -2433,7 +2433,7 @@ fn a_fee_posts_gross_to_receivables_and_net_to_the_bank() {
|
||||
|
||||
/// A payment that settles more than one document names its lines in
|
||||
/// application order, and two applications on one document are refused:
|
||||
/// each document's bound is one bound (BS-arap-6 INVARIANTS 1 and 2).
|
||||
/// each document's bound is one bound (BS-arap-6 invariants 4 and 5).
|
||||
#[test]
|
||||
fn a_settlement_names_its_lines_and_refuses_a_document_twice() {
|
||||
use ledger_core::{Application, DocRef, SettleParams};
|
||||
|
||||
@@ -1919,7 +1919,7 @@ mod shares {
|
||||
assert_eq!((a.paid, a.received), (Decimal::ZERO, Decimal::ZERO));
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 3 (capital first): a members' entry counts what
|
||||
/// BS-partner-3 statement 3 (capital first): a members' entry counts what
|
||||
/// moved their capital, not other money on it: 300.00 in, 200.00 of it
|
||||
/// Tobin's capital and 100.00 an expense refunded, is Tobin's 200.00
|
||||
/// received (cash) and nothing of Morgan's. (Before P3 the 300.00 net
|
||||
|
||||
@@ -550,7 +550,7 @@ fn defect14_shares_take_the_partys_side_and_reversals_flip() {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 4: on the member-only entries, basis all is the statement of
|
||||
/// BS-partner-3 statement 6: on the member-only entries, basis all is the statement of
|
||||
/// members' equity (contributions and distributions, the same dates), and
|
||||
/// basis cash is the K-1 worksheet's cash contributions.
|
||||
#[test]
|
||||
@@ -655,7 +655,7 @@ fn defect24_an_accrual_through_another_liability_counts_once() {
|
||||
assert_eq!(b.totals(c, Basis::All), (Decimal::ZERO, d("1200.00")));
|
||||
}
|
||||
|
||||
/// Defect 24 and BS-partner-3 item 6: a credit to what the company owes a party
|
||||
/// Defect 24 and BS-partner-3 statement 8: a credit to what the company owes a party
|
||||
/// itself never counts as paying it. A fee on the issuer's own card is a
|
||||
/// bill from the issuer (counted when the card is paid); a distribution
|
||||
/// still owed to a member counts when it is paid; equipment bought on the
|
||||
@@ -778,7 +778,7 @@ fn a_distribution_owed_counts_twice_until_the_members_are_named_its_creditors()
|
||||
/// again when paid (400.00); now it counts nothing until it is paid, then
|
||||
/// 200.00, once, on both bases (Helvering v. Price; party_target
|
||||
/// INVARIANT 2). The statement of members' equity counts it when declared:
|
||||
/// party totals catch up when it is paid (BS-partner-3 item 4's conditions).
|
||||
/// party totals catch up when it is paid (BS-partner-3 statement 6's conditions).
|
||||
#[test]
|
||||
fn defect24_a_distribution_declared_to_a_payable_counts_once_when_paid() {
|
||||
let mut b = books();
|
||||
@@ -829,7 +829,7 @@ fn defect24_a_distribution_declared_to_a_payable_counts_once_when_paid() {
|
||||
assert_eq!(b.totals(t, Basis::Cash), (d("300.00"), Decimal::ZERO));
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 3: a distribution's cash is the money it paid and its in
|
||||
/// BS-partner-3 statement 3: a distribution's cash is the money it paid and its in
|
||||
/// kind the property it gave. Equipment carried at 1,000.00 less 300.00
|
||||
/// depreciated, and 100.00 in cash, distributed: 100.00 cash and 700.00
|
||||
/// in kind (it read 800.00 in kind and no cash, the equipment's cost
|
||||
@@ -868,7 +868,7 @@ fn a_distribution_of_money_and_depreciated_property_splits_by_what_moved() {
|
||||
assert_eq!(b.resolved(gain).1, vec![part(t, "900.00", "0", "900.00")]);
|
||||
}
|
||||
|
||||
/// Defect 24 and the card rule (BS-partner-3 item 5): a gift card the company
|
||||
/// Defect 24 and the card rule (BS-partner-3 statement 7): a gift card the company
|
||||
/// sold is deferred revenue, a promise, though its account's name says
|
||||
/// "card". It counted as received when sold and again when redeemed
|
||||
/// (200.00); now once, when the money came in. A card the company pays
|
||||
@@ -892,7 +892,7 @@ fn defect24_a_gift_card_sold_is_received_once() {
|
||||
assert_eq!(b.totals(c, Basis::All), (Decimal::ZERO, d("100.00")));
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 5 and `parties::card_accounts` INVARIANTS 1-4: one rule for
|
||||
/// BS-partner-3 statement 7 and `parties::card_accounts` INVARIANTS 1-4: one rule for
|
||||
/// what a card is. Before any business card is recorded, the liabilities
|
||||
/// whose names say "card" but not "gift" (2050 Business Card; never 2410
|
||||
/// Gift Card Liability), less a member's card's account; once one is
|
||||
@@ -958,7 +958,7 @@ fn a_card_is_a_recorded_business_card_else_a_liability_named_card() {
|
||||
assert_eq!(b.resolved(on_2050).0.direction, Direction::Neither);
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 3, case 3: E is the movement of equity other than retained
|
||||
/// BS-partner-3 statement 3, case 3: E is the movement of equity other than retained
|
||||
/// earnings, so a members' entry reads as the statement of members' equity
|
||||
/// reads it. Retained earnings given up for equipment moves no member's
|
||||
/// capital: neither, as the statement shows no distribution. Retained
|
||||
@@ -1035,7 +1035,7 @@ fn a_refund_is_received_from_the_vendor() {
|
||||
assert_eq!(b.totals(v, Basis::Cash), (d("100.00"), d("20.00")));
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 3 (capital first): a mixed contribution is split into money
|
||||
/// BS-partner-3 statement 3 (capital first): a mixed contribution is split into money
|
||||
/// and property exactly as the K-1 worksheet splits it (its SCENARIO 3),
|
||||
/// whichever member the shares list first; an expense a member pays
|
||||
/// straight to capital is cash, as on the K-1 (k1 INVARIANT 3); a debt
|
||||
@@ -1168,7 +1168,7 @@ fn a_members_entry_keeps_its_reading_after_they_leave() {
|
||||
);
|
||||
}
|
||||
|
||||
/// BS-partner-3 item 3, case 1: a period's closing entry moves nothing with
|
||||
/// BS-partner-3 statement 3, case 1: a period's closing entry moves nothing with
|
||||
/// anyone: direction neither, its members' part their income allocated
|
||||
/// (credited to their capital: negative), counted in no total.
|
||||
#[test]
|
||||
@@ -1661,7 +1661,7 @@ proptest! {
|
||||
/// account converted to capital, some through their distributions
|
||||
/// accounts, some declared to distributions payable and paid later,
|
||||
/// and reverse some of it later in the year. For each member, over
|
||||
/// every span from the year's start to any date (BS-partner-3 item 4's
|
||||
/// every span from the year's start to any date (BS-partner-3 statement 6's
|
||||
/// conditions hold: a reversal in such a span always has its original
|
||||
/// in it): basis all is the statement of members' equity's
|
||||
/// contributions and distributions, but for a distribution declared
|
||||
|
||||
@@ -534,7 +534,7 @@ fn a_reversal_nets_a_project_to_zero() {
|
||||
let entries = project_entries(&b.l, c);
|
||||
assert_eq!(entries, vec![(r, cents(180_000)), (e, cents(-180_000))]);
|
||||
// Nothing left on an account, but two lines tagged: it breaks even,
|
||||
// it isn't untagged (BS-statement-5 item 7).
|
||||
// it isn't untagged (WB-statement-7).
|
||||
assert!(t.expenses_by_account.is_empty());
|
||||
assert_eq!((t.revenue_lines, t.expenses_lines), (0, 2));
|
||||
assert!(t.any_tagged());
|
||||
@@ -652,7 +652,7 @@ fn differs_from_names_projects() {
|
||||
assert_eq!(a.l.differs_from(&before), vec!["projects"]);
|
||||
}
|
||||
|
||||
/// BS-statement-5 item 7: the margin is the contribution's share of
|
||||
/// WB-statement-7: the margin is the contribution's share of
|
||||
/// revenue, one place, half to even, and none without revenue.
|
||||
#[test]
|
||||
fn contribution_margin_is_one_place_and_none_without_revenue() {
|
||||
@@ -671,7 +671,7 @@ fn contribution_margin_is_one_place_and_none_without_revenue() {
|
||||
assert_eq!(pct(Decimal::MAX, cents(1)), None, "never panics");
|
||||
}
|
||||
|
||||
/// BS-statement-5 item 7: each month's net to date opens on the lines
|
||||
/// WB-statement-7: each month's net to date opens on the lines
|
||||
/// before the months (a deposit last year) and ends on the net to date;
|
||||
/// a reimbursement credited above its cost leaves the expense below zero.
|
||||
#[test]
|
||||
|
||||
@@ -2505,9 +2505,9 @@ proptest! {
|
||||
/// the cash part of the equity and designated-debt movements: each
|
||||
/// entry's cash applied to the sections moving against it, operating,
|
||||
/// investing, financing, each up to its own movement (BS-statement-3
|
||||
/// rule 3), then to the kinds within each section in their order;
|
||||
/// statement 4), then to the kinds within each section in their order;
|
||||
/// plus what the loan or a member's capital paid or received for the
|
||||
/// company (rule 11, D-42): the loan pays for operating lines (the
|
||||
/// company (statement 16, D-42): the loan pays for operating lines (the
|
||||
/// balance-sheet ones first) and receives for revenue and expense;
|
||||
/// capital pays and receives for revenue and expense only. Written
|
||||
/// here apart from the kernel.
|
||||
|
||||
@@ -1444,7 +1444,7 @@ fn lines(ls: &[ledger_core::reports::CashFlowLine]) -> Vec<(String, Decimal)> {
|
||||
/// amounts borrowed"): borrowing and repayment are separate lines, one
|
||||
/// per entry, borrowing first (each lender's, by code), then repayments.
|
||||
/// The software the owner paid personally is borrowed from the owner and
|
||||
/// spent on its date (BS-statement-3 rule 11, D-42: constructive receipt
|
||||
/// spent on its date (BS-statement-3 statement 16, D-42: constructive receipt
|
||||
/// and disbursement). Financing: +100 + 1,000 − 100 − 400 = 600; nothing
|
||||
/// is disclosed.
|
||||
#[test]
|
||||
@@ -1487,7 +1487,7 @@ fn a_loan_the_entity_makes_is_investing_gross() {
|
||||
assert_eq!(cf.cash_from_investing, dec(-300));
|
||||
}
|
||||
|
||||
/// Oracle: D-42 (BS-statement-3 rule 11; ASC 230 is silent on a payment
|
||||
/// Oracle: D-42 (BS-statement-3 statement 16; ASC 230 is silent on a payment
|
||||
/// made on the entity's behalf, PwC FSP 6.9.3.1 and DART Roadmap 7.2
|
||||
/// present it as constructive receipt and disbursement). The owner paying
|
||||
/// software personally is cash the company borrowed (financing +100) and
|
||||
|
||||
Reference in new issue
Block a user