|
Packit |
0b5880 |
/*
|
|
Packit |
0b5880 |
* Check: a unit test framework for C
|
|
Packit |
0b5880 |
* Copyright (C) 2001, 2002 Arien Malec
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
0b5880 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
0b5880 |
* License as published by the Free Software Foundation; either
|
|
Packit |
0b5880 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
0b5880 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
0b5880 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
0b5880 |
* Lesser General Public License for more details.
|
|
Packit |
0b5880 |
*
|
|
Packit |
0b5880 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
0b5880 |
* License along with this library; if not, write to the
|
|
Packit |
0b5880 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
|
Packit |
0b5880 |
* MA 02110-1301, USA.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#include "../lib/libcompat.h"
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
/* Tests for log related stuff in check which need non-exported functions. */
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#include <stdio.h>
|
|
Packit |
0b5880 |
#include <stdlib.h>
|
|
Packit |
0b5880 |
#include <string.h>
|
|
Packit |
0b5880 |
#include <check.h>
|
|
Packit |
0b5880 |
#include <check_list.h>
|
|
Packit |
0b5880 |
#include <check_impl.h>
|
|
Packit |
0b5880 |
#include <check_log.h>
|
|
Packit |
0b5880 |
#include "check_check.h"
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#if ENABLE_SUBUNIT
|
|
Packit |
0b5880 |
START_TEST(test_init_logging_subunit)
|
|
Packit |
0b5880 |
{
|
|
Packit |
0b5880 |
/* init_logging with CK_SUBUNIT sets stdout
|
|
Packit |
0b5880 |
* to a subunit function, not any log.
|
|
Packit |
0b5880 |
*/
|
|
Packit |
0b5880 |
Log * first_log = NULL;
|
|
Packit |
0b5880 |
Suite *s = suite_create("Suite");
|
|
Packit |
0b5880 |
SRunner *sr = srunner_create(s);
|
|
Packit |
0b5880 |
srunner_init_logging(sr, CK_SUBUNIT);
|
|
Packit |
0b5880 |
check_list_front (sr->loglst);
|
|
Packit |
0b5880 |
ck_assert_msg (!check_list_at_end(sr->loglst), "No entries in log list");
|
|
Packit |
0b5880 |
first_log = (Log *)check_list_val(sr->loglst);
|
|
Packit |
0b5880 |
ck_assert_msg (first_log != NULL, "log is NULL");
|
|
Packit |
0b5880 |
check_list_advance(sr->loglst);
|
|
Packit |
0b5880 |
ck_assert_msg(check_list_at_end(sr->loglst), "More than one entry in log list");
|
|
Packit |
0b5880 |
ck_assert_msg(first_log->lfun == subunit_lfun,
|
|
Packit |
0b5880 |
"Log function is not the subunit lfun.");
|
|
Packit |
0b5880 |
srunner_end_logging(sr);
|
|
Packit |
0b5880 |
srunner_free(sr);
|
|
Packit |
0b5880 |
}
|
|
Packit |
0b5880 |
END_TEST
|
|
Packit |
0b5880 |
#endif
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
Suite *make_log_internal_suite(void)
|
|
Packit |
0b5880 |
{
|
|
Packit |
0b5880 |
Suite *s;
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
#if ENABLE_SUBUNIT
|
|
Packit |
0b5880 |
TCase *tc_core_subunit;
|
|
Packit |
0b5880 |
s = suite_create("Log");
|
|
Packit |
0b5880 |
tc_core_subunit = tcase_create("Core SubUnit");
|
|
Packit |
0b5880 |
suite_add_tcase(s, tc_core_subunit);
|
|
Packit |
0b5880 |
tcase_add_test(tc_core_subunit, test_init_logging_subunit);
|
|
Packit |
0b5880 |
#else
|
|
Packit |
0b5880 |
s = suite_create("Log");
|
|
Packit |
0b5880 |
#endif
|
|
Packit |
0b5880 |
|
|
Packit |
0b5880 |
return s;
|
|
Packit |
0b5880 |
}
|
|
Packit |
0b5880 |
|