#include "check.hpp" #include #include #include using namespace Void::TeamSpeak; static_assert(!std::is_copy_constructible_v); static_assert(std::is_move_constructible_v); static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v>); static_assert(std::is_same_v().deleteFile("x")), Void::Result::Result>); TEST_CASE(modern_build_command_escapes_fields) { const auto command = buildCommand("sendtextmessage", { {"msg", "hello world|all"}, {"target", "7"}}); CHECK_EQ(command, std::string("sendtextmessage msg=hello\\sworld\\pall target=7")); } TEST_CASE(strong_ids_do_not_implicitly_convert) { const ClientId client{42}; const ChannelId channel{42}; CHECK(client.value == 42); CHECK(channel.value == 42); CHECK(static_cast(client)); CHECK(static_cast(channel)); } TEST_CASE(whisper_targets_report_empty_state) { WhisperTargets targets; CHECK(targets.empty()); targets.clients.push_back(ClientId{7}); CHECK(!targets.empty()); } TEST_CASE(logical_voice_streams_have_strong_independent_handles) { Client client; auto first = client.createVoiceStream(); auto second = client.createVoiceStream(); CHECK(first.has_value()); CHECK(second.has_value()); CHECK(first->value != second->value); WhisperTargets targets; targets.clients.push_back(ClientId{7}); const std::uint8_t frame[] = {1, 2, 3}; auto sent = client.sendWhisper(*first, frame, targets); CHECK(!sent.has_value()); CHECK(sent.error().code == Error::Code::NotConnected); CHECK(client.destroyVoiceStream(*first).has_value()); CHECK(!client.destroyVoiceStream(*first).has_value()); CHECK(client.destroyVoiceStream(*second).has_value()); }