Skip to content

Commit

Permalink
test: fix GetRangeWithMaxLongLength on 32 bit machines (#1867)
Browse files Browse the repository at this point in the history
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<long>::max(). Thanks to q2a3z for
the hint!

Fixes: #1795
  • Loading branch information
Tachi107 committed Jun 23, 2024
1 parent 9e4f93d commit bdefdce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <atomic>
#include <chrono>
#include <future>
#include <limits>
#include <memory>
#include <sstream>
#include <stdexcept>
Expand Down Expand Up @@ -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<long>::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"));
Expand Down

0 comments on commit bdefdce

Please sign in to comment.