swig/Examples/test-suite/go/overload_extend2_runme.go
Ian Lance Taylor 7aafe3d8b2 Fix all Go tests to build with "go build"
Tested against Go 1.6 through Go 1.13beta1, and gccgo.

Fixes #1607
2019-08-08 14:30:50 -07:00

33 lines
462 B
Go

package main
import "swigtests/overload_extend2"
func main() {
f := overload_extend2.NewFoo()
if f.Test(3) != 1 {
panic(0)
}
if f.Test("hello") != 2 {
panic(0)
}
if f.Test(3.5, 2.5) != 3 {
panic(0)
}
if f.Test("hello", 20) != 1020 {
panic(0)
}
if f.Test("hello", 20, 100) != 120 {
panic(0)
}
// C default args
if f.Test(f) != 30 {
panic(0)
}
if f.Test(f, 100) != 120 {
panic(0)
}
if f.Test(f, 100, 200) != 300 {
panic(0)
}
}