aboutsummaryrefslogtreecommitdiff
path: root/tests/core/cgo/adder_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/core/cgo/adder_test.go')
-rw-r--r--tests/core/cgo/adder_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/core/cgo/adder_test.go b/tests/core/cgo/adder_test.go
new file mode 100644
index 00000000..fc9bf451
--- /dev/null
+++ b/tests/core/cgo/adder_test.go
@@ -0,0 +1,19 @@
+package objc
+
+import (
+ "fmt"
+ "math/rand"
+ "testing"
+)
+
+func TestCPPAdder(t *testing.T) {
+ a := rand.Int31()
+ b := rand.Int31()
+ expected := a + b
+ if result := AddC(a, b); result != expected {
+ t.Error(fmt.Errorf("wrong result: got %d, expected %d", result, expected))
+ }
+ if result := AddCPP(a, b); result != expected {
+ t.Error(fmt.Errorf("wrong result: got %d, expected %d", result, expected))
+ }
+}