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

Function BenchmarkWriteTool_SmallFile

pkg/tools/builtin/write_test.go:140–165  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

138}
139
140func BenchmarkWriteTool_SmallFile(b *testing.B) {
141 tool, err := NewWriteTool(nil)
142 if err != nil {
143 b.Fatalf("Failed to create Write tool: %v", err)
144 }
145
146 helper := NewTestHelper(&testing.T{})
147 defer helper.CleanupAll()
148
149 filePath := helper.TmpDir + "/benchmark.txt"
150 content := "Benchmark content"
151
152 input := map[string]any{
153 "file_path": filePath,
154 "content": content,
155 }
156
157 // 清理文件
158 defer func() {
159 if err := os.Remove(filePath); err != nil {
160 b.Errorf("Failed to remove file: %v", err)
161 }
162 }()
163
164 BenchmarkTool(b, tool, input)
165}

Callers

nothing calls this directly

Calls 5

CleanupAllMethod · 0.95
NewWriteToolFunction · 0.85
NewTestHelperFunction · 0.85
BenchmarkToolFunction · 0.85
RemoveMethod · 0.45

Tested by

no test coverage detected