summaryrefslogtreecommitdiff
path: root/project2/common/check.cpp
blob: d288e2fcdd240c50377a1692558abc72bb18d3ee (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
#include <pch.hpp>
#include "check.h"
#include "scriptLoader.h"
#include "scriptStorage.h"

DECLARE_LOADER("check", Check);
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->loader.addLoadTarget(p, Storer::into<ElementLoader>(&test));
}

Check::~Check()
{
}

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