1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include <check.h>
- #include <stdio.h>
- #include <libgen.h>
-
- #include "ttail_check.h"
- #include "ttail.h"
- #include "ttail_init.h"
- #include "ttail_search.h"
-
- START_TEST (test_search_closest_init)
- {
- int ret;
-
- ret = ttail_search_files_init(ttail);
- ck_assert_int_eq(ret,0);
- ck_assert(ttail->session->file.vpos == 0);
- #ifdef HUGEFILE
- ck_assert_int_eq(ttail->session->file.sz_div,0);
- #endif
- }
- END_TEST
-
- START_TEST (test_search_closest_init_filesz)
- {
- size_t i;
- ttail_search_files_init(ttail);
- for(i=0;i<6;i++)
- {
- ck_assert(samples_sz[i] == ttail->session->file.file_sz[i]);
- }
-
- }
- END_TEST
-
- START_TEST (test_search_closest_init_vfile)
- {
- size_t i;
- off_t full_sz;
-
- ttail_search_files_init(ttail);
-
- full_sz = 0;
- for(i=0;i<6;i++)
- {
- ck_assert(full_sz == ttail->session->file.vfile[i]);
- full_sz += samples_sz[i];
- }
- ck_assert(full_sz == ttail->session->file.vsz);
- }
- END_TEST
-
- TTAIL_CHECK_START( "ttail search_files checks",\
- "ttail_logline_closest_files_init() checks")
- TTAIL_SET_FIXTURE(setup_closest_fileinit, teardown_closest_fileinit);
- TTAIL_ADD_TEST(test_search_closest_init);
- TTAIL_ADD_TEST(test_search_closest_init_filesz);
- TTAIL_ADD_TEST(test_search_closest_init_vfile);
- TTAIL_CHECK_END
|