chore: auto-commit (7 archivos)

- call_monitor
- main.go
- operations.db
- operations.db-shm
- operations.db-wal
- cluster.go
- cluster_test.go

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-16 16:33:24 +02:00
parent 37ae34bcfc
commit 8e51094d94
7 changed files with 320 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
package main
import "testing"
func TestNormalizeSnippet(t *testing.T) {
cases := []struct {
in string
want string
}{
{"sqlite3 /tmp/x.db \"SELECT 42\"", "sqlite3 /PATH \"STR\""},
{"grep -n 'foo' line 123", "grep -n 'STR' line N"},
{" multi space ", "multi space"},
{"sha=ab12cd34ef56", "sha=HEX"},
}
for _, c := range cases {
got := normalizeSnippet(c.in)
if got != c.want {
t.Errorf("normalize(%q)=%q want %q", c.in, got, c.want)
}
}
}
func TestHashSnippetStable(t *testing.T) {
a := hashSnippet(normalizeSnippet("ls /tmp/foo"))
b := hashSnippet(normalizeSnippet("ls /tmp/bar"))
if a != b {
t.Errorf("expected same hash after normalization: %s vs %s", a, b)
}
c := hashSnippet(normalizeSnippet("cat /tmp/foo"))
if a == c {
t.Errorf("expected different hash for different commands")
}
}
func TestSplitCSV(t *testing.T) {
cases := []struct {
in string
want int
}{
{"a,b,c", 3},
{" a , b , c ", 3},
{"", 0},
{"a,,b", 2},
}
for _, c := range cases {
got := splitCSV(c.in)
if len(got) != c.want {
t.Errorf("splitCSV(%q) len=%d want %d (%v)", c.in, len(got), c.want, got)
}
}
}