summaryrefslogtreecommitdiff
path: root/u8c-check/src/test1.inl
diff options
context:
space:
mode:
Diffstat (limited to 'u8c-check/src/test1.inl')
-rw-r--r--u8c-check/src/test1.inl24
1 files changed, 24 insertions, 0 deletions
diff --git a/u8c-check/src/test1.inl b/u8c-check/src/test1.inl
new file mode 100644
index 0000000..4e2a18e
--- /dev/null
+++ b/u8c-check/src/test1.inl
@@ -0,0 +1,24 @@
+#include <cstdint> /* u8c_uint32c, u8c_ubytec, std::int_fast8_t, u8c::uint32 */
+#include <iomanip> /* std::hex */
+#include <iostream> /* std::cout, std::endl */
+#include <random> /* std::random_device */
+
+auto test1() -> void {
+ std::random_device rd;
+ std::uniform_int_distribution<char32_t> distr(u8c_uint32c(0x0),u8c_uint32c(0x100));
+ for(std::int_fast8_t n = u8c_bytec(0x0);n <= u8c_bytec(0x4);n += u8c_ubytec(0x1)) {
+ auto const chr = distr(rd);
+ std::cout << "U+" << std::hex << static_cast<u8c::uint32>(chr) << " (\"" << u8c::uninm(chr) << "\" @ \"" << u8c::uniblk(chr) << "\")" << std::endl;
+ std::cout << "Is alphanumeric: " << u8c::isalnum(chr) << std::endl;
+ std::cout << "Is alphabetic: " << u8c::isalpha(chr) << std::endl;
+ std::cout << "Is control character: " << u8c::iscntrl(chr) << std::endl;
+ std::cout << "Is digit: " << u8c::isdigit(chr) << std::endl;
+ std::cout << "Is lowercase: " << u8c::islower(chr) << std::endl;
+ std::cout << "Is punctuation mark: " << u8c::ispunct(chr) << std::endl;
+ std::cout << "Is whitespace: " << u8c::isspace(chr) << std::endl;
+ std::cout << "Is surrogate point: " << u8c::issurro(chr) << std::endl;
+ std::cout << "Is uppercase: " << u8c::isupper(chr) << std::endl;
+ std::cout << "Is hexadecimal digit: " << u8c::isxdigit(chr) << std::endl;
+ std::cout << std::endl;
+ }
+}