Root/
| 1 | #!/bin/sh |
| 2 | . ./Common |
| 3 | |
| 4 | ############################################################################### |
| 5 | |
| 6 | fped "keys: tables, master before slave" <<EOF |
| 7 | table { a, eng } { 1, "one" } { 2, "two" } |
| 8 | table { ?a, ger } { 1, "eins" } { 2, "zwei" } |
| 9 | |
| 10 | %iprint eng |
| 11 | %iprint ger |
| 12 | EOF |
| 13 | expect <<EOF |
| 14 | one |
| 15 | eins |
| 16 | two |
| 17 | zwei |
| 18 | EOF |
| 19 | |
| 20 | #------------------------------------------------------------------------------ |
| 21 | |
| 22 | fped "keys: tables, master after slave" <<EOF |
| 23 | table { ?a, eng } { 1, "one" } { 2, "two" } |
| 24 | table { a, spa } { 1, "uno" } { 2, "dos" } |
| 25 | |
| 26 | %iprint eng |
| 27 | %iprint spa |
| 28 | EOF |
| 29 | expect <<EOF |
| 30 | one |
| 31 | uno |
| 32 | two |
| 33 | dos |
| 34 | EOF |
| 35 | |
| 36 | #------------------------------------------------------------------------------ |
| 37 | |
| 38 | fped_fail "keys: tables, slaves without master" <<EOF |
| 39 | table { ?a, eng } { 1, "one" } { 2, "two" } |
| 40 | table { ?a, lat } { 1, "unum" } { 2, "duo" } |
| 41 | |
| 42 | %iprint eng |
| 43 | %iprint lat |
| 44 | EOF |
| 45 | expect <<EOF |
| 46 | undefined variable "a" |
| 47 | EOF |
| 48 | |
| 49 | #------------------------------------------------------------------------------ |
| 50 | |
| 51 | fped_fail "keys: tables, both masters" <<EOF |
| 52 | table { a, eng } { 1, "one" } { 2, "two" } |
| 53 | table { a, lat } { 1, "unum" } { 2, "duo" } |
| 54 | |
| 55 | %iprint eng |
| 56 | %iprint lat |
| 57 | EOF |
| 58 | expect <<EOF |
| 59 | 2: duplicate variable "a" near "a" |
| 60 | EOF |
| 61 | |
| 62 | #------------------------------------------------------------------------------ |
| 63 | |
| 64 | fped "keys: master is single variable, slave is table" <<EOF |
| 65 | set n = 2 |
| 66 | table { ?n, square } { 1, 1 } { 2, 4 } { 3, 9 } { 4, 16 } |
| 67 | |
| 68 | %iprint square |
| 69 | EOF |
| 70 | expect <<EOF |
| 71 | 4 |
| 72 | EOF |
| 73 | |
| 74 | #------------------------------------------------------------------------------ |
| 75 | |
| 76 | fped "keys: master is table, slave is single variable" <<EOF |
| 77 | table { n, cube } { 1, 1 } { 2, 8 } { 3, 27 } { 4, 64 } |
| 78 | set ?n = 3 |
| 79 | |
| 80 | %iprint cube |
| 81 | EOF |
| 82 | expect <<EOF |
| 83 | 27 |
| 84 | EOF |
| 85 | |
| 86 | #------------------------------------------------------------------------------ |
| 87 | |
| 88 | fped "keys: master is loop, slave is table" <<EOF |
| 89 | loop n = 1, 3 |
| 90 | table { ?n, sqr } { 1, 1 } { 2, 4 } { 3, 9 } { 4, 16 } |
| 91 | |
| 92 | %iprint sqr |
| 93 | EOF |
| 94 | expect <<EOF |
| 95 | 1 |
| 96 | 4 |
| 97 | 9 |
| 98 | EOF |
| 99 | |
| 100 | #------------------------------------------------------------------------------ |
| 101 | |
| 102 | fped "keys: two keys" <<EOF |
| 103 | table { a, an } { 1, "one" } { 2, "two" } |
| 104 | table { b, bn } { 3, "three" } { 4, "four" } { 5, "five" } |
| 105 | table { ?a, ?b, sum } |
| 106 | { 1, 3, "four" } |
| 107 | { 2, 4, "six" } |
| 108 | { 3, 4, "seven" } |
| 109 | |
| 110 | %iprint sum |
| 111 | EOF |
| 112 | expect <<EOF |
| 113 | four |
| 114 | six |
| 115 | EOF |
| 116 | |
| 117 | #------------------------------------------------------------------------------ |
| 118 | |
| 119 | fped "keys: key set by outer frame" <<EOF |
| 120 | frame tab { |
| 121 | table { sqrt, ?n } { 1, 1 } { 2, 4 } { 3, 9 } { 4, 16 } { 5, 25 } |
| 122 | %iprint sqrt |
| 123 | } |
| 124 | |
| 125 | table { n } { 25 } { 9 } |
| 126 | |
| 127 | frame tab @ |
| 128 | EOF |
| 129 | expect <<EOF |
| 130 | 5 |
| 131 | 3 |
| 132 | EOF |
| 133 | |
| 134 | ############################################################################### |
| 135 |
Branches:
master
