blob: e619f7cfa41acebb52e08116c5d9635feaca5fe5 (
plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#pragma once
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "../honeysuckle.h"
#include "colors.h"
#define STR_IMPL(x) #x
#define STR(x) STR_IMPL(x)
#define mu_indent " "
/* minunit testing macros modified from those at
www.jera.com/techinfo/jtns/jtn002.html */
#define mu_assert(message, test) do { \
if (!(test)) return message \
"\n" mu_indent " [" __FILE__ ":" STR(__LINE__) "]"; \
} while (0)
#define mu_run_test(name, test) do { \
lua_State *L = luaL_newstate(); \
luaL_openlibs(L); \
const char *message = test(L); \
lua_close(L); \
tests_run++; \
if (message) { \
printf(RED mu_indent "test '%s' failed: %s\n" RESET, name, message); \
tests_failed++; \
} \
} while (0)
#define mu_suite_start() tests_run_old = tests_run;
#define mu_suite_finish() printf(mu_indent "ran %d tests\n", tests_run - tests_run_old);
#define TEST(name) static const char* name(lua_State *L)
extern int tests_run, tests_run_old, tests_failed;
void hs_type_to_string_tests();
void hs_parse_args_tests();
void hs_parse_overloaded_tests();
void hs_create_table_tests();
void hs_create_enum_tests();
void hs_process_table_tests();
void hs_throw_error_tests();
void hs_traceback_tests();
void hs_call_tests();
void hs_call_args_tests();
void hs_pushstring_tests();
void hs_rxx_tests();
|