MCPcopy Create free account
hub / github.com/astercloud/aster / TestSimplicityChecker_Reset

Function TestSimplicityChecker_Reset

pkg/middleware/simplicity_checker_test.go:294–329  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

292}
293
294func TestSimplicityChecker_Reset(t *testing.T) {
295 m := NewSimplicityCheckerMiddleware(&SimplicityCheckerConfig{
296 Enabled: true,
297 MaxHelperFunctions: 1,
298 })
299
300 code := `func parseHelper() {}`
301
302 req := &ToolCallRequest{
303 ToolName: "Write",
304 ToolInput: map[string]any{
305 "file_path": "test.go",
306 "content": code,
307 },
308 }
309
310 handler := func(ctx context.Context, req *ToolCallRequest) (*ToolCallResponse, error) {
311 return &ToolCallResponse{Result: "ok"}, nil
312 }
313
314 _, _ = m.WrapToolCall(context.Background(), req, handler)
315
316 if m.helperCount == 0 {
317 t.Error("Expected helperCount > 0 after detection")
318 }
319
320 // 重置
321 m.Reset()
322
323 if m.helperCount != 0 {
324 t.Errorf("Expected helperCount=0 after reset, got %d", m.helperCount)
325 }
326 if len(m.GetWarnings()) != 0 {
327 t.Error("Expected empty warnings after reset")
328 }
329}
330
331func TestSimplicityChecker_OnAgentStart(t *testing.T) {
332 m := NewSimplicityCheckerMiddleware(&SimplicityCheckerConfig{

Callers

nothing calls this directly

Calls 5

WrapToolCallMethod · 0.95
ResetMethod · 0.95
GetWarningsMethod · 0.95
ErrorMethod · 0.65

Tested by

no test coverage detected