set(types "double")
list(APPEND types "complex_double")

set(operations "hmat_vec_prod")
list(APPEND operations "hmat_mat_prod")
list(APPEND operations "hmat_vec_transp_prod")
list(APPEND operations "hmat_mat_transp_prod")

foreach(type ${types})
    foreach(operation ${operations})
        add_executable(Test_${operation}_${type} test_${operation}_${type}.cpp)
        target_link_libraries(Test_${operation}_${type} htool)
        add_dependencies(build-tests-virtual-hmatrix-hmatrix-product Test_${operation}_${type})
        add_test(NAME Test_${operation}_${type}_1 COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 1 ${MPIEXEC_PREFLAGS} ${CMAKE_CURRENT_BINARY_DIR}/Test_${operation}_${type})
        set_tests_properties(Test_${operation}_${type}_1 PROPERTIES ENVIRONMENT OMP_NUM_THREADS=4)
        add_test(NAME Test_${operation}_${type}_2 COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 2 ${MPIEXEC_PREFLAGS} ${CMAKE_CURRENT_BINARY_DIR}/Test_${operation}_${type})
        set_tests_properties(Test_${operation}_${type}_2 PROPERTIES ENVIRONMENT OMP_NUM_THREADS=2)
        add_test(NAME Test_${operation}_${type}_4 COMMAND ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} 4 ${MPIEXEC_PREFLAGS} ${CMAKE_CURRENT_BINARY_DIR}/Test_${operation}_${type})
        set_tests_properties(Test_${operation}_${type}_4 PROPERTIES ENVIRONMENT OMP_NUM_THREADS=1)
    endforeach()
endforeach()
