susumu.yata
null+****@clear*****
Tue Dec 16 10:45:56 JST 2014
susumu.yata 2014-11-26 16:04:29 +0900 (Wed, 26 Nov 2014) New Revision: 66e719a8e86e34be97ca2855d58e1ed620c87d25 https://github.com/groonga/grnxx/commit/66e719a8e86e34be97ca2855d58e1ed620c87d25 Message: Change the range of values to test negative values. Modified files: test/test_sorter.cpp Modified: test/test_sorter.cpp (+10 -8) =================================================================== --- test/test_sorter.cpp 2014-11-26 15:31:31 +0900 (8aaae88) +++ test/test_sorter.cpp 2014-11-26 16:04:29 +0900 (c5cd515) @@ -51,8 +51,8 @@ void init_test() { // Generate random values. // Bool: true, false, and N/A. - // Int: [0, 128) and N/A. - // Float: [0.0, 1.0) and N/A. + // Int: [-128, 128) and N/A. + // Float: [-1.0, 1.0) and N/A. // Text: length = [1, 4], byte = ['0', '9'], and N/A. constexpr size_t NUM_ROWS = 1 << 16; std::mt19937_64 mersenne_twister; @@ -78,18 +78,20 @@ void init_test() { } } - source = mersenne_twister() % 129; - if (source == 128) { + source = mersenne_twister() % 257; + if (source == 256) { test.int_values[i] = grnxx::Int::na(); } else { - test.int_values[i] = grnxx::Int(source); + test.int_values[i] = + grnxx::Int(static_cast<int64_t>(source) - 128); } - source = mersenne_twister() % 129; - if (source == 128) { + source = mersenne_twister() % 257; + if (source == 256) { test.float_values[i] = grnxx::Float::na(); } else { - test.float_values[i] = grnxx::Float(source / 128.0); + test.float_values[i] = + grnxx::Float((static_cast<int64_t>(source) - 128) / 128.0); } source = mersenne_twister() % 5; -------------- next part -------------- HTML����������������������������...Download