ManaPlus
Namespaces | Data Structures | Typedefs | Functions
Catch Namespace Reference

Namespaces

 Detail
 
 Generators
 
 Internal
 
 Matchers
 

Data Structures

struct  AssertionInfo
 
class  AssertionResult
 
struct  AssertionResultData
 
struct  AutoReg
 
class  BetweenGenerator
 
struct  CaseSensitive
 
class  CompositeGenerator
 
struct  CopyableStream
 
struct  Counts
 
class  ExceptionTranslatorRegistrar
 
class  ExpressionLhs
 
struct  IContext
 
struct  IExceptionTranslator
 
struct  IExceptionTranslatorRegistry
 
struct  IGenerator
 
struct  IGeneratorInfo
 
struct  IGeneratorsForTest
 
struct  IMutableContext
 
struct  IMutableRegistryHub
 
struct  IRegistryHub
 
struct  IResultCapture
 
struct  IRunner
 
struct  IShared
 
struct  ITagAliasRegistry
 
struct  ITestCase
 
struct  ITestCaseRegistry
 
struct  MessageBuilder
 
struct  MessageInfo
 
class  MethodTestCase
 
struct  NameAndDesc
 
class  NonCopyable
 
class  NotImplementedException
 
class  Option
 
struct  pluralise
 
class  Ptr
 
struct  RegistrarForTagAliases
 
class  ResultBuilder
 
struct  ResultDisposition
 
struct  ResultWas
 
class  SafeBool
 
class  ScopedMessage
 
class  Section
 
struct  SectionEndInfo
 
struct  SectionInfo
 
struct  SharedImpl
 
struct  SourceLineInfo
 
struct  StreamEndStop
 
struct  StringMaker
 
struct  StringMaker< R C::* >
 
struct  StringMaker< T * >
 
struct  TagAlias
 
class  TestCase
 
struct  TestCaseInfo
 
struct  TestFailureException
 
class  Timer
 
struct  Totals
 
class  ValuesGenerator
 

Typedefs

typedef void(* TestFunction) ()
 
typedef std::string(* exceptionTranslateFunction) ()
 
typedef std::vector< const IExceptionTranslator * > ExceptionTranslators
 

Functions

template<typename ContainerT >
void deleteAll (ContainerT &container)
 
template<typename AssociativeContainerT >
void deleteAllValues (AssociativeContainerT &container)
 
bool startsWith (std::string const &s, std::string const &prefix)
 
bool endsWith (std::string const &s, std::string const &suffix)
 
bool contains (std::string const &s, std::string const &infix)
 
void toLowerInPlace (std::string &s)
 
std::string toLower (std::string const &s)
 
std::string trim (std::string const &str)
 
bool replaceInPlace (std::string &str, std::string const &replaceThis, std::string const &withThis)
 
std::ostreamoperator<< (std::ostream &os, SourceLineInfo const &info)
 
bool isTrue (bool value)
 
bool alwaysTrue ()
 
bool alwaysFalse ()
 
void throwLogicError (std::string const &message, SourceLineInfo const &locationInfo)
 
void seedRng (IConfig const &config)
 
unsigned int rngSeed ()
 
template<typename T >
T const & operator+ (T const &value, StreamEndStop)
 
IGeneratorsForTestcreateGeneratorsForTest ()
 
IContextgetCurrentContext ()
 
IMutableContextgetCurrentMutableContext ()
 
void cleanUpContext ()
 
Stream createStream (std::string const &streamName)
 
bool matchTest (TestCase const &testCase, TestSpec const &testSpec, IConfig const &config)
 
std::vector< TestCasefilterTests (std::vector< TestCase > const &testCases, TestSpec const &testSpec, IConfig const &config)
 
std::vector< TestCase > const & getAllTestCasesSorted (IConfig const &config)
 
void registerTestCase (ITestCase *testCase, char const *className, NameAndDesc const &nameAndDesc, SourceLineInfo const &lineInfo)
 
