github.com/laevusdexter/asmcgocall@v0.0.0-20200220061330-f484a47e9b97/examples/single_return_test.go (about) 1 package main 2 3 import ( 4 "testing" 5 ) 6 7 func TestSingleRet(t *testing.T) { 8 res := singleRetAsmcgocall() 9 10 if singleRetExpected != res { 11 t.Fatal("singleRetAsmcgocall...", "expected:", singleRetExpected, "got:", res) 12 } 13 14 res = singleRetCgocall() 15 16 if singleRetExpected != res { 17 t.Fatal("singleRetCgocall...", "expected:", singleRetExpected, "got:", res) 18 } 19 } 20 21 func BenchmarkSingleRetAsmcgocall(b *testing.B) { 22 for i := 0; i < b.N; i++ { 23 singleRetAsmcgocall() 24 } 25 } 26 27 func BenchmarkSignleRetCgocall(b *testing.B) { 28 for i := 0; i < b.N; i++ { 29 singleRetCgocall() 30 } 31 }