tests/test_list.c \
tests/test_exn.c \
tests/test_str.c \
- tests/test_mem.c \
tests/test_set.c \
tests/test_vec.c \
tests/test_rbt.c \
#include "exn.h"
#include <stdio.h>
-#ifdef TESTING
-extern void test_exit(int);
-#define exit(status) test_exit(status)
-#endif
-
typedef struct exn_stack_t {
struct exn_stack_t* p_next;
exn_handler_t handler;
#endif
#if (LEAK_DETECT_LEVEL > 0)
-#ifndef TESTING
-static
-#endif
void summarize_leaks(void) {
if(Num_Allocations > 0) {
puts("Warning: Memory leak(s) detected!");
if(node->right) mem_release(node->right);
}
-#ifndef TESTING
-static
-#endif
rbt_node_t* rbt_node_new(void* contents){
rbt_node_t* node = mem_allocate(sizeof(rbt_node_t), &rbt_node_free);
node->left = NULL;
/* ---------------------------------------- */
/* informational / querying functions */
/* ---------------------------------------- */
-#ifndef TESTING
-static
-#endif
rbt_color_t rbt_node_color(rbt_node_t* node){
//leaves are NULL and black implicitly
return (node ? node->color : BLACK);
RUN_TEST_SUITE(String);
RUN_TEST_SUITE(RBT);
RUN_TEST_SUITE(Exn);
- RUN_TEST_SUITE(Mem);
RUN_TEST_SUITE(Set);
RUN_TEST_SUITE(Map);
return PRINT_TEST_RESULTS();
} exn_test_state_t;
static int Exit_Status = 0;
-void test_exit(int status) {
+void exit(int status) {
Exit_Status = status;
if (NULL != exn_handler())
exn_handler()->state = EXN_DONE;
+++ /dev/null
-// Unit Test Framework Includes
-#include "test.h"
-
-// File To Test
-#include "mem.h"
-
-static void test_setup(void) { }
-
-//-----------------------------------------------------------------------------
-// Begin Unit Tests
-//-----------------------------------------------------------------------------
-TEST_SUITE(Mem) {
- TEST(Verify_mem_can_summarize_leaks)
- {
- void* p_obj = mem_allocate(sizeof(4),NULL);
- extern void summarize_leaks(void);
- summarize_leaks();
- mem_release( p_obj );
- }
-}