Vector tests added
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user