Debian Codegraph @

examples/complex/complex_test.go

raw symbols SCIP
1 package complex
2
3 import (
4 "math"
5 "testing"
6 "testing/quick"
7 )
8
9 //go:generate go run asm.go -out complex.s -stubs stub.go
10
11 func TestReal(t *testing.T) {
12 expect := func(z complex128) float64 {
13 return real(z)
14 }
15 if err := quick.CheckEqual(Real, expect, nil); err != nil {
16 t.Fatal(err)
17 }
18 }
19
20 func TestImag(t *testing.T) {
21 expect := func(z complex128) float64 {
22 return imag(z)
23 }
24 if err := quick.CheckEqual(Imag, expect, nil); err != nil {
25 t.Fatal(err)
26 }
27 }
28
29 func TestNorm(t *testing.T) {
30 expect := func(z complex128) float64 {
31 return math.Sqrt(real(z)*real(z) + imag(z)*imag(z))
32 }
33 if err := quick.CheckEqual(Norm, expect, nil); err != nil {
34 t.Fatal(err)
35 }
36 }