45 lines
811 B
C
45 lines
811 B
C
#include "xtest.h"
|
|
#include "source.h"
|
|
#include "examples.h"
|
|
|
|
static void test_simple() {
|
|
xtest_expect_assertion_failure();
|
|
div(10, 0);
|
|
}
|
|
|
|
static void test_no_failure() {
|
|
div(10, 1);
|
|
}
|
|
|
|
static void test_no_failure_2() {
|
|
div(10, 2);
|
|
}
|
|
|
|
static void test_will_fail() {
|
|
xtest_expect_assertion_failure();
|
|
div(10, 1);
|
|
}
|
|
|
|
static void test_will_fail_2() {
|
|
div(10, 0);
|
|
}
|
|
|
|
static void test_other_failure() {
|
|
xtest_expect_assertion_failure();
|
|
xtest_assert(0);
|
|
div(10, 0);
|
|
}
|
|
|
|
void example_expect_assertions() {
|
|
xtest_run(test_simple);
|
|
xtest_run(test_no_failure);
|
|
xtest_run(test_other_failure);
|
|
xtest_run(test_will_fail);
|
|
xtest_run(test_will_fail_2);
|
|
xtest_run(test_no_failure_2);
|
|
}
|
|
|
|
#ifndef XTEST_ALL_EXAMPLES
|
|
XTEST_RUN_MAIN(example_expect_assertions)
|
|
#endif
|