X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/a606686934b4028c29dca8e9dae6b2e188cee9c5..80e348724041a694002fc38f57e8868b9b9a2be9:/probe_log_helper_test.go?ds=inline diff --git a/probe_log_helper_test.go b/probe_log_helper_test.go index ddce81d..7df9f48 100644 --- a/probe_log_helper_test.go +++ b/probe_log_helper_test.go @@ -10,6 +10,21 @@ import ( // probeMessages is the length of the generated log for the live probe. const probeMessages = 1000 +var ( + probePeople = []string{"Mara", "Joel", "Ines", "Tomas", "Priya", "Lena"} + probeBreads = []string{"rye", "sourdough", "baguette", "brioche", "spelt", "seed loaf"} + probeDays = []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"} + probeThings = []string{"order form", "price list", "delivery route", "stock count", "invoice export", "oven schedule"} + probeProblems = []string{"shows the wrong total", "skips the last row", "is slow at noon", "loses the customer note", "rounds the tax down"} + probePlaces = []string{"the front page", "the weekly report", "the shared folder", "the admin menu"} + probeTasks = []string{"add a field for allergies", "send the invoices on Friday", "split the route in two", "print labels for the shelf"} + probeCauses = []string{"the date has no time zone", "the cache keeps old prices", "the loop stops one row early", "the form trims the note"} + probeChanges = []string{"the total to use cents", "the route to sort by street", "the export to add the tax line", "the form to keep the note"} + probePreferences = []string{"short answers", "a call before a change to prices", "invoices as PDF", "reports in the morning"} + probeFiles = []string{"orders/form.go", "prices/list.go", "routes/plan.go", "stock/count.go", "export/invoice.go", "ovens/schedule.go"} + probeModules = []string{"orders", "prices", "routes", "stock", "export", "ovens"} +) + // ProbeWriter writes readable made-up messages. type ProbeWriter struct { random *rand.Rand @@ -38,6 +53,7 @@ func (g *ProbeWriter) message() (string, string) { // fill joins lines of write until the text has about size bytes. func (g *ProbeWriter) fill(write func() string, size int) string { var text strings.Builder + for text.Len() < size { if text.Len() > 0 { text.WriteByte(' ') @@ -82,7 +98,9 @@ func (g *ProbeWriter) pick(words []string) string { // toolCall returns a tool name and its JSON input of about size bytes. func (g *ProbeWriter) toolCall(size int) string { name := g.pick([]string{"shell", "read", "write", "edit"}) + var input map[string]string + switch name { case "shell": input = map[string]string{"command": "grep -n '" + g.pick(probeThings) + "' " + g.pick(probeFiles)} @@ -130,18 +148,3 @@ func probeLog(count int) []DatedMessage { return messages } - -var ( - probePeople = []string{"Mara", "Joel", "Ines", "Tomas", "Priya", "Lena"} - probeBreads = []string{"rye", "sourdough", "baguette", "brioche", "spelt", "seed loaf"} - probeDays = []string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"} - probeThings = []string{"order form", "price list", "delivery route", "stock count", "invoice export", "oven schedule"} - probeProblems = []string{"shows the wrong total", "skips the last row", "is slow at noon", "loses the customer note", "rounds the tax down"} - probePlaces = []string{"the front page", "the weekly report", "the shared folder", "the admin menu"} - probeTasks = []string{"add a field for allergies", "send the invoices on Friday", "split the route in two", "print labels for the shelf"} - probeCauses = []string{"the date has no time zone", "the cache keeps old prices", "the loop stops one row early", "the form trims the note"} - probeChanges = []string{"the total to use cents", "the route to sort by street", "the export to add the tax line", "the form to keep the note"} - probePreferences = []string{"short answers", "a call before a change to prices", "invoices as PDF", "reports in the morning"} - probeFiles = []string{"orders/form.go", "prices/list.go", "routes/plan.go", "stock/count.go", "export/invoice.go", "ovens/schedule.go"} - probeModules = []string{"orders", "prices", "routes", "stock", "export", "ovens"} -)