Exemplo n.º 1
0
// Routes returns a function
func Routes(s string, i int) {
	switch s {
	case "1":
		fmt.Println(euler.Euler1(i))
	case "2":
		fmt.Println(euler.Euler2(i))
	case "3":
		fmt.Println(euler.Euler3(i))
	case "4":
		fmt.Println(euler.Euler4(i))
	case "5":
		fmt.Println(euler.Euler5(i))
	case "6":
		fmt.Println(euler.Euler6(i))
	case "7":
		fmt.Println(euler.Euler7(i))
	case "8":
		fmt.Println(euler.Euler8(i))
	case "9":
		fmt.Println(euler.Euler9(i))
	case "10":
		fmt.Println(euler.Euler10(i))
	case "11":
		euler.Euler11()
	case "12":
		fmt.Println(euler.Euler12(i))
	default:
		euler.FizzBuzzPop()
	}
}
Exemplo n.º 2
0
func TestEuler7(t *testing.T) {
	type Euler7Test struct {
		test int // input
		expt int // expected result
	}

	var tt = []Euler7Test{
		{6, 13},
		// {10001, 104743},
	}

	for i := 0; i < len(tt); i++ {
		testIn := euler.Euler7(tt[i].test)
		testExp := tt[i].expt

		if testIn != testExp {
			t.Error("Euler 7 failed")
		}
	}
}