2020-01-04 14:21:38 +00:00
|
|
|
test_sources = [
|
2020-07-05 15:08:28 +00:00
|
|
|
'conformance_burntsushi_invalid.cpp',
|
|
|
|
'conformance_burntsushi_valid.cpp',
|
|
|
|
'conformance_iarna_invalid.cpp',
|
|
|
|
'conformance_iarna_valid.cpp',
|
2020-04-02 21:39:21 +00:00
|
|
|
'impl_toml.cpp',
|
2020-04-06 12:57:49 +00:00
|
|
|
'tests.cpp',
|
|
|
|
'parsing_floats.cpp',
|
2020-01-04 14:21:38 +00:00
|
|
|
'parsing_arrays.cpp',
|
|
|
|
'parsing_booleans.cpp',
|
|
|
|
'parsing_comments.cpp',
|
|
|
|
'parsing_dates_and_times.cpp',
|
|
|
|
'parsing_integers.cpp',
|
|
|
|
'parsing_key_value_pairs.cpp',
|
|
|
|
'parsing_spec_example.cpp',
|
|
|
|
'parsing_strings.cpp',
|
2020-02-03 09:12:43 +00:00
|
|
|
'parsing_tables.cpp',
|
2021-10-25 21:49:17 +00:00
|
|
|
'main.cpp',
|
2020-02-03 09:12:43 +00:00
|
|
|
'manipulating_arrays.cpp',
|
2020-03-03 08:10:07 +00:00
|
|
|
'manipulating_tables.cpp',
|
2020-04-06 12:57:49 +00:00
|
|
|
'manipulating_values.cpp',
|
2020-04-18 13:14:07 +00:00
|
|
|
'unicode.cpp',
|
2020-07-27 22:04:52 +00:00
|
|
|
'user_feedback.cpp',
|
2020-12-18 16:08:15 +00:00
|
|
|
'using_iterators.cpp',
|
2020-07-13 18:18:04 +00:00
|
|
|
'windows_compat.cpp'
|
2020-01-04 14:21:38 +00:00
|
|
|
]
|
|
|
|
|
2020-08-08 17:51:33 +00:00
|
|
|
#######################################################################################################################
|
|
|
|
# fast math check
|
|
|
|
#######################################################################################################################
|
|
|
|
|
|
|
|
compiler_supports_fast_math_args = []
|
|
|
|
if compiler.get_id() == 'gcc' or compiler.get_id() == 'clang'
|
|
|
|
compiler_supports_fast_math_args += '-ffast-math'
|
|
|
|
compiler_supports_fast_math_args += '-ffp-contract=fast'
|
|
|
|
elif compiler.get_id() == 'msvc' or compiler.get_id() == 'intel-cl'
|
|
|
|
compiler_supports_fast_math_args += '/fp:fast'
|
|
|
|
endif
|
2020-07-17 13:33:56 +00:00
|
|
|
compiler_supports_fast_math = compiler.links('''
|
|
|
|
#include <cmath>
|
|
|
|
#include <iostream>
|
|
|
|
int main()
|
|
|
|
{
|
2020-08-11 13:34:03 +00:00
|
|
|
std::cout << std::exp2(2.0) << std::pow(2.0, 3.0) << "\n";
|
2020-07-17 13:33:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
''',
|
2021-09-22 06:47:15 +00:00
|
|
|
name: 'supports fast-math',
|
|
|
|
args: compiler_supports_fast_math_args
|
2020-07-17 13:33:56 +00:00
|
|
|
)
|
2020-06-24 18:05:23 +00:00
|
|
|
|
2020-08-08 17:51:33 +00:00
|
|
|
#######################################################################################################################
|
|
|
|
# do the thing!
|
|
|
|
#######################################################################################################################
|
|
|
|
|
2020-07-17 13:33:56 +00:00
|
|
|
fast_math_modes = [ false, true ]
|
|
|
|
exception_modes = [ true, false ]
|
2020-07-21 13:11:32 +00:00
|
|
|
unreleased_feature_modes = [ false, true ]
|
2020-07-17 13:33:56 +00:00
|
|
|
cpp20_modes = [ false, true ]
|
2020-09-05 10:26:12 +00:00
|
|
|
test_executables = []
|
2020-07-17 13:33:56 +00:00
|
|
|
counter = 0
|
2020-07-25 17:37:30 +00:00
|
|
|
|
2020-07-17 13:33:56 +00:00
|
|
|
foreach cpp20 : cpp20_modes
|
2020-07-21 13:11:32 +00:00
|
|
|
if cpp20 and not compiler_supports_cpp20
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
foreach unrel : unreleased_feature_modes
|
2020-07-18 12:10:19 +00:00
|
|
|
foreach fast_math : fast_math_modes
|
|
|
|
if fast_math and not compiler_supports_fast_math
|
2020-07-17 13:33:56 +00:00
|
|
|
continue
|
|
|
|
endif
|
2020-07-18 12:10:19 +00:00
|
|
|
foreach exceptions : exception_modes
|
2020-07-17 13:33:56 +00:00
|
|
|
|
2020-09-05 10:26:12 +00:00
|
|
|
test_name = ''
|
|
|
|
test_overrides = []
|
|
|
|
test_overrides += overrides
|
|
|
|
test_args = []
|
|
|
|
test_args += additional_arguments
|
|
|
|
|
|
|
|
if cpp20
|
|
|
|
test_name = 'cpp20'
|
|
|
|
test_overrides += 'cpp_std=none'
|
|
|
|
test_args += compiler_supports_cpp20_args
|
|
|
|
if compiler_supports_char8
|
|
|
|
test_args += compiler_supports_char8_args
|
2020-07-18 12:10:19 +00:00
|
|
|
endif
|
2020-09-05 10:26:12 +00:00
|
|
|
else
|
|
|
|
test_name = 'cpp17'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if exceptions
|
|
|
|
test_overrides += 'cpp_eh=default'
|
|
|
|
test_args += '-DSHOULD_HAVE_EXCEPTIONS=1'
|
|
|
|
if is_windows
|
|
|
|
test_args += '-D_HAS_EXCEPTIONS=1'
|
2020-07-18 12:10:19 +00:00
|
|
|
endif
|
2020-09-05 10:26:12 +00:00
|
|
|
else
|
|
|
|
test_name = test_name + '_noexcept'
|
|
|
|
test_overrides += 'cpp_eh=none'
|
|
|
|
test_args += '-DSHOULD_HAVE_EXCEPTIONS=0'
|
|
|
|
if is_windows
|
|
|
|
test_args += '-D_HAS_EXCEPTIONS=0'
|
2020-07-18 12:10:19 +00:00
|
|
|
endif
|
2020-09-05 10:26:12 +00:00
|
|
|
endif
|
2020-07-18 12:10:19 +00:00
|
|
|
|
2020-09-05 10:26:12 +00:00
|
|
|
if fast_math
|
|
|
|
test_name = test_name + '_fastmath'
|
|
|
|
test_args += compiler_supports_fast_math_args
|
|
|
|
endif
|
2020-07-25 17:37:30 +00:00
|
|
|
|
2020-09-05 10:26:12 +00:00
|
|
|
if compiler_supports_float16 or compiler_supports_fp16
|
|
|
|
if compiler_supports_fp16
|
|
|
|
test_args += '-DSHOULD_HAVE_FP16=1'
|
2020-07-25 17:37:30 +00:00
|
|
|
endif
|
2020-09-05 10:26:12 +00:00
|
|
|
if compiler_supports_float16
|
|
|
|
test_args += '-DSHOULD_HAVE_FLOAT16=1'
|
2020-07-25 17:37:30 +00:00
|
|
|
endif
|
2020-09-05 10:26:12 +00:00
|
|
|
endif
|
|
|
|
if compiler_supports_int128
|
|
|
|
test_args += '-DSHOULD_HAVE_INT128=1'
|
|
|
|
endif
|
|
|
|
if compiler_supports_float128
|
|
|
|
test_args += '-DSHOULD_HAVE_FLOAT128=1'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if unrel
|
|
|
|
test_name = test_name + '_unrel'
|
|
|
|
test_args += '-DTOML_UNRELEASED_FEATURES=1'
|
|
|
|
else
|
|
|
|
test_args += '-DTOML_UNRELEASED_FEATURES=0'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if counter % 6 == 3
|
|
|
|
test_args += '-DTOML_HEADER_ONLY=1'
|
|
|
|
endif
|
|
|
|
if counter % 2 == 1
|
|
|
|
test_args += '-DUSE_SINGLE_HEADER=1'
|
|
|
|
endif
|
|
|
|
if counter % 4 == 2 and exceptions
|
|
|
|
test_args += '-DUSE_TARTANLLAMA_OPTIONAL=1'
|
|
|
|
test_name = test_name + '_tlopt'
|
|
|
|
endif
|
|
|
|
|
|
|
|
test_executables += [[
|
|
|
|
test_name,
|
|
|
|
executable(
|
|
|
|
test_name,
|
|
|
|
test_sources,
|
2021-09-22 06:47:15 +00:00
|
|
|
include_directories: include_dirs,
|
|
|
|
cpp_args: test_args,
|
|
|
|
override_options: test_overrides
|
2020-09-05 10:26:12 +00:00
|
|
|
)
|
|
|
|
]]
|
|
|
|
|
|
|
|
counter = counter + 1
|
2020-07-17 13:33:56 +00:00
|
|
|
|
2020-07-18 12:10:19 +00:00
|
|
|
endforeach # exceptions
|
|
|
|
endforeach # fast_math
|
2020-07-17 13:33:56 +00:00
|
|
|
endforeach # strict
|
|
|
|
endforeach # cpp20
|
2020-04-06 12:57:49 +00:00
|
|
|
|
|
|
|
locales = [
|
|
|
|
'C',
|
|
|
|
'en_US.utf8',
|
|
|
|
'ja_JP.utf8',
|
|
|
|
'it_IT.utf8',
|
|
|
|
'tr_TR.utf8',
|
|
|
|
'fi_FI.utf8',
|
|
|
|
'fr_FR.utf8',
|
|
|
|
'zh_CN.utf8',
|
|
|
|
'de_DE.utf8'
|
|
|
|
]
|
2020-03-03 21:28:24 +00:00
|
|
|
|
2020-09-05 10:26:12 +00:00
|
|
|
foreach executable : test_executables
|
2020-07-17 13:33:56 +00:00
|
|
|
foreach locale : locales
|
2020-08-01 18:15:09 +00:00
|
|
|
test(
|
|
|
|
executable[0] + ' (' + locale + ')', executable[1],
|
2021-09-22 06:47:15 +00:00
|
|
|
env: ['LC_ALL=' + locale],
|
|
|
|
workdir: meson.source_root()/'tests'
|
2020-08-01 18:15:09 +00:00
|
|
|
)
|
2020-04-06 12:57:49 +00:00
|
|
|
endforeach
|
|
|
|
endforeach
|