aboutsummaryrefslogtreecommitdiff
path: root/Examples/go/goin/runme.go
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/go/goin/runme.go')
-rw-r--r--Examples/go/goin/runme.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/Examples/go/goin/runme.go b/Examples/go/goin/runme.go
new file mode 100644
index 000000000..dfc7b0936
--- /dev/null
+++ b/Examples/go/goin/runme.go
@@ -0,0 +1,38 @@
+package main
+
+import (
+ "fmt"
+ "swigtests/example"
+)
+
+type mycallbacks struct {
+ example.Callbacks
+}
+
+var tststrs = []string{ "A", "BCD", "EFGH" }
+var tstint int = 5
+
+func (v *mycallbacks) Call1(val int, strarray []string) bool {
+ var rv bool = true
+
+ for i, s := range strarray {
+ fmt.Printf("%d: %s\n", i, s)
+ if s != tststrs[i] {
+ fmt.Printf(" ***Mismatch, expected %s\n", tststrs[i])
+ rv = false
+ }
+ }
+ if val != tstint {
+ rv = false
+ }
+ return rv
+}
+
+func main() {
+ cbs := &mycallbacks{}
+ cbs.Callbacks = example.NewDirectorCallbacks(cbs)
+ worked := example.Check1(cbs, tstint, tststrs)
+ if !worked {
+ panic("Data mismatch")
+ }
+}