61 lines
1.6 KiB
Go
61 lines
1.6 KiB
Go
package household_scenarios
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
type scenario struct {
|
|
ID string `json:"id"`
|
|
Category string `json:"category"`
|
|
Messages []string `json:"messages"`
|
|
Must []string `json:"must"`
|
|
MustNot []string `json:"must_not"`
|
|
}
|
|
|
|
func TestHouseholdScenarioCatalogIsComplete(t *testing.T) {
|
|
data, err := os.ReadFile(filepath.Join("scenarios.json"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var scenarios []scenario
|
|
if err := json.Unmarshal(data, &scenarios); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(scenarios) < 10 {
|
|
t.Fatalf("scenario catalog has %d entries, want at least 10", len(scenarios))
|
|
}
|
|
required := map[string]bool{
|
|
"identity_memory": false,
|
|
"current_information": false,
|
|
"travel_and_places": false,
|
|
"multi_action_orchestration": false,
|
|
"goals_reminders_tasks": false,
|
|
"speech_image_ocr": false,
|
|
"creative_conversation": false,
|
|
"degraded_and_conflict": false,
|
|
"natural_dialogue": false,
|
|
"authority_and_outcome": false,
|
|
}
|
|
seen := map[string]bool{}
|
|
for _, item := range scenarios {
|
|
if item.ID == "" || item.Category == "" || len(item.Messages) == 0 || len(item.Must) == 0 || len(item.MustNot) == 0 {
|
|
t.Fatalf("incomplete scenario: %+v", item)
|
|
}
|
|
if seen[item.ID] {
|
|
t.Fatalf("duplicate scenario id %q", item.ID)
|
|
}
|
|
seen[item.ID] = true
|
|
if _, ok := required[item.Category]; ok {
|
|
required[item.Category] = true
|
|
}
|
|
}
|
|
for category, present := range required {
|
|
if !present {
|
|
t.Fatalf("scenario category %q is missing", category)
|
|
}
|
|
}
|
|
}
|