Skip to content

Commit

Permalink
Fix GenericBufReader constructor calls
Browse files Browse the repository at this point in the history
Type deduction needs some help...
  • Loading branch information
AlexMax committed Dec 10, 2023
1 parent 5e362f9 commit e5fac39
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/test_bufreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ static LexIO::VectorStream GetStream()
return rvo;
}

using VectorBufReader = LexIO::GenericBufReader<LexIO::VectorStream>;

TEST_CASE("FillBuffer, single call")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

auto test = LexIO::FillBuffer(bufReader, 8);
REQUIRE(test.first[0] == 'T');
Expand All @@ -50,7 +52,7 @@ TEST_CASE("FillBuffer, single call")
TEST_CASE("FillBuffer, multiple calls")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

// Buffer initial four bytes.
auto test = LexIO::FillBuffer(bufReader, 4);
Expand All @@ -76,7 +78,7 @@ TEST_CASE("FillBuffer, multiple calls")
TEST_CASE("FillBuffer, EOF")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

// Buffer everything.
auto test = LexIO::FillBuffer(bufReader, 64);
Expand All @@ -94,7 +96,7 @@ TEST_CASE("FillBuffer, EOF")
TEST_CASE("FillBuffer, EOF with initial buffer")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

auto test = LexIO::FillBuffer(bufReader, 4);
REQUIRE(test.first[0] == 'T');
Expand All @@ -113,7 +115,7 @@ TEST_CASE("FillBuffer, EOF with initial buffer")
TEST_CASE("FillBuffer, zero sized read")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

auto test = LexIO::FillBuffer(bufReader, 0);
REQUIRE(test.second == 0);
Expand All @@ -122,7 +124,7 @@ TEST_CASE("FillBuffer, zero sized read")
TEST_CASE("ConsumeBuffer, single call")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

// Fill, then consume whole buffer.
LexIO::FillBuffer(bufReader, 8);
Expand All @@ -141,7 +143,7 @@ TEST_CASE("ConsumeBuffer, single call")
TEST_CASE("ConsumeBuffer, multiple calls")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

// Consume half the buffer.
LexIO::FillBuffer(bufReader, 8);
Expand All @@ -160,7 +162,7 @@ TEST_CASE("ConsumeBuffer, multiple calls")
TEST_CASE("ConsumeBuffer, EOF")
{
auto stream = GetStream();
auto bufReader = LexIO::GenericBufReader(std::move(stream));
auto bufReader = VectorBufReader(std::move(stream));

// Fill to EOF, consume part of it.
auto test = LexIO::FillBuffer(bufReader, 64);
Expand Down

0 comments on commit e5fac39

Please sign in to comment.