
if get_option('enable_tests')
  subdir('auxiliary')

  tests = [
    'addr_interval',
    'agraph',
    'analysis_block',
    'analysis_cc',
    'analysis_class_graph',
    'analysis_function',
    'analysis_hints',
    'analysis_types',
    'analysis_meta',
    'analysis_var',
    'analysis_xrefs',
    'annotated_code',
    'autocmplt',
    'base64',
    'big',
    'bin',
    'binheap',
    'bitmap',
    'buf',
    'cmd',
    'cons',
    'contrbtree',
    'core_cmd',
    'core_seek',
    'core_task',
    'debruijn',
    'debug',
    'debug_session',
    'diff',
    'dwarf',
    'dwarf_info',
    'dwarf_integration',
    'esil_dfg_filter',
    'event',
    'file',
    'flags',
    'glob',
    'graph',
    'hex',
    'id_storage',
    'idpool',
    'idstorage',
    'intervaltree',
    'io',
    'json',
    'list',
    'ovf',
    'parse_ctype',
    'pdb',
    'pj',
    'queue',
    'reg',
    'rzpipe',
    'rz_test',
    'serialize_analysis',
    'serialize_config',
    'serialize_flag',
    'serialize_spaces',
    'rbtree',
    'sign',
    'skiplist',
    'skyline',
    'spaces',
    'sparse',
    'stack',
    'str',
    'strbuf',
    'subprocess',
    'table',
    'task',
    'tree',
    'uleb128',
    'unum',
    'util',
    'vector'
  ]

  unit_test_env = environment()
  if test_env_common_path != []
    unit_test_env.prepend('PATH', test_env_common_path)
  endif

  foreach test : tests
    exe = executable('test_@0@'.format(test), 'test_@0@.c'.format(test),
      include_directories: [platform_inc],
      dependencies: [
        rz_util_dep,
        rz_main_dep,
        rz_socket_dep,
        rz_core_dep,
        rz_io_dep,
        rz_bin_dep,
        rz_flag_dep,
        rz_cons_dep,
        rz_asm_dep,
        rz_debug_dep,
        rz_config_dep,
        rz_bp_dep,
        rz_reg_dep,
        rz_syscall_dep,
        rz_analysis_dep,
        rz_parse_dep,
        rz_egg_dep,
        rz_search_dep,
        rz_hash_dep,
        rz_crypto_dep,
        rz_magic_dep,
        lrt,
      ],
      install: false,
      install_rpath: rpath_exe,
      implicit_include_directories: false
    )
    test(test, exe, workdir: join_paths(meson.current_source_dir(), '..'), env: unit_test_env)
  endforeach
endif
