Update mocks (#967)
This commit is contained in:
parent
4b9d6e9799
commit
724d12b762
@ -18,6 +18,14 @@ namespace MockGraphingImpl
|
|||||||
}
|
}
|
||||||
virtual std::optional<std::vector<std::shared_ptr<Graphing::IEquation>>> TryInitialize(const Graphing::IExpression* graphingExp = nullptr)
|
virtual std::optional<std::vector<std::shared_ptr<Graphing::IEquation>>> TryInitialize(const Graphing::IExpression* graphingExp = nullptr)
|
||||||
{
|
{
|
||||||
|
if (graphingExp != nullptr)
|
||||||
|
{
|
||||||
|
std::vector<std::shared_ptr<Graphing::IEquation>> equations;
|
||||||
|
equations.push_back(nullptr);
|
||||||
|
m_variables.push_back(std::make_shared<MockVariable>(MockVariable{}));
|
||||||
|
return std::optional<std::vector<std::shared_ptr<Graphing::IEquation>>>(equations);
|
||||||
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,43 @@ namespace MockGraphingImpl
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MockExpression : public Graphing::IExpression
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MockExpression()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int GetExpressionID() const override
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
bool IsEmptySet() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class MockVariable : public Graphing::IVariable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MockVariable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetVariableID() const override
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const std::wstring& GetVariableName() override
|
||||||
|
{
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::wstring& varName = L"m";
|
||||||
|
};
|
||||||
|
|
||||||
class MathSolver : public Graphing::IMathSolver
|
class MathSolver : public Graphing::IMathSolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -72,7 +109,12 @@ namespace MockGraphingImpl
|
|||||||
|
|
||||||
std::unique_ptr<Graphing::IExpression> ParseInput(const std::wstring& input) override
|
std::unique_ptr<Graphing::IExpression> ParseInput(const std::wstring& input) override
|
||||||
{
|
{
|
||||||
return nullptr;
|
if (input.empty())
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_unique<MockExpression>(MockExpression{});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Graphing::IGraph> CreateGrapher(const Graphing::IExpression* expression) override;
|
std::shared_ptr<Graphing::IGraph> CreateGrapher(const Graphing::IExpression* expression) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user