Skip to content

desktop/src-tauri/crates/core/tests/fixed_samples.rs

Comment 1, line 1

desktop/src-tauri/crates/core/tests/fixed_samples.rs:1

//! Eleven fixed mathematical examples from validation.md; expectations are literal, not implementation-generated.

Comment 2, line 17

desktop/src-tauri/crates/core/tests/fixed_samples.rs:17

/// Example 1: uncached input 100, cache reads 800, cache writes 100 and output 100

Comment 3, line 18

desktop/src-tauri/crates/core/tests/fixed_samples.rs:18

/// give input_total 1000, total tokens 1100 and an 80% cached-input ratio.

Comment 4, line 45

desktop/src-tauri/crates/core/tests/fixed_samples.rs:45

/// Example 2: input_total 1000 includes cache reads 800; output 100 includes reasoning 40.

Comment 5, line 46

desktop/src-tauri/crates/core/tests/fixed_samples.rs:46

/// Total tokens are 1100; with verified absent cache writes, uncached input is 200.

Comment 6, line 64

desktop/src-tauri/crates/core/tests/fixed_samples.rs:64

// Adding cache/reasoning again would wrongly give 1940.

Comment 7, line 72

desktop/src-tauri/crates/core/tests/fixed_samples.rs:72

/// Example 3: A has input/cache 100/90 and B has 900/90; the combined ratio is 18%, not 50%.

Comment 8, line 80

desktop/src-tauri/crates/core/tests/fixed_samples.rs:80

// Individual ratios are 90% and 10%; their 50% arithmetic mean is not the combined ratio.

Comment 9, line 89

desktop/src-tauri/crates/core/tests/fixed_samples.rs:89

/// Example 4: input 100 with unknown output keeps known input 100 and a missing complete total.

Comment 10, line 92

desktop/src-tauri/crates/core/tests/fixed_samples.rs:92

// Pure-function check.

Comment 11, line 103

desktop/src-tauri/crates/core/tests/fixed_samples.rs:103

// Stored daily input is 100; output/total remain NULL without substituting zero.

Comment 12, line 136

desktop/src-tauri/crates/core/tests/fixed_samples.rs:136

/// Example 5: revising one request from 100 to 80 leaves value 80 and one call, neither 180 nor MAX=100.

Comment 13, line 179

desktop/src-tauri/crates/core/tests/fixed_samples.rs:179

/// Example 6: two stable request ids each report 100; total 200 and two calls despite identical usage.

Comment 14, line 211

desktop/src-tauri/crates/core/tests/fixed_samples.rs:211

/// Example 7: one DSH attempt streams 80 then finishes 100; a retry finishes 40, giving 140.

Comment 15, line 227

desktop/src-tauri/crates/core/tests/fixed_samples.rs:227

// Final usage replaces streamed usage for the same attempt.

Comment 16, line 235

desktop/src-tauri/crates/core/tests/fixed_samples.rs:235

// The retry creates a distinct attempt.

Comment 17, line 263

desktop/src-tauri/crates/core/tests/fixed_samples.rs:263

/// Example 8: cumulative 100->150->150 gives deltas 50 and 0; a verified new process starts at 20.

Comment 18, line 264

desktop/src-tauri/crates/core/tests/fixed_samples.rs:264

/// Keep the initial 100 as its source interval, without assigning it to today.

Comment 19, line 281

desktop/src-tauri/crates/core/tests/fixed_samples.rs:281

// A verified new process resets the baseline to 20 for its new interval.

Comment 20, line 284

desktop/src-tauri/crates/core/tests/fixed_samples.rs:284

// An unverified decrease cannot reset to zero and be accumulated anew.

Comment 21, line 295

desktop/src-tauri/crates/core/tests/fixed_samples.rs:295

// Preserve the initial 100 as a native source interval with unknown start, outside daily totals.

Comment 22, line 338

desktop/src-tauri/crates/core/tests/fixed_samples.rs:338

// No per-call events exist, so daily totals stay empty instead of receiving the interval 100.

Comment 23, line 343

desktop/src-tauri/crates/core/tests/fixed_samples.rs:343

/// Example 9: one session active on two days has weekly/monthly DISTINCT session=1 and active_days=2.

Comment 24, line 380

desktop/src-tauri/crates/core/tests/fixed_samples.rs:380

/// Example 10: a Hermes two-day cumulative row has token=1000/api_call_count=3 and only first_seen/last_seen.

Comment 25, line 381

desktop/src-tauri/crates/core/tests/fixed_samples.rs:381

/// Keep an interval aggregate, without three invented model_call events or assigning 1000 to the last day; rereads add nothing.

Comment 26, line 409

desktop/src-tauri/crates/core/tests/fixed_samples.rs:409

// Repeating the same aggregate adds no usage.

Comment 27, line 416

desktop/src-tauri/crates/core/tests/fixed_samples.rs:416

// Create no per-call model_call records and no last-day daily total of 1000.

Comment 28, line 436

desktop/src-tauri/crates/core/tests/fixed_samples.rs:436

/// Example 11: Hermes primary-model cumulative 100, separate auxiliary-task 20 and sessions primary-loop 100

Comment 29, line 437

desktop/src-tauri/crates/core/tests/fixed_samples.rs:437

/// sum to 120 for verified exclusive model/task coverage; exclude the duplicate session total instead of summing 220.

Comment 30, line 471

desktop/src-tauri/crates/core/tests/fixed_samples.rs:471

// sessions primary-loop duplicates model-main coverage and remains a comparison row.