Add base for menu parsing unit tests

This commit is contained in:
Jan
2021-11-14 12:46:13 +01:00
parent 13589fd43c
commit 0033ab2a2b
19 changed files with 288 additions and 9 deletions

View File

@ -13,7 +13,7 @@ CommonEventHandlerCondition::CommonEventHandlerCondition(std::unique_ptr<ICommon
{
}
CommonEventHandlerElementType CommonEventHandlerCondition::GetType()
CommonEventHandlerElementType CommonEventHandlerCondition::GetType() const
{
return CommonEventHandlerElementType::CONDITION;
}

View File

@ -16,9 +16,9 @@ namespace menu
std::unique_ptr<CommonEventHandlerSet> m_else_elements;
CommonEventHandlerCondition();
explicit CommonEventHandlerCondition(std::unique_ptr<ICommonExpression> condition, std::unique_ptr<CommonEventHandlerSet> conditionElements,
std::unique_ptr<CommonEventHandlerSet> elseElements);
CommonEventHandlerCondition(std::unique_ptr<ICommonExpression> condition, std::unique_ptr<CommonEventHandlerSet> conditionElements,
std::unique_ptr<CommonEventHandlerSet> elseElements);
CommonEventHandlerElementType GetType() override;
_NODISCARD CommonEventHandlerElementType GetType() const override;
};
}

View File

@ -10,7 +10,7 @@ CommonEventHandlerScript::CommonEventHandlerScript(std::string script)
{
}
CommonEventHandlerElementType CommonEventHandlerScript::GetType()
CommonEventHandlerElementType CommonEventHandlerScript::GetType() const
{
return CommonEventHandlerElementType::SCRIPT;
}

View File

@ -14,6 +14,6 @@ namespace menu
CommonEventHandlerScript();
explicit CommonEventHandlerScript(std::string script);
CommonEventHandlerElementType GetType() override;
_NODISCARD CommonEventHandlerElementType GetType() const override;
};
}

View File

@ -14,7 +14,7 @@ CommonEventHandlerSetLocalVar::CommonEventHandlerSetLocalVar(SetLocalVarType typ
{
}
CommonEventHandlerElementType CommonEventHandlerSetLocalVar::GetType()
CommonEventHandlerElementType CommonEventHandlerSetLocalVar::GetType() const
{
return CommonEventHandlerElementType::SET_LOCAL_VAR;
}

View File

@ -26,6 +26,6 @@ namespace menu
CommonEventHandlerSetLocalVar();
CommonEventHandlerSetLocalVar(SetLocalVarType type, std::string varName, std::unique_ptr<ICommonExpression> value);
CommonEventHandlerElementType GetType() override;
_NODISCARD CommonEventHandlerElementType GetType() const override;
};
}

View File

@ -1,5 +1,7 @@
#pragma once
#include "Utils/ClassUtils.h"
namespace menu
{
enum class CommonEventHandlerElementType
@ -21,6 +23,6 @@ namespace menu
ICommonEventHandlerElement& operator=(const ICommonEventHandlerElement& other) = default;
ICommonEventHandlerElement& operator=(ICommonEventHandlerElement&& other) noexcept = default;
virtual CommonEventHandlerElementType GetType() = 0;
_NODISCARD virtual CommonEventHandlerElementType GetType() const = 0;
};
}