Generate equipment loot atomically, grant random boxes and prevent repeat claims. Read gacha pools, pity, products, tickets, missions, presets, chapter rewards and inventory costs from GameData; extend both collaboration UR ticket pools. Sync owned recipes, configure startup state and calendars in versioned seeds, and validate unlock tickets and revival talents.
28 lines
744 B
Go
28 lines
744 B
Go
package gamedata
|
|
|
|
import (
|
|
"database/sql"
|
|
"testing"
|
|
)
|
|
|
|
func TestCookingRecipesReadCatalogIdentities(t *testing.T) {
|
|
db, err := sql.Open("sqlite", ":memory:")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer db.Close()
|
|
if _, err := db.Exec("CREATE TABLE CookingTable(id INTEGER); INSERT INTO CookingTable VALUES(503),(707)"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
design, err := loadCookingRecipeDesign(db)
|
|
if err != nil || len(design.IDs) != 2 || !design.IDs[503] || !design.IDs[707] || design.IDs[101] {
|
|
t.Fatalf("design=%+v err=%v", design, err)
|
|
}
|
|
if _, err := db.Exec("INSERT INTO CookingTable VALUES(0)"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := loadCookingRecipeDesign(db); err == nil {
|
|
t.Fatal("invalid recipe identity accepted")
|
|
}
|
|
}
|