(file_progress_show_total): use 'copied_bytes' to show numeric value.
[midnight-commander.git] / tests / src / filemanager / examine_cd.c
blobd3ee84e92ca136457bbd7a90083cdf4314a6b1ce
1 /*
2 src/filemanager - examine_cd() function testing
4 Copyright (C) 2012-2024
5 Free Software Foundation, Inc.
7 Written by:
8 Andrew Borodin <aborodin@vmail.ru>, 2012, 2020
9 Slava Zanko <slavazanko@gmail.com>, 2013
11 This file is part of the Midnight Commander.
13 The Midnight Commander is free software: you can redistribute it
14 and/or modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation, either version 3 of the License,
16 or (at your option) any later version.
18 The Midnight Commander is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #define TEST_SUITE_NAME "/src/filemanager"
29 #include "tests/mctest.h"
31 #include <stdio.h>
33 #include "src/filemanager/cd.c"
35 /* --------------------------------------------------------------------------------------------- */
37 WPanel *current_panel = NULL;
39 panel_view_mode_t
40 get_current_type (void)
42 return view_listing;
45 gboolean
46 panel_cd (WPanel *panel, const vfs_path_t *new_dir_vpath, enum cd_enum cd_type)
48 (void) panel;
49 (void) new_dir_vpath;
50 (void) cd_type;
52 return TRUE;
55 void
56 sync_tree (const vfs_path_t *vpath)
58 (void) vpath;
61 /* --------------------------------------------------------------------------------------------- */
63 static void
64 setup (void)
68 static void
69 teardown (void)
73 /* --------------------------------------------------------------------------------------------- */
75 #define check_examine_cd(input, etalon) \
76 { \
77 result = examine_cd (input); \
78 ck_assert_msg (strcmp (result->str, etalon) == 0, \
79 "\ninput (%s)\nactial (%s) not equal to\netalon (%s)", input, result->str, etalon); \
80 g_string_free (result, TRUE); \
83 /* *INDENT-OFF* */
84 START_TEST (test_examine_cd)
85 /* *INDENT-ON* */
87 GString *result;
89 g_setenv ("AAA", "aaa", TRUE);
91 check_examine_cd ("/test/path", "/test/path");
93 check_examine_cd ("$AAA", "aaa");
94 check_examine_cd ("${AAA}", "aaa");
95 check_examine_cd ("$AAA/test", "aaa/test");
96 check_examine_cd ("${AAA}/test", "aaa/test");
98 check_examine_cd ("/$AAA", "/aaa");
99 check_examine_cd ("/${AAA}", "/aaa");
100 check_examine_cd ("/$AAA/test", "/aaa/test");
101 check_examine_cd ("/${AAA}/test", "/aaa/test");
103 check_examine_cd ("/test/path/$AAA", "/test/path/aaa");
104 check_examine_cd ("/test/path/$AAA/test2", "/test/path/aaa/test2");
105 check_examine_cd ("/test/path/test1$AAA/test2", "/test/path/test1aaa/test2");
107 check_examine_cd ("/test/path/${AAA}", "/test/path/aaa");
108 check_examine_cd ("/test/path/${AAA}/test2", "/test/path/aaa/test2");
109 check_examine_cd ("/test/path/${AAA}test2", "/test/path/aaatest2");
110 check_examine_cd ("/test/path/test1${AAA}", "/test/path/test1aaa");
111 check_examine_cd ("/test/path/test1${AAA}test2", "/test/path/test1aaatest2");
113 check_examine_cd ("/test/path/\\$AAA", "/test/path/$AAA");
114 check_examine_cd ("/test/path/\\$AAA/test2", "/test/path/$AAA/test2");
115 check_examine_cd ("/test/path/test1\\$AAA", "/test/path/test1$AAA");
117 check_examine_cd ("/test/path/\\${AAA}", "/test/path/${AAA}");
118 check_examine_cd ("/test/path/\\${AAA}/test2", "/test/path/${AAA}/test2");
119 check_examine_cd ("/test/path/\\${AAA}test2", "/test/path/${AAA}test2");
120 check_examine_cd ("/test/path/test1\\${AAA}test2", "/test/path/test1${AAA}test2");
122 /* *INDENT-OFF* */
123 END_TEST
124 /* *INDENT-ON* */
126 /* --------------------------------------------------------------------------------------------- */
129 main (void)
131 TCase *tc_core;
133 tc_core = tcase_create ("Core");
135 tcase_add_checked_fixture (tc_core, setup, teardown);
137 /* Add new tests here: *************** */
138 tcase_add_test (tc_core, test_examine_cd);
139 /* *********************************** */
141 return mctest_run_all (tc_core);
144 /* --------------------------------------------------------------------------------------------- */