9unit/test/tests.c

62 lines
1.4 KiB
C

/*
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.
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.
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/>.
*/
#include <u.h>
#include <libc.h>
#include "../9unit.h"
#include "initial-state.h"
#include "run-test.h"
#include "append-test-log.h"
#include "test-context.h"
// Internal Prototypes
static void tests(TestState *);
// Public Functions
void
main()
{
run_tests(tests);
exits(0);
}
// Internal Functions
static void
tests(TestState *s)
{
if (!s) exits("ERROR: no TestState");
// Make a copy of the initial TestState
TestState scpy;
memcpy(&scpy, s, sizeof(TestState));
test_context_with(s, "initial state", test_initial_state, &scpy);
test_context(s, "run_test()", test_run_test);
test_context(s, "append_test_log()", test_append_test_log);
test_context(s, "test_context()", test_test_context);
}
//jl