mpd/test/test_protocol.cxx

27 lines
566 B
C++
Raw Normal View History

#include "protocol/ArgParser.hxx"
#include "protocol/Ack.hxx"
#include "protocol/RangeArg.hxx"
2018-08-20 16:19:17 +02:00
#include "util/Compiler.h"
2018-10-16 19:01:13 +02:00
#include <gtest/gtest.h>
#include <stdlib.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);
}