diff --git a/test/counterParsing.cpp b/test/counterParsing.cpp index d5a9c664c..bc9cc9394 100644 --- a/test/counterParsing.cpp +++ b/test/counterParsing.cpp @@ -137,64 +137,64 @@ TEST(ParseCounterTest, wrongType) } #define CHECK(TEST, EXPECTED) \ -{ auto count = countMimeType(counterStr, [](const std::string& s) { return TEST;}); ASSERT_EQ(count, EXPECTED); } +{ auto count = countMimeType(counterStr, [](const std::string& s) { return TEST;}); ASSERT_EQ(count, (unsigned)EXPECTED); } TEST(ParseCounterTest, countMimeType) { { std::string counterStr = "text/html;raw=true=1"; - CHECK(true, 1U); - CHECK(false, 0U); - CHECK(s.find("text/html") == 0, 1U); - CHECK(s.find("text/html;raw=true") == 0, 1U); + CHECK(true, 1); + CHECK(false, 0); + CHECK(s.find("text/html") == 0, 1); + CHECK(s.find("text/html;raw=true") == 0, 1); } { std::string counterStr = "foo=1;text/html;raw=true=50;bar=2"; - CHECK(true, 53U); - CHECK(false, 0U); - CHECK(s.find("text/html") == 0, 50U); - CHECK(s == "text/html", 0U); - CHECK(s.find("text/html;raw=true") == 0, 50U); - CHECK(s == "text/html;raw=true", 50U); - CHECK(s.find("text/html;raw=true;param=value") == 0, 0U); + CHECK(true, 53); + CHECK(false, 0); + CHECK(s.find("text/html") == 0, 50); + CHECK(s == "text/html", 0); + CHECK(s.find("text/html;raw=true") == 0, 50); + CHECK(s == "text/html;raw=true", 50); + CHECK(s.find("text/html;raw=true;param=value") == 0, 0); } { std::string counterStr = "foo=1;text/html;raw=true;param=value=50;bar=2"; - CHECK(true, 53U); - CHECK(false, 0U); - CHECK(s.find("text/html") == 0, 50U); - CHECK(s.find("text/html;raw=true") == 0, 50U); - CHECK(s == "text/html;raw=true", 0U); - CHECK(s.find("text/html;raw=true;param=value") == 0, 50U); + CHECK(true, 53); + CHECK(false, 0); + CHECK(s.find("text/html") == 0, 50); + CHECK(s.find("text/html;raw=true") == 0, 50); + CHECK(s == "text/html;raw=true", 0); + CHECK(s.find("text/html;raw=true;param=value") == 0, 50); } { std::string counterStr = "application/javascript=8;text/html=3;application/warc-headers=28364;text/html;raw=true=6336;text/css=47;text/javascript=98;image/png=968;image/webp=24;application/json=3694;image/gif=10274;image/jpeg=1582;font/woff2=25;text/plain=284;application/atom+xml=247;application/x-www-form-urlencoded=9;video/mp4=9;application/x-javascript=7;application/xml=1;image/svg+xml=5"; - CHECK(true, 51985U); - CHECK(false, 0U); - CHECK(s == "application/javascript", 8U); - CHECK(s == "text/html", 3U); - CHECK(s == "application/warc-headers", 28364U); - CHECK(s == "text/html;raw=true", 6336U); - CHECK(s == "text/css", 47U); - CHECK(s == "text/javascript", 98U); - CHECK(s == "image/png", 968U); - CHECK(s == "image/webp", 24U); - CHECK(s == "application/json", 3694U); - CHECK(s == "image/gif", 10274U); - CHECK(s == "image/jpeg", 1582U); - CHECK(s == "font/woff2", 25U); - CHECK(s == "text/plain", 284U); - CHECK(s == "application/atom+xml", 247U); - CHECK(s == "application/x-www-form-urlencoded", 9U); - CHECK(s == "video/mp4", 9U); - CHECK(s == "application/x-javascript", 7U); - CHECK(s == "application/xml", 1U); - CHECK(s == "image/svg+xml", 5U); - CHECK(s.find("text/") == 0, (unsigned int)(3+6336+47+98+284)); - CHECK(s.find("text/html") == 0, (unsigned int)(3+6336)); - CHECK(s.find("application/") == 0, (unsigned int)(8+28364+3694+247+9+7+1)); - CHECK(s.find("image/") == 0, (unsigned int)(968+24+10274+1582+5)); - CHECK(s.find("xml") != std::string::npos, (unsigned int)(247+1+5)); - CHECK(s.find("image/") == 0 || s.find("video/") == 0 || s.find("sound/") == 0, (unsigned int)(968+24+10274+1582+9+5)); + CHECK(true, 51985); + CHECK(false, 0); + CHECK(s == "application/javascript", 8); + CHECK(s == "text/html", 3); + CHECK(s == "application/warc-headers", 28364); + CHECK(s == "text/html;raw=true", 6336); + CHECK(s == "text/css", 47); + CHECK(s == "text/javascript", 98); + CHECK(s == "image/png", 968); + CHECK(s == "image/webp", 24); + CHECK(s == "application/json", 3694); + CHECK(s == "image/gif", 10274); + CHECK(s == "image/jpeg", 1582); + CHECK(s == "font/woff2", 25); + CHECK(s == "text/plain", 284); + CHECK(s == "application/atom+xml", 247); + CHECK(s == "application/x-www-form-urlencoded", 9); + CHECK(s == "video/mp4", 9); + CHECK(s == "application/x-javascript", 7); + CHECK(s == "application/xml", 1); + CHECK(s == "image/svg+xml", 5); + CHECK(s.find("text/") == 0, 3+6336+47+98+284); + CHECK(s.find("text/html") == 0, 3+6336); + CHECK(s.find("application/") == 0, 8+28364+3694+247+9+7+1); + CHECK(s.find("image/") == 0, 968+24+10274+1582+5); + CHECK(s.find("xml") != std::string::npos, 247+1+5); + CHECK(s.find("image/") == 0 || s.find("video/") == 0 || s.find("sound/") == 0, 968+24+10274+1582+9+5); } }