From 518eebe33af18547f8df6d49928aaa70144eb95b Mon Sep 17 00:00:00 2001 From: Andrea Pappacoda Date: Sun, 23 Jun 2024 19:09:07 +0200 Subject: [PATCH] test: fix GetRangeWithMaxLongLength on 32 bit machines The test used the hardcoded long value for 64 bit machines even on 32 bit ones, leading to test failures. With this patch the max long length is obtained using std::numeric_limits::max(). Thanks to q2a3z for the hint! Fixes: https://github.com/yhirose/cpp-httplib/issues/1795 --- test/test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test.cc b/test/test.cc index 7fe39ad..855988d 100644 --- a/test/test.cc +++ b/test/test.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -3474,7 +3475,7 @@ TEST_F(ServerTest, GetStreamedWithRangeError) { TEST_F(ServerTest, GetRangeWithMaxLongLength) { auto res = - cli_.Get("/with-range", {{"Range", "bytes=0-9223372036854775807"}}); + cli_.Get("/with-range", {{"Range", "bytes=0-" + std::to_string(std::numeric_limits::max())}}); EXPECT_EQ(StatusCode::RangeNotSatisfiable_416, res->status); EXPECT_EQ("0", res->get_header_value("Content-Length")); EXPECT_EQ(false, res->has_header("Content-Range"));