Vector tests added

This commit is contained in:
2019-04-28 19:48:48 +02:00
parent 3dbc5c211a
commit 2c726f144f
3 changed files with 85 additions and 15 deletions

View File

@@ -1,23 +1,14 @@
#include "../binary-trees/binarytree.hpp"
#include <random>
#include "testutil.hpp"
#include <unordered_set>
unsigned static GetRandomNumber()
{
static std::default_random_engine eng;
static std::uniform_int_distribution<unsigned> valueDist(0u, 8096u);
return valueDist(eng);
}
void FillWithRandomNumbers(BinaryTree::Tree<unsigned> & tree,
std::unordered_set<unsigned> & control,
unsigned const count = 512u)
{
for(unsigned i = 0u; i < count; ++i)
{
unsigned const value = GetRandomNumber();
unsigned const value = Util::GetRandomNumber();
control.insert(value);
tree.Insert(value);
}
@@ -54,7 +45,7 @@ bool TestDeletion()
unsigned const toDeleteCount = control.size() / 4;
while(i < toDeleteCount)
{
auto const toDelete = GetRandomNumber();
auto const toDelete = Util::GetRandomNumber();
auto iter = control.find(toDelete);
if(iter != control.end())
{