Skip to content

Commit f770e35

Browse files
author
pippocao
committed
avoid out of memory on 32 bits system when compiling test cases
1 parent c636ad4 commit f770e35

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test/test_log_3.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ namespace bq {
5050
static bq::array<bq::string> test_log_3_all_console_outputs;
5151

5252
// Larger parameter (eg. 3) will result in an exponential increase in test time overhead.
53-
constexpr int32_t MAX_PARAM = 2;
53+
template <size_t BITS>
54+
struct param_count_helper { };
55+
template <>
56+
struct param_count_helper<32> {
57+
constexpr static int32_t MAX_PARAM = 1;
58+
};
59+
template <>
60+
struct param_count_helper<64> {
61+
constexpr static int32_t MAX_PARAM = 2;
62+
};
5463

5564
template <typename T, typename... Ts>
5665
constexpr std::array<T, sizeof...(Ts)> test_make_array(Ts... ts)
@@ -898,6 +907,7 @@ namespace bq {
898907
{
899908
test_output(bq::log_level::info, "full log test begin, this will take minutes, and need about 50M free disk space.\n");
900909
clear_test_output_folder();
910+
constexpr size_t MAX_PARAM = param_count_helper<sizeof(void*) * 8>::MAX_PARAM;
901911
init_fmt_strings<MAX_PARAM>();
902912

903913
log_head = "[" + log_inst.get_name() + "]\t";

0 commit comments

Comments
 (0)