ProteoWizard
Functions
mru_list_test.cpp File Reference
#include "Std.hpp"
#include "mru_list.hpp"
#include "pwiz/utility/misc/unit.hpp"

Go to the source code of this file.

Functions

void test ()
int main (int argc, const char *argv[])

Function Documentation

void test ( )

Definition at line 29 of file mru_list_test.cpp.

References pwiz::util::mru_list< Item, KeyExtractor >::begin(), pwiz::util::mru_list< Item, KeyExtractor >::insert(), pwiz::util::mru_list< Item, KeyExtractor >::rbegin(), pwiz::util::mru_list< Item, KeyExtractor >::size(), and unit_assert.

{
mru.insert("Fighting");
mru.insert("Fu");
mru.insert("Kung");
mru.insert("Was");
mru.insert("Everybody");
unit_assert(mru.size() == 5);
unit_assert(*mru.begin() == "Everybody");
unit_assert(*mru.rbegin() == "Fighting");
// set "Everybody" as MRU item (no effect)
mru.insert("Everybody");
unit_assert(mru.size() == 5);
unit_assert(*mru.begin() == "Everybody");
unit_assert(*mru.rbegin() == "Fighting");
// set "Fighting" as MRU item
mru.insert("Fighting");
unit_assert(mru.size() == 5);
unit_assert(*mru.begin() == "Fighting");
unit_assert(*mru.rbegin() == "Fu");
// pop LRU item "Fu"
mru.insert("Wax on, wax off");
unit_assert(mru.size() == 5);
unit_assert(*mru.begin() == "Wax on, wax off");
unit_assert(*mru.rbegin() == "Kung");
}
int main ( int  argc,
const char *  argv[] 
)

Definition at line 66 of file mru_list_test.cpp.

References e(), test(), TEST_EPILOG, TEST_FAILED, and TEST_PROLOG.

{
TEST_PROLOG(argc, argv)
try
{
test();
}
catch (exception& e)
{
TEST_FAILED(e.what())
}
catch (...)
{
TEST_FAILED("Caught unknown exception.")
}
}