Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehoehns committed Nov 29, 2023
1 parent 8a250c0 commit d7c0791
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
5 changes: 0 additions & 5 deletions pkg/ints/ints.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,3 @@ func FromStringSlice(input []string) []int {
}
return output
}

// ToStringAndSum converts a slice of strings to a slice of ints and sums them
func ToStringAndSum(input []string) int {
return Sum(FromStringSlice(input))
}
10 changes: 0 additions & 10 deletions pkg/ints/ints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ func TestFromSliceString(t *testing.T) {

}

func TestSumStringSlice(t *testing.T) {

t.Run("Should add up all values in a slice of strings", func(t *testing.T) {
expected := 6
actual := ToStringAndSum([]string{"1", "2", "3"})
assert.Equal(t, expected, actual)
})

}

func TestAbs(t *testing.T) {

t.Run("Should return the absolute value of a negative int", func(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion puzzles/day00/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ func elvesFromFile(name string) []elf {
elves := make([]elf, 0)
paragraphs := files.ReadParagraphs(name)
for _, group := range paragraphs {
calories := ints.FromStringSlice(group)
elves = append(elves, elf{
totalCalories: ints.ToStringAndSum(group),
totalCalories: ints.Sum(calories),
})
}
return elves
Expand Down

0 comments on commit d7c0791

Please sign in to comment.