mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
parent
7abca1531f
commit
83abd68029
6 changed files with 59 additions and 26 deletions
|
@ -20,7 +20,7 @@
|
|||
#include "net/http/http.h"
|
||||
|
||||
TEST(ParseContentLength, test) {
|
||||
EXPECT_EQ(-1, ParseContentLength("", 0));
|
||||
EXPECT_EQ(0, ParseContentLength("", 0));
|
||||
EXPECT_EQ(-1, ParseContentLength("-1", 2));
|
||||
EXPECT_EQ(-1, ParseContentLength("-2", 2));
|
||||
EXPECT_EQ(0, ParseContentLength("0", 1));
|
||||
|
|
|
@ -52,6 +52,14 @@ TEST(ParseHttpRange, testOffset) {
|
|||
EXPECT_EQ(10, length);
|
||||
}
|
||||
|
||||
TEST(ParseHttpRange, testEmptySecond) {
|
||||
long start, length;
|
||||
const char *s = "bytes=0-";
|
||||
EXPECT_TRUE(ParseHttpRange(s, strlen(s), 100, &start, &length));
|
||||
EXPECT_EQ(0, start);
|
||||
EXPECT_EQ(100, length);
|
||||
}
|
||||
|
||||
TEST(ParseHttpRange, testToEnd) {
|
||||
long start, length;
|
||||
const char *s = "bytes=40";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue