1package pdfexport23import (4 "reflect"5 "testing"6)78func TestOrderPuzzlesForPrintDeterministicWithSeed(t *testing.T) {9 input := []Puzzle{10 {Name: "a", Category: "Sudoku", DifficultyScore: 0.0},11 {Name: "b", Category: "Sudoku", DifficultyScore: 0.1},12 {Name: "c", Category: "Nonogram", DifficultyScore: 0.2},13 {Name: "d", Category: "Nonogram", DifficultyScore: 0.3},14 {Name: "e", Category: "Takuzu", DifficultyScore: 0.4},15 {Name: "f", Category: "Takuzu", DifficultyScore: 0.5},16 {Name: "g", Category: "Hitori", DifficultyScore: 0.6},17 {Name: "h", Category: "Hitori", DifficultyScore: 0.7},18 {Name: "i", Category: "Shikaku", DifficultyScore: 0.8},19 {Name: "j", Category: "Shikaku", DifficultyScore: 0.9},20 }2122 orderedA := OrderPuzzlesForPrint(input, "zine-seed")23 orderedB := OrderPuzzlesForPrint(input, "zine-seed")24 if !reflect.DeepEqual(orderedA, orderedB) {25 t.Fatal("expected deterministic ordering with same seed")26 }2728 orderedC := OrderPuzzlesForPrint(input, "different-seed")29 if reflect.DeepEqual(orderedA, orderedC) {30 t.Fatal("expected different ordering with a different seed")31 }3233 if got, want := len(orderedA), len(input); got != want {34 t.Fatalf("length = %d, want %d", got, want)35 }36}