1package objc 2 3import ( 4 "fmt" 5 "math/rand" 6 "testing" 7) 8 9func TestCPPAdder(t *testing.T) { 10 a := rand.Int31() 11 b := rand.Int31() 12 expected := a + b 13 if result := AddC(a, b); result != expected { 14 t.Error(fmt.Errorf("wrong result: got %d, expected %d", result, expected)) 15 } 16 if result := AddCPP(a, b); result != expected { 17 t.Error(fmt.Errorf("wrong result: got %d, expected %d", result, expected)) 18 } 19} 20