home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume20
/
xxalloc
/
txtest.c
< prev
next >
Wrap
Text File
|
1989-10-16
|
2KB
|
67 lines
{
type *t1, **t2, ***t3;
printf("checking type 1 \n");
if (xx_amount() != 0L)
printf("type: amount == %ld", xx_amount());
t1 = t1_alloc(NB, NE);
for (i = NB; i <= NE; i++)
t1[i] = (type) i;
for (i = NB; i <= NE; i++)
if (t1[i] != (type) i)
printf("type: after allocate t1[%d] = %t != %d\n",
i, t1[i], i);
t1 = t1_renum(t1, NB, NE, NB+NO, NE+NO);
for (i = NB+NO; i <= NE+NO; i++)
if (t1[i] != (type) (i-NO))
printf("type: after renum t1[%d] = %t != %d\n",
i, t1[i], i-NO);
t1_free(t1, NB+NO, NE+NO);
printf("checking type 2 \n");
if (xx_amount() != 0L)
printf("type: amount == %ld", xx_amount());
t2 = t2_alloc(NB, NE, NB, NE);
for (i = NB; i <= NE; i++)
for (j = NB; j <= NE; j++)
t2[i][j] = (type) (i + j);
for (i = NB; i <= NE; i++)
for (j = NB; j <= NE; j++)
if (t2[i][j] != (type) (i+j))
printf("type: after allocate t2[%d][%d] = %t != %d\n",
i, j, t2[i][j], i+j);
t2 = t2_renum(t2, NB, NE, NB, NE, NB+NO, NE+NO, NB+NO, NE+NO);
for (i = NB+NO; i <= NE+NO; i++)
for (j = NB+NO; j <= NE+NO; j++)
if (t2[i][j] != (type) (i+j-NO-NO))
printf("type: after allocate t2[%d][%d] = %t != %d\n",
i, j, t2[i][j], i+j-NO-NO);
t2_free(t2, NB+NO, NE+NO, NB+NO, NE+NO);
printf("checking type 3 \n");
if (xx_amount() != 0L)
printf("type: amount == %ld", xx_amount());
t3 = t3_alloc(NB, NE, NB, NE, NB, NE);
for (i = NB; i <= NE; i++)
for (j = NB; j <= NE; j++)
for (k = NB; k <= NE; k++)
t3[i][j][k] = (type) (i + j + k);
for (i = NB; i <= NE; i++)
for (j = NB; j <= NE; j++)
for (k = NB; k <= NE; k++)
if (t3[i][j][k] != (type) (i+j+k))
printf("type: after allocate t3[%d][%d][%d] = %t != %d\n",
i, j, k, t3[i][j][k], i+j+k);
t3 = t3_renum(t3, NB, NE, NB, NE, NB, NE,
NB+NO, NE+NO, NB+NO, NE+NO, NB+NO, NE+NO);
for (i = NB+NO; i <= NE+NO; i++)
for (j = NB+NO; j <= NE+NO; j++)
for (k = NB+NO; k <= NE+NO; k++)
if (t3[i][j][k] != (type) (i+j+k-3*NO))
printf("type: after allocate t3[%d][%d][%d] = %t != %d\n",
i, j, k, t3[i][j][k], i+j+k-3*NO);
t3_free(t3, NB+NO, NE+NO, NB+NO, NE+NO, NB+NO, NE+NO);
}