PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Go | 98 lines | 76 code | 18 blank | 4 comment | 34 complexity | 8435b95ea574f82ae5429042ffa095dd MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. package main
  2. import . "./reference_global_vars"
  3. func main() {
  4. // const class reference variable
  5. if GetconstTC().GetNum() != 33 {
  6. panic(0)
  7. }
  8. // primitive reference variables
  9. SetVar_bool(Createref_bool(false))
  10. if Value_bool(GetVar_bool()) != false {
  11. println(1, GetVar_bool(), Value_bool(GetVar_bool()))
  12. panic(0)
  13. }
  14. SetVar_bool(Createref_bool(true))
  15. if Value_bool(GetVar_bool()) != true {
  16. println(2, GetVar_bool(), Value_bool(GetVar_bool()))
  17. panic(0)
  18. }
  19. SetVar_char(Createref_char('w'))
  20. if Value_char(GetVar_char()) != 'w' {
  21. println(3, GetVar_char(), Value_char(GetVar_char()))
  22. panic(0)
  23. }
  24. SetVar_unsigned_char(Createref_unsigned_char(10))
  25. if Value_unsigned_char(GetVar_unsigned_char()) != 10 {
  26. println(4, GetVar_unsigned_char(), Value_unsigned_char(GetVar_unsigned_char()))
  27. panic(0)
  28. }
  29. SetVar_signed_char(Createref_signed_char(10))
  30. if Value_signed_char(GetVar_signed_char()) != 10 {
  31. panic(0)
  32. }
  33. SetVar_short(Createref_short(10))
  34. if Value_short(GetVar_short()) != 10 {
  35. panic(0)
  36. }
  37. SetVar_unsigned_short(Createref_unsigned_short(10))
  38. if Value_unsigned_short(GetVar_unsigned_short()) != 10 {
  39. panic(0)
  40. }
  41. SetVar_int(Createref_int(10))
  42. if Value_int(GetVar_int()) != 10 {
  43. panic(0)
  44. }
  45. SetVar_unsigned_int(Createref_unsigned_int(10))
  46. if Value_unsigned_int(GetVar_unsigned_int()) != 10 {
  47. panic(0)
  48. }
  49. SetVar_long(Createref_long(10))
  50. if Value_long(GetVar_long()) != 10 {
  51. panic(0)
  52. }
  53. SetVar_unsigned_long(Createref_unsigned_long(10))
  54. if Value_unsigned_long(GetVar_unsigned_long()) != 10 {
  55. panic(0)
  56. }
  57. SetVar_long_long(Createref_long_long(0x6FFFFFFFFFFFFFF8))
  58. if Value_long_long(GetVar_long_long()) != 0x6FFFFFFFFFFFFFF8 {
  59. panic(0)
  60. }
  61. //ull = abs(0xFFFFFFF2FFFFFFF0)
  62. ull := uint64(55834574864)
  63. SetVar_unsigned_long_long(Createref_unsigned_long_long(ull))
  64. if Value_unsigned_long_long(GetVar_unsigned_long_long()) != ull {
  65. panic(0)
  66. }
  67. SetVar_float(Createref_float(10.5))
  68. if Value_float(GetVar_float()) != 10.5 {
  69. panic(0)
  70. }
  71. SetVar_double(Createref_double(10.5))
  72. if Value_double(GetVar_double()) != 10.5 {
  73. panic(0)
  74. }
  75. // class reference variable
  76. SetVar_TestClass(Createref_TestClass(NewTestClass(20)))
  77. if Value_TestClass(GetVar_TestClass()).GetNum() != 20 {
  78. panic(0)
  79. }
  80. }