(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestComputeSavings(t *testing.T) { |
| 10 | c := DefaultConstants() // 20 min/run, 5 min/switch, $100/hr |
| 11 | n := Counts{AutoRuns: 3, OwnerTicks: 3, ResumeLookups: 6, RefLookups: 6, CrossLookups: 4} |
| 12 | s := ComputeSavings(c, n) |
| 13 | |
| 14 | // automation: (3+3)*20/60 = 2.0 hrs ; switch: (6+6)*5/60 = 1.0 hr |
| 15 | if s.AutomationHours != 2.0 || s.ContextSwitchHours != 1.0 { |
| 16 | t.Errorf("hours = %v/%v, want 2.0/1.0", s.AutomationHours, s.ContextSwitchHours) |
| 17 | } |
| 18 | // ContextTokens is NOT set by ComputeSavings — it is assigned by BuildStats. |
| 19 | if s.ContextTokens != 0 { |
| 20 | t.Errorf("ContextTokens should be 0 after ComputeSavings (set by BuildStats), got %d", s.ContextTokens) |
| 21 | } |
| 22 | if s.AddressableCount != 10 { // cross4 + ref6 |
| 23 | t.Errorf("AddressableCount = %d, want 10", s.AddressableCount) |
| 24 | } |
| 25 | if s.TotalHours != 3.0 || s.TotalDollars != 300.0 { // 3hrs * $100 |
| 26 | t.Errorf("total = %v hrs / $%v, want 3.0/300", s.TotalHours, s.TotalDollars) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func TestLoadConstantsDefaultsAndOverride(t *testing.T) { |
| 31 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected