You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.1 KiB
C++
105 lines
3.1 KiB
C++
/*
|
|
* Copyright (c) Contributors to the Open 3D Engine Project
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AzCore/Component/Entity.h>
|
|
#include <AzCore/Component/EntityBus.h>
|
|
#include <AzCore/Component/EntityId.h>
|
|
#include <ScriptCanvas/Data/Data.h>
|
|
#include <ScriptCanvas/Libraries/UnitTesting/UnitTestBus.h>
|
|
|
|
namespace ScriptCanvas
|
|
{
|
|
class RuntimeComponent;
|
|
|
|
namespace UnitTesting
|
|
{
|
|
class Reporter
|
|
: public Bus::Handler
|
|
, public AZ::EntityBus::Handler
|
|
{
|
|
public:
|
|
Reporter();
|
|
Reporter(const RuntimeComponent& graph);
|
|
~Reporter();
|
|
|
|
void FinishReport();
|
|
|
|
void FinishReport(const RuntimeComponent& graph);
|
|
|
|
const AZStd::vector<Report>& GetCheckpoints() const;
|
|
|
|
const AZStd::vector<Report>& GetFailure() const;
|
|
|
|
const AZ::EntityId& GetGraphId() const;
|
|
|
|
const AZStd::vector<Report>& GetSuccess() const;
|
|
|
|
bool IsActivated() const;
|
|
|
|
bool IsComplete() const;
|
|
|
|
bool IsDeactivated() const;
|
|
|
|
bool IsErrorFree() const;
|
|
|
|
bool IsReportFinished() const;
|
|
|
|
bool operator==(const Reporter& other) const;
|
|
|
|
void Reset();
|
|
|
|
void SetGraph(const RuntimeComponent& graph);
|
|
|
|
// Bus::Handler
|
|
|
|
void AddFailure(const Report& report) override;
|
|
|
|
void AddSuccess(const Report& report) override;
|
|
|
|
void Checkpoint(const Report& report) override;
|
|
|
|
void ExpectFalse(const bool value, const Report& report) override;
|
|
|
|
void ExpectTrue(const bool value, const Report& report) override;
|
|
|
|
void MarkComplete(const Report& report) override;
|
|
|
|
SCRIPT_CANVAS_UNIT_TEST_EQUALITY_OVERLOAD_OVERRIDES(ExpectEqual);
|
|
|
|
SCRIPT_CANVAS_UNIT_TEST_EQUALITY_OVERLOAD_OVERRIDES(ExpectNotEqual);
|
|
|
|
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectGreaterThan);
|
|
|
|
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectGreaterThanEqual);
|
|
|
|
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectLessThan);
|
|
|
|
SCRIPT_CANVAS_UNIT_TEST_COMPARE_OVERLOAD_OVERRIDES(ExpectLessThanEqual);
|
|
|
|
protected:
|
|
void OnEntityActivated(const AZ::EntityId&) override;
|
|
void OnEntityDeactivated(const AZ::EntityId&) override;
|
|
|
|
private:
|
|
bool m_graphIsActivated = false;
|
|
bool m_graphIsDeactivated = false;
|
|
bool m_graphIsComplete = false;
|
|
bool m_graphIsErrorFree = false;
|
|
bool m_isReportFinished = false;
|
|
AZ::EntityId m_graphId;
|
|
AZ::EntityId m_entityId;
|
|
AZStd::vector<Report> m_checkpoints;
|
|
AZStd::vector<Report> m_failures;
|
|
AZStd::vector<Report> m_successes;
|
|
}; // class Reporter/
|
|
|
|
} // namespace UnitTesting
|
|
|
|
} // namespace ScriptCanvas
|