summaryrefslogtreecommitdiff
path: root/project2/common/check.cpp
blob: 3a29a9b6e91544eabe3908554ac313e83e6f7c5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <pch.hpp>
#include "check.h"
#include "scriptLoader.h"
#include "scriptStorage.h"
#include <factory.impl.h>

NAMEDFACTORY("check", Check, CheckFactory);
StaticMessageException(NoTestsToPerform, "No tests to perform");

Check::Check(ScriptNodePtr p) :
	SourceObject(p),
	message(p, "message", "Check failed"),
	group(p, "group", "default"),
	present(p, "present", "")
{
	p->script.lock()->loader.addLoadTarget(p, Storer::into<TestFactory>(&test));
}

Check::~Check()
{
}

bool
Check::performCheck(ExecContext * ec) const
{
	if (!test) {
		throw NoTestsToPerform();
	}
	return test->passes(ec);
}

INSTANTIATEFACTORY(Check, std::shared_ptr<const ScriptNode>);