Skip to content

Commit

Permalink
better tests/test-003_run-rnd
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMirzayanov committed Sep 28, 2023
1 parent 60c9c2f commit 8f438fa
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 14 deletions.
6 changes: 6 additions & 0 deletions tests/test-003_run-rnd/refs/r1/stdout
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ c
f
d
b
c
f
c
e
b
c
6 changes: 6 additions & 0 deletions tests/test-003_run-rnd/refs/r2/stdout
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,9 @@ b
f
d
c
d
e
e
e
e
b
47 changes: 33 additions & 14 deletions tests/test-003_run-rnd/src/gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,37 @@ int main(int argc, char* argv[])
std::cout << rnd.wnext((signed int) 42, (signed int) 2011, 4) << std::endl;
std::cout << rnd.wnext((signed short) 42, (signed short) 2011, 4) << std::endl;

std::set<std::string> string_set;
string_set.insert("a");
string_set.insert("b");
string_set.insert("c");
string_set.insert("d");
string_set.insert("e");
string_set.insert("f");

std::cout << rnd.any(string_set) << std::endl;
std::cout << rnd.any(string_set.begin(), string_set.end()) << std::endl;
std::cout << rnd.wany(string_set, 1) << std::endl;
std::cout << rnd.wany(string_set.begin(), string_set.end(), 1) << std::endl;
std::cout << rnd.wany(string_set, -1) << std::endl;
std::cout << rnd.wany(string_set.begin(), string_set.end(), -1) << std::endl;
{
std::set<std::string> string_set;
string_set.insert("a");
string_set.insert("b");
string_set.insert("c");
string_set.insert("d");
string_set.insert("e");
string_set.insert("f");

std::cout << rnd.any(string_set) << std::endl;
std::cout << rnd.any(string_set.begin(), string_set.end()) << std::endl;
std::cout << rnd.wany(string_set, 1) << std::endl;
std::cout << rnd.wany(string_set.begin(), string_set.end(), 1) << std::endl;
std::cout << rnd.wany(string_set, -1) << std::endl;
std::cout << rnd.wany(string_set.begin(), string_set.end(), -1) << std::endl;
}

{
std::multiset<std::string> string_multiset;
string_multiset.insert("a");
string_multiset.insert("b"); string_multiset.insert("b");
string_multiset.insert("c"); string_multiset.insert("c"); string_multiset.insert("c");
string_multiset.insert("d");
string_multiset.insert("e"); string_multiset.insert("e"); string_multiset.insert("e");
string_multiset.insert("f"); string_multiset.insert("f"); string_multiset.insert("f"); string_multiset.insert("f");

std::cout << rnd.any(string_multiset) << std::endl;
std::cout << rnd.any(string_multiset.begin(), string_multiset.end()) << std::endl;
std::cout << rnd.wany(string_multiset, 2) << std::endl;
std::cout << rnd.wany(string_multiset.begin(), string_multiset.end(), 1) << std::endl;
std::cout << rnd.wany(string_multiset, -1) << std::endl;
std::cout << rnd.wany(string_multiset.begin(), string_multiset.end(), -2) << std::endl;
}
}

0 comments on commit 8f438fa

Please sign in to comment.