mirror of
https://github.com/LizardByte/Sunshine.git
synced 2024-11-17 08:09:50 +00:00
27 lines
795 B
C++
27 lines
795 B
C++
|
/**
|
||
|
* @file tests/unit/test_network.cpp
|
||
|
* @brief Test src/network.*
|
||
|
*/
|
||
|
#include <src/network.h>
|
||
|
|
||
|
#include "../tests_common.h"
|
||
|
|
||
|
struct MdnsInstanceNameTest: testing::TestWithParam<std::tuple<std::string, std::string>> {};
|
||
|
|
||
|
TEST_P(MdnsInstanceNameTest, Run) {
|
||
|
auto [input, expected] = GetParam();
|
||
|
ASSERT_EQ(net::mdns_instance_name(input), expected);
|
||
|
}
|
||
|
|
||
|
INSTANTIATE_TEST_SUITE_P(
|
||
|
MdnsInstanceNameTests,
|
||
|
MdnsInstanceNameTest,
|
||
|
testing::Values(
|
||
|
std::make_tuple("shortname-123", "shortname-123"),
|
||
|
std::make_tuple("space 123", "space-123"),
|
||
|
std::make_tuple("hostname.domain.test", "hostname"),
|
||
|
std::make_tuple("&", "Sunshine"),
|
||
|
std::make_tuple("", "Sunshine"),
|
||
|
std::make_tuple("😁", "Sunshine"),
|
||
|
std::make_tuple(std::string(128, 'a'), std::string(63, 'a'))));
|