Go binary/server for helping run/build sessions for the Maze Rats TTRPG
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

85 lines
2.6 KiB

package tables
import (
"mazeratsgen/internal/dice"
"testing"
)
func TestNPCGenMethods(t *testing.T) {
roller := dice.NewRoller(1)
table := NPCTable{Roller: roller}
table.CivilizedNPC(roller.TableRoll())
table.UnderworldNPC(roller.TableRoll())
table.WildernessNPC(roller.TableRoll())
table.FemaleName(roller.TableRoll())
table.MaleName(roller.TableRoll())
table.UpperClassSurname(roller.TableRoll())
table.LowerClassSurname(roller.TableRoll())
table.Asset(roller.TableRoll())
table.Liability(roller.TableRoll())
table.NPCGoal(roller.TableRoll())
table.Misfortune(roller.TableRoll())
table.Mission(roller.TableRoll())
table.Method(roller.TableRoll())
table.Appearance(roller.TableRoll())
table.PhysicalDetail(roller.TableRoll())
table.Clothing(roller.TableRoll())
table.Personality(roller.TableRoll())
table.Mannerism(roller.TableRoll())
table.Secret(roller.TableRoll())
table.Hobby(roller.TableRoll())
table.Reputation(roller.TableRoll())
table.DivineDomain(roller.TableRoll())
table.AfterTheParty(roller.TableRoll())
}
func TestForEXTERNALs(t *testing.T) {
t.Parallel()
roller := dice.NewRoller(1)
table := NPCTable{Roller: roller}
tests := []struct {
Name string
Func func([2]int) string
}{
{Name: "Secret", Func: table.Secret},
{Name: "CivilizedNPC", Func: table.CivilizedNPC},
{Name: "UnderworldNPC", Func: table.UnderworldNPC},
{Name: "WildernessNPC", Func: table.WildernessNPC},
{Name: "FemaleName", Func: table.FemaleName},
{Name: "MaleName", Func: table.MaleName},
{Name: "UpperClassName", Func: table.UpperClassSurname},
{Name: "LowerClassName", Func: table.LowerClassSurname},
{Name: "Asset", Func: table.Asset},
{Name: "Liability", Func: table.Liability},
{Name: "NPCGoal", Func: table.NPCGoal},
{Name: "Misfortune", Func: table.Misfortune},
{Name: "Mission", Func: table.Mission},
{Name: "Method", Func: table.Method},
{Name: "Appearance", Func: table.Appearance},
{Name: "PhysicalDetail", Func: table.PhysicalDetail},
{Name: "Clothing", Func: table.Clothing},
{Name: "Personality", Func: table.Personality},
{Name: "Mannerism", Func: table.Mannerism},
{Name: "Hobby", Func: table.Hobby},
{Name: "Reputation", Func: table.Reputation},
{Name: "DivineDomain", Func: table.DivineDomain},
{Name: "AfterTheParty", Func: table.AfterTheParty},
}
t.Run("No EXTERNALs", func(t *testing.T) {
t.Parallel()
for _, fTest := range tests {
for x := 1; x <= 6; x++ {
for y := 1; y <= 6; y++ {
result := fTest.Func([2]int{x, y})
if result == "EXTERNAL" {
t.Errorf("Expected roll %v(%v,%v) to not equal 'EXTERNAL'",
fTest.Name, x, y)
}
}
}
}
})
}