package game import ( "testing" ) func TestInsertHand(t *testing.T) { cards1 := InsertHand(1, 8, []int8{1, 2, 4, 4, 5, 5, 6, 6, 7, 7}) if cards1[len(cards1)-1] != 8 { t.Errorf("InsertHand tail error") } cards2 := InsertHand(1, 1, []int8{1, 2, 4, 4, 5, 5, 6, 6, 7, 7}) if cards2[1] != 1 { t.Errorf("InsertHand front error") } cards3 := InsertHand(1, 6, []int8{1, 2, 4, 4, 5, 5, 6, 6, 7, 7}) if cards3[8] != 6 { t.Errorf("InsertHand middle error") } cards4 := InsertHand(1, 27, []int8{}) if cards4[0] != 27 { t.Errorf("InsertHand single error") } cards5 := InsertHand(1, 27, []int8{26, 16, 17}) if cards5[1] != 27 || cards5[3] != 17 { t.Errorf("InsertHand lack tile error") } }