summaryrefslogtreecommitdiff
path: root/rttest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'rttest.cc')
-rw-r--r--rttest.cc51
1 files changed, 32 insertions, 19 deletions
diff --git a/rttest.cc b/rttest.cc
index 21819f9..2feafae 100644
--- a/rttest.cc
+++ b/rttest.cc
@@ -22,8 +22,9 @@ int main() {
char const * const rtypnm = typeid (rtyp).name();
auto const getval = []<typename typ>(typ const & valref) {
- if constexpr (::zp::ischr<typ>) {return static_cast<::zp::i02m>(valref);}
- else {return valref;}
+ if constexpr (::zp::ischr<typ>) {return static_cast<::zp::i02m>(valref);}
+ else if constexpr (::zp::isptr<typ>) {return reinterpret_cast<void *>(valref);}
+ else {return valref;}
};
auto const lval = getval(lvalref);
@@ -35,6 +36,8 @@ int main() {
::fmt::print("\x1B[38;5;161munequal\x1B[0m (at #{})\n",srcloc.line());
//throw ::std::exception {};
++numerr;
+
+ return;
}
::fmt::print("\x1B[38;5;77mequal\x1B[0m\n");
@@ -93,9 +96,19 @@ int main() {
[&] {
tst("special numbers");
- cmp(::zp::isnan(::zp::nan<float>), true);
- cmp(::zp::isnan(::zp::nan<double>), true);
- cmp(::zp::isnan(::zp::nan<long double>),true);
+ cmp(zp_isnanf( zp_nanf), true);
+ cmp(zp_isnand( zp_nand), true);
+ cmp(zp_isnanld(zp_nanld),true);
+ }();
+
+ [&] {
+ tst("memory sequences");
+
+ ::zp::i04 filbuf;
+
+ cmp(::zp::memfil(&filbuf,0xFFu,sizeof (filbuf)),reinterpret_cast<char unsigned *>(&filbuf+0x1u)+0x1u);
+
+ cmp(filbuf,0xFFFFFFFFFFFFFFFFu);
}();
[&] {
@@ -105,9 +118,9 @@ int main() {
wchar_t wstr[] = L"Hello there!";
char32_t str02[] = U"Hello there!";
- ::zp::sz const len = ::zp::strlen(str);
- ::zp::sz const wlen = ::zp::strlen(wstr);
- ::zp::sz const len02 = ::zp::strlen(str02);
+ ::zp::sz const len = ::zp_strlen( str);
+ ::zp::sz const wlen = ::zp_wstrlen( wstr);
+ ::zp::sz const len02 = ::zp_utf32len(str02);
cmp(len, 0xCu);
cmp(wlen, 0xCu);
@@ -117,9 +130,9 @@ int main() {
auto const wbuf = new wchar_t[ wlen];
auto const buf02 = new char32_t[len02];
- cmp(::zp::strcpy(buf, str), len);
- cmp(::zp::strcpy(wbuf, wstr), wlen);
- cmp(::zp::strcpy(buf02,str02),len02);
+ cmp(::zp_strcpy( buf, str), len);
+ cmp(::zp_wstrcpy( wbuf, wstr), wlen);
+ cmp(::zp_utf32cpy(buf02,str02),len02);
delete[] buf;
delete[] wbuf;
@@ -131,12 +144,12 @@ int main() {
char32_t const src[] = U"\U0001F480";
- ::zp::sz const buf8len = ::zp::utf8enclen(src);
+ ::zp::sz const buf8len = ::zp_utf8enclen(src);
cmp(buf8len,0x4u);
char8_t * buf8 = new char8_t[buf8len+0x1u];
- ::zp::utf8enc(buf8,src);
+ ::zp_utf8enc(buf8,src);
cmp(buf8[0x0u],0xF0u);
cmp(buf8[0x1u],0x9Fu);
@@ -144,12 +157,12 @@ int main() {
cmp(buf8[0x3u],0x80u);
cmp(buf8[0x4u],0x00u);
- ::zp::sz const buf02len = ::zp::utf8declen(buf8);
+ ::zp::sz const buf02len = ::zp_utf8declen(buf8);
cmp(buf02len,0x1u);
char32_t * buf02 = new char32_t[buf02len+0x1u];
- ::zp::utf8dec(buf02,buf8);
+ ::zp_utf8dec(buf02,buf8);
cmp(buf02[0x0u],0x1F480u);
cmp(buf02[0x1u],0x0u);
@@ -163,24 +176,24 @@ int main() {
char32_t const src[] = U"\U0001F480\u00F0";
- ::zp::sz const buf01len = ::zp::utf16enclen(src);
+ ::zp::sz const buf01len = ::zp_utf16enclen(src);
cmp(buf01len,0x3u);
char16_t * buf01 = new char16_t[buf01len+0x1u];
- ::zp::utf16enc(buf01,src);
+ ::zp_utf16enc(buf01,src);
cmp(buf01[0x0u],0xD83Du);
cmp(buf01[0x1u],0xDC80u);
cmp(buf01[0x2u],0x00F0u);
cmp(buf01[0x3u],0x0000u);
- ::zp::sz const buf02len = ::zp::utf16declen(buf01);
+ ::zp::sz const buf02len = ::zp_utf16declen(buf01);
cmp(buf02len,0x2u);
char32_t * buf02 = new char32_t[buf02len+0x1u];
- ::zp::utf16dec(buf02,buf01);
+ ::zp_utf16dec(buf02,buf01);
cmp(buf02[0x0u],0x1F480u);
cmp(buf02[0x1u],0xF0u);