@@ -13,7 +13,7 @@
int main() {
etest::test("blob URL generation", [] {
std::string REGEX_UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
std::string regex_uuid = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
url::Host h = {url::HostType::DnsDomain, "example.com"};
url::Origin o = {"https", h, std::uint16_t{8080}, std::nullopt, false};
@@ -21,7 +21,7 @@ int main() {
std::string blob = url::blob_url_create(o);
std::cout << "Generated Blob URL: " << blob << std::endl;
etest::expect(std::regex_match(blob, std::regex("blob:https://example.com:8080/" + REGEX_UUID)));
etest::expect(std::regex_match(blob, std::regex("blob:https://example.com:8080/" + regex_uuid)));
h = url::Host{url::HostType::Ip4Addr, std::uint32_t{134744072}};
o = {"https", h, std::uint16_t{8080}, std::nullopt, false};
@@ -29,7 +29,7 @@ int main() {
blob = url::blob_url_create(o);
std::cout << "Generated Blob URL: " << blob << std::endl;
etest::expect(std::regex_match(blob, std::regex("blob:https://8.8.8.8:8080/" + REGEX_UUID)));
etest::expect(std::regex_match(blob, std::regex("blob:https://8.8.8.8:8080/" + regex_uuid)));
std::array<uint16_t, 8> v6 = {0x2001, 0xdb8, 0x85a3, 0, 0, 0x8a2e, 0x370, 0x7334};
h = url::Host{url::HostType::Ip6Addr, v6};
@@ -39,7 +39,7 @@ int main() {
std::cout << "Generated Blob URL: " << blob;
etest::expect(std::regex_match(
blob, std::regex("blob:https://\\[2001:db8:85a3::8a2e:370:7334\\]:8080/" + REGEX_UUID)));
blob, std::regex("blob:https://\\[2001:db8:85a3::8a2e:370:7334\\]:8080/" + regex_uuid)));
});
return etest::run_all_tests();