1
0
Fork 0
forked from lthn/blockchain
blockchain/tests/unit_tests/decoy_selection.cpp

51 lines
1 KiB
C++
Raw Permalink Normal View History

2023-12-15 01:42:06 +03:00
// Copyright (c) 2019 Zano Project
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <algorithm>
#include "gtest/gtest.h"
#include "wallet/decoy_selection.h"
TEST(decoy_selection_test, decoy_selection_test)
{
// const uint64_t test_scale_size = 20000;
2023-12-15 01:42:06 +03:00
decoy_selection_generator dsg;
2024-03-25 21:56:22 +01:00
dsg.init(100);
2023-12-15 01:42:06 +03:00
std::map<uint64_t, uint64_t> hits;
2024-03-25 21:56:22 +01:00
//std::vector<uint64_t> decoys = dsg.generate_distribution(15);
std::cout << "";
2023-12-15 01:42:06 +03:00
//std::vector<uint64_t> hits(test_scale_size, 0);
2024-03-25 21:56:22 +01:00
while (true)
{
std::vector<uint64_t> decoys = dsg.generate_distribution(15);
for (auto d : decoys)
{
hits[d]++;
}
if (hits[10] > 500)
break;
}
std::stringstream ss;
for (auto it = hits.begin(); it != hits.end(); it++)
{
if (it->second != 0)
{
ss << it->first << ", " << it->second << std::endl;
}
}
epee::file_io_utils::save_string_to_file("distribution.csv", ss.str());
2023-12-15 01:42:06 +03:00
}