File: keys

package info (click to toggle)
fped 0.1%2B201210-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 948 kB
  • ctags: 1,663
  • sloc: ansic: 12,650; yacc: 1,112; sh: 974; lex: 204; makefile: 140; awk: 75
file content (134 lines) | stat: -rwxr-xr-x 2,605 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/sh
. ./Common

###############################################################################

fped "keys: tables, master before slave" <<EOF
table { a, eng } { 1, "one" } { 2, "two" }
table { ?a, ger } { 1, "eins" } { 2, "zwei" }

%iprint eng
%iprint ger
EOF
expect <<EOF
one
eins
two
zwei
EOF

#------------------------------------------------------------------------------

fped "keys: tables, master after slave" <<EOF
table { ?a, eng } { 1, "one" } { 2, "two" }
table { a, spa } { 1, "uno" } { 2, "dos" }

%iprint eng
%iprint spa
EOF
expect <<EOF
one
uno
two
dos
EOF

#------------------------------------------------------------------------------

fped_fail "keys: tables, slaves without master" <<EOF
table { ?a, eng } { 1, "one" } { 2, "two" }
table { ?a, lat } { 1, "unum" } { 2, "duo" }

%iprint eng
%iprint lat
EOF
expect <<EOF
undefined variable "a"
EOF

#------------------------------------------------------------------------------

fped_fail "keys: tables, both masters" <<EOF
table { a, eng } { 1, "one" } { 2, "two" }
table { a, lat } { 1, "unum" } { 2, "duo" }

%iprint eng
%iprint lat
EOF
expect <<EOF
2: duplicate variable "a" near "a"
EOF

#------------------------------------------------------------------------------

fped "keys: master is single variable, slave is table" <<EOF
set n = 2
table { ?n, square } { 1, 1 } { 2, 4 } { 3, 9 } { 4, 16 }

%iprint square
EOF
expect <<EOF
4
EOF

#------------------------------------------------------------------------------

fped "keys: master is table, slave is single variable" <<EOF
table { n, cube } { 1, 1 } { 2, 8 } { 3, 27 } { 4, 64 }
set ?n = 3

%iprint cube
EOF
expect <<EOF
27
EOF

#------------------------------------------------------------------------------

fped "keys: master is loop, slave is table" <<EOF
loop n = 1, 3
table { ?n, sqr } { 1, 1 } { 2, 4 } { 3, 9 } { 4, 16 }

%iprint sqr
EOF
expect <<EOF
1
4
9
EOF

#------------------------------------------------------------------------------

fped "keys: two keys" <<EOF
table { a, an } { 1, "one" } { 2, "two" }
table { b, bn } { 3, "three" } { 4, "four" } { 5, "five" }
table { ?a, ?b, sum }
  { 1, 3, "four" }
  { 2, 4, "six" }
  { 3, 4, "seven" }

%iprint sum
EOF
expect <<EOF
four
six
EOF

#------------------------------------------------------------------------------

fped "keys: key set by outer frame" <<EOF
frame tab {
	table { sqrt, ?n } { 1, 1 } { 2, 4 } { 3, 9 } { 4, 16 } { 5, 25 }
	%iprint sqrt
}

table { n } { 25 } { 9 }

frame tab @
EOF
expect <<EOF
5
3
EOF

###############################################################################