File: returns_test.go

package info (click to toggle)
golang-github-mmcloughlin-avo 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 15,024 kB
  • sloc: xml: 71,029; asm: 14,862; sh: 194; makefile: 21; ansic: 11
file content (25 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package returns

import (
	"testing"
	"testing/quick"
)

//go:generate go run asm.go -out returns.s -stubs stub.go

func TestFunctionsEqual(t *testing.T) {
	cases := []struct {
		f, g interface{}
	}{
		{Interval, func(s, n uint64) (uint64, uint64) { return s, s + n }},
		{Butterfly, func(x0, x1 float64) (float64, float64) { return x0 + x1, x0 - x1 }},
		{Septuple, func(b byte) [7]byte { return [...]byte{b, b, b, b, b, b, b} }},
		{CriticalLine, func(t float64) complex128 { return complex(0.5, t) }},
		{NewStruct, func(w uint16, p [2]float64, q uint64) Struct { return Struct{Word: w, Point: p, Quad: q} }},
	}
	for _, c := range cases {
		if err := quick.CheckEqual(c.f, c.g, nil); err != nil {
			t.Fatal(err)
		}
	}
}