| 1 |
writeInfoLine: "Table: Rows to columns" |
| 2 |
|
| 3 |
orig = Create formant table (Peterson & Barney 1952) |
| 4 |
|
| 5 |
# Syntax 1 (command line syntax with "last argument = rest of line": poorly readable) |
| 6 |
new1 = nowarn Rows to columns... "Type Sex Speaker" IPA F0 F1 F2 F3 |
| 7 |
|
| 8 |
# Syntax 2 (with space-separated strings) |
| 9 |
selectObject: orig |
| 10 |
new2 = nowarn Rows to columns: "Type Sex Speaker", "IPA", "F0 F1 F2 F3" |
| 11 |
assert objectsAreIdentical (new1, new2) |
| 12 |
|
| 13 |
# Syntax 3 (with string arrays) |
| 14 |
selectObject: orig |
| 15 |
new3 = nowarn Rows to columns: { "Type", "Sex", "Speaker" }, "IPA", { "F0", "F1", "F2", "F3" } |
| 16 |
assert objectsAreIdentical (new1, new3) |
| 17 |
|
| 18 |
@test: new1 |
| 19 |
@test: new2 |
| 20 |
@test: new3 |
| 21 |
|
| 22 |
procedure test: which |
| 23 |
appendInfoLine: which |
| 24 |
selectObject: which |
| 25 |
numberOfRows = Get number of rows |
| 26 |
assert numberOfRows = 76 |
| 27 |
value = Get value: 10, "F1.u" |
| 28 |
assert value = 450 or value = 420 |
| 29 |
numberOfColumns = Get number of columns |
| 30 |
assert numberOfColumns = 43 |
| 31 |
columnName$ = Get column label: 10 |
| 32 |
assert columnName$ = "F0.\ic" |
| 33 |
endproc |
| 34 |
|
| 35 |
removeObject: orig, new1, new2, new3 |
| 36 |
|
| 37 |
appendInfoLine: "OK" |