Rename *ll* and *ul* to ll and ul in in-interval
[maxima.git] / share / contrib / operatingsystem / rtest_operatingsystem.mac
blob1c0245952cd6db077c7858f78f746fa28b665fe3
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Tests for the operatingsystem package */
3 /* File tests may need write and read permissions in the current directory */
4 /* run the test (if you start maxima with ./maxima-local) with */
5 /* batch("share/contrib/operatingsystem/rtest_operatingsystem.mac", 'test); */
6 /* Be careful: if operations fail, directories may be left over or one might be in another directory! */
8 (kill(all),0);
9 0$
11 ( load("operatingsystem"), 0 );
14 (olddir : getcurrentdirectory(), 0);
17 (mkdir("testdir1"), 0);
20 (chdir("testdir1"),0);
23 (newdir : getcurrentdirectory(), 0);
26 mkdirokay : if sequal(concat(olddir, "testdir1/"), newdir) then "ok" else "not ok";
27 "ok"$
29 /* in the new directory, try to create, rename and remove a file */
30 pathname_name(stringout("testfile", "testdata"));
31 "testfile"$
33 length(directory("*"));
36 pathname_name(first(directory("*")));
37 "testfile"$
39 (rename_file("testfile", "testfile2"),0);
42 length(directory("*"));
45 pathname_name(first(directory("*")));
46 "testfile2"$
48 (copy_file("testfile2", "testfile3"),0);
51 length(directory("*"));
54 pathname_name(first(sort(directory("*"))));
55 "testfile2"$
57 pathname_name(second(sort(directory("*"))));
58 "testfile3"$
60 (delete_file("testfile2"),0);
63 length(directory("*"));
66 pathname_name(first(directory("*")));
67 "testfile3"$
69 (delete_file("testfile3"),0);
72 length(directory("*"));
76 (if sequal(mkdirokay, "ok") then chdir(".."),0);
80 /* do this test only if creating a new directory worked */
81 (if sequal(mkdirokay, "ok") then rmdir("testdir1"), 0);
84 /* now test a more complicated name - with spaces, german umlauts */
85 (mkdir("testdir1 äöüß"), 0);
88 /* do this test only if creating a new directory worked */
89 (chdir("testdir1 äöüß"),0);
92 (newdir : getcurrentdirectory(), 0);
95 mkdirokay : if sequal(concat(olddir, "testdir1 äöüß/"), newdir) then "ok" else "not ok";
96 "ok"$
98 /* do this test only if creating a new directory worked */
99 (if sequal(mkdirokay, "ok") then chdir(".."),0);
102 /* do this test only if creating a new directory worked */
103 (if sequal(mkdirokay, "ok") then rmdir("testdir1 äöüß"), 0);