29 lines
522 B
C
29 lines
522 B
C
#include "xtest.h"
|
|
#include "source.h"
|
|
#include "examples.h"
|
|
|
|
|
|
void rand_int() {
|
|
int a = xtest_rand_int();
|
|
int b = xtest_rand_int();
|
|
int res = a + b;
|
|
xtest_assert_is(add(a, b), res);
|
|
}
|
|
|
|
void rand_double() {
|
|
double a = xtest_rand_double_range(0, 10);
|
|
double b = xtest_rand_double_range(0, 10);
|
|
double diff = a - b;
|
|
xtest_assert(diff < 10.0);
|
|
}
|
|
|
|
void example_prng(void) {
|
|
xtest_run(rand_int);
|
|
xtest_run(rand_double);
|
|
}
|
|
|
|
|
|
#ifndef XTEST_ALL_EXAMPLES
|
|
XTEST_RUN_MAIN(example_prng)
|
|
#endif
|