(t *testing.T)
| 541 | } |
| 542 | |
| 543 | func TestComputeRunMetricsDiff_NegativeChange(t *testing.T) { |
| 544 | summary1 := &RunSummary{ |
| 545 | Run: WorkflowRun{ |
| 546 | TokenUsage: 8000, |
| 547 | Duration: 20 * time.Minute, |
| 548 | Turns: 15, |
| 549 | }, |
| 550 | } |
| 551 | summary2 := &RunSummary{ |
| 552 | Run: WorkflowRun{ |
| 553 | TokenUsage: 4000, |
| 554 | Duration: 12 * time.Minute, |
| 555 | Turns: 10, |
| 556 | }, |
| 557 | } |
| 558 | |
| 559 | diff := computeRunMetricsDiff(summary1, summary2) |
| 560 | |
| 561 | require.NotNil(t, diff, "Should produce metrics diff") |
| 562 | assert.Equal(t, "-50%", diff.TokenUsageChange, "Token usage should decrease by 50%") |
| 563 | assert.Equal(t, "-8m0s", diff.DurationChange, "Duration should decrease by 8m0s") |
| 564 | assert.Equal(t, -5, diff.TurnsChange, "Turns change should be -5") |
| 565 | } |
| 566 | |
| 567 | func TestComputeRunMetricsDiff_BothNil(t *testing.T) { |
| 568 | diff := computeRunMetricsDiff(nil, nil) |
nothing calls this directly
no test coverage detected