PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Examples/test-suite/go/overload_extendc_runme.go

#
Go | 33 lines | 29 code | 3 blank | 1 comment | 16 complexity | a83fb54788875200b23a448d9ceec100 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. package main
  2. import "./overload_extendc"
  3. func main() {
  4. f := overload_extendc.NewFoo()
  5. if f.Test(3) != 1 {
  6. panic(0)
  7. }
  8. if f.Test("hello") != 2 {
  9. panic(0)
  10. }
  11. if f.Test(3.5, 2.5) != 3 {
  12. panic(0)
  13. }
  14. if f.Test("hello", 20) != 1020 {
  15. panic(0)
  16. }
  17. if f.Test("hello", 20, 100) != 120 {
  18. panic(0)
  19. }
  20. // C default args
  21. if f.Test(f) != 30 {
  22. panic(0)
  23. }
  24. if f.Test(f, 100) != 120 {
  25. panic(0)
  26. }
  27. if f.Test(f, 100, 200) != 300 {
  28. panic(0)
  29. }
  30. }