File: testutils.h

package info (click to toggle)
libmypaint 1.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,904 kB
  • sloc: ansic: 5,953; sh: 4,418; makefile: 292; python: 210
file content (27 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef TESTUTILS_H
#define TESTUTILS_H

typedef int (*TestFunction) (void *user_data);

typedef struct {
    char *id;
    TestFunction function;
    void *user_data;
} TestCase;

typedef enum {
    TEST_CASE_NORMAL = 0,
    TEST_CASE_BENCHMARK
} TestCaseType;

int test_cases_run(int argc, char **argv, TestCase *tests, int tests_n, TestCaseType type);

char *read_file(const char *path);

int expect_int(int expected, int actual, const char *description);
int expect_float(float expected, float actual, const char *description);
int expect_true(int actual, const char *description);

#define TEST_CASES_NUMBER(array) (sizeof(array) / sizeof(array[0]))

#endif // TESTUTILS_H