1
0
forked from Alepha/Alepha

Exception problem debugging.

This commit is contained in:
2024-09-05 12:15:14 -04:00
parent 90531755f8
commit 759b2ecdea
6 changed files with 34 additions and 11 deletions

View File

@ -33,9 +33,14 @@ namespace Alepha::Hydrogen::Atomic ::detail:: Dropbox_m
inline namespace exports
{
struct finished_exception;
template< typename > class Dropbox;
using DropboxFinishedException= synthetic_exception< struct finished_exception, FinishedException >;
template< template< auto > class > struct ck {};
template< typename > class tag;
using ck2= ck< tag >;
using DropboxFinishedException= synthetic_exception< finished_exception, FinishedException >;
using AnyTaggedDropboxFinishedException= AnyTagged< DropboxFinishedException >;
template< typename tag > using TaggedDropboxFinishedException= Tagged< DropboxFinishedException, tag >;

View File

@ -31,6 +31,7 @@ namespace Alepha::Hydrogen::Atomic ::detail:: Mailbox_m
inline namespace exports
{
struct finished_exception;
template< typename > class Mailbox;
using MailboxFinishedException= synthetic_exception< struct finished_exception, FinishedException >;

View File

@ -1,6 +1,7 @@
static_assert( __cplusplus > 2020'99 );
#include "../Mailbox.h"
#include "../Dropbox.h"
#include <Alepha/Testing/test.h>
#include <Alepha/Testing/TableTest.h>
@ -14,7 +15,7 @@ static auto init= Alepha::Utility::enroll <=[]
"Smoke Test"_test <=[]
{
Alepha::Atomic::Mailbox< int > m( 1024 );
Alepha::Atomic::Dropbox< int > m( 1024 );
m.push( 42 );
m.push( 42 );
@ -23,6 +24,13 @@ static auto init= Alepha::Utility::enroll <=[]
assert( m.pop() == 42 );
assert( m.pop() == 42 );
Alepha::Atomic::DropboxFinishedException *de= nullptr;
Alepha::Atomic::MailboxFinishedException *me= nullptr;
//Alepha::Atomic::MailboxFinishedException2 *me2= nullptr;
static_assert( not std::is_same_v< decltype( de ), decltype( me ) > );
//me2= me;
//de= me;
try
{
m.pop();
@ -34,15 +42,17 @@ static auto init= Alepha::Utility::enroll <=[]
std::cerr << "We caught an exception." << std::endl;
const Alepha::Exception *const cond_p= &cond;
assert( dynamic_cast< const Alepha::Atomic::MailboxFinishedException * >( cond_p ) );
assert( not dynamic_cast< const Alepha::Atomic::MailboxFinishedException * >( cond_p ) );
assert( dynamic_cast< const Alepha::Atomic::DropboxFinishedException * >( cond_p ) );
assert( dynamic_cast< const Alepha::FinishedException * >( cond_p ) );
assert( dynamic_cast< const Alepha::Exception * >( cond_p ) );
assert( dynamic_cast< const Alepha::Atomic::MailboxFinishedCondition * >( cond_p ) );
assert( not dynamic_cast< const Alepha::Atomic::MailboxFinishedCondition * >( cond_p ) );
assert( dynamic_cast< const Alepha::FinishedCondition * >( cond_p ) );
assert( dynamic_cast< const Alepha::Condition * >( cond_p ) );
assert( not dynamic_cast< const Alepha::CriticalError * >( cond_p ) );
assert( not dynamic_cast< const Alepha::Atomic::AnyTaggedMailboxFinishedException * >( cond_p ) );
assert( not dynamic_cast< const Alepha::AnyTaggedFinishedException * >( cond_p ) );