Browse Source

Remove legacy test dir

git-svn-id: https://klish.googlecode.com/svn/trunk@587 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 12 years ago
parent
commit
047d9f4146
9 changed files with 16 additions and 1564 deletions
  1. 0 4
      Makefile.am
  2. 15 110
      Makefile.in
  3. 1 1
      contrib/buildroot/package/klish/klish.mk
  4. 0 438
      test/bintree.c
  5. 0 33
      test/bintree.h
  6. 0 704
      test/heap.c
  7. 0 176
      test/mallocTest.c
  8. 0 48
      test/module.am
  9. 0 50
      test/string.c

+ 0 - 4
Makefile.am

@@ -23,8 +23,6 @@ EXTRA_DIST              =  \
     lub/module.am          \
     tinyrl/module.am       \
     tinyxml/module.am      \
-    test/module.am         \
-    xml-examples/module.am \
     konf/module.am         \
     doxygen.config         \
     clish.xsd              \
@@ -38,6 +36,4 @@ include $(top_srcdir)/clish/module.am
 include $(top_srcdir)/lub/module.am
 include $(top_srcdir)/tinyrl/module.am
 include $(top_srcdir)/tinyxml/module.am
-include $(top_srcdir)/test/module.am
-include $(top_srcdir)/xml-examples/module.am
 include $(top_srcdir)/konf/module.am

File diff suppressed because it is too large
+ 15 - 110
Makefile.in


+ 1 - 1
contrib/buildroot/package/klish/klish.mk

@@ -9,7 +9,7 @@ KLISH_VERSION:=HEAD
 KLISH_SITE:=http://klish.googlecode.com/svn/trunk
 KLISH_SITE_METHOD:=svn
 else
-KLISH_VERSION = 1.5.3
+KLISH_VERSION = 1.5.4
 KLISH_SOURCE = klish-$(KLISH_VERSION).tar.bz2
 KLISH_SITE = http://klish.googlecode.com/files
 endif

+ 0 - 438
test/bintree.c

