32#include "tinytest_macros.h"
51test_strcmp(
void *data)
59 tt_abort_msg(
"The empty string was not equal to itself");
64 tt_assert(strcmp(
"testcase",
"testcase") == 0);
69 tt_want(strcmp(
"tinytest",
"testcase") > 0);
77 tt_int_op(strcmp(
"abc",
"abc"), OP_EQ, 0);
80 tt_int_op(strcmp(
"abc",
"abcd"), OP_LT, 0);
83 tt_str_op(
"abc", OP_LT,
"abcd");
112setup_data_buffer(
const struct testcase_t *testcase)
127clean_data_buffer(
const struct testcase_t *testcase,
void *ptr)
139 setup_data_buffer, clean_data_buffer
145test_memcpy(
void *ptr)
154 strcpy(db->buffer1,
"String 0");
155 memcpy(db->buffer2, db->buffer1,
sizeof(db->buffer1));
156 tt_str_op(db->buffer1, OP_EQ, db->buffer2);
159 db->buffer2[100] = 3;
160 tt_mem_op(db->buffer1, OP_LT, db->buffer2,
sizeof(db->buffer1));
164 mem = strdup(
"Hello world.");
168 tt_str_op(db->buffer1, OP_NE, mem);
177test_timeout(
void *ptr)
189 tt_int_op(t2-t1, OP_GE, 4);
191 tt_int_op(t2-t1, OP_LE, 6);
206 {
"strcmp", test_strcmp, },
211 {
"memcpy", test_memcpy, TT_FORK, &data_buffer_setup },
215 {
"timeout", test_timeout, TT_OFF_BY_DEFAULT },
226 {
"demo/", demo_tests },
233const char *alltests[] = {
"+..", NULL };
234const char *slowtests[] = {
"+demo/timeout", NULL };
238 {
"SLOW", slowtests },
245main(
int c,
const char **v)
262 tinytest_set_aliases(aliases);
263 return tinytest_main(c, v, groups);
Definitions for timing-related constants.
int main(int argc, char *argv[])