void registerTestCaseFunction (TestFunction function, SourceLineInfo const &lineInfo, NameAndDesc const &nameAndDesc)
 
bool isOk (ResultWas::OfType resultType)
 
bool isJustInfo (int flags)
 
ResultDisposition::Flags operator| (ResultDisposition::Flags lhs, ResultDisposition::Flags rhs)
 
bool shouldContinueOnFailure (int flags)
 
bool isFalseTest (int flags)
 
bool shouldSuppressFailure (int flags)
 
template<typename T >
std::string toString (T const &value)
 converts any type to a string More...
 
std::string toString (std::string const &value)
 
std::string toString (std::wstring const &value)
 
std::string toString (const char *const value)
 
std::string toString (char *const value)
 
std::string toString (const wchar_t *const value)
 
std::string toString (wchar_t *const value)
 
std::string toString (int value)
 
std::string toString (unsigned long value)
 
std::string toString (unsigned int value)
 
std::string toString (const double value)
 
std::string toString (const float value)
 
std::string toString (bool value)
 
std::string toString (char value)
 
std::string toString (signed char value)
 
std::string toString (unsigned char value)
 
template<typename T , typename Allocator >
std::string toString (std::vector< T, Allocator > const &v)
 
IResultCapturegetResultCapture ()
 
bool isDebuggerActive ()
 
void writeToDebugConsole (std::string const &text)
 
IRegistryHubgetRegistryHub ()
 
IMutableRegistryHubgetMutableRegistryHub ()
 
void cleanUp ()
 
std::string translateActiveException ()
 
template<>
std::string toString< Detail::Approx > (Detail::Approx const &value)
 
TestCase makeTestCase (ITestCase *testCase, std::string const &className, std::string const &name, std::string const &description, SourceLineInfo const &lineInfo)
 

Typedef Documentation

◆ exceptionTranslateFunction

typedef std::string(* Catch::exceptionTranslateFunction) ()

Definition at line 2560 of file catch.hpp.

◆ ExceptionTranslators

Definition at line 2562 of file catch.hpp.

◆ TestFunction

typedef void(* Catch::TestFunction) ()

Definition at line 657 of file catch.hpp.

Function Documentation

◆ alwaysFalse()

bool Catch::alwaysFalse ( )
inline

Definition at line 407 of file catch.hpp.

References config, rngSeed(), seedRng(), and throwLogicError().

407 { return false; }

◆ alwaysTrue()

bool Catch::alwaysTrue ( )
inline

Definition at line 406 of file catch.hpp.

406 { return true; }

◆ cleanUp()

void Catch::cleanUp ( )

◆ cleanUpContext()

void Catch::cleanUpContext ( )

◆ contains()

bool Catch::contains ( std::string const &  s,
std::string const &  infix 
)

◆ createGeneratorsForTest()

IGeneratorsForTest* Catch::createGeneratorsForTest ( )

◆ createStream()

Stream Catch::createStream ( std::string const &  streamName)

◆ deleteAll()

template<typename ContainerT >
void Catch::deleteAll ( ContainerT &  container)
inline

Definition at line 353 of file catch.hpp.

Referenced by Catch::CompositeGenerator< T >::~CompositeGenerator().

353  {
354  typename ContainerT::const_iterator it = container.begin();
355  typename ContainerT::const_iterator itEnd = container.end();
356  for(; it != itEnd; ++it )
357  delete *it;
358  }

◆ deleteAllValues()

template<typename AssociativeContainerT >
void Catch::deleteAllValues ( AssociativeContainerT &  container)
inline

Definition at line 360 of file catch.hpp.

360  {
361  typename AssociativeContainerT::const_iterator it = container.begin();
362  typename AssociativeContainerT::const_iterator itEnd = container.end();
363  for(; it != itEnd; ++it )
364  delete it->second;
365  }

◆ endsWith()

bool Catch::endsWith ( std::string const &  s,
std::string const &  suffix 
)

◆ filterTests()

std::vector<TestCase> Catch::filterTests ( std::vector< TestCase > const &  testCases,
TestSpec const &  testSpec,
IConfig const &  config 
)

