c-rss/tests/test_requests.cpp
2024-08-20 09:38:47 -05:00

17 lines
570 B
C++

#include <string>
#include <gtest/gtest.h>
#include "requests.h"
TEST(RequestsTest, HttpsGetTest) {
requestsInit();
std::string expected = "<!DOCTYPE html>\n<html >\n<head><meta charset=\"utf-8\">\n<title>Ben Shiller</title>";
for (int i = 0; i < 10; ++i) {
GetRequestResult result = requestsGet("https://shillerben.com");
// std::cout << "GET https://shillerben.com returned: " << result.data << '\n';
ASSERT_EQ(strncmp(result.data, expected.c_str(), expected.size()), 0);
free(result.data);
}
requestsCleanup();
}