GPT-6 Astra
9.0# The tests and benchmark are correct, comprehensive, idiomatic, and satisfy all functional requirements, but the requested explanatory comments on the test and benchmark functions are missing.
inspect full trace →Write idiomatic Go table-driven tests — tests knowledge of Go testing conventions
Write a Go test file for the following function:
```go
// WordCount returns a map of each unique word in s to the number
// of times it appears. Words are case-insensitive and separated by
// whitespace. Punctuation attached to words is stripped.
func WordCount(s string) map[string]int
```
Requirements:
- Package: `wordcount` (test file: `wordcount_test.go`)
- Use Go's standard `testing` package — no third-party libraries
- Use a table-driven test with a `[]struct{ name, input string; want map[string]int }` slice
- Include at least 6 test cases: empty string, single word, mixed case, punctuation, repeated words, multi-word sentence
- Use `t.Run(tc.name, ...)` for subtests so failures are identifiable
- Use `reflect.DeepEqual` or `maps.Equal` to compare maps
- Add a benchmark `BenchmarkWordCount` that runs on a realistic sentence
Do the 6+ test cases cover empty input, case-insensitivity, punctuation stripping, and repeated words with correct expected counts? Is the map comparison correct (not == on maps)? Does the benchmark compile and follow Go benchmark conventions (b.N loop)?
Is the table-driven pattern used correctly (slice of structs, not parallel variables)? Are subtests used with t.Run? Is the test file in the right package (wordcount or wordcount_test)? Is the code idiomatic Go (no unnecessary imports, proper error handling)?
Are test case names descriptive ('empty string', 'mixed case punctuation')? Is there a comment on the test function explaining what it covers? Is the benchmark named and commented correctly?
# The tests and benchmark are correct, comprehensive, idiomatic, and satisfy all functional requirements, but the requested explanatory comments on the test and benchmark functions are missing.
inspect full trace →# The tests and benchmark fully satisfy the functional and structural requirements with idiomatic Go, but both exported test functions lack the requested explanatory comments.
inspect full trace →