@@ -1,438 +0,0 @@
-#include <string.h>
-#include <stdio.h>
-#include "bintree.h"
-
-#include "lub/blockpool.h"
-#include "lub/test.h"
-/**
- \example test/bintree.c
- */
-
-/*************************************************************
- * TEST CODE
- ************************************************************* */
-/* create a pool of nodes */
-static test_node_t nodes[NUM_TEST_NODES];
-static lub_blockpool_t testpool;
-
-static test_node_t duplicate;
-
-static int testseq;
-
-/*--------------------------------------------------------------- */
-/*
- #define DUMP
- */
-
-static void
-dump_node(lub_bintree_t      *this,
-          lub_bintree_node_t *node)
-{
-        test_node_t *clientnode = (void *)(((char*)node) - this->node_offset);
-        test_node_t *leftnode   = (void *)(((char*)node->left) - this->node_offset);
-        test_node_t *rightnode  = (void *)(((char*)node->right) - this->node_offset);
-        
-        if(NULL != node)
-        {
-                printf(" %d<--%d-->%d",
-                       leftnode ? leftnode->value : -1,
-                       clientnode->value,
-                       rightnode ? rightnode->value : -1);
-                
-                if(node->left)
-                        dump_node(this,node->left);
-                
-                if(node->right)
-                        dump_node(this,node->right);
-        }
-}
-
-extern void dump_tree(lub_bintree_t *tree);
-void
-dump_tree(lub_bintree_t *tree)
-{
-        printf("\nTREE(0x%p):",(void*)tree);
-        dump_node(tree,tree->root);
-        printf("\n");
-}
-#ifndef DUMP
-#define dump_tree(tree)
-#endif /* not DUMP */
-
-/*
- * Returns a pseudo random number based on the input.
- * This will given 2^15 concequtive numbers generate the entire
- * number space in a psedo random manner.
- */
-static int
-random(int i)
-{
-        /* multiply the first prime after 2^14 and mask to 15 bits */
-        return (16411*i) & (32767);
-}
-
-/* This operation is invokes to initialise a new instance of a test node
- *
- * seed - the seed to use for the random details within the instance
- */
-static void
-constructor(test_node_t *this,
-            int          seed)
-{
-        this->value      = seed;
-        this->address[0] = 0x08;
-        this->address[1] = 0x00;
-        this->address[2] = 0x4e;
-        this->address[3] = 0x00;
-        this->address[4] = ((this->value     ) & 0xFF);
-        this->address[5] = ((this->value >> 8) & 0xFF);
-
-        /* initialise the control blocks */
-        lub_bintree_node_init(&this->bt_node1);
-        lub_bintree_node_init(&this->bt_node2);
-}
-/* This operation creates and initialised a new instance of a test node
- *
- * seed - the seed to use for the random details within the instance
- */
-static test_node_t *
-new(int seed)
-{
-        test_node_t *node = lub_blockpool_alloc(&testpool);
-
-        if(NULL != node)
-        {
-                /* call the constructor */
-                constructor(node,seed);
-        }
-        return node;
-}
-
-/* forward declare these functions */
-static lub_bintree_compare_fn test_value_compare;
-static lub_bintree_getkey_fn  test_value_getkey;
-static lub_bintree_compare_fn test_address_compare;
-static lub_bintree_getkey_fn  test_address_getkey;
-
-/*
- * This defines the attributes associated with a tree
- */
-typedef struct
-{
-        lub_bintree_t           tree;
-        lub_bintree_compare_fn *compare;
-        lub_bintree_getkey_fn  *getkey;
-        size_t                   offset;
-        lub_bintree_key_t       nonexistant;
-} mapping_t;
-
-
-typedef struct
-{
-        unsigned char address[6];
-} address_key_t;
-
-typedef struct
-{
-        int value;
-} value_key_t;
-
-
-/* This is the main entry point for this executable
- */
-int main(int argc, const char *argv[])
-{
-        unsigned int i,t;
- 	int          status;
- 	
-        /*
-         * TREE ATTRBUTES
-         */
-        address_key_t address_key = {{0xff,0xff,0xff,0xff,0xff,0xff}};
-        value_key_t   value_key   = {-1};
-
-        mapping_t     mapping[2];
-
-	lub_test_parse_command_line(argc,argv);
-	lub_test_begin("lub_bintree");
-
-        /*
-         * define the attributes for each tree
-         */
-        /* integer based search */
-        mapping[0].compare     = test_value_compare;
-        mapping[0].getkey      = test_value_getkey;
-        mapping[0].offset      = offsetof(test_node_t,bt_node1);
-        memcpy(&mapping[0].nonexistant,&value_key,sizeof(value_key));
-        
-        /* MAC address based search */
-        mapping[1].compare     = test_address_compare;
-        mapping[1].getkey      = test_address_getkey;
-        mapping[1].offset      = offsetof(test_node_t,bt_node2);
-        memcpy(&mapping[1].nonexistant,&address_key,sizeof(address_key));
-
-        /*
-         * create a duplicate node... (will get the same details as
-         * the first one from the pool)
-         */
-        constructor(&duplicate,0);
-        
-        /*
-         * create a blockpool to manage node allocation/deallocation
-         */
-        lub_blockpool_init(&testpool,
-                            nodes,
-                            sizeof(test_node_t),
-                            NUM_TEST_NODES);
-        /*
-         * test each tree
-         */ 
-        for(t = 0; t < 2; t++)
-        {
-                lub_bintree_t *tree = &mapping[t].tree;
-		
-                /* create the tree */
-		lub_test_seq_begin(++testseq,"tree(%d)",t);
-                lub_bintree_init(tree,
-                                  mapping[t].offset,
-                                  mapping[t].compare,
-                                  mapping[t].getkey);
-
-
- 		/*------------------------------------------------------------ */
-                lub_test_check(NULL == lub_bintree_findfirst(tree),
-                              "Check findfirst returns NULL on empty tree");
-		lub_test_check(NULL == lub_bintree_findlast(tree),
-		              "Check findlast returns NULL on an empty tree");
- 		/*------------------------------------------------------------ */
-   		status = LUB_TEST_PASS;
-                for(i=0; i < NUM_TEST_NODES;i++)
-                {
-                        test_node_t *node;
-                        if(0 == t)
-                        {
-                                /* create a test node */
-                                node = new(i);
-				if(NULL == node)
-				{
-					status = LUB_TEST_FAIL;
-					break;
-                        	}
-                        }
-                        else
-                        {
-                                value_key_t key;
-                                key.value = i;
-                                /*
-                                 * find the necessary node using the
-                                 * first tree (fiddling with one tree
-                                 * before inserting into another
-                                 */
-                                node = lub_bintree_find(&mapping[0].tree,
-                                                         &key);
-                        }
-                        /* insert it into the tree */
-                        if(0 != lub_bintree_insert(tree,node))
-                        {
-                        	status = LUB_TEST_FAIL;
-                        	break;
-                        }
-                }
-		lub_test_check(LUB_TEST_PASS == status,
-		              "Inserting %d nodes",
-		              NUM_TEST_NODES);
- 		/*------------------------------------------------------------ */
-		lub_test_check_int(-1,lub_bintree_insert(tree,&duplicate),
-		                  "Inserting duplicate should fail");
- 		/*------------------------------------------------------------ */
-		lub_bintree_remove(tree,&duplicate);
-		lub_test_seq_log(LUB_TEST_NORMAL,"Remove original node");
- 		/*------------------------------------------------------------ */
-		lub_test_check_int(0,lub_bintree_insert(tree,&duplicate),
-		                  "Reinsert original node");
- 		/*------------------------------------------------------------ */
-		status = LUB_TEST_PASS;
-                for(i=0; i < NUM_TEST_NODES;i++)
-                {
-                        test_node_t *node;
-                        /*
-                         * find each test node in the tree
-                         */
-                        if (t == 0) 
-                        {
-                                /*
-                                 * search by integer
-                                 */
-                                value_key_t key;
-                                key.value = random(i);
-                                
-                                node = lub_bintree_find(tree,&key);
-				if(node->value != key.value)
-				{
-					status = LUB_TEST_FAIL;
-					break;
-				}
-                        }
-                        else
-                        {
-                                /*
-                                 * search by address
-                                 */
-                                address_key_t key;
-                                int rand = random(i);
-                                key.address[0] = 0x08;
-                                key.address[1] = 0x00;
-                                key.address[2] = 0x4e;
-                                key.address[3] = 0x00;
-                                key.address[4] = ((rand     ) & 0xFF);
-                                key.address[5] = ((rand >> 8) & 0xFF);
-                                
-                                node = lub_bintree_find(tree,&key);
-                                if(memcmp(key.address, node->address,6) != 0)
-                                {
-                                	status = LUB_TEST_FAIL;
-                                	break;
-                                }
-                        }
-                }
-		lub_test_check(LUB_TEST_PASS == status,
-		              "Check lub_bintree_find() can find every node");
- 		/*------------------------------------------------------------ */
-                /*
-                 * iterate through the tree forwards
-                 */
-                {
-                        lub_bintree_iterator_t iter;
-                        test_node_t *node = lub_bintree_findfirst(tree);
-			int j = 0;
-
-                	status = LUB_TEST_PASS;
-                        for(lub_bintree_iterator_init(&iter,tree,node);
-                            node;
-                            node = lub_bintree_iterator_next(&iter),j++)
-                        {
-                        	if(t == 0)
-                        	{
-                        		/* check that the insertion works in the right order */
-                        		if(node->value != j)
-                        		{
-                        			status = LUB_TEST_FAIL;
-                        			break;
-                        		}
-                        	}
-                        }
-			lub_test_check(LUB_TEST_PASS == status,
-				      "Iterate forwards checking order",t);
-                }
- 		/*------------------------------------------------------------ */
-                /*
-                 * iterate through the tree backwards
-                 */
-                {
-                        lub_bintree_iterator_t iter;
-                        test_node_t *node = lub_bintree_findlast(tree);
-			int j = NUM_TEST_NODES - 1;            
-                
-                	status = LUB_TEST_PASS;
-                        for(lub_bintree_iterator_init(&iter,tree,node);
-                            node;
-                            node = lub_bintree_iterator_previous(&iter),j--)
-                        {
-                        	if(t == 0)
-                        	{
-                        		/* check that the insertion works in the right order */
-                        		if(node->value != j)
-                        		{
-                        			status = LUB_TEST_FAIL;
-                        			break;
-                        		}
-                        	}
-                        }
-                }
-		lub_test_check(LUB_TEST_PASS == status,
-		              "Iterate backwards checking order",t);
- 		/*------------------------------------------------------------ */
-                lub_test_check(NULL == lub_bintree_find(tree,&mapping[t].nonexistant),
-                              "Check search for non-existant node fails");
- 		/*------------------------------------------------------------ */
-		lub_test_seq_end();
-        }
-
-        for(t=0;t <2; t++)
-        {
-                lub_bintree_t *tree = &mapping[t].tree;
-                test_node_t    *node;
-                void           *(*find_op)(lub_bintree_t *) = lub_bintree_findfirst;
-                
- 		/*------------------------------------------------------------ */
-                lub_test_seq_begin(++testseq,"tree(%d)",t);
-                /*
-                 * iterate through the tree removing the nodes
-                 */
-		i = 0;
-                while( (node = find_op(tree)) )
-                {
-                        /* remove from the tree */
-                        lub_bintree_remove(tree,node);
-                        if (t == 1)
-                        {
-                                /* add back to the pool */
-                                lub_blockpool_free(&testpool,node);
-                        }
-			i++;
-
-			if(find_op == lub_bintree_findfirst)
-			{
-				find_op = lub_bintree_findlast;
-			}
-			else
-			{
-				find_op = lub_bintree_findfirst;
-			}
-                }
-	        lub_test_check_int(i,NUM_TEST_NODES,"Check removed all nodes");
-		lub_test_seq_end();
- 		/*------------------------------------------------------------ */
-        }
-        
-        /* tidy up */
-        status = lub_test_get_status();
-        lub_test_end();
-        
-        return status;
-}
-
-static int
-test_value_compare(const void *clientnode,
-                   const void *clientkey)
-{
-        const test_node_t *node = clientnode;
-        const value_key_t *key  = clientkey;
-        return node->value - key->value;
-}
-
-static void
-test_value_getkey(const void         *clientnode,
-                  lub_bintree_key_t *key)
-{
-        const test_node_t *node = clientnode;
-        /* fill out the opaque key */
-        memcpy(key,&node->value,sizeof(int));
-}
-static int
-test_address_compare(const void *clientnode,
-                     const void *clientkey)
-{
-        const test_node_t   *node = clientnode;
-        return memcmp(node->address,clientkey,6);
-}
-
-static void
-test_address_getkey(const void         *clientnode,
-                    lub_bintree_key_t *key)
-{
-        const test_node_t *node = clientnode;
-        /* fill out the opaque key */
-        memcpy(key,node->address,6);
-}
-

