mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-14 01:42:55 +01:00
24 lines
441 B
Go
24 lines
441 B
Go
|
package apg
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestIntToAlgo(t *testing.T) {
|
||
|
tt := []struct {
|
||
|
name string
|
||
|
a int
|
||
|
e Algorithm
|
||
|
}{
|
||
|
{"AlgoPronouncable", 0, AlgoPronouncable},
|
||
|
{"AlgoRandom", 1, AlgoRandom},
|
||
|
{"AlgoUnsupported", 2, AlgoUnsupported},
|
||
|
}
|
||
|
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)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|