MCPcopy Create free account
hub / github.com/github/gh-aw / TestComputeToolCallsDiff_ChangedTools

Function TestComputeToolCallsDiff_ChangedTools

pkg/cli/audit_diff_test.go:1177–1208  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1175}
1176
1177func TestComputeToolCallsDiff_ChangedTools(t *testing.T) {
1178 m1 := &LogMetrics{
1179 ToolCalls: []ToolCallInfo{
1180 {Name: "bash", CallCount: 5, MaxOutputSize: 300},
1181 {Name: "gh", CallCount: 3},
1182 },
1183 }
1184 m2 := &LogMetrics{
1185 ToolCalls: []ToolCallInfo{
1186 {Name: "bash", CallCount: 12, MaxOutputSize: 800},
1187 {Name: "gh", CallCount: 3},
1188 },
1189 }
1190
1191 diff := computeToolCallsDiff(m1, m2)
1192 require.NotNil(t, diff, "Should produce diff")
1193
1194 assert.Len(t, diff.ChangedTools, 1, "Should have 1 changed tool (bash)")
1195 assert.Empty(t, diff.NewTools, "Should have no new tools")
1196 assert.Empty(t, diff.RemovedTools, "Should have no removed tools")
1197
1198 bashEntry := findToolCallDiffEntry(diff.ChangedTools, "bash")
1199 require.NotNil(t, bashEntry, "Should find bash in changed tools")
1200 assert.Equal(t, "changed", bashEntry.Status, "bash status should be 'changed'")
1201 assert.Equal(t, 5, bashEntry.Run1CallCount, "bash run1 call count should be 5")
1202 assert.Equal(t, 12, bashEntry.Run2CallCount, "bash run2 call count should be 12")
1203 assert.Equal(t, "+7", bashEntry.CallCountChange, "bash change should be +7")
1204 assert.Equal(t, 300, bashEntry.Run1MaxOutputSize, "run1 max output should be 300")
1205 assert.Equal(t, 800, bashEntry.Run2MaxOutputSize, "run2 max output should be 800")
1206
1207 assert.Equal(t, 1, diff.Summary.ChangedToolCount, "Summary should show 1 changed tool")
1208}
1209
1210func TestComputeToolCallsDiff_AllToolsContainsEverything(t *testing.T) {
1211 m1 := &LogMetrics{

Callers

nothing calls this directly

Calls 2

computeToolCallsDiffFunction · 0.85
findToolCallDiffEntryFunction · 0.85

Tested by

no test coverage detected