2019/day1/main_test.go
2019-12-02 19:27:03 +01:00

53 lines
1.2 KiB
Go

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)
}
}