diff options
Diffstat (limited to 'src/util/test_program.c')
-rw-r--r-- | src/util/test_program.c | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/src/util/test_program.c b/src/util/test_program.c index a9b3b064a..983610f2e 100644 --- a/src/util/test_program.c +++ b/src/util/test_program.c | |||
@@ -11,12 +11,12 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file util/test_program.c | 21 | * @file util/test_program.c |
22 | * @brief tests for program.c | 22 | * @brief tests for program.c |
@@ -34,23 +34,23 @@ static int setme2; | |||
34 | * Main function that will be run. | 34 | * Main function that will be run. |
35 | */ | 35 | */ |
36 | static void | 36 | static void |
37 | runner (void *cls, | 37 | runner(void *cls, |
38 | char *const *args, | 38 | char *const *args, |
39 | const char *cfgfile, | 39 | const char *cfgfile, |
40 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 40 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
41 | { | 41 | { |
42 | int *ok = cls; | 42 | int *ok = cls; |
43 | 43 | ||
44 | GNUNET_assert (setme1 == 1); | 44 | GNUNET_assert(setme1 == 1); |
45 | GNUNET_assert (0 == strcmp (args[0], "extra")); | 45 | GNUNET_assert(0 == strcmp(args[0], "extra")); |
46 | GNUNET_assert (args[1] == NULL); | 46 | GNUNET_assert(args[1] == NULL); |
47 | GNUNET_assert (NULL != strstr (cfgfile, "/test_program_data.conf")); | 47 | GNUNET_assert(NULL != strstr(cfgfile, "/test_program_data.conf")); |
48 | *ok = 0; | 48 | *ok = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | int | 52 | int |
53 | main (int argc, char *argv[]) | 53 | main(int argc, char *argv[]) |
54 | { | 54 | { |
55 | int ok = 1; | 55 | int ok = 1; |
56 | char *const argvx[] = { | 56 | char *const argvx[] = { |
@@ -64,72 +64,72 @@ main (int argc, char *argv[]) | |||
64 | NULL | 64 | NULL |
65 | }; | 65 | }; |
66 | struct GNUNET_GETOPT_CommandLineOption options1[] = { | 66 | struct GNUNET_GETOPT_CommandLineOption options1[] = { |
67 | GNUNET_GETOPT_option_flag ('n', | 67 | GNUNET_GETOPT_option_flag('n', |
68 | "name", | 68 | "name", |
69 | "description", | 69 | "description", |
70 | &setme1), | 70 | &setme1), |
71 | GNUNET_GETOPT_OPTION_END | 71 | GNUNET_GETOPT_OPTION_END |
72 | }; | 72 | }; |
73 | struct GNUNET_GETOPT_CommandLineOption options2[] = { | 73 | struct GNUNET_GETOPT_CommandLineOption options2[] = { |
74 | GNUNET_GETOPT_option_flag ('n', | 74 | GNUNET_GETOPT_option_flag('n', |
75 | "name", | 75 | "name", |
76 | "description", | 76 | "description", |
77 | &setme1), | 77 | &setme1), |
78 | GNUNET_GETOPT_option_flag ('N', | 78 | GNUNET_GETOPT_option_flag('N', |
79 | "number", | 79 | "number", |
80 | "description", | 80 | "description", |
81 | &setme2), | 81 | &setme2), |
82 | GNUNET_GETOPT_OPTION_END | 82 | GNUNET_GETOPT_OPTION_END |
83 | }; | 83 | }; |
84 | struct GNUNET_GETOPT_CommandLineOption options3[] = { | 84 | struct GNUNET_GETOPT_CommandLineOption options3[] = { |
85 | GNUNET_GETOPT_option_flag ('N', | 85 | GNUNET_GETOPT_option_flag('N', |
86 | "number", | 86 | "number", |
87 | "description", | 87 | "description", |
88 | &setme1), | 88 | &setme1), |
89 | GNUNET_GETOPT_option_flag ('n', | 89 | GNUNET_GETOPT_option_flag('n', |
90 | "name", | 90 | "name", |
91 | "description", | 91 | "description", |
92 | &setme2), | 92 | &setme2), |
93 | GNUNET_GETOPT_OPTION_END | 93 | GNUNET_GETOPT_OPTION_END |
94 | }; | 94 | }; |
95 | struct GNUNET_GETOPT_CommandLineOption options4[] = { | 95 | struct GNUNET_GETOPT_CommandLineOption options4[] = { |
96 | GNUNET_GETOPT_option_flag ('n', | 96 | GNUNET_GETOPT_option_flag('n', |
97 | "name", | 97 | "name", |
98 | "description", | 98 | "description", |
99 | &setme1), | 99 | &setme1), |
100 | GNUNET_GETOPT_option_flag ('n', | 100 | GNUNET_GETOPT_option_flag('n', |
101 | "name", | 101 | "name", |
102 | "description", | 102 | "description", |
103 | &setme2), | 103 | &setme2), |
104 | GNUNET_GETOPT_OPTION_END | 104 | GNUNET_GETOPT_OPTION_END |
105 | }; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | GNUNET_log_setup ("test_program", | 108 | GNUNET_log_setup("test_program", |
109 | "WARNING", | 109 | "WARNING", |
110 | NULL); | 110 | NULL); |
111 | GNUNET_assert (GNUNET_OK == | 111 | GNUNET_assert(GNUNET_OK == |
112 | GNUNET_PROGRAM_run (7, argvx, | 112 | GNUNET_PROGRAM_run(7, argvx, |
113 | "test_program", | 113 | "test_program", |
114 | "A test", | 114 | "A test", |
115 | options1, | 115 | options1, |
116 | &runner, &ok)); | 116 | &runner, &ok)); |
117 | 117 | ||
118 | GNUNET_assert (GNUNET_OK == | 118 | GNUNET_assert(GNUNET_OK == |
119 | GNUNET_PROGRAM_run (7, argvx, | 119 | GNUNET_PROGRAM_run(7, argvx, |
120 | "test_program", "A test", | 120 | "test_program", "A test", |
121 | options2, | 121 | options2, |
122 | &runner, &ok)); | 122 | &runner, &ok)); |
123 | GNUNET_assert (GNUNET_OK == | 123 | GNUNET_assert(GNUNET_OK == |
124 | GNUNET_PROGRAM_run (7, argvx, | 124 | GNUNET_PROGRAM_run(7, argvx, |
125 | "test_program", "A test", | 125 | "test_program", "A test", |
126 | options3, | 126 | options3, |
127 | &runner, &ok)); | 127 | &runner, &ok)); |
128 | GNUNET_assert (GNUNET_OK == | 128 | GNUNET_assert(GNUNET_OK == |
129 | GNUNET_PROGRAM_run (7, argvx, | 129 | GNUNET_PROGRAM_run(7, argvx, |
130 | "test_program", "A test", | 130 | "test_program", "A test", |
131 | options4, | 131 | options4, |
132 | &runner, &ok)); | 132 | &runner, &ok)); |
133 | 133 | ||
134 | return ok; | 134 | return ok; |
135 | } | 135 | } |