MCPcopy Create free account
hub / github.com/FastLED/FastLED / FL_TEST_FILE

Function FL_TEST_FILE

tests/fl/stl/asio/http/test_utils/mock_http.cpp:7–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "fl/stl/json.h"
6
7FL_TEST_FILE(FL_FILEPATH) {
8
9using namespace fl;
10using namespace fl::net::http;
11
12// Test: MockHttpServer - Construction
13FL_TEST_CASE("MockHttpServer - Construction") {
14 MockHttpServer server(47701);
15 FL_CHECK_FALSE(server.isConnected());
16 FL_CHECK_EQ(0, server.getClientCount());
17}
18
19// Test: MockHttpServer - Start
20FL_TEST_CASE("MockHttpServer - Start server") {
21 MockHttpServer server(47701);
22 FL_CHECK(server.connect());
23 FL_CHECK(server.isConnected());
24}
25
26// Test: MockHttpServer - Stop
27FL_TEST_CASE("MockHttpServer - Stop server") {
28 MockHttpServer server(47701);
29 server.connect();
30 server.disconnect();
31 FL_CHECK_FALSE(server.isConnected());
32}
33
34// Test: MockHttpServer - Double start is safe
35FL_TEST_CASE("MockHttpServer - Double start is safe") {
36 MockHttpServer server(47701);
37 FL_CHECK(server.connect());
38 FL_CHECK(server.connect());
39 FL_CHECK(server.isConnected());
40}
41
42// Test: MockHttpServer - Double stop is safe
43FL_TEST_CASE("MockHttpServer - Double stop is safe") {
44 MockHttpServer server(47701);
45 server.connect();
46 server.disconnect();
47 server.disconnect();
48 FL_CHECK_FALSE(server.isConnected());
49}
50
51// Test: MockHttpServer - Accept single client
52FL_TEST_CASE("MockHttpServer - Accept single client") {
53 MockHttpServer server(47701);
54 server.connect();
55
56 uint32_t clientId = server.acceptClient();
57 FL_CHECK_NE(0, clientId);
58 FL_CHECK_EQ(1, server.getClientCount());
59}
60
61// Test: MockHttpServer - Accept multiple clients
62FL_TEST_CASE("MockHttpServer - Accept multiple clients") {
63 MockHttpServer server(47701);
64 server.connect();

Callers

nothing calls this directly

Calls 15

acceptClientMethod · 0.80
writeResponseMethod · 0.80
readRequestMethod · 0.80
arrayClass · 0.50
isConnectedMethod · 0.45
getClientCountMethod · 0.45
connectMethod · 0.45
disconnectMethod · 0.45
disconnectClientMethod · 0.45
setMethod · 0.45
push_backMethod · 0.45
as_stringMethod · 0.45

Tested by

no test coverage detected