mirror of
https://github.com/throwtheswitch/cexception.git
synced 2026-09-08 03:09:58 +00:00
- updated CException to just be the core two files, and the custom config include is now optional
- made the docs a bit better git-svn-id: http://cexception.svn.sourceforge.net/svnroot/cexception/trunk@8 50f63946-2846-0410-8d77-f904c773002e
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
#define _EXCEPTION_H
|
||||
|
||||
//Optionally define the exception type (something like an int which can be directly assigned)
|
||||
#define EXCEPTION_T int
|
||||
#define CEXCEPTION_T int
|
||||
|
||||
// Optionally define the reserved value representing NO EXCEPTION
|
||||
#define EXCEPTION_NONE (1234)
|
||||
#define CEXCEPTION_NONE (1234)
|
||||
|
||||
// Multi-Tasking environments will need a couple of macros defined to make this library
|
||||
// properly handle multiple exception stacks. You will need to include and required
|
||||
@@ -16,13 +16,10 @@
|
||||
// For example, Quadros might include the following implementation:
|
||||
#ifndef TEST
|
||||
#include "OSAPI.h"
|
||||
#define EXCEPTION_GET_ID (KS_GetTaskID())
|
||||
#define EXCEPTION_NUM_ID (NTASKS + 1)
|
||||
#define CEXCEPTION_GET_ID (KS_GetTaskID())
|
||||
#define CEXCEPTION_NUM_ID (NTASKS + 1)
|
||||
#endif
|
||||
|
||||
// INCLUDE THE ACTUAL CEXCEPTION LIBRARY
|
||||
#include "CException.h"
|
||||
|
||||
//This could be a good place to define/include some error ID's:
|
||||
#define ERROR_ID_EVERYTHING_IS_BROKEN (0x88)
|
||||
#define ERROR_ID_ONLY_THIS_IS_BROKEN (0x77)
|
||||
+14
-14
@@ -1,5 +1,5 @@
|
||||
#include "unity.h"
|
||||
#include "Exception.h"
|
||||
#include "CException.h"
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
@@ -12,7 +12,7 @@ void tearDown(void)
|
||||
void test_BasicTryDoesNothingIfNoThrow(void)
|
||||
{
|
||||
int i;
|
||||
EXCEPTION_T e = 0x5a5a;
|
||||
CEXCEPTION_T e = 0x5a5a;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -29,7 +29,7 @@ void test_BasicTryDoesNothingIfNoThrow(void)
|
||||
|
||||
void test_BasicThrowAndCatch(void)
|
||||
{
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -48,7 +48,7 @@ void test_BasicThrowAndCatch(void)
|
||||
|
||||
void test_BasicThrowAndCatch_WithMiniSyntax(void)
|
||||
{
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
//Mini Throw and Catch
|
||||
Try
|
||||
@@ -69,7 +69,7 @@ void test_BasicThrowAndCatch_WithMiniSyntax(void)
|
||||
void test_VerifyVolatilesSurviveThrowAndCatch(void)
|
||||
{
|
||||
volatile unsigned int VolVal = 0;
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -98,7 +98,7 @@ void HappyExceptionThrower(unsigned int ID)
|
||||
void test_ThrowFromASubFunctionAndCatchInRootFunc(void)
|
||||
{
|
||||
volatile unsigned int ID = 0;
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -117,7 +117,7 @@ void test_ThrowFromASubFunctionAndCatchInRootFunc(void)
|
||||
|
||||
void HappyExceptionRethrower(unsigned int ID)
|
||||
{
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -139,7 +139,7 @@ void HappyExceptionRethrower(unsigned int ID)
|
||||
void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void)
|
||||
{
|
||||
volatile unsigned int ID = 0;
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -157,7 +157,7 @@ void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void)
|
||||
|
||||
void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void)
|
||||
{
|
||||
EXCEPTION_T e = 3;
|
||||
CEXCEPTION_T e = 3;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -174,7 +174,7 @@ void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void)
|
||||
|
||||
void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void)
|
||||
{
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -192,7 +192,7 @@ void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptE
|
||||
|
||||
void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void)
|
||||
{
|
||||
EXCEPTION_T e1, e2;
|
||||
CEXCEPTION_T e1, e2;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -219,7 +219,7 @@ void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionI
|
||||
|
||||
void test_CanHaveMultipleTryBlocksInASingleFunction(void)
|
||||
{
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -245,7 +245,7 @@ void test_CanHaveMultipleTryBlocksInASingleFunction(void)
|
||||
void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void)
|
||||
{
|
||||
int i = 0;
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
@@ -269,7 +269,7 @@ void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void)
|
||||
void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void)
|
||||
{
|
||||
int i = 0;
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
|
||||
Try
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* AUTOGENERATED FILE. DO NOT EDIT. */
|
||||
#include "unity.h"
|
||||
#include "Exception.h"
|
||||
#include "CException.h"
|
||||
|
||||
extern void setUp(void);
|
||||
extern void tearDown(void);
|
||||
@@ -20,7 +20,7 @@ extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExc
|
||||
|
||||
static void runTest(UnityTestFunction test)
|
||||
{
|
||||
EXCEPTION_T e;
|
||||
CEXCEPTION_T e;
|
||||
if (TEST_PROTECT())
|
||||
{
|
||||
setUp();
|
||||
|
||||
Reference in New Issue
Block a user