+ 0 - 33
test/bintree.h

@@ -1,33 +0,0 @@
-/*********************** -*- Mode: C -*- ***********************
- * Architecture    : 
- * SubSystem       : 
- * Component       : 
- * File            : bintree.h
- * Documents       : 
- * Components used : 
- *---------------------------------------------------------------
- * Description
- * ===========
- * This header defines a test node structure
- *---------------------------------------------------------------
- * Author          : Graeme McKerrell
- * Created On      : Wed Jan 28 13:14:36 2004
- * Status          : UNTESTED
- *---------------------------------------------------------------
- * HISTORY
- * 7-May-2004		Graeme McKerrell	
- *    updated to use "lub_test_" namespace
- *---------------------------------------------------------------
- * Copyright (c) 3Com Corporation. All Rights Reserved
- **************************************************************** */
-#include "lub/bintree.h"
-typedef struct
-{
-    lub_bintree_node_t bt_node1;
-    lub_bintree_node_t bt_node2;
-    int                value;
-    unsigned char      address[6];
-    short              idx; /* used by legacy implementation */
-} test_node_t;
-
-#define NUM_TEST_NODES 32768

+ 0 - 704
test/heap.c

@@ -1,704 +0,0 @@
-/**
-\example test/heap.c
- */
-#include <string.h>
-#include <stdio.h>
-#include "lub/heap.h"
-
-#include "lub/test.h"
-
-/*************************************************************
- * TEST CODE
- ************************************************************* */
-int testseq = 0;
-
-/* 
- * This is the main entry point for this executable
- */
-#define SIZEOF_HEAP_T        (140)
-#define SIZEOF_ALLOC_BLOCK_T (  8)
-#define SIZEOF_NODE_T        ( 20)
-#define SIZEOF_CONTEXT_T     (104)
- 
-#define RAW_SIZE (SIZEOF_HEAP_T + 132)
-
-/* allow space to assign a leak detection context */
-#define ACTUAL_SIZE (RAW_SIZE)
-
-char segment1[ACTUAL_SIZE];
-char segment2[ACTUAL_SIZE*4];
-
-#define LARGE_SIZE 1024 * 400
-char large_seg[LARGE_SIZE];
-
-#define MIN_ALLOC 12
-
-typedef struct test_node_s test_node_t;
-struct test_node_s
-{
-    test_node_t *next;
-};
-
-static test_node_t *first_node;
-/*--------------------------------------------------------- */
-/*
- * Returns a pseudo random number based on the input.
- * This will given 2^15 concequtive numbers generate the entire
- * number space in a psedo random manner.
- */
-static int
-random(int i)
-{
-        /* multiply the first prime after 2^14 and mask to 15 bits */
-        return (16411*i) & (32767);
-}
-/*--------------------------------------------------------- */
-static void
-create_nodes(lub_heap_t *heap,
-             int         count)
-{
-    test_node_t *node;
-    int          i;
-    
-    lub_test_seq_log(LUB_TEST_NORMAL,"Create % random sized blocks",count);
-    first_node = NULL;
-    for(i = 0; i < count; i++)
-    {
-        union
-        {
-            test_node_t **node_ptr;
-            char        **char_ptr;
-        } tmp;
-        /* pick a random size upto 400 bytes */
-        size_t size = 1 + 400 * random(i) / 32768;
-        node = NULL;
-        tmp.node_ptr = &node;
-        lub_heap_realloc(heap,tmp.char_ptr,size,LUB_HEAP_ALIGN_NATIVE);
-        
-        if(NULL != node)
-        {
-            /* put this into the linked list for later */
-            node->next = first_node;
-            first_node = node;
-        }
-        else
-        {
-            lub_test_seq_log(LUB_TEST_NORMAL,"ONLY MANAGED TO CREATE %d BLOCKS",i);
-            break;
-        }
-    }
-    lub_test_seq_log(LUB_TEST_NORMAL,"Dump the details...");
-    lub_heap_show(heap,BOOL_TRUE);
-}
-/*--------------------------------------------------------- */
-static void
-test_performance(void)
-{
-    lub_heap_t  *heap;
-    
-    lub_test_seq_begin(++testseq,"Check the performance...");
-    heap = lub_heap_create(large_seg,sizeof(large_seg));
-    lub_test_check(NULL != heap,"Check creation of 400KB heap");
-    
-    create_nodes(heap,1000);
-    
-    lub_test_seq_log(LUB_TEST_NORMAL,"Now free every other node...");
-    {
-        test_node_t **ptr;
-        int         i   = 0;
-        for(ptr = &first_node;
-            *ptr;
-            i++,ptr = &(*ptr)->next)
-        {
-            if(i % 2)
-            {
-                char *tmp = (char*)*ptr;
-                /* remove from the linked list */
-                *ptr = (*ptr)->next;
-                
-                /* and free the node */
-                lub_heap_realloc(heap,&tmp,0,LUB_HEAP_ALIGN_NATIVE);
-            }
-        }
-    }
-    lub_test_seq_log(LUB_TEST_NORMAL,"Dump the details...");
-    lub_heap_show(heap,BOOL_TRUE);
-
-    create_nodes(heap,500);
-    
-    lub_heap_destroy(heap);
-    lub_test_seq_end();
-}
-/*--------------------------------------------------------- */
-static void
-test_stats_check(lub_heap_t *this)
-{
-    lub_heap_stats_t stats;
-    unsigned total_memory,used_memory;
-    
-    lub_heap__get_stats(this,&stats);
-    total_memory = stats.segs_bytes 
-                   - stats.static_bytes;
-    used_memory  = stats.free_bytes 
-                   + stats.free_overhead 
-                   + stats.alloc_bytes 
-                   + stats.alloc_overhead;
-    
-    lub_test_check_int(total_memory,used_memory,
-                       "Check that the (segs_bytes - static_bytes) equals the free and allocated bytes + overheads");
-    if(total_memory != used_memory)
-    {
-        lub_heap_show(this,BOOL_TRUE);
-    }
-}
-/*--------------------------------------------------------- */
-static void
-test_taint_check(char *ptr,size_t size)
-{
-    bool_t tainted = BOOL_TRUE;
-    if(ptr && (LUB_HEAP_ZERO_ALLOC != ptr))
-    {
-        while(size--)
-        {
-            if((unsigned char)*ptr != 0xaa)
-            {
-                tainted = BOOL_FALSE;
-                break;
-            }
-        }
-    }
-    lub_test_check(tainted,"Check memory has been tainted");
-}
-/*--------------------------------------------------------- */
-void
-test_main(unsigned frame_count)
-{
-    lub_heap_t  *heap;
-    char        *tmp;
-    char        *ptr1 = NULL;
-    char        *ptr2 = NULL;
-    char        *ptr3 = NULL;
-    lub_heap_status_t result;
-    lub_heap_stats_t  stats;
-    size_t       actual_size = RAW_SIZE;
-    
-    if(frame_count)
-    {
-        actual_size = ACTUAL_SIZE;
-    }
-    
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_create(segment1,%d)",actual_size);
-    
-    heap = lub_heap_create(segment1,actual_size);
-    lub_test_check(NULL != heap,"Check heap created correctly");
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    test_stats_check(heap);
-
-    lub_test_seq_log(LUB_TEST_NORMAL,"Configured to collect %d frames for leak detection",frame_count);
-    lub_heap__set_framecount(frame_count);
-
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-    
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    
-    lub_test_seq_begin(++testseq,"lub_heap_add_segment(segment2,%d)",actual_size*2);
-    
-    lub_heap_add_segment(heap,segment2,actual_size*2);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.free_blocks,"Check the two adjacent segments get merged");
-    
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_static_alloc(heap,10)");
-    
-    tmp = lub_heap_static_alloc(heap,10);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(NULL != tmp,"Check static allocation works");
-    test_taint_check(tmp,12);
-    test_stats_check(heap);
-
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.static_blocks,"Check the number of static blocks");
-    lub_test_check_int(12,stats.static_bytes,"Check static_bytes has gone up");
-    if (tmp) 
-        memset(tmp,0x11,10);
-    
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,10,LUB_HEAP_ALIGN_NATIVE)");
-    
-    result = lub_heap_realloc(heap,&ptr1,10,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check dynamic allocation says it works");
-    lub_test_check(NULL != ptr1,"Check dynamic allocation actually works");
-    test_taint_check(ptr1,10);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(MIN_ALLOC,stats.alloc_bytes,"Check alloc bytes has gone up");
-    if(ptr1)
-        memset(ptr1,0x22,10);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_static_alloc(heap,10)");
-
-    tmp = lub_heap_static_alloc(heap,10);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(NULL != tmp,"Check static allocation works");
-    test_taint_check(tmp,10);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.static_blocks,"Check the number of static blocks");
-    lub_test_check_int(2*MIN_ALLOC,stats.static_bytes,"Check static bytes has gone up");
-    if(tmp)
-        memset(tmp,0x33,10);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_static_alloc(heap,200)");
-    
-    tmp = lub_heap_static_alloc(heap,200);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(NULL != tmp,"Check static allocation from second segment works");
-    test_taint_check(tmp,200);
-    test_stats_check(heap);
-
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(3,stats.static_blocks,"Check the number of static blocks");
-    lub_test_check_int(200+2*MIN_ALLOC,stats.static_bytes,"Check static_bytes has gone up");
-    if(tmp)
-        memset(tmp,0x99,200);
-    
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,30,LUB_HEAP_ALIGN_NATIVE)");
-
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,30,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check growing an allocation works");
-    lub_test_check(ptr1 == tmp,"Check growing an allocation keeps the same pointer");
-    test_taint_check(ptr1+10,20);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(20 + MIN_ALLOC,stats.alloc_bytes,"Check alloc bytes has gone up");
-    if(ptr1)
-        memset(ptr1,0x44,30);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,30,LUB_HEAP_ALIGN_NATIVE)");
-
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,30,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check asking for the same size works");
-    lub_test_check(ptr1 == tmp,"Check it keeps the same pointer");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(20+MIN_ALLOC,stats.alloc_bytes,"Check alloc bytes");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,4,LUB_HEAP_ALIGN_NATIVE)");
-
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,4,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check shrinking an allocation works");
-    lub_test_check(ptr1 == tmp,"Check shrinking an allocation retains pointer");
-    test_taint_check(ptr1+4,MIN_ALLOC-4);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    if(ptr1)
-        memset(ptr1,0x55,4);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,100,LUB_HEAP_ALIGN_NATIVE)");
-
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,104,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check growing and moving works");
-    lub_test_check(ptr1 != tmp,"Check growing and moving changes the pointer");
-    test_taint_check(ptr1+4,100);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    if(ptr1)
-        memset(ptr1,0x55,100);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check releasing an allocation says it works");
-    lub_test_check(LUB_HEAP_ZERO_ALLOC == ptr1,"Check releasing an allocation actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(0,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check(BOOL_TRUE == lub_heap_check_memory(heap),"Check integrity of heap");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,20,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now test with multiple dynamic blocks to exercise different recovery mechanisms */
-    result = lub_heap_realloc(heap,&ptr1,20,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check dynamic allocation (1) says it works");
-    lub_test_check(NULL != ptr1,"Check dynamic allocation (1) actually works");
-    test_taint_check(ptr1,20);
-    test_stats_check(heap);
-    
-    if(ptr1)
-        memset(ptr1,0x66,20);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,20,LUB_HEAP_ALIGN_NATIVE)");
-
-    result = lub_heap_realloc(heap,&ptr2,30,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check dynamic allocation (2) says it works");
-    lub_test_check(NULL != ptr2,"Check dynamic allocation (2) actually works");
-    test_taint_check(ptr2,32);
-    test_stats_check(heap);
-    
-    if(ptr2)
-        memset(ptr2,0x77,20);
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr3,1,LUB_HEAP_ALIGN_NATIVE)");
-
-    result = lub_heap_realloc(heap,&ptr3,1,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check dynamic allocation (3) says it works");
-    lub_test_check(NULL != ptr3,"Check dynamic allocation (3) actually works");
-    test_taint_check(ptr3,8);
-    test_stats_check(heap);
-    
-    if(ptr3)
-        memset(ptr3,0x88,1);
-
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(3,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(3,stats.static_blocks,"Check the number static blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-    lub_test_check_int(60,stats.alloc_bytes,"Check alloc bytes has gone up");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,8,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* shrink the second block to create a new free block */
-    tmp = ptr2;
-    result = lub_heap_realloc(heap,&ptr2,8,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check shrinking (2) says it works");
-    lub_test_check(tmp == ptr2,"Check shrinking (2) maintains the pointer");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(3,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* release the second block to cause fragmentation */
-    tmp = ptr2;
-    result = lub_heap_realloc(heap,&ptr2,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check releasing an allocation (2) says it works");
-    lub_test_check(LUB_HEAP_ZERO_ALLOC == ptr2,"Check releasing an allocation (2) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* deliberatly double free the memory */
-    ptr2 = tmp;
-    result = lub_heap_realloc(heap,&ptr2,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_DOUBLE_FREE == result,"Check double free is spotted");
-    lub_test_check(tmp == ptr2,"Check pointer hasn't changed.");
-    test_stats_check(heap);
-    ptr2 = NULL;
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,24,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* extend the lower block */
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,24,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check growing allocation (1) says it works");
-    lub_test_check(NULL != ptr1,"Check growing allocation (1) actually works");
-    lub_test_check(tmp == ptr1,"Check growing allocation (1) didn't move block");
-    test_taint_check(ptr1+20,4);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,48,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* extend the lower block to absorb the free block */
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,48,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check growing allocation (1) says it works");
-    lub_test_check(NULL != ptr1,"Check growing allocation (1) actually works");
-    lub_test_check(tmp == ptr1,"Check growing allocation (1) didn't move block");
-    test_taint_check(ptr1+20,16);
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* release the lower block */
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check releasing (1) says it works");
-    lub_test_check(LUB_HEAP_ZERO_ALLOC == ptr1,"Check releasing memory (1) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr3,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* release the upper block */
-    tmp = ptr3;
-    result = lub_heap_realloc(heap,&ptr3,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check releasing (3) says it works");
-    lub_test_check(LUB_HEAP_ZERO_ALLOC == ptr3,"Check releasing memory (3) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(0,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,12,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now test extending blocks downwards */
-    result = lub_heap_realloc(heap,&ptr1,12,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check allocation (1) says it works");
-    lub_test_check(NULL != ptr1,"Check allocation memory (1) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(1,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,12,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now test extending blocks downwards */
-    result = lub_heap_realloc(heap,&ptr2,12,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check allocation (2) says it works");
-    lub_test_check(NULL != ptr2,"Check allocation memory (2) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr3,12,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now test extending blocks downwards */
-    result = lub_heap_realloc(heap,&ptr3,12,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check allocation (1) says it works");
-    lub_test_check(NULL != ptr3,"Check allocation memory (1) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(3,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr1,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* release the lower block */
-    tmp = ptr1;
-    result = lub_heap_realloc(heap,&ptr1,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check releasing (1) says it works");
-    lub_test_check(LUB_HEAP_ZERO_ALLOC == ptr1,"Check releasing memory (1) actually works");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,16,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now extend the middle block (downwards) */
-    tmp = ptr2;
-    result = lub_heap_realloc(heap,&ptr2,16,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check extending downwards (2) says it works");
-    lub_test_check(tmp != ptr2,"Check extending downwards (2) changes pointer");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,20,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now extend the middle block (downwards) */
-    tmp = ptr2;
-    result = lub_heap_realloc(heap,&ptr2,20,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check extending downwards (2) says it works");
-    lub_test_check(tmp != ptr2,"Check extending downwards (2) changes pointer");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(2,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,0,LUB_HEAP_ALIGN_NATIVE)");
-
-    /* now set the pointer to NULL */
-    ptr2 = NULL;
-    result = lub_heap_realloc(heap,&ptr2,0,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_OK == result,"Check that releasing NULL and allocating nothing says it works");
-    lub_test_check(LUB_HEAP_ZERO_ALLOC == ptr2,"Check pointer is LUB_HEAP_ALLOC_ZERO");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_realloc(heap,&ptr2,-1,LUB_HEAP_ALIGN_NATIVE)");
-
-    result = lub_heap_realloc(heap,&ptr2,-1,LUB_HEAP_ALIGN_NATIVE);
-    lub_test_check(lub_heap_check_memory(heap),"Check integrity of heap");
-    lub_test_check(LUB_HEAP_FAILED == result,"Check that allocating large size near 2^32 fails");
-    lub_test_check(NULL == ptr2,"Check pointer is unchanged");
-    test_stats_check(heap);
-    
-    lub_heap__get_stats(heap,&stats);
-    lub_test_check_int(2,stats.alloc_blocks,"Check the number of dynamic blocks");
-    lub_test_check_int(1,stats.free_blocks,"Check the number of free blocks");
-
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_show()");
-
-    lub_heap_show(heap,BOOL_TRUE);
-    
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_show()");
-
-    lub_heap_show(heap,BOOL_TRUE);
-    
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_show_leaks()");
-    lub_heap_leak_report(LUB_HEAP_SHOW_ALL,"");
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-    test_performance();
-    /*----------------------------------------------------- */
-    lub_test_seq_begin(++testseq,"lub_heap_destroy()");
-    lub_heap_destroy(heap);
-    lub_test_seq_end();
-    /*----------------------------------------------------- */
-}
-/*--------------------------------------------------------- */
-int 
-main(int argc, const char *argv[])
-{
-    int status;
-
-    lub_heap_init(argv[0]);
-    
-    lub_test_parse_command_line(argc,argv);
-    lub_test_begin("lub_heap");
-
-    lub_heap_taint(BOOL_TRUE);
-    lub_heap_check(BOOL_TRUE);
-
-    /* first of all test with leak detection switched off */
-    test_main(0);
-
-#if 1
-    /* now test with leak detection switched on */
-    test_main(1); /* a single context to use */
-#endif
-    /* tidy up */
-    status = lub_test_get_status();
-    lub_test_end();
-    
-    return status;
-}
-/*--------------------------------------------------------- */

+ 0 - 176
test/mallocTest.c

@@ -1,176 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-
-
-int test_numbers[] =
-{
-    100,
-    200,
-    300,
-    400,
-    500,
-    1000,
-    2000,
-    3000,
-    4000,
-    5000,
-    10000,
-    15000,
-    20000,
-    25000,
-    30000,
-    35000,
-    40000,
-    45000,
-    50000,
-    60000,
-    70000,
-    80000,
-    90000,
-    100000,
-    200000,
-    0
-};
-
-typedef struct test_node_s test_node_t;
-struct test_node_s
-{
-    test_node_t *next;
-};
-
-static test_node_t *first_node;
-/*--------------------------------------------------------- */
-/*
- * Returns a pseudo random number based on the input.
- * This will given 2^15 concequtive numbers generate the entire
- * number space in a psedo random manner.
- */
-static int
-pseudo_random(int i)
-{
-        /* multiply the first prime after 2^14 and mask to 15 bits */
-        return (16411*i) & (32767);
-}
-/*--------------------------------------------------------- */
-static void
-create_nodes(unsigned count,int verbose)
-{
-    test_node_t *node;
-    int          i;
-    
-    if (verbose) printf("Create %d random sized blocks...",count);
-    for(i = 0; i < count; i++)
-    {
-        /* pick a random size upto 4096 bytes */
-        size_t size = 1 + 4096 * pseudo_random(i) / 32768;
-
-        node = malloc(size);
-        
-        if(NULL != node)
-        {
-            /* put this into the linked list for later */
-            node->next = first_node;
-            first_node = node;
-        }
-        else
-        {
-            break;
-        }
-    }
-    if (verbose) printf("done\n");
-}
-/*--------------------------------------------------------- */
-static void
-destroy_nodes(int count,
-              int skip,
-              int verbose)
-{
-    test_node_t **ptr = &first_node;
-    int           i;
-    
-    if (verbose) printf("Fragment by destroying %d blocks...",count / skip);
-    for(i = 0; 
-        *ptr && (*ptr)->next && (i < count); 
-        i++, ptr = &(*ptr)->next)
-    {
-        if(i % skip)
-        {
-            char *tmp = (char*)*ptr;
-            /* remove from the linked list */
-            *ptr = (*ptr)->next;
-
-            /* and free the node */
-            free(tmp);
-        }
-    }
-    if (verbose) printf("done\n");
-}
-/*--------------------------------------------------------- */
-void
-mallocTest(int number)
-{
-    struct timespec start_time;
-    struct timespec end_time;
-    struct timespec delta_time;
-    int            *num_allocs;
-    int             single_shot[] =
-    {
-        0,0
-    };
-    if(0 == number)
-    {
-        num_allocs = test_numbers;
-    }
-    else
-    {
-        num_allocs = single_shot;
-        single_shot[0] = number;
-    }
-    while(*num_allocs)
-    {
-        int count = *num_allocs++;
-        
-        clock_gettime(CLOCK_REALTIME,&start_time);
-    
-        create_nodes(count,single_shot[0]);
-    
-        if (single_shot[0]) printf("Now free every other node\n");
-        destroy_nodes(count,2,single_shot[0]);
-    
-        create_nodes(count >> 1,single_shot[0]);
-        if(single_shot[0])
-        {
-            printf("Now free all the nodes...");
-        }
-        while(first_node)
-        {
-            test_node_t *node = first_node;
-            first_node = node->next;
-            free(node);
-        }
-        if (single_shot[0]) printf("done\n");
-
-        clock_gettime(CLOCK_REALTIME,&end_time);
-        delta_time.tv_sec  = end_time.tv_sec  - start_time.tv_sec;
-        delta_time.tv_nsec = end_time.tv_nsec - start_time.tv_nsec;
-
-        printf("*** %6d in %10lu milliseconds\n",count,
-                delta_time.tv_sec * 1000 + delta_time.tv_nsec/1000000);
-    }
-}
-/*--------------------------------------------------------- */
-int
-main(int argc, char **argv)
-{
-    unsigned number = 0;
-
-    if(argc > 1)
-    {
-        number = atoi(argv[1]);
-    }
-    mallocTest(number);
-    
-    return 0;
-}
-/*--------------------------------------------------------- */

+ 0 - 48
test/module.am

@@ -1,48 +0,0 @@
-## Process this file with automake to generate Makefile.in
-noinst_PROGRAMS            = \
-    test/bintree             \
-    test/string
-
-test_bintree_SOURCES       = \
-    test/bintree.c           \
-    test/bintree.h
-test_bintree_LDADD         = \
-    liblub.la                \
-     @BFD_LIBS@
-
-if LUBHEAP
-  noinst_PROGRAMS           += \
-    test/heap                  \
-    test/mallocTest            \
-    test/lubMallocTest
-
-  test_heap_SOURCES          = \
-    test/heap.c
-  test_heap_LDADD            = \
-    liblub.la                  \
-    @BFD_LIBS@
-
-  test_mallocTest_CFLAGS     = @RT_CFLAGS@ 
-  test_mallocTest_SOURCES    = \
-    test/mallocTest.c
-  test_mallocTest_LDADD      = \
-    @RT_LIBS@
-
-  test_lubMallocTest_CFLAGS  = @RT_CFLAGS@
-  test_lubMallocTest_LDFLAGS = 
-  test_lubMallocTest_SOURCES = \
-    test/mallocTest.c
-
-  test_lubMallocTest_LDADD   = \
-    @RT_LIBS@                  \
-    liblubheap.la              \
-    liblub.la                  \
-    @BFD_LIBS@
-endif
-
-test_string_SOURCES        = \
-    test/string.c
-test_string_LDADD          = \
-    liblub.la                \
-    @BFD_LIBS@
-

+ 0 - 50
test/string.c

@@ -1,50 +0,0 @@
-#include "lub/test.h"
-#include "lub/string.h"
-
-/*************************************************************
- * TEST CODE
- ************************************************************* */
-
-static int testseq;
-
-/*--------------------------------------------------------------- */
-/* This is the main entry point for this executable
- */
-int main(int argc, const char *argv[])
-{
-    int comp;
- 	int status;
-
-	lub_test_parse_command_line(argc,argv);
-	lub_test_begin("lub_string");
-
-    lub_test_seq_begin(++testseq,"lub_string_nocasecmp()");
-    
-    comp = lub_string_nocasecmp("HeLlO","hello");
-    lub_test_check((0 == comp),
-                        "Check 'HeLlO' == 'hello'");
-
-    comp = lub_string_nocasecmp("HeLlO","hell");
-    lub_test_check((comp > 0),
-                        "Check 'HeLlO' > 'hell'");
-
-    comp = lub_string_nocasecmp("hell","HeLlO");
-    lub_test_check((comp < 0),
-                        "Check 'hell'  < 'HeLlO'");
-
-    comp = lub_string_nocasecmp("HeLlO","hellp");
-    lub_test_check((comp < 0),
-                        "Check 'HeLlO' < 'hellp'");
-
-    comp = lub_string_nocasecmp("hellp","HeLlO");
-    lub_test_check((comp > 0),
-                        "Check 'hellp' > 'HeLlO'");
-     
-    lub_test_seq_end();
-        
-    /* tidy up */
-    status = lub_test_get_status();
-    lub_test_end();
-       
-    return status;
-}

Some files were not shown because too many files changed in this diff