1
2
3
4
5
6 package main
7
8 import "testing"
9
10
11 func eq_ssa(a int64) bool {
12 return 4+a == 10
13 }
14
15
16 func neq_ssa(a int64) bool {
17 return 10 != a+4
18 }
19
20 func testCmp(t *testing.T) {
21 if wanted, got := true, eq_ssa(6); wanted != got {
22 t.Errorf("eq_ssa: expected %v, got %v\n", wanted, got)
23 }
24 if wanted, got := false, eq_ssa(7); wanted != got {
25 t.Errorf("eq_ssa: expected %v, got %v\n", wanted, got)
26 }
27 if wanted, got := false, neq_ssa(6); wanted != got {
28 t.Errorf("neq_ssa: expected %v, got %v\n", wanted, got)
29 }
30 if wanted, got := true, neq_ssa(7); wanted != got {
31 t.Errorf("neq_ssa: expected %v, got %v\n", wanted, got)
32 }
33 }
34
35 func TestCmp(t *testing.T) {
36 testCmp(t)
37 }
38
View as plain text