コード例 #1
0
// Euler6 solution
func Euler6(p int) int {
	sumSquare := goutils.SumSquare(p)
	squareSum := goutils.SquareSum(p)

	squareDiff := squareSum - sumSquare
	return squareDiff
}
コード例 #2
0
// TestSquareSum tests SquareSum
func TestSquareSum(t *testing.T) {
	var tt = []goutils.TTII{
		{10, 3025},
	}

	for i := 0; i < len(tt); i++ {
		testIn := goutils.SquareSum(tt[i].Test)
		testExp := tt[i].Expt

		if testExp != testIn {
			t.Error("SquareSum test failed")
		}
	}
}