mpd/test/test_protocol.cxx

24 lines
518 B
C++
Raw Permalink Normal View History

#include "protocol/ArgParser.hxx"
#include "protocol/Ack.hxx"
#include "protocol/RangeArg.hxx"
2018-10-16 19:01:13 +02:00
#include <gtest/gtest.h>
2018-10-16 19:01:13 +02:00
TEST(ArgParser, Range)
{
RangeArg range = ParseCommandArgRange("1");
2018-10-16 19:01:13 +02:00
EXPECT_EQ(1u, range.start);
EXPECT_EQ(2u, range.end);
range = ParseCommandArgRange("1:5");
2018-10-16 19:01:13 +02:00
EXPECT_EQ(1u, range.start);
EXPECT_EQ(5u, range.end);
range = ParseCommandArgRange("1:");
2018-10-16 19:01:13 +02:00
EXPECT_EQ(1u, range.start);
EXPECT_GE(range.end, 999999u);
2018-10-16 19:01:13 +02:00
EXPECT_THROW(range = ParseCommandArgRange("-2"),
ProtocolError);
}