Add Url/Html encoding, ISO-8601 interval parse, TempFile, random_string charset
Universal additions (all generic, header-only, tested; full suite 1127 pass): - Void::Encoding::Url — RFC 3986 percent encode/decode + query_encode. - Void::Text::html_unescape — numeric + common named HTML entities -> UTF-8. - Void::Time::parse_iso8601_interval — parse PT#H#M#S / P#DT#H#M#S durations (distinct from the unit-suffix parse_duration). - Void::FileSystem::TempFile — RAII unique temp file (alongside TempDir), with keep() to persist. - Void::Random::random_string(n, charset) overload. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
80293ee56f
commit
fb0506581f
9 files changed
+645
-6
No files matched your search
@@ -5,6 +5,34 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
// ── random_string charset ────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test random_string_length_and_charset()
|
||||
{
|
||||
const std::string charset = "ABC";
|
||||
const auto s = Void::Random::random_string(64, charset);
|
||||
Void::Testing::expect_eq(s.size(), std::size_t{64});
|
||||
for (char c : s) {
|
||||
Void::Testing::expect(charset.find(c) != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
Void::Testing::Test random_string_default_alphanumeric()
|
||||
{
|
||||
const auto s = Void::Random::random_string(32);
|
||||
Void::Testing::expect_eq(s.size(), std::size_t{32});
|
||||
for (char c : s) {
|
||||
const bool alnum = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9');
|
||||
Void::Testing::expect(alnum);
|
||||
}
|
||||
}
|
||||
|
||||
Void::Testing::Test random_string_empty_charset_is_empty()
|
||||
{
|
||||
Void::Testing::expect(Void::Random::random_string(10, "").empty());
|
||||
}
|
||||
|
||||
// ── Xoshiro256 ───────────────────────────────────────────────────────────────
|
||||
|
||||
Void::Testing::Test xoshiro_produces_output()
|
||||
|
||||
Reference in new issue
Block a user