Created
September 22, 2021 16:32
-
-
Save hibri/83808312b6e270a001522793be1d04a4 to your computer and use it in GitHub Desktop.
Revisions
-
hibri created this gist
Sep 22, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ package main import ( "testing" "github.com/stretchr/testify/assert" ) func TestAlwaysTrue(t *testing.T) { assert.True(t, true) } func TestEmptyBasketIs0(t *testing.T) { assert.Equal(t, 0, scan("")) } func TestAIs50(t *testing.T) { assert.Equal(t, 50, scan("A")) } func TestBis30(t *testing.T) { assert.Equal(t, 30, scan("B")) } func TestABis80(t *testing.T) { assert.Equal(t, 80, scan("AB")) } func TestAAIs100(t *testing.T) { assert.Equal(t, 100, scan("AA")) } func scan(items string) int { total := 0 prices := map[rune]int{ 'A': 50, 'B': 30, } for _, char := range items { total += prices[char] } return total }