Skip to content

Commit 553d28f

Browse files
committed
* move doctest to root
* check if doctest exists and disable tests if it does not * update readme
1 parent 57b37ab commit 553d28f

File tree

8 files changed

+18
-9
lines changed

8 files changed

+18
-9
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "3rdparty/doctest"]
2-
path = 3rdparty/doctest
1+
[submodule "doctest"]
2+
path = doctest
33
url = https://github.com/onqtam/doctest.git

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ set(NETLIB_SRC
2323
option(BUILD_TESTS "Build tests" ON)
2424
option(BUILD_EXAMPLES "Build example programs" ON)
2525

26+
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/doctest/CMakeLists.txt")
27+
set(BUILD_TESTS OFF)
28+
endif()
29+
2630
if(BUILD_TESTS)
2731
# doctest
28-
include_directories(3rdparty)
32+
include_directories(doctest)
2933
add_subdirectory(tests)
3034
endif()
3135

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# cpp-net-lib
22

3-
This lib is under heavy development and not really ready for use yet.
4-
53
[![All platform build test](https://github.com/lpcvoid/cpp-net-lib/actions/workflows/test_matrix.yml/badge.svg?branch=master)](https://github.com/lpcvoid/cpp-net-lib/actions/workflows/test_matrix.yml)
64

75
Modern, header-only, compact and cross-platform C++ network/sockets library.
@@ -26,6 +24,13 @@ git submodule add https://github.com/lpcvoid/cpp-net-lib.git extern/cpp-net-lib
2624

2725
This will check out the lib as a submodule within your project. Now just `#include "extern/netlib.hpp"` somewhere.
2826

27+
Alternatively, you can run the examples and tests like you would any other CMake based
28+
project:
29+
```shell
30+
cmake -B build
31+
cmake --build build
32+
```
33+
2934
There are some cmake flags you can use:
3035

3136
| Option | Default | Description |

tests/test_client_examplecom.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "../3rdparty/doctest/doctest/doctest.h"
1+
#include "../doctest/doctest/doctest.h"
22
#include "../src/netlib.hpp"
33

44
static const std::string basic_get = R"(GET / HTTP/1.1\r\nHost: example.com\r\n\r\n)";

tests/test_client_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "../3rdparty/doctest/doctest/doctest.h"
1+
#include "../doctest/doctest/doctest.h"
22
#include "../src/netlib.hpp"
33
#include <iostream>
44
#include <random>

tests/test_client_server_disconnect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "../3rdparty/doctest/doctest/doctest.h"
1+
#include "../doctest/doctest/doctest.h"
22
#include "../src/netlib.hpp"
33

44
using namespace std::chrono_literals;

tests/test_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define DOCTEST_CONFIG_IMPLEMENT
2-
#include "../3rdparty/doctest/doctest/doctest.h"
2+
#include "../doctest/doctest/doctest.h"
33

44
int main(int argc, char** argv) {
55
doctest::Context context;

0 commit comments

Comments
 (0)