9unit/test/tests.c

63 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 and store it
TestState scpy;
memcpy(&scpy, s, sizeof(TestState));
s->ptr = &scpy;
test_context(s, "initial state", test_initial_state);
test_run_test(s);
test_append_test_log(s);
test_context(s, "test_context()", test_test_context);
}
//jl