|
@@ -190,15 +190,15 @@ void teardown_fname(void)
|
190
|
190
|
START_TEST (test_argparse_file_non_exist)
|
191
|
191
|
{
|
192
|
192
|
ttail_t *t;
|
193
|
|
- char *args[3] = {"foo", "-l", NULL};
|
|
193
|
+ char *args[4] = {"foo", "-d", "Mar 6 13:37", NULL};
|
194
|
194
|
|
195
|
|
- args[2] = fname[FNAME_NO_EXIST];
|
196
|
|
- t = ttail_init(3, args);
|
|
195
|
+ args[3] = fname[FNAME_NO_EXIST];
|
|
196
|
+ t = ttail_init(4, args);
|
197
|
197
|
ck_assert_msg(t != NULL, "init failed");
|
198
|
198
|
|
199
|
199
|
ck_assert_msg(t->logfile_sz == 1,
|
200
|
200
|
"ttail_t.logfile_sz should be 1");
|
201
|
|
- ck_assert_msg(strcmp(t->logfile_name[0], args[2]) == 0,
|
|
201
|
+ ck_assert_msg(strcmp(t->logfile_name[0], args[3]) == 0,
|
202
|
202
|
"ttail_t.logfile_name[0] does not contain the filename");
|
203
|
203
|
ck_assert_msg(t->logfile[0] == NULL,
|
204
|
204
|
"ttail_t.logfile[0] should be NULL");
|
|
@@ -211,16 +211,16 @@ END_TEST
|
211
|
211
|
START_TEST (test_argparse_file_exist)
|
212
|
212
|
{
|
213
|
213
|
ttail_t *t;
|
214
|
|
- char *args[3] = {"foo", "-l", NULL};
|
|
214
|
+ char *args[4] = {"foo", "-d", "Mar 10 13:37", NULL};
|
215
|
215
|
|
216
|
|
- args[2] = fname[FNAME_EXIST];
|
|
216
|
+ args[3] = fname[FNAME_EXIST];
|
217
|
217
|
|
218
|
|
- t = ttail_init(3, args);
|
|
218
|
+ t = ttail_init(4, args);
|
219
|
219
|
ck_assert_msg(t != NULL, "init failed");
|
220
|
220
|
|
221
|
221
|
ck_assert_msg(t->logfile_sz == 1,
|
222
|
222
|
"ttail_t.logfile_sz should be 1");
|
223
|
|
- ck_assert_msg(strcmp(t->logfile_name[0], args[2]) == 0,
|
|
223
|
+ ck_assert_msg(strcmp(t->logfile_name[0], args[3]) == 0,
|
224
|
224
|
"ttail_t.logfile_name[0] does not contain the filename");
|
225
|
225
|
ck_assert_msg(t->logfile[0] != NULL,
|
226
|
226
|
"ttail_t.logfile[0] shouldn't be NULL");
|
|
@@ -234,15 +234,15 @@ START_TEST (test_argparse_file_multiple)
|
234
|
234
|
{
|
235
|
235
|
ttail_t *t;
|
236
|
236
|
int i;
|
237
|
|
- char *args[11] = {"foo", "-l", NULL, "-l", NULL,
|
238
|
|
- "-l", NULL, "-l", NULL, "-l", NULL};
|
|
237
|
+ char *args[8] = {"foo", "-d", "mar 10 13:37", NULL, NULL, NULL, NULL,
|
|
238
|
+ NULL};
|
239
|
239
|
|
240
|
240
|
for(i=0; i<__Fname_sz; i++)
|
241
|
241
|
{
|
242
|
|
- args[(i*2)+2] = fname[i];
|
|
242
|
+ args[i+3] = fname[i];
|
243
|
243
|
}
|
244
|
244
|
|
245
|
|
- t = ttail_init(11, args);
|
|
245
|
+ t = ttail_init(8, args);
|
246
|
246
|
ck_assert_msg(t != NULL, "init failed");
|
247
|
247
|
|
248
|
248
|
ck_assert_msg(t->logfile_sz == __Fname_sz,
|
|
@@ -250,7 +250,7 @@ START_TEST (test_argparse_file_multiple)
|
250
|
250
|
|
251
|
251
|
for(i=0;i<__Fname_sz; i++)
|
252
|
252
|
{
|
253
|
|
- ck_assert_msg(strcmp(t->logfile_name[i], args[(i*2)+2]) == 0,
|
|
253
|
+ ck_assert_msg(strcmp(t->logfile_name[i], args[i+3]) == 0,
|
254
|
254
|
"some filename corrupted in ttail_t.logfile_name");
|
255
|
255
|
if(i%2)
|
256
|
256
|
{
|