Debian Codegraph @

dwtest/runAllTests.praat

raw
1 # dwtest/runAllTests.praat
2 # 2024-12-01 writing settings to UTF-8 for Praat 7
3 # 2025-08-16 make more reproducible
4
5 #
6 # Some tests require standard settings for the text input encoding:
7 # files in UTF-8 format should always be readable.
8 #
9 Text writing preferences: "UTF-8"
10 if macintosh
11 Text reading preferences: "try UTF-8, then MacRoman"
12 elif windows
13 Text reading preferences: "try UTF-8, then Windows Latin-1"
14 elif unix
15 Text reading preferences: "try UTF-8, then ISO Latin-1"
16 else
17 exitScript: "Unknown operating system."
18 endif
19
20 writeInfoLine: "Running all tests..."
21
22 tests = Create Strings as file list: "tests", "test_*.praat"
23 ntests = Get number of strings
24 for itest to ntests
25 selectObject: tests
26 test$ = Get string: itest
27 appendInfoLine: test$
28 report_before$ = Report memory use
29 #
30 # The following two lines aim at making the test reproducible.
31 # That is, the test should give the same result on different
32 # computers and different platforms and at different times.
33 # The random seed is allowed to change with the Praat release;
34 # just run all the tests if you change the random seed,
35 # even if there was no change in the Praat source code.
36 # This is because the success of some precision tests
37 # has been reported (by maintainers) to depend on the random state.
38 # Also make sure that the random seed is the same
39 # for the other two "runAlltests" scripts.
40 #
41 random_initializeWithSeedUnsafelyButPredictably (5489)
42 Debug multi-threading: "yes", 8, 0, "no"
43 runScript: test$
44 @check_memory: report_before$, " "
45 endfor
46 random_initializeSafelyAndUnpredictably()
47 Debug multi-threading: "yes", 0, 0, "no"
48
49 procedure check_memory: .report_before$, .preprint$
50 .m$[1] = "Strings: "
51 .m$[2] = "Arrays: "
52 .m$[3] = "Things: "
53 .report_after$ = Report memory use
54 appendInfoLine: .preprint$, "Memory:"
55 for .i to 3
56 .nb = extractNumber (.report_before$, .m$[.i])
57 .na = extractNumber (.report_after$, .m$[.i])
58 .post$ = if .nb <> .na then " !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" else "" endif
59 appendInfoLine: .preprint$, .m$[.i], .nb, " ", .na, .post$
60 endfor
61 endproc
62 removeObject: tests
63
64 appendInfoLine: " ALL PRAAT TESTS WENT OK"
65 appendInfoLine: ""
66 line$ [5] = " ##### ##### ##### #####"
67 line$ [8] = " ##### ##### #######"
68 line$ [1] = " ###### ##### #####"
69 line$ [2] = " ############## ##### #####"
70 line$ [4] = " ##### ##### ##### #####"
71 line$ [7] = " ##### ##### #########"
72 line$ [9] = " ##### ##### #####"
73 line$ [3] = " ##### ##### ##### #####"
74 line$ [6] = " ##### ##### ##### #####"
75 for line from 1 to 9
76 appendInfoLine: line$ [line]
77 endfor
78 for line from 1 to 8
79 appendInfoLine: line$ [9 - line]
80 endfor