mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 06:49:28 -05:00
Add Tests for ZCG cpp
This commit is contained in:
@ -0,0 +1,36 @@
|
||||
#include "MockParserLineStream.h"
|
||||
|
||||
const std::string MockParserLineStream::MOCK_FILENAME;
|
||||
|
||||
MockParserLineStream::MockParserLineStream(const std::vector<std::string>& lines)
|
||||
: m_lines(lines),
|
||||
m_line(0)
|
||||
{
|
||||
}
|
||||
|
||||
ParserLine MockParserLineStream::NextLine()
|
||||
{
|
||||
if(m_line < m_lines.size())
|
||||
{
|
||||
const auto line = m_line++;
|
||||
return ParserLine(MOCK_FILENAME, line + 1, m_lines[line]);
|
||||
}
|
||||
|
||||
return ParserLine(MOCK_FILENAME, 0, std::string());
|
||||
}
|
||||
|
||||
bool MockParserLineStream::IncludeFile(const std::string& filename)
|
||||
{
|
||||
m_includes.push_back(filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MockParserLineStream::IsOpen() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MockParserLineStream::Eof() const
|
||||
{
|
||||
return m_line >= m_lines.size();
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Parsing/IParserLineStream.h"
|
||||
|
||||
class MockParserLineStream final : public IParserLineStream
|
||||
{
|
||||
static const std::string MOCK_FILENAME;
|
||||
|
||||
const std::vector<std::string>& m_lines;
|
||||
unsigned m_line;
|
||||
std::vector<std::string> m_includes{};
|
||||
|
||||
public:
|
||||
explicit MockParserLineStream(const std::vector<std::string>& lines);
|
||||
|
||||
ParserLine NextLine() override;
|
||||
bool IncludeFile(const std::string& filename) override;
|
||||
_NODISCARD bool IsOpen() const override;
|
||||
_NODISCARD bool Eof() const override;
|
||||
};
|
Reference in New Issue
Block a user