#pragma once
#include "ConditionalFixture.h"
#ifndef TTB_COND_FIXTURE_STANDALONE
#include "TestEvents.h"
#endif
#include <iostream>
namespace TestToolBox
{
TTB_INLINE ConditionalFixture::~ConditionalFixture()
{
RemoveCurrent();
}
TTB_INLINE bool ConditionalFixture::Exists(std::string const & in_idFixture, int in_level)
{
bool fixtureExists(false);
fixtureExists = m_upConditionalFixtureEntry
&& m_upConditionalFixtureEntry->idFixture == in_idFixture;
return fixtureExists;
}
TTB_INLINE bool ConditionalFixture::RemoveCurrent()
{
if (m_upConditionalFixtureEntry)
{
WriteLine("TTB: Deleting conditional fixture " + m_upConditionalFixtureEntry->idFixture);
m_upConditionalFixtureEntry.reset();
return true;
}
return false;
}
TTB_INLINE void ConditionalFixture::Add(std::string const & in_idFixture, ConditionalFixtureBaseUp in_upFixture)
{
WriteLine("TTB: Created conditional fixture " + in_idFixture);
m_upConditionalFixtureEntry = ConditionalFixtureEntryUp(new ConditionalFixtureEntry(in_idFixture, std::move(in_upFixture)));
}
TTB_INLINE void ConditionalFixture::WriteLine(std::string const & info)
{
#ifndef TTB_COND_FIXTURE_STANDALONE
TTB_INFO_S(info);
#endif
}
}