| 1 |
project('configure file output format') |
| 2 |
|
| 3 |
data = configuration_data() |
| 4 |
data.set_quoted('str', 'hello world!', description: '''This is |
| 5 |
a multiline |
| 6 |
description''') |
| 7 |
data.set('unquoted', 'float') |
| 8 |
data.set('int', 42, description: 'ultimate question of life, the universe, and everything') |
| 9 |
data.set('bool', true) |
| 10 |
data.set('false', false) |
| 11 |
|
| 12 |
config_h = configure_file( |
| 13 |
configuration: data, |
| 14 |
output_format: 'c', |
| 15 |
output: 'config.h' |
| 16 |
) |
| 17 |
|
| 18 |
config_nasm = configure_file( |
| 19 |
configuration: data, |
| 20 |
output_format: 'nasm', |
| 21 |
output: 'config.nasm' |
| 22 |
) |
| 23 |
|
| 24 |
config_json = configure_file( |
| 25 |
configuration: data, |
| 26 |
output_format: 'json', |
| 27 |
output: 'config.json' |
| 28 |
) |
| 29 |
|
| 30 |
config_mg = configure_file( |
| 31 |
configuration: data, |
| 32 |
macro_name: 'CONFIG_MAGNESIUM_H', |
| 33 |
output_format: 'c', |
| 34 |
output: 'config_mg.h' |
| 35 |
) |
| 36 |
|
| 37 |
py = find_program('python3') |
| 38 |
compare_py = files('compare.py') |
| 39 |
expected_config_h = files('expected/config.h') |
| 40 |
expected_config_nasm = files('expected/config.nasm') |
| 41 |
expected_config_json = files('expected/config.json') |
| 42 |
expected_config_mg = files('expected/config.mg') |
| 43 |
|
| 44 |
test('c_output', py, args: [compare_py, expected_config_h, config_h]) |
| 45 |
test('nasm_output', py, args: [compare_py, expected_config_nasm, config_nasm]) |
| 46 |
test('json_output', py, args: [compare_py, expected_config_json, config_json]) |
| 47 |
test('c_mg_output', py, args: [compare_py, expected_config_mg, config_mg]) |