Realistic mock show generator, validation for same-track chains and untimed signals, loop icon, assignRows convergence limit

This commit is contained in:
Ian Gulliver
2026-02-20 21:02:18 -07:00
parent 4e2135f483
commit b282ab710f
6 changed files with 197 additions and 60 deletions

View File

@@ -1,26 +1,32 @@
package main
import "testing"
import (
"testing"
"time"
)
func TestBuildTimelineFromMockShow(t *testing.T) {
show := GenerateMockShow(7, 100, 1000)
t0 := time.Now()
show := GenerateMockShow(5, 100, 1000)
t.Logf("GenerateMockShow: %v (%d blocks, %d triggers)", time.Since(t0), len(show.Blocks), len(show.Triggers))
t1 := time.Now()
if err := show.Validate(); err != nil {
t.Fatalf("generated show failed validation: %v", err)
}
t.Logf("Validate: %v", time.Since(t1))
t2 := time.Now()
tl, err := BuildTimeline(show)
t.Logf("BuildTimeline: %v", time.Since(t2))
if err != nil {
t.Fatalf("BuildTimeline failed: %v", err)
}
if len(tl.Tracks) != 8 {
t.Errorf("expected 8 tracks (7 + cue), got %d", len(tl.Tracks))
}
if len(tl.Blocks) != 1100 {
t.Errorf("expected 1100 blocks (100 cues + 1000), got %d", len(tl.Blocks))
}
t.Logf("tracks=%d blocks=%d", len(tl.Tracks), len(tl.Blocks))
}
func BenchmarkBuildTimeline(b *testing.B) {
show := GenerateMockShow(7, 100, 1000)
show := GenerateMockShow(5, 100, 1000)
if err := show.Validate(); err != nil {
b.Fatal(err)
}