/[ascend]/trunk/base/generic/utilities/test/test_ascMalloc.c
ViewVC logotype

Diff of /trunk/base/generic/utilities/test/test_ascMalloc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 707 by johnpye, Fri Mar 31 08:52:57 2006 UTC revision 708 by johnpye, Tue Jun 27 07:34:31 2006 UTC
# Line 230  static void test_ascMalloc(void) Line 230  static void test_ascMalloc(void)
230    
231    /* test ascreallocPURE() */    /* test ascreallocPURE() */
232    
233    p_str1 = (char *)ascmalloc(50);                       /* allocate a block & check status */    p_str1 = ASC_NEW_ARRAY(char,50);                       /* allocate a block & check status */
234    CU_TEST_FATAL(NULL != p_str1);    CU_TEST_FATAL(NULL != p_str1);
235  #ifdef MALLOC_DEBUG  #ifdef MALLOC_DEBUG
236    CU_TEST(50 == ascmeminuse());    CU_TEST(50 == ascmeminuse());
# Line 462  static void test_ascMalloc(void) Line 462  static void test_ascMalloc(void)
462    
463    /* test ascrealloc() */    /* test ascrealloc() */
464    
465    p_str1 = (char *)ascmalloc(50);                       /* allocate several blocks & check status */    p_str1 = ASC_NEW_ARRAY(char,50);                       /* allocate several blocks & check status */
466    p_str2 = (char *)ascmalloc(20);    p_str2 = ASC_NEW_ARRAY(char,20);
467    p_str3 = (char *)ascmalloc(25);    p_str3 = ASC_NEW_ARRAY(char,25);
468    CU_TEST_FATAL(NULL != p_str1);    CU_TEST_FATAL(NULL != p_str1);
469    CU_TEST_FATAL(NULL != p_str2);    CU_TEST_FATAL(NULL != p_str2);
470    CU_TEST_FATAL(NULL != p_str3);    CU_TEST_FATAL(NULL != p_str3);
# Line 712  static void test_ascMalloc(void) Line 712  static void test_ascMalloc(void)
712    CU_TEST(1 == AllocatedMemory(&str1_bad, 0));          /* non-NULL pointer, nothing allocated */    CU_TEST(1 == AllocatedMemory(&str1_bad, 0));          /* non-NULL pointer, nothing allocated */
713  #endif  #endif
714    
715    p_str1 = (char *)ascmalloc(100);                      /* allocate 1 block */    p_str1 = ASC_NEW_ARRAY(char,100);                      /* allocate 1 block */
716    CU_TEST_FATAL(NULL != p_str1);    CU_TEST_FATAL(NULL != p_str1);
717    
718    p_str2 = (char *)malloc(100);                         /* allocate another outside ascMalloc */    p_str2 = (char *)malloc(100);                         /* allocate another outside ascMalloc */
# Line 808  static void test_ascMalloc(void) Line 808  static void test_ascMalloc(void)
808    
809    /* test InMemoryBlock() */    /* test InMemoryBlock() */
810    
811    p_str1 = (char *)ascmalloc(100);                      /* allocate 1 block */    p_str1 = ASC_NEW_ARRAY(char,100);                      /* allocate 1 block */
812    CU_TEST_FATAL(NULL != p_str1);    CU_TEST_FATAL(NULL != p_str1);
813    CU_TEST(0 != InMemoryBlock(p_str1, p_str1));    CU_TEST(0 != InMemoryBlock(p_str1, p_str1));
814    CU_TEST(0 != InMemoryBlock(p_str1, p_str1+1));    CU_TEST(0 != InMemoryBlock(p_str1, p_str1+1));
# Line 843  static void test_ascMalloc(void) Line 843  static void test_ascMalloc(void)
843    CU_TEST(FALSE == asc_assert_failed());    CU_TEST(FALSE == asc_assert_failed());
844  #endif  #endif
845    
846    p_str1 = (char *)ascmalloc(100);    p_str1 = ASC_NEW_ARRAY(char,100);
847    p_int1 = (int *)asccalloc(10, sizeof(int));    p_int1 = (int *)asccalloc(10, sizeof(int));
848    
849    p_str2 = (char *)malloc(100);                       /* don't use asc*alloc! */    p_str2 = (char *)malloc(100);                       /* don't use asc*alloc! */
# Line 944  static void test_ascMalloc(void) Line 944  static void test_ascMalloc(void)
944    CU_TEST(FALSE == asc_assert_failed());    CU_TEST(FALSE == asc_assert_failed());
945  #endif  #endif
946    
947    p_str1 = (char *)ascmalloc(100);    p_str1 = ASC_NEW_ARRAY(char,100);
948    p_int1 = (int *)asccalloc(10, sizeof(int));    p_int1 = (int *)asccalloc(10, sizeof(int));
949    
950    p_str2 = (char *)malloc(100);                       /* don't use asc*alloc! */    p_str2 = (char *)malloc(100);                       /* don't use asc*alloc! */
# Line 1014  static void test_ascMalloc(void) Line 1014  static void test_ascMalloc(void)
1014    CU_TEST(FALSE == asc_assert_failed());    CU_TEST(FALSE == asc_assert_failed());
1015  #endif  #endif
1016    
1017    p_str1 = (char *)ascmalloc(100);    p_str1 = ASC_NEW_ARRAY(char,100);
1018    p_int1 = (int *)asccalloc(10, sizeof(int));    p_int1 = (int *)asccalloc(10, sizeof(int));
1019    
1020    p_str2 = (char *)malloc(100);                       /* don't use asc*alloc! */    p_str2 = (char *)malloc(100);                       /* don't use asc*alloc! */
# Line 1112  static void test_ascMalloc(void) Line 1112  static void test_ascMalloc(void)
1112    CU_TEST(FALSE == asc_assert_failed());    CU_TEST(FALSE == asc_assert_failed());
1113  #endif  #endif
1114    
1115    p_str1 = (char *)ascmalloc(100);                    /* allocate 1 block */    p_str1 = ASC_NEW_ARRAY(char,100);                    /* allocate 1 block */
1116    CU_TEST_FATAL(NULL != p_str1);    CU_TEST_FATAL(NULL != p_str1);
1117    
1118    asc_assert_reset();    asc_assert_reset();

Legend:
Removed from v.707  
changed lines
  Added in v.708

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22