Root/test/iprint

Source at commit 377b7f81193685f23c93546767a059e194419446 created 3 years 5 months ago.
By Werner Almesberger, fped.c: new option -m (for -p and -P) to suppress showing measurements
1#!/bin/sh
2. ./Common
3
4###############################################################################
5
6fped "iprint: loop" <<EOF
7loop x = 1, 3
8%iprint x
9EOF
10expect <<EOF
111
122
133
14EOF
15
16#------------------------------------------------------------------------------
17
18fped "iprint: two tables (independent)" <<EOF
19table { a } { 1 } { 2 }
20table { b } { 3 } { 4 }
21
22%iprint a*10+b
23EOF
24expect <<EOF
2513
2614
2723
2824
29EOF
30
31#------------------------------------------------------------------------------
32
33fped "iprint: two tables (2nd references 1st)" <<EOF
34table { a } { 1 } { 2 }
35table { b } { 3+a } { 4+a }
36
37%iprint a*10+b
38EOF
39expect <<EOF
4014
4115
4225
4326
44EOF
45
46#------------------------------------------------------------------------------
47
48fped "iprint: two tables (1st references 2nd)" <<EOF
49table { a } { 1+b } { 2+b }
50table { b } { 3 } { 4 }
51
52%iprint a*10+b
53EOF
54expect <<EOF
5543
5654
5753
5864
59EOF
60
61#------------------------------------------------------------------------------
62
63fped "iprint: inside frame (global variable)" <<EOF
64frame foo {
65    %iprint n
66}
67
68loop n = 1, 2
69frame foo @
70EOF
71expect <<EOF
721
732
74EOF
75
76#------------------------------------------------------------------------------
77
78fped "iprint: inside frame (local variable) " <<EOF
79frame foo {
80    set n1 = n+1
81    %iprint n1
82}
83
84loop n = 1, 2
85frame foo @
86EOF
87expect <<EOF
882
893
90EOF
91
92#------------------------------------------------------------------------------
93
94fped_fail "iprint: undefined variable" <<EOF
95%iprint foo
96EOF
97expect <<EOF
98undefined variable "foo"
99EOF
100
101#------------------------------------------------------------------------------
102
103fped_dump "iprint: dump" <<EOF
104%iprint 42
105EOF
106expect <<EOF
10742
108/* MACHINE-GENERATED ! */
109
110package "_"
111unit mm
112
113%iprint 42
114EOF
115
116###############################################################################
117

Archive Download this file

Branches:
master



interactive