breakhack/test/check_util.c

61 lines
1.4 KiB
C
Raw Normal View History

2018-02-16 18:11:26 +01:00
/*
* BreakHack - A dungeone crawler RPG
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2017-11-30 21:00:47 +01:00
#include <stdlib.h>
#include <check.h>
#include "../src/util.h"
START_TEST(test_util_ec_malloc)
{
int *i = ec_malloc(sizeof(int));
ck_assert( i != NULL );
free(i);
}
END_TEST
static Suite* t_suite_create(void)
2017-11-30 21:00:47 +01:00
{
Suite *s;
TCase *tc_core;
s = suite_create("Util");
tc_core = tcase_create("Core");
tcase_add_test(tc_core, test_util_ec_malloc);
suite_add_tcase(s, tc_core);
return s;
}
int main(void)
{
int number_failed;
Suite *s;
SRunner *sr;
s = t_suite_create();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
return number_failed == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}