From 430f97bed9d758de90a72b0c06b2be1989ba2b1d Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Tue, 10 Feb 2026 16:56:06 -0500 Subject: add rows layout --- layout/math_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 layout/math_test.go (limited to 'layout/math_test.go') diff --git a/layout/math_test.go b/layout/math_test.go new file mode 100644 index 0000000..7ff6b78 --- /dev/null +++ b/layout/math_test.go @@ -0,0 +1,19 @@ +package layout + +import "testing" + +func TestSum(t *testing.T) { + t.Parallel() + testSum(t, []int{}, 0) + testSum(t, []int{0}, 0) + testSum(t, []int{1}, 1) + testSum(t, []int{12, 34}, 46) + testSum(t, []int{12, 34, 56}, 102) +} + +func testSum[N number](t *testing.T, s []N, want N) { + n := sum(s) + if n != want { + t.Errorf("sum(%v) = %v; want %v", s, n, want) + } +} -- cgit v1.2.3