include(cmake_test/cmake_test)

ct_add_test(NAME "stress_test_map")
function("${stress_test_map}")
    message("CMake Version: ${CMAKE_VERSION}")
    include(cmakepp_lang/map/map)
    include(cmakepp_lang/utilities/timer)
    set(n_iterations 40000)
    cpp_map(CTOR my_map)

    cpp_start_timing("set_timer")
    foreach(key_i RANGE ${n_iterations})
        cpp_map(SET "${my_map}" ${key_i} "${key_i}_value")
    endforeach()
    cpp_stop_timing(time2set "set_timer")
    message("Time to set ${n_iterations} keys: ${time2set} s")

    cpp_start_timing("get_timer")
    foreach(key_i RANGE ${n_iterations})
        cpp_map(GET value "${my_map}" ${key_i})
    endforeach()
    cpp_stop_timing(time2get "get_timer")
    message("Time to get ${n_iterations} keys: ${time2get} s")
endfunction()
