MCPcopy
hub / github.com/chai2010/advanced-go-programming-book / TestMin

Function TestMin

examples/ch3.x/min/min_test.go:12–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestMin(t *testing.T) {
13 t.Run("go", func(t *testing.T) {
14 if x := Min(1, 2); x != 1 {
15 t.Fatalf("expect = %d, got = %d", 1, x)
16 }
17 if x := Min(2, 1); x != 1 {
18 t.Fatalf("expect = %d, got = %d", 1, x)
19 }
20 })
21 t.Run("asm", func(t *testing.T) {
22 if x := AsmMin(1, 2); x != 1 {
23 t.Fatalf("expect = %d, got = %d", 1, x)
24 }
25 if x := AsmMin(2, 1); x != 1 {
26 t.Fatalf("expect = %d, got = %d", 1, x)
27 }
28 })
29}
30func TestMax(t *testing.T) {
31 t.Run("go", func(t *testing.T) {
32 if x := Max(1, 2); x != 2 {

Callers

nothing calls this directly

Calls 2

MinFunction · 0.85
AsmMinFunction · 0.85

Tested by

no test coverage detected