|
| 1 | +runtest = files(join_paths(meson.project_source_root(), 'tests', 'runtest.sh')) |
| 2 | + |
| 3 | +tests = { |
| 4 | + 'multi': { 'args': [] }, |
| 5 | + 'multi_max_line': { 'args': ['-DINI_MAX_LINE=20'] }, |
| 6 | + 'single': { 'args': ['-DINI_ALLOW_MULTILINE=0'] }, |
| 7 | + 'disallow_inline_comments': { 'args': ['-DINI_ALLOW_INLINE_COMMENTS=0'] }, |
| 8 | + 'stop_on_first_error': { 'args': ['-DINI_STOP_ON_FIRST_ERROR=1'] }, |
| 9 | + 'handler_lineno': { 'args': ['-DINI_HANDLER_LINENO=1'] }, |
| 10 | + 'string': { 'src': 'unittest_string.c', 'args': ['-DINI_MAX_LINE=20'] }, |
| 11 | + 'heap': { 'args': ['-DINI_USE_STACK=0'] }, |
| 12 | + 'heap_max_line': { 'args': ['-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_INITIAL_ALLOC=20'] }, |
| 13 | + 'heap_realloc': { 'args': ['-DINI_USE_STACK=0', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=5'] }, |
| 14 | + 'heap_realloc_max_line': { 'args': ['-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=5'] }, |
| 15 | + 'heap_string': { 'src': 'unittest_string.c', 'args': ['-DINI_USE_STACK=0', '-DINI_MAX_LINE=20', '-DINI_INITIAL_ALLOC=20'] }, |
| 16 | + 'call_handler_on_new_section': { 'args': ['-DINI_CALL_HANDLER_ON_NEW_SECTION=1'] }, |
| 17 | + 'allow_no_value': { 'args': ['-DINI_ALLOW_NO_VALUE=1'] }, |
| 18 | + 'alloc': { 'src': 'unittest_alloc.c', 'args': ['-DINI_CUSTOM_ALLOCATOR=1', '-DINI_USE_STACK=0', '-DINI_ALLOW_REALLOC=1', '-DINI_INITIAL_ALLOC=12'] } |
| 19 | +} |
| 20 | + |
| 21 | +foreach name, properties : tests |
| 22 | + test_src = 'src' in properties ? properties['src'] : 'unittest.c' |
| 23 | + exe = executable('unittest_' + name, src_inih, test_src, c_args : ['-Wall', properties['args']]) |
| 24 | + test('test_' + name, runtest, depends : [exe], args : [files('baseline_' + name + '.txt'), exe.full_path()]) |
| 25 | +endforeach |
0 commit comments