1 parent
6dddf513b3
commit
a7ffe73a6c
14 files changed
+700
-114
No files matched your search
@@ -5,7 +5,7 @@ file(GLOB ECHOIONPROTOCOL_TEST_SOURCES CONFIGURE_DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/test_*.cpp")
|
||||
|
||||
add_executable(echoion_protocol_tests ${ECHOIONPROTOCOL_TEST_SOURCES})
|
||||
target_link_libraries(echoion_protocol_tests PRIVATE EchoionProtocol)
|
||||
target_link_libraries(echoion_protocol_tests PRIVATE Void::TeamSpeak)
|
||||
target_include_directories(echoion_protocol_tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#include "check.hpp"
|
||||
|
||||
#include <Void/TeamSpeak/TeamSpeak.hpp>
|
||||
|
||||
using namespace Void::TeamSpeak;
|
||||
|
||||
TEST_CASE(modern_library_creates_independent_clients)
|
||||
{
|
||||
ClientLibrary library;
|
||||
auto first = library.createClient();
|
||||
auto second = library.createClient();
|
||||
CHECK(first != nullptr);
|
||||
CHECK(second != nullptr);
|
||||
CHECK(first.get() != second.get());
|
||||
CHECK_EQ(first->state(), ConnectionState::Disconnected);
|
||||
CHECK_EQ(second->state(), ConnectionState::Disconnected);
|
||||
}
|
||||
|
||||
TEST_CASE(strong_ids_do_not_erase_target_types)
|
||||
{
|
||||
WhisperTargets targets{
|
||||
.channels = {ChannelId{42}},
|
||||
.clients = {ClientId{7}, ClientId{8}},
|
||||
};
|
||||
CHECK(!targets.empty());
|
||||
CHECK_EQ(targets.channels.front().value, std::uint64_t{42});
|
||||
CHECK_EQ(targets.clients.size(), std::size_t{2});
|
||||
CHECK(ClientId{7} != ClientId{8});
|
||||
}
|
||||
|
||||
TEST_CASE(connect_options_are_validated_before_network_io)
|
||||
{
|
||||
Client client;
|
||||
auto result = client.connect({});
|
||||
CHECK(!result.has_value());
|
||||
CHECK_EQ(result.error().code, Error::Code::InvalidArgument);
|
||||
}
|
||||
Reference in new issue
Block a user