9unit/test/tests.c

62 lines
1.4 KiB
C
Raw Normal View History

2023-11-07 15:29:08 -05:00
/*
9unit
Copyright (C) Jonathan Lamothe <jonathan@jlamothe.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
2023-11-07 15:29:08 -05:00
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
Lesser General Public License for more details.
2023-11-07 15:29:08 -05:00
You should have received a copy of the GNU Lesser General Public
License along with this program. If not, see
<http://www.gnu.org/licenses/>.
2023-11-07 15:29:08 -05:00
*/
#include <u.h>
#include <libc.h>
#include "../9unit.h"
#include "initial-state.h"
2023-11-08 18:38:42 -05:00
#include "run-test.h"
2023-11-10 15:30:44 -05:00
#include "append-test-log.h"
#include "test-context.h"
// Internal Prototypes
static void tests(TestState *);
// Public Functions
2023-11-07 15:29:08 -05:00
void
main()
{
2023-11-08 17:10:09 -05:00
run_tests(tests);
2023-11-07 15:29:08 -05:00
exits(0);
}
// Internal Functions
static void
tests(TestState *s)
{
if (!s) exits("ERROR: no TestState");
2023-11-19 23:50:42 -05:00
// Make a copy of the initial TestState
TestState scpy;
memcpy(&scpy, s, sizeof(TestState));
2023-11-19 23:50:42 -05:00
test_context_with(s, "initial state", test_initial_state, &scpy);
test_context(s, "run_test()", test_run_test);
2023-11-19 23:50:42 -05:00
test_context(s, "append_test_log()", test_append_test_log);
test_context(s, "test_context()", test_test_context);
}
2023-11-07 15:29:08 -05:00
//jl