chore (linux build): Add benign changes to satisfy clang13
This commit is contained in:
1 parent
616361eaf1
commit
e1d66e9a0e
8 files changed
+44
-14
No files matched your search
@@ -99,7 +99,8 @@ public:
|
||||
std::vector<int> added_keys,
|
||||
changed_keys,
|
||||
removed_keys;
|
||||
for (size_t x = 0; x < change_count; ++x) {
|
||||
for (std::size_t x = 0;
|
||||
x < static_cast<std::size_t>(change_count); ++x) {
|
||||
const StreamUpdate& change = changes[x];
|
||||
switch(change.type) {
|
||||
case StreamUpdate::REMOVE:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
|
||||
namespace bts {
|
||||
namespace log {
|
||||
|
||||
@@ -45,9 +45,6 @@ void print_pool_stats(const utils::ConcurrentPool<MBOSnapshot>& pool) {
|
||||
|
||||
std::sort(bid_sz.begin(), bid_sz.end());
|
||||
std::sort(ask_sz.begin(), ask_sz.end());
|
||||
size_t bid_tot =0, ask_tot = 0;
|
||||
for(size_t i : bid_sz) { bid_tot += i; }
|
||||
for(size_t i : ask_sz) { ask_tot += i; }
|
||||
|
||||
std::stringstream bid_percentiles, ask_percentiles;
|
||||
for (double x : { 0.5, 0.75, 0.9, 0.95, 0.99 }) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "../IntPrice.h"
|
||||
#include "../MBOProcessor.h"
|
||||
#include "Co2TestInstrument.h"
|
||||
#include "lib/utils/Shuffle.h"
|
||||
|
||||
#include <random>
|
||||
#include <algorithm>
|
||||
@@ -54,7 +55,7 @@ std::vector<inc::Update> gen_test_orders(uint64_t id=100, inc::UpdateType type=i
|
||||
// std::cout << std::endl << order_id.value() << ": " << price.price() << "-" << size;
|
||||
}
|
||||
}
|
||||
std::random_shuffle(result.begin(), result.end());
|
||||
utils::Shuffle::shuffle(result.begin(), result.end());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ TEST_CASE("MBO incremental", "[md][mbo]") {
|
||||
concat( gen_test_orders(128, inc::UpdateType::Bid),
|
||||
gen_test_orders(256, inc::UpdateType::Ask));
|
||||
|
||||
std::random_shuffle(orders.begin(), orders.end());
|
||||
utils::Shuffle::shuffle(orders.begin(), orders.end());
|
||||
apply_incremental(state, orders);
|
||||
|
||||
REQUIRE(state.bid.size() + state.ask.size() == orders.size());
|
||||
@@ -188,7 +189,8 @@ TEST_CASE("MBO sort order", "[md][mbo]") {
|
||||
});
|
||||
}
|
||||
}
|
||||
std::random_shuffle(updates.begin(), updates.end());
|
||||
std::random_device rd;
|
||||
std::shuffle(updates.begin(), updates.end(), std::mt19937(rd()));
|
||||
|
||||
apply_incremental(state, updates);
|
||||
|
||||
@@ -316,5 +318,7 @@ TEST_CASE("MBO change price and size", "[md][mbo]") {
|
||||
REQUIRE(!not_ask);
|
||||
}
|
||||
|
||||
}}}
|
||||
#endif
|
||||
} // namespace test
|
||||
} // namespace md
|
||||
} // namespace bts
|
||||
#endif
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "lib/utils/bts_chrono.h"
|
||||
#include "lib/utils/defer.h"
|
||||
#include "lib/utils/warn_ctrl.h"
|
||||
#include "lib/utils/Shuffle.h"
|
||||
|
||||
#include "lib/config/protos/MarketData.pb.h"
|
||||
#include "lib/utils/Sqlite_utils.h"
|
||||
@@ -1217,7 +1218,7 @@ struct Co2IndexTests {
|
||||
|
||||
template <class Index> void test_random_search(Index &index) {
|
||||
vector<uint64_t> temp(random_ids);
|
||||
std::random_shuffle(temp.begin(), temp.end());
|
||||
utils::Shuffle::shuffle(temp.begin(), temp.end());
|
||||
for (auto &id : temp) {
|
||||
if (used_ids.find(id) != used_ids.end()) {
|
||||
REQUIRE(index.has_security(id));
|
||||
|
||||
@@ -67,10 +67,10 @@ struct MomentumRecorderParams {
|
||||
while (ss.good()) {
|
||||
string substr;
|
||||
getline(ss, substr, ',');
|
||||
substr.erase(
|
||||
substr.begin(),
|
||||
std::find_if(substr.begin(), substr.end(),
|
||||
std::bind1st(std::not_equal_to<char>(), ' ')));
|
||||
substr.erase(substr.begin(),
|
||||
std::find_if(substr.begin(), substr.end(),
|
||||
std::bind(std::not_equal_to<char>(), ' ',
|
||||
std::placeholders::_1)));
|
||||
security_name_strs.insert(prefix + substr);
|
||||
}
|
||||
} catch (...) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "lib/orderman/orders/spreader_orders/tests/tests_common.h"
|
||||
#include "lib/utils/helper_macros.h"
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -150,6 +151,7 @@ TEST_CASE ("quoter price quantity state", "[spreader]")
|
||||
for(uint32_t i=0; i<n_elems; i++)
|
||||
if(arr[i]>128)
|
||||
sum+=arr[i];
|
||||
UNUSED(sum);
|
||||
std::cout << "br pred (sorted) " << (utils::TimeStamp::now()-t0).nanoseconds() << " ns" << std::endl;
|
||||
// for(uint32_t i=0; i<n_iters; i++){
|
||||
// auto t0=utils::TimeStamp::now();
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
namespace bts::utils {
|
||||
|
||||
class Shuffle {
|
||||
public:
|
||||
template <class Iter>
|
||||
static void shuffle(Iter first, Iter last);
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Definition
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
template <class Iter>
|
||||
void Shuffle::shuffle(Iter first, Iter last) {
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
std::shuffle(first, last, g);
|
||||
}
|
||||
|
||||
} // namespace bts::utils
|
||||
Reference in new issue
Block a user