◆ getAllTestCasesSorted()

std::vector<TestCase> const& Catch::getAllTestCasesSorted ( IConfig const &  config)

◆ getCurrentContext()

IContext& Catch::getCurrentContext ( )

◆ getCurrentMutableContext()

IMutableContext& Catch::getCurrentMutableContext ( )

◆ getMutableRegistryHub()

IMutableRegistryHub& Catch::getMutableRegistryHub ( )

◆ getRegistryHub()

IRegistryHub& Catch::getRegistryHub ( )

◆ getResultCapture()

IResultCapture& Catch::getResultCapture ( )

◆ isDebuggerActive()

bool Catch::isDebuggerActive ( )

◆ isFalseTest()

bool Catch::isFalseTest ( int  flags)
inline

Definition at line 821 of file catch.hpp.

References Catch::ResultDisposition::FalseTest.

821 { return ( flags & ResultDisposition::FalseTest ) != 0; }

◆ isJustInfo()

bool Catch::isJustInfo ( int  flags)
inline

Definition at line 803 of file catch.hpp.

References Catch::ResultWas::Info.

803  {
804  return flags == ResultWas::Info;
805  }

◆ isOk()

bool Catch::isOk ( ResultWas::OfType  resultType)
inline

Definition at line 800 of file catch.hpp.

References Catch::ResultWas::FailureBit.

800  {
801  return ( resultType & ResultWas::FailureBit ) == 0;
802  }

◆ isTrue()

bool Catch::isTrue ( bool  value)
inline

Definition at line 405 of file catch.hpp.

405 { return value; }

◆ makeTestCase()

TestCase Catch::makeTestCase ( ITestCase testCase,
std::string const &  className,
std::string const &  name,
std::string const &  description,
SourceLineInfo const &  lineInfo 
)

◆ matchTest()

bool Catch::matchTest ( TestCase const &  testCase,
TestSpec const &  testSpec,
IConfig const &  config 
)

◆ operator+()

template<typename T >
T const& Catch::operator+ ( T const &  value,
StreamEndStop   
)

Definition at line 424 of file catch.hpp.

Referenced by Catch::ExpressionLhs< T >::endExpression().

424  {
425  return value;
426  }

◆ operator<<()

std::ostream& Catch::operator<< ( std::ostream os,
SourceLineInfo const &  info 
)

◆ operator|()

Definition at line 816 of file catch.hpp.

816  {
817  return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );
818  }

◆ registerTestCase()

void Catch::registerTestCase ( ITestCase testCase,
char const *  className,
NameAndDesc const &  nameAndDesc,
SourceLineInfo const &  lineInfo 
)

Referenced by Catch::AutoReg::AutoReg().

◆ registerTestCaseFunction()

void Catch::registerTestCaseFunction ( TestFunction  function,
SourceLineInfo const &  lineInfo,
NameAndDesc const &  nameAndDesc 
)

Referenced by Catch::AutoReg::AutoReg().

◆ replaceInPlace()

bool Catch::replaceInPlace ( std::string &  str,
std::string const &  replaceThis,
std::string const &  withThis 
)

◆ rngSeed()

unsigned int Catch::rngSeed ( )

Referenced by alwaysFalse().

◆ seedRng()

void Catch::seedRng ( IConfig const &  config)

Referenced by alwaysFalse().

◆ shouldContinueOnFailure()

bool Catch::shouldContinueOnFailure ( int  flags)
inline

Definition at line 820 of file catch.hpp.

References Catch::ResultDisposition::ContinueOnFailure.

820 { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }

◆ shouldSuppressFailure()

bool Catch::shouldSuppressFailure ( int  flags)
inline

Definition at line 822 of file catch.hpp.

References Catch::ResultDisposition::SuppressFail.

822 { return ( flags & ResultDisposition::SuppressFail ) != 0; }

◆ startsWith()

bool Catch::startsWith ( std::string const &  s,
std::string const &  prefix 
)

