From 3515af80fcc8c6003bf19ad051b3b0ea8cf622fc Mon Sep 17 00:00:00 2001 From: Jooheon Yoo Date: Thu, 18 Jan 2024 13:12:44 -0800 Subject: [PATCH] Modify check_with_randome_values --- .../Unit/Framework/CheckWithRandomValues.hpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/Unit/Framework/CheckWithRandomValues.hpp b/tests/Unit/Framework/CheckWithRandomValues.hpp index 474935e2bd5ef..96c2e8076b7b9 100644 --- a/tests/Unit/Framework/CheckWithRandomValues.hpp +++ b/tests/Unit/Framework/CheckWithRandomValues.hpp @@ -155,24 +155,24 @@ void check_with_random_values_impl( make_not_null(&(distributions[ArgumentIs])))); size_t count = 0; - tmpl::for_each([&f, &klass, &args, &used_for_size, &member_args, - &epsilon, &module_name, &function_names, - &count](auto tag) { + const auto result = (klass.*f)(std::get(args)...); + tmpl::for_each([&args, &used_for_size, &member_args, &epsilon, + &module_name, &function_names, &count, + &result](auto tag) { (void)member_args; // Avoid compiler warning (void)used_for_size; // Avoid compiler warning using Tag = tmpl::type_from; - const auto result = - tuples::get((klass.*f)(std::get(args)...)); const auto& function_name = function_names[count]; CAPTURE(module_name); CAPTURE(function_name); CAPTURE(args); CAPTURE(member_args); - const auto python_result = pypp::call>( - module_name, function_name, std::get(args)..., - forward_to_pypp>( - std::get(member_args), used_for_size)...); - CHECK_ITERABLE_CUSTOM_APPROX(result, python_result, + const auto python_result = + pypp::call(result))>>( + module_name, function_name, std::get(args)..., + forward_to_pypp(result))>>( + std::get(member_args), used_for_size)...); + CHECK_ITERABLE_CUSTOM_APPROX(tuples::get(result), python_result, Approx::custom().epsilon(epsilon).scale(1.0)); ++count; });