38 lines
998 B
C++
38 lines
998 B
C++
#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);
|
|
}
|