2019/day1/main_test.go

53 lines
1.2 KiB
Go
Raw Normal View History

2019-12-02 18:27:03 +00:00
package main
import "testing"
func TestCalcRequiredFuel1(t *testing.T) {
total := CalcRequiredFuel(12)
if total != 2 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 2)
}
}
func TestCalcRequiredFuel2(t *testing.T) {
total := CalcRequiredFuel(14)
if total != 2 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 2)
}
}
func TestCalcRequiredFuel3(t *testing.T) {
total := CalcRequiredFuel(1968)
if total != 654 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 654)
}
}
func TestCalcRequiredFuel4(t *testing.T) {
total := CalcRequiredFuel(100756)
if total != 33583 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 33583)
}
}
func TestCalcFuelRecusive1(t *testing.T) {
total := CalcFuelRecusive(14)
if total != 2 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 2)
}
}
func TestCalcFuelRecusive2(t *testing.T) {
total := CalcFuelRecusive(100756)
if total != 50346 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 50346)
}
}
func TestCalcFuelRecusive3(t *testing.T) {
total := CalcFuelRecusive(1969)
if total != 966 {
t.Errorf("CalcRequiredFuel was incorrect, got: %d, want: %d.", total, 966)
}
}