◆ throwLogicError()

void Catch::throwLogicError ( std::string const &  message,
SourceLineInfo const &  locationInfo 
)

Referenced by alwaysFalse().

◆ toLower()

std::string Catch::toLower ( std::string const &  s)

◆ toLowerInPlace()

void Catch::toLowerInPlace ( std::string &  s)

◆ toString() [1/17]

template<typename T >
std::string Catch::toString ( T const &  value)

converts any type to a string

The default template forwards on to ostringstream - except when an ostringstream overload does not exist - in which case it attempts to detect that and writes {?}. Overload (not specialise) this template for custom typs that you don't want to provide an ostream overload for.

Definition at line 1774 of file catch.hpp.

References Catch::Detail::StringMakerBase< Detail::IsStreamInsertable< T >::value >::convert().

Referenced by Setup_Colors::action(), Setup_Video::action(), KillStats::action(), CharSelectDialog::action(), ChatWindow::addColors(), LocalPlayer::addJobMessage(), SkillDialog::addSkill(), LocalPlayer::addXpMessage(), KillStats::attributeChanged(), ChatWindow::attributeChanged(), ConfigManager::backupConfig(), Setup_Video::cancel(), Catch::ExpressionLhs< T >::captureExpression(), createGuiWindows(), debugCallback(), ResourceManager::deleteInstance(), ResourceManager::deleteResourceManager(), Actions::doSit(), UpdaterWindow::download(), ItemShortcutContainer::draw(), VirtShortcutContainer::draw(), EquipmentWindow::draw(), FloorItem::draw(), ItemContainer::draw(), Viewport::drawPath(), EditServerDialog::EditServerDialog(), Catch::ExpressionLhs< T >::endExpression(), TestMain::exec(), Joystick::finishCalibration(), SetupActionDropDown::fromWidget(), SetupItemDropDown::fromWidget(), SetupItemSlider::fromWidget(), SetupItemSlider2::fromWidget(), SetupItemSliderInt::fromWidget(), KillStats::gainXp(), SDL::getAllVideoModes(), ItemPopup::getCardsString(), WorldListModel::getElementAt(), ScrollArea::getImageByState(), Loader::getImageSet(), ItemPopup::getOptionsString(), LocalPlayer::getPingTime(), Theme::getProgressColor(), Loader::getSprite(), Configuration::getStringValue(), Loader::getSubImage(), Loader::getSubImageSet(), PopupMenu::handleLink(), Map::initializeAmbientLayers(), KillStats::KillStats(), ItemShortcut::load(), ShortcutBase::load(), SpellManager::load(), SetupItem::load(), OutfitWindow::load(), MiniStatusWindow::loadBars(), WindowMenu::loadButtons(), ServerDialog::loadCustomServers(), loadQuest(), ChatWindow::loadState(), UpdaterWindow::logic(), ResourceManager::logResource(), ModeListModel::ModeListModel(), MiniStatusWindow::mouseMoved(), Joystick::open(), SpellManager::parseCommand(), EAthena::MessageIn::postInit(), TmwAthena::ChatRecv::processBeingChat(), TmwAthena::TradeRecv::processTradeItemAddResponse(), Catch::Detail::rangeToString(), Net::MessageIn::readCoordinatePair(), Net::MessageIn::readCoordinates(), MapReader::readTileset(), Configuration::removeOldKeys(), TmwAthena::BuySellHandler::requestBuyList(), GuildManager::requestGuildInfo(), TmwAthena::BuySellHandler::requestSellList(), ItemShortcutContainer::safeDraw(), VirtShortcutContainer::safeDraw(), EquipmentWindow::safeDraw(), ItemContainer::safeDraw(), SpellManager::save(), ItemShortcut::save(), ShortcutBase::save(), OutfitWindow::save(), EmoteShortcut::save(), MiniStatusWindow::saveBars(), WindowMenu::saveButtons(), ServerDialog::saveCustomServers(), PlayerInfo::saveProtectedItems(), ChatWindow::saveState(), ChatWindow::saveTab(), Being::setAction(), Image::setAlpha(), CharCreateDialog::setAttributes(), Setup_Colors::setEntry(), Setup_Video::Setup_Video(), Setup_Visual::Setup_Visual(), IntTextField::setValue(), Configuration::setValue(), Configuration::setValueInt(), Being::showName(), QuestsWindow::showQuest(), Net::MessageIn::skip(), Net::MessageIn::skipToEnd(), GuildManager::slowLogic(), InputManager::store(), Being::takeDamage(), toString(), Catch::Detail::Approx::toString(), ChangeDisplay::update(), AttrDisplay::update(), KillStats::update(), SkillInfo::update(), StatusWindow::updateArrowsBar(), ShopItem::updateDisplayName(), StatusWindow::updateHPBar(), StatusWindow::updateMPBar(), ActorManager::updateNameId(), UpdaterWindow::updateProgress(), StatusWindow::updateProgressBar(), CharCreateDialog::updateSliders(), WhoIsOnline::updateWindow(), anonymous_namespace{playerrelations.cpp}::PlayerConfSerialiser::writeConfigItem(), PacketLimiter::writePacketLimits(), and Catch::Matchers::Impl::Matcher< std::string >::~Matcher().

