aboutsummaryrefslogtreecommitdiffstats
path: root/layout/math_test.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-02-10 16:56:06 -0500
committerSam Anthony <sam@samanthony.xyz>2026-02-10 16:56:06 -0500
commit430f97bed9d758de90a72b0c06b2be1989ba2b1d (patch)
tree057a578389bfafe595ba415797908979c3d09add /layout/math_test.go
parent3ce04a4d3dc8d174b520d85804e5c8dce8c5d08f (diff)
downloadgui-430f97bed9d758de90a72b0c06b2be1989ba2b1d.zip
add rows layout
Diffstat (limited to 'layout/math_test.go')
-rw-r--r--layout/math_test.go19
1 files changed, 19 insertions, 0 deletions
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)
+ }
+}