ce49d99c2f
Since we switched from autotools to Meson in commit
94592c1406
, we don't need to include
`config.h` early to properly enable large file support. Meson passes
the required macros on the compiler command line instead of defining
them in `config.h`.
This means we can include `config.h` at any time, whenever we want to
check its macros, and there are no ordering constraints.
27 lines
566 B
C++
27 lines
566 B
C++
#include "protocol/ArgParser.hxx"
|
|
#include "protocol/Ack.hxx"
|
|
#include "protocol/RangeArg.hxx"
|
|
#include "util/Compiler.h"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
TEST(ArgParser, Range)
|
|
{
|
|
RangeArg range = ParseCommandArgRange("1");
|
|
EXPECT_EQ(1u, range.start);
|
|
EXPECT_EQ(2u, range.end);
|
|
|
|
range = ParseCommandArgRange("1:5");
|
|
EXPECT_EQ(1u, range.start);
|
|
EXPECT_EQ(5u, range.end);
|
|
|
|
range = ParseCommandArgRange("1:");
|
|
EXPECT_EQ(1u, range.start);
|
|
EXPECT_GE(range.end, 999999u);
|
|
|
|
EXPECT_THROW(range = ParseCommandArgRange("-2"),
|
|
ProtocolError);
|
|
}
|