blob: ab504e3a7df12338cededc43971fdab14007d75d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "http/http_server.hpp"
#include <string>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
using ::testing::MatchesRegex;
namespace crow
{
TEST(HttpServer, getCachedDateStr)
{
struct FakeHandler
{};
FakeHandler handler;
crow::Server<FakeHandler> server(&handler, {});
std::string firstString = server.getCachedDateStrImpl();
EXPECT_THAT(
firstString,
MatchesRegex(
"(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (0[1-9]|[12][0-9]|3[01]) "
"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{4} "
"([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9] GMT"));
EXPECT_EQ(firstString, server.getCachedDateStrImpl());
}
} // namespace crow
|