From c4c34c1bfe568b653399cb5349ce54b5ee1c519b Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 25 May 2019 15:47:58 -0700 Subject: Augmented UnitSuite, added more to Blob, and added tests. --- src/stable/exceptionindexoutofbounds.cpp | 14 ++++++++++++++ src/stable/exceptionindexoutofbounds.h | 18 ++++++++++++++++++ src/stable/unitsuite.h | 10 ++++++++++ 3 files changed, 42 insertions(+) create mode 100644 src/stable/exceptionindexoutofbounds.cpp create mode 100644 src/stable/exceptionindexoutofbounds.h (limited to 'src/stable') diff --git a/src/stable/exceptionindexoutofbounds.cpp b/src/stable/exceptionindexoutofbounds.cpp new file mode 100644 index 0000000..eb6d589 --- /dev/null +++ b/src/stable/exceptionindexoutofbounds.cpp @@ -0,0 +1,14 @@ +/* + * Copyright (C) 2007-2019 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#include "exceptionindexoutofbounds.h" + +namespace Bu +{ + subExceptionDef( ExceptionIndexOutOfBounds ); +} + diff --git a/src/stable/exceptionindexoutofbounds.h b/src/stable/exceptionindexoutofbounds.h new file mode 100644 index 0000000..fbb2a04 --- /dev/null +++ b/src/stable/exceptionindexoutofbounds.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2007-2019 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#ifndef BU_EXCEPTION_INDEX_OUT_OF_BOUNDS_H +#define BU_EXCEPTION_INDEX_OUT_OF_BOUNDS_H + +#include "bu/exceptionbase.h" + +namespace Bu +{ + subExceptionDecl( ExceptionIndexOutOfBounds ); +} + +#endif diff --git a/src/stable/unitsuite.h b/src/stable/unitsuite.h index 85060c0..5f84058 100644 --- a/src/stable/unitsuite.h +++ b/src/stable/unitsuite.h @@ -138,6 +138,16 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Bu::UnitSuite::Expect &e ); { \ throw Bu::UnitSuite::Failed( #tst, __FILE__, __LINE__ ); \ } else (void)0 + +#define unitTestCatch( tst, exception ) try \ +{ \ + tst; \ + throw Bu::UnitSuite::Failed( #tst, __FILE__, __LINE__ ); \ +} catch( exception & ) { } \ +catch(...) { \ + throw Bu::UnitSuite::Failed( #tst, __FILE__, __LINE__ ); \ +} (void)0 + #define unitFailed( msg ) throw Bu::UnitSuite::Failed(msg, __FILE__, __LINE__) #endif -- cgit v1.2.3