|
| 1 | +package clap |
| 2 | + |
| 3 | +import "testing" |
| 4 | + |
| 5 | +func TestBetweenWords(t *testing.T) { |
| 6 | + result := BetweenWords("mitochondria is the powerhouse of the cell", "🔪️") |
| 7 | + expected := "mitochondria🔪️is🔪️the🔪️powerhouse🔪️of🔪️the🔪️cell" |
| 8 | + |
| 9 | + if result != expected { |
| 10 | + t.Errorf("FAILED: Expected "+expected+"\" got %v", result) |
| 11 | + } else { |
| 12 | + t.Log("PASSED") |
| 13 | + } |
| 14 | +} |
| 15 | + |
| 16 | +func TestBetweenLetter(t *testing.T) { |
| 17 | + result := BetweenLetters("mitochondria", "🔪️") |
| 18 | + expected := "M🔪️I🔪️T🔪️O🔪️C🔪️H🔪️O🔪️N🔪️D🔪️R🔪️I🔪️A" |
| 19 | + |
| 20 | + if result != expected { |
| 21 | + t.Errorf("FAILED: Expected "+expected+"\" got %v", result) |
| 22 | + } else { |
| 23 | + t.Log("PASSED") |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +func TestClap(t *testing.T) { |
| 28 | + result := Clap("mitochondria is the powerhouse of the cell") |
| 29 | + expected := "mitochondria👏️is👏️the👏️powerhouse👏️of👏️the👏️cell" |
| 30 | + |
| 31 | + if result != expected { |
| 32 | + t.Errorf("FAILED: Expected "+expected+"\" got %v", result) |
| 33 | + } else { |
| 34 | + t.Log("PASSED") |
| 35 | + } |
| 36 | + |
| 37 | + result = Clap("mitochondria") |
| 38 | + expected = "M👏️I👏️T👏️O👏️C👏️H👏️O👏️N👏️D👏️R👏️I👏️A" |
| 39 | + |
| 40 | + if result != expected { |
| 41 | + t.Errorf("FAILED: Expected "+expected+"\" got %v", result) |
| 42 | + } else { |
| 43 | + t.Log("PASSED") |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +func TesEmoji(t *testing.T) { |
| 48 | + result := Emoji("mitochondria is the powerhouse of the cell", "🔪️") |
| 49 | + expected := "mitochondria🔪️is🔪️the🔪️powerhouse🔪️of🔪️the🔪️cell" |
| 50 | + |
| 51 | + if result != expected { |
| 52 | + t.Errorf("FAILED: Expected "+expected+"\" got %v", result) |
| 53 | + } else { |
| 54 | + t.Log("PASSED") |
| 55 | + } |
| 56 | + |
| 57 | + result = Emoji("mitochondria", "🔪️") |
| 58 | + expected = "M🔪️I🔪️T🔪️O🔪️C🔪️H🔪️O🔪️N🔪️D🔪️R🔪️I🔪️A" |
| 59 | + |
| 60 | + if result != expected { |
| 61 | + t.Errorf("FAILED: Expected "+expected+"\" got %v", result) |
| 62 | + } else { |
| 63 | + t.Log("PASSED") |
| 64 | + } |
| 65 | +} |
0 commit comments