meas_qual 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. #!/bin/sh
  2. . ./Common
  3. ###############################################################################
  4. fped_dump "qualified measurements: no qualifier" <<EOF
  5. frame c { v: vec @(0mm, 0mm) }
  6. frame b { frame c @ }
  7. frame a { frame b @ }
  8. frame a @
  9. meas c.v >> c.v
  10. EOF
  11. expect <<EOF
  12. /* MACHINE-GENERATED ! */
  13. frame c {
  14. v: vec @(0mm, 0mm)
  15. }
  16. frame b {
  17. frame c @
  18. }
  19. frame a {
  20. frame b @
  21. }
  22. package "_"
  23. unit mm
  24. frame a @
  25. meas c.v >> c.v
  26. EOF
  27. #------------------------------------------------------------------------------
  28. fped_dump "qualified measurements: fully qualified" <<EOF
  29. frame c { v: vec @(0mm, 0mm) }
  30. frame b { frame c @ }
  31. frame a { frame b @ }
  32. frame a @
  33. meas a/b/c.v >> c.v
  34. EOF
  35. expect_grep '^meas' <<EOF
  36. meas a/b/c.v >> c.v
  37. EOF
  38. #------------------------------------------------------------------------------
  39. fped_dump "qualified measurements: partially qualified" <<EOF
  40. frame c { v: vec @(0mm, 0mm) }
  41. frame b { frame c @ }
  42. frame a { frame b @ }
  43. frame a @
  44. meas a/c.v >> c.v
  45. EOF
  46. expect_grep '^meas' <<EOF
  47. meas a/c.v >> c.v
  48. EOF
  49. #------------------------------------------------------------------------------
  50. fped_dump "qualified measurements: wrong order" <<EOF
  51. frame c { v: vec @(0mm, 0mm) }
  52. frame b { frame c @ }
  53. frame a { frame b @ }
  54. frame a @
  55. meas b/a/c.v >> c.v
  56. EOF
  57. expect_grep 'warning' <<EOF
  58. 5: warning: not all qualifiers can be reached near "v"
  59. EOF
  60. #------------------------------------------------------------------------------
  61. fped_dump "qualified measurements: unlinked frame" <<EOF
  62. frame c { v: vec @(0mm, 0mm) }
  63. frame b { frame c @ }
  64. frame a { frame b @ }
  65. frame x {}
  66. frame a @
  67. frame x @
  68. meas a/c.v >> x/c.v
  69. EOF
  70. expect_grep 'warning' <<EOF
  71. 7: warning: not all qualifiers can be reached near "v"
  72. EOF
  73. #------------------------------------------------------------------------------
  74. fped_fail "qualified measurements: duplicate qualifier" <<EOF
  75. frame c { v: vec @(0mm, 0mm) }
  76. frame b { frame c @ }
  77. frame a { frame b @ }
  78. frame a @
  79. meas b/b/c.v >> c.v
  80. EOF
  81. expect <<EOF
  82. 5: duplicate qualifier "b" near "v"
  83. EOF
  84. #------------------------------------------------------------------------------
  85. fped "qualified measurements: \"macro\" unqualified" <<EOF
  86. frame x {
  87. a: vec @(0mm, 0mm)
  88. b: vec .(d, 0mm)
  89. }
  90. frame a {
  91. set d = 2mm
  92. frame x @
  93. }
  94. frame b {
  95. set d = 3mm
  96. frame x @
  97. }
  98. frame a @
  99. vec @(1mm, 0mm)
  100. frame b .
  101. meas x.a >> x.b /* dummy */
  102. m: meas x.a >> x.b
  103. %meas m
  104. EOF
  105. expect <<EOF
  106. 4
  107. EOF
  108. #------------------------------------------------------------------------------
  109. fped "qualified measurements: \"macro\" qualified (a)" <<EOF
  110. frame x {
  111. a: vec @(0mm, 0mm)
  112. b: vec .(d, 0mm)
  113. }
  114. frame a {
  115. set d = 2mm
  116. frame x @
  117. }
  118. frame b {
  119. set d = 3mm
  120. frame x @
  121. }
  122. frame a @
  123. vec @(1mm, 0mm)
  124. frame b .
  125. meas x.a >> x.b /* dummy */
  126. m: meas a/x.a >> a/x.b
  127. %meas m
  128. EOF
  129. expect <<EOF
  130. 2
  131. EOF
  132. #------------------------------------------------------------------------------
  133. fped "qualified measurements: \"macro\" qualified (b)" <<EOF
  134. frame x {
  135. a: vec @(0mm, 0mm)
  136. b: vec .(d, 0mm)
  137. }
  138. frame a {
  139. set d = 2mm
  140. frame x @
  141. }
  142. frame b {
  143. set d = 3mm
  144. frame x @
  145. }
  146. frame a @
  147. vec @(1mm, 0mm)
  148. frame b .
  149. meas x.a >> x.b /* dummy */
  150. m: meas b/x.a >> b/x.b
  151. %meas m
  152. EOF
  153. expect <<EOF
  154. 3
  155. EOF
  156. #------------------------------------------------------------------------------
  157. fped "qualified measurements: \"macro\" qualified (a/b)" <<EOF
  158. frame x {
  159. a: vec @(0mm, 0mm)
  160. b: vec .(d, 0mm)
  161. }
  162. frame a {
  163. set d = 2mm
  164. frame x @
  165. }
  166. frame b {
  167. set d = 3mm
  168. frame x @
  169. }
  170. frame a @
  171. vec @(1mm, 0mm)
  172. frame b .
  173. meas x.a >> x.b /* dummy */
  174. m: meas a/x.a >> b/x.b
  175. %meas m
  176. EOF
  177. expect <<EOF
  178. 4
  179. EOF
  180. #------------------------------------------------------------------------------
  181. fped "qualified measurements: \"macro\" qualified (b/a)" <<EOF
  182. frame x {
  183. a: vec @(0mm, 0mm)
  184. b: vec .(d, 0mm)
  185. }
  186. frame a {
  187. set d = 2mm
  188. frame x @
  189. }
  190. frame b {
  191. set d = 3mm
  192. frame x @
  193. }
  194. frame a @
  195. vec @(1mm, 0mm)
  196. frame b .
  197. meas x.a >> x.b /* dummy */
  198. m: meas b/x.a >> a/x.b
  199. %meas m
  200. EOF
  201. expect <<EOF
  202. 1
  203. EOF
  204. ###############################################################################