Comments, doc comments, test names, error and log messages, CLI help, README, Makefile, CI step names and the design document are now all in English. No behaviour changes; the full suite passes under the race detector. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
27 lines
758 B
Go
27 lines
758 B
Go
package sim
|
|
|
|
import "strings"
|
|
|
|
// simWords is the word pool the fake output is drawn from.
|
|
var simWords = []string{
|
|
"alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta",
|
|
"iota", "kappa", "lambda", "mu", "nu", "xi", "omicron", "pi",
|
|
}
|
|
|
|
// tokenText returns the text of the n-th generated token (n starts at 1).
|
|
// It must be deterministic: the text written into the cache on completion has
|
|
// to match exactly what was streamed to the client.
|
|
func tokenText(n int) string {
|
|
return " " + simWords[(n-1)%len(simWords)]
|
|
}
|
|
|
|
// generatedText returns the concatenation of the first n tokens.
|
|
func generatedText(n int) string {
|
|
var b strings.Builder
|
|
b.Grow(n * 7)
|
|
for i := 1; i <= n; i++ {
|
|
b.WriteString(tokenText(i))
|
|
}
|
|
return b.String()
|
|
}
|