test_String_extensions.praat 1.1 KB

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