summaryrefslogtreecommitdiff
path: root/test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test.cc')
-rw-r--r--test.cc34
1 files changed, 32 insertions, 2 deletions
diff --git a/test.cc b/test.cc
index d6a2da5..d22bc24 100644
--- a/test.cc
+++ b/test.cc
@@ -215,14 +215,14 @@ template<typename ltyp,typename rtyp> static auto cmp(int unsigned & numerr,int
::std::cout << " " << ln << ". " << ltypnm << " (" << lval << ") " << mthstr << " " << rtypnm << " (" << rval << ")... ";
if (!cmp(lval,rval)) {
- ::std::cout << "\x1B[38;5;161merror\x1B[0m\n";
+ ::std::cout << "\x1B[38;5;161merror\x1B[0m" << ::std::endl;
//throw ::std::exception {};
++numerr;
return;
}
- ::std::cout <<"\x1B[38;5;77mokay\x1B[0m\n";
+ ::std::cout <<"\x1B[38;5;77mokay\x1B[0m" << ::std::endl;
}
#define chkeq(lval,rval) (::cmp(numerr,__LINE__,0x0u,(lval),(rval)))
@@ -279,6 +279,36 @@ int main() {
chkeq(res.chk(),true);
chkeq(res.exp(fun,"expectation failed"),-0x45);
+
+ class nopod0 {
+ public:
+ char val;
+
+ nopod0() noexcept : val('\x00') {}
+ nopod0(char const* const str) noexcept : val(str[0x0]) {}
+
+ ~nopod0() noexcept(false) {}
+ };
+
+ class nopod1 {
+ public:
+ int val;
+
+ nopod1() noexcept : val(0x0) {}
+ nopod1(int const val) noexcept : val(0x0-val) {}
+
+ ~nopod1() noexcept(false) {}
+ };
+
+ auto resnopod = ::zp::res<nopod0,nopod1>::oky("Hallo");
+
+ chkeq(resnopod.chk(),true);
+ chkeq(resnopod.getoky().val,'H');
+
+ resnopod = ::zp::res<nopod0,nopod1>::err(0x4);
+
+ chkeq(resnopod.chk(),false);
+ chkeq(resnopod.geterr().val,-0x4);
}();
[&] {