OSC bind address
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m41s
CI / Windows Release Package (push) Successful in 2m30s

This commit is contained in:
Aiden
2026-05-10 17:23:28 +10:00
parent a3635b5d31
commit f11d531e0c
11 changed files with 81 additions and 9 deletions

View File

@@ -74,6 +74,11 @@ struct OscServerTestAccess
return server.DispatchMessage(message, error);
}
static bool TryParseBindAddress(const std::string& bindAddress, in_addr& address, std::string& error)
{
return OscServer::TryParseBindAddress(bindAddress, address, error);
}
static void SetUpdateParameterCallback(
OscServer& server,
const std::function<bool(const std::string&, const std::string&, const std::string&, std::string&)>& callback)
@@ -191,6 +196,23 @@ void TestRejectsUnsupportedAddress()
Expect(!called, "unsupported OSC namespace does not invoke callback");
Expect(!error.empty(), "unsupported OSC address reports an error");
}
void TestParsesOscBindAddress()
{
in_addr loopback = {};
std::string error;
Expect(OscServerTestAccess::TryParseBindAddress("127.0.0.1", loopback, error), "loopback OSC bind address parses");
Expect(loopback.S_un.S_addr != 0, "loopback OSC bind address produces a socket address");
in_addr wildcard = {};
error.clear();
Expect(OscServerTestAccess::TryParseBindAddress("0.0.0.0", wildcard, error), "wildcard OSC bind address parses");
in_addr invalid = {};
error.clear();
Expect(!OscServerTestAccess::TryParseBindAddress("localhost", invalid, error), "hostname OSC bind address is rejected");
Expect(!error.empty(), "invalid OSC bind address reports an error");
}
}
int main()
@@ -201,6 +223,7 @@ int main()
TestDecodeIntStringAndBoolMessages();
TestDispatchValidAddress();
TestRejectsUnsupportedAddress();
TestParsesOscBindAddress();
if (gFailures != 0)
{