2023-08-04 20:35:31 +02:00
|
|
|
package apg
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestIntToAlgo(t *testing.T) {
|
|
|
|
tt := []struct {
|
|
|
|
name string
|
|
|
|
a int
|
|
|
|
e Algorithm
|
|
|
|
}{
|
2024-03-12 18:28:01 +01:00
|
|
|
{"AlgoPronounceable", 0, AlgoPronounceable},
|
2023-08-04 20:35:31 +02:00
|
|
|
{"AlgoRandom", 1, AlgoRandom},
|
2024-03-07 21:22:14 +01:00
|
|
|
{"AlgoCoinflip", 2, AlgoCoinFlip},
|
|
|
|
{"AlgoUnsupported", 3, AlgoUnsupported},
|
2023-08-04 20:35:31 +02:00
|
|
|
}
|
|
|
|
for _, tc := range tt {
|
|
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
|
|
a := IntToAlgo(tc.a)
|
|
|
|
if a != tc.e {
|
|
|
|
t.Errorf("IntToAlgo() failed, expected: %d, got: %d", tc.e, a)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|