iprint 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/sh
  2. . ./Common
  3. ###############################################################################
  4. fped "iprint: loop" <<EOF
  5. loop x = 1, 3
  6. %iprint x
  7. EOF
  8. expect <<EOF
  9. 1
  10. 2
  11. 3
  12. EOF
  13. #------------------------------------------------------------------------------
  14. fped "iprint: two tables (independent)" <<EOF
  15. table { a } { 1 } { 2 }
  16. table { b } { 3 } { 4 }
  17. %iprint a*10+b
  18. EOF
  19. expect <<EOF
  20. 13
  21. 14
  22. 23
  23. 24
  24. EOF
  25. #------------------------------------------------------------------------------
  26. fped "iprint: two tables (2nd references 1st)" <<EOF
  27. table { a } { 1 } { 2 }
  28. table { b } { 3+a } { 4+a }
  29. %iprint a*10+b
  30. EOF
  31. expect <<EOF
  32. 14
  33. 15
  34. 25
  35. 26
  36. EOF
  37. #------------------------------------------------------------------------------
  38. fped "iprint: two tables (1st references 2nd)" <<EOF
  39. table { a } { 1+b } { 2+b }
  40. table { b } { 3 } { 4 }
  41. %iprint a*10+b
  42. EOF
  43. expect <<EOF
  44. 43
  45. 54
  46. 53
  47. 64
  48. EOF
  49. #------------------------------------------------------------------------------
  50. fped "iprint: inside frame (global variable)" <<EOF
  51. frame foo {
  52. %iprint n
  53. }
  54. loop n = 1, 2
  55. frame foo @
  56. EOF
  57. expect <<EOF
  58. 1
  59. 2
  60. EOF
  61. #------------------------------------------------------------------------------
  62. fped "iprint: inside frame (local variable) " <<EOF
  63. frame foo {
  64. set n1 = n+1
  65. %iprint n1
  66. }
  67. loop n = 1, 2
  68. frame foo @
  69. EOF
  70. expect <<EOF
  71. 2
  72. 3
  73. EOF
  74. #------------------------------------------------------------------------------
  75. fped_fail "iprint: undefined variable" <<EOF
  76. %iprint foo
  77. EOF
  78. expect <<EOF
  79. undefined variable "foo"
  80. EOF
  81. #------------------------------------------------------------------------------
  82. fped_dump "iprint: dump" <<EOF
  83. %iprint 42
  84. EOF
  85. expect <<EOF
  86. 42
  87. /* MACHINE-GENERATED ! */
  88. package "_"
  89. unit mm
  90. %iprint 42
  91. EOF
  92. ###############################################################################