updated template script for test args order

This commit is contained in:
alexchao26
2020-12-13 02:34:03 -05:00
parent 9e86d9784d
commit eb2eacdf9e
26 changed files with 333 additions and 362 deletions
+1 -7
View File
@@ -34,19 +34,13 @@ func part1(input string) int {
}
func part2(input string) int {
parsed := parseInput(input)
_ = parsed
return 0
}
func parseInput(input string) []int {
var ans []int
func parseInput(input string) (ans []int) {
lines := strings.Split(input, "\n")
for _, l := range lines {
ans = append(ans, mathutil.StrToInt(l))
}
return ans
}
+21 -23
View File
@@ -1,18 +1,18 @@
package main
import "testing"
import (
"testing"
)
var tests1 = []struct {
name string
want int
input string
// add extra args if needed
}{
// {"actual", ACTUAL_ANSWER, util.ReadFile("input.txt")},
}
func TestPart1(t *testing.T) {
for _, tt := range tests1 {
func Test_part1(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
// {"actual", util.ReadFile("input.txt"), ACTUAL_ANSWER},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part1(tt.input); got != tt.want {
t.Errorf("part1() = %v, want %v", got, tt.want)
@@ -21,17 +21,15 @@ func TestPart1(t *testing.T) {
}
}
var tests2 = []struct {
name string
want int
input string
// add extra args if needed
}{
// {"actual", ACTUAL_ANSWER, util.ReadFile("input.txt")},
}
func TestPart2(t *testing.T) {
for _, tt := range tests2 {
func Test_part2(t *testing.T) {
tests := []struct {
name string
input string
want int
}{
// {"actual", util.ReadFile("input.txt"), ACTUAL_ANSWER},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := part2(tt.input); got != tt.want {
t.Errorf("part2() = %v, want %v", got, tt.want)