1774  {
1775  return StringMaker<T>::convert( value );
1776 }

◆ toString() [2/17]

std::string Catch::toString ( std::string const &  value)

◆ toString() [3/17]

std::string Catch::toString ( std::wstring const &  value)

◆ toString() [4/17]

std::string Catch::toString ( const char *const  value)

◆ toString() [5/17]

std::string Catch::toString ( char *const  value)

◆ toString() [6/17]

std::string Catch::toString ( const wchar_t *const  value)

◆ toString() [7/17]

std::string Catch::toString ( wchar_t *const  value)

◆ toString() [8/17]

std::string Catch::toString ( int  value)

◆ toString() [9/17]

std::string Catch::toString ( unsigned long  value)

◆ toString() [10/17]

std::string Catch::toString ( unsigned int  value)

◆ toString() [11/17]

std::string Catch::toString ( const double  value)

Definition at line 860 of file stringutils.cpp.

861 {
862  return strprintf("%f", static_cast<float>(num));
863 }
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99

◆ toString() [12/17]

std::string Catch::toString ( const float  value)

Definition at line 855 of file stringutils.cpp.

856 {
857  return strprintf("%f", num);
858 }
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99

◆ toString() [13/17]

std::string Catch::toString ( bool  value)

◆ toString() [14/17]

std::string Catch::toString ( char  value)

◆ toString() [15/17]

std::string Catch::toString ( signed char  value)

◆ toString() [16/17]

std::string Catch::toString ( unsigned char  value)

Definition at line 824 of file stringutils.cpp.

825 {
826  char buf[5];
827  buf[4] = '\0';
828  size_t idx = 3;
829  do
830  buf[idx--] = CAST_8((num % 10) + '0');
831  while ((num /= 10) != 0);
832  return buf + idx + 1;
833 }
#define CAST_8
Definition: cast.h:24

◆ toString() [17/17]

template<typename T , typename Allocator >
std::string Catch::toString ( std::vector< T, Allocator > const &  v)

Definition at line 1713 of file catch.hpp.

References Catch::Detail::rangeToString(), and toString().

1713  {
1714  return Detail::rangeToString( v.begin(), v.end() );
1715 }
std::string rangeToString(InputIterator first, InputIterator last)
Definition: catch.hpp:1780

◆ toString< Detail::Approx >()

template<>
std::string Catch::toString< Detail::Approx > ( Detail::Approx const &  value)
inline

Definition at line 2693 of file catch.hpp.

2693  {
2694  return value.toString();
2695 }

◆ translateActiveException()

std::string Catch::translateActiveException ( )

◆ trim()

std::string Catch::trim ( std::string const &  str)

◆ writeToDebugConsole()

void Catch::writeToDebugConsole ( std::string const &  text)