summaryrefslogtreecommitdiff
path: root/test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test.cc')
-rw-r--r--test.cc61
1 files changed, 23 insertions, 38 deletions
diff --git a/test.cc b/test.cc
index 9255f40..ac5c636 100644
--- a/test.cc
+++ b/test.cc
@@ -91,12 +91,11 @@ static_assert(::zp::typequ<::zp::nulptrtyp,::std::nullptr_t>::val == true);
static_assert(::zp::bytelen == CHAR_BIT);
template<typename typtyp> constexpr static auto chktyp() noexcept -> bool {
- using ::zp::inf;
- using ::zp::nan;
using ::zp::nulptr;
using ::zp::typequ;
using typ = ::zp::typ<typtyp>;
+ using val = ::zp::val<typtyp>;
using numlim = ::std::numeric_limits<typtyp>;
if constexpr (!typequ<typename ::zp::remcv<typtyp>::typ,bool>::val && !typ::ischr) {static_assert(typ::isint == ::std::is_integral_v<typtyp>);}
@@ -107,11 +106,11 @@ template<typename typtyp> constexpr static auto chktyp() noexcept -> bool {
static_assert(typ::hassgn == numlim::is_signed);
- static_assert(typ::min == numlim::lowest());
- static_assert(typ::max == numlim::max());
+ static_assert(val::min() == numlim::lowest());
+ static_assert(val::max() == numlim::max());
if constexpr (typ::isflt) {
- static_assert(inf<typtyp>::val == numlim::infinity());
+ static_assert(val::inf() == numlim::infinity());
}
return true;
@@ -307,17 +306,17 @@ int main() {
chkeq(sizeof (f02),0x4u);
chkeq(sizeof (f04),0x8u);
- f02 = ::zp::nan<::zp::f02>::val;
- f04 = ::zp::nan<::zp::f04>::val;
+ f02 = ::zp::val<::zp::f02>::nan();
+ f04 = ::zp::val<::zp::f04>::nan();
chkeq(::zp::isnan(f02),true);
chkeq(::zp::isnan(f04),true);
- f02 = ::zp::inf<::zp::f02>::val;
- f04 = ::zp::inf<::zp::f04>::val;
+ f02 = ::zp::val<::zp::f02>::inf();
+ f04 = ::zp::val<::zp::f04>::inf();
- chkgt(f02,::zp::typ<::zp::f02>::max);
- chkgt(f04,::zp::typ<::zp::f04>::max);
+ chkgt(f02,::zp::val<::zp::f02>::max());
+ chkgt(f04,::zp::val<::zp::f04>::max());
}();
[&] {
@@ -483,45 +482,31 @@ int main() {
delete[] buf02;
}();
-#if false
- [&] {
- tst("boxes");
-
- ::zp::box<::zp::i8s,::std::allocator<::zp::i8s>> box0 = 0x4;
-
- chkeq(*box0,0x4);
-
- ::zp::box<::zp::i8s,::std::allocator<::zp::i8s>> const box1 = 0x0-box1;
-
- chkeq(*box1,-0x4);
- }();
-#endif
-
[&] {
tst("arrays");
- ::zp::arr<::zp::i8,::std::allocator<::zp::i8>> arr(0x8u);
+ auto arr0 = ::zp::arr<::zp::i8,::std::allocator<::zp::i8>>::alc(0x8u);
- chkeq(arr.len(),0x8u);
+ chkeq(arr0.len(),0x8u);
- arr[0x0] = 0x7Fu;
- arr[0x1] = 0x3Fu;
- arr[0x2] = 0x1Fu;
- arr[0x3] = 0x0Fu;
- arr[0x4] = 0x07u;
- arr[0x5] = 0x03u;
- arr[0x6] = 0x01u;
- arr[0x7] = 0x00u;
+ arr0[0x0] = 0x7Fu;
+ arr0[0x1] = 0x3Fu;
+ arr0[0x2] = 0x1Fu;
+ arr0[0x3] = 0x0Fu;
+ arr0[0x4] = 0x07u;
+ arr0[0x5] = 0x03u;
+ arr0[0x6] = 0x01u;
+ arr0[0x7] = 0x00u;
::zp::i8 prv = 0xFFu;
- for (::zp::i8 const val : arr) {
+ for (::zp::i8 const val : arr0) {
chkeq(val,static_cast<::zp::i8>(prv>>0x1u));
prv = val;
}
- arr.fil(0xFFu);
+ arr0.fil(0xFFu);
- for (::zp::i8 const val : arr) {
+ for (::zp::i8 const val : arr0) {
chkeq(val,0xFFu);
}
}();