Source code is divided in three modules:
client
server
shared
(code shared between client and server)
Besides that, there's also a test suite.
To build the application client and server executables, simply run:
make
To clear the build in case of (for example) inconsistencies, run:
make clean
To run the client, this is the interface:
./app_client <username> <server-address> <server-port>
To run the server, this is the interface:
./app_server <bind-address> <bind-port>
To run all tests, run this command:
make test
Currently, there is no way to run a single test isolated.
Depending on the module you want to test, you should edit either
src/test/shared.cpp
, src/test/client.cpp
or src/test/server.cpp
.
Inside one of these files, create or update the test suite for the submodule you
want to test. Adding a test to the test suite is simply:
.test("test identifier", [] {
// test code goes here
})
To assert a condition holds, use the TEST_ASSERT
macro:
TEST_ASSERT("message in case of failure", my_condition());
To create a test suite, please take a look into the existing test suites
(src/test/shared.cpp
surely contains test suites as examples).