Debian Codegraph @

dwtest/test_String_extensions.praat

raw
1 # test_String_extensions.praat
2 # djmw 20170401
3
4 appendInfoLine: "test_String_extensions"
5
6 procedure test: .string$, .separators$, .ntokens
7 tokens = Create Strings as tokens: .string$, .separators$
8 numberOfStrings = Get number of strings
9 assert numberOfStrings = .ntokens; "'.string$'", "'.separators$', 'numberOfStrings'"
10 removeObject: tokens
11 endproc
12
13 @test: "a", " ", 1
14 @test: "a", ",", 1
15 @test: "a", " ", 1
16
17 @test: "a b c", " ", 3
18 @test: "a b c", " ,", 3
19 @test: "a b c", ",", 1
20
21 @test: "a b c", ",", 1
22 @test: "a b c", " ", 3
23 @test: "a,,,, b c", " ", 3
24 @test: "a,,,,b,,,c", " ", 1
25 @test: "a,,,,b,,,c", ",", 3
26 @test: "a", " ,", 1
27 @test: "a b", " , ", 2
28 @test: " a b", " , ", 2
29 @test: "a,,,,b,,,c", " ", 1
30 @test: "a, ,b, ,c", ",", 5
31
32 @test: "A string\tof ..tokens\nand some more tokens", ".,", 2
33 @test: "A string\tof ..tokens\nand some more tokens", " .,", 6
34 @test: "A string\tof ..tokens\nand some more tokens", " .,", 6
35 @test: "A string" + tab$+ "of ..tokens"+newline$+"and some more tokens", " .,"+tab$+newline$, 8
36
37 appendInfoLine: "test_String_extensions OK"