1package main 2 3import ( 4 "testing" 5) 6 7func TestLetterInSmallWord(t *testing.T) { 8 s := "hello in there" 9 if inSmallWordOrSpace(s, 0) { // "h" 10 //fmt.Println(0) 11 t.Fail() 12 } 13 if !inSmallWordOrSpace(s, 5) { // " " 14 //fmt.Println(5) 15 t.Fail() 16 } 17 if !inSmallWordOrSpace(s, 6) { // "i" 18 //fmt.Println(6) 19 t.Fail() 20 } 21 if !inSmallWordOrSpace(s, 7) { // "n" 22 //fmt.Println(7) 23 t.Fail() 24 } 25 if !inSmallWordOrSpace(s, 8) { // " " 26 //fmt.Println(8) 27 t.Fail() 28 } 29 if inSmallWordOrSpace(s, 9) { // "t" 30 //fmt.Println(9) 31 t.Fail() 32 } 33} 34 35func TestSelectionLettersForChoices(t *testing.T) { 36 choices := []string{ 37 "This is a string", 38 "This is another", 39 "This is yet a string", 40 "And here is another", 41 } 42 counter := 0 43 for _, stringAndPosition := range selectionLettersForChoices(choices) { 44 s := choices[counter] 45 counter++ 46 runes := []rune(s) 47 runes[stringAndPosition.pos] = '!' 48 s = string(runes) 49 //fmt.Println(s) 50 _ = s 51 } 52} 53