Тесты zalloc_ext_test.c написаны и пройдены сразу же! Учитесь!

This commit is contained in:
Kolan Sh 2011-06-16 13:39:31 +04:00
parent ffb9a25ddd
commit 49cfd34cd6
2 changed files with 52 additions and 33 deletions

View File

@ -16,12 +16,13 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=1
FILE_NAME_0=372;C;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/zalloc_ext_test.c;0
FILE_NAME_1=6576;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.c;0
FILE_NAME_2=0;C;0;16;1;1;1;/home/kolan/projects/include/xerror.h;0
FILE_NAME_3=2311;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.h;0
FILE_NAME_4=0;C;0;16;1;1;1;/home/kolan/projects/include/zalloc.h;0
current_page=0
FILE_NAME_0=262;C;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/zalloc_ext_test.c;0
FILE_NAME_1=8384;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.c;0
FILE_NAME_2=2684;C;0;16;1;1;1;/home/kolan/projects/include/zalloc_ext.h;0
FILE_NAME_3=0;C;0;16;1;1;1;/home/kolan/projects/include/zalloc.h;0
FILE_NAME_4=0;C;0;16;1;1;1;/home/kolan/projects/include/xalloc.h;0
FILE_NAME_5=1193;Make;0;16;1;1;1;/home/kolan/dev/c/zalloc_ext/Makefile;0
[build-menu]
NF_00_LB=_Сделать

View File

@ -25,33 +25,51 @@ int main()
zptr2 = zalloc_append_usual(zptr2, arr, 9832472);
zptr4_str = zalloc_append_usual_str(zptr4_str, " - twice :)");
puts(zptr4_str);
//~ zalloc_append8(zdest, elem);
//~ zalloc_append8_str(zdest, elem);
//~ zalloc_append16(zdest, elem);
//~ zalloc_append16_str(zdest, elem);
//~ zalloc_append32(zdest, elem);
//~ zalloc_append32_str(zdest, elem);
//~ zalloc_append64(zdest, elem);
//~ zalloc_append64_str(zdest, elem);
//~
//~ /* Cut/Copy/Insert functions
//~ */
//~ zalloc_cut(zptr, off, len);
//~ zalloc_cut_str(zptr, off, len);
//~ zalloc_copy(zptr, off, len);
//~ zalloc_copy_str(zptr, off, len);
//~ zalloc_insert(zdest, off, zsrc);
//~ zalloc_insert_str(zdest, off, zsrc);
//~ zalloc_insert_usual(zdest, off, arr, len);
//~ zalloc_insert_usual_str(zdest, off, str);
//~ zalloc_insert8(zptr, off, elem);
//~ zalloc_insert8_str(zptr, off, elem);
//~ zalloc_insert16(zptr, off, elem);
//~ zalloc_insert16_str(zptr, off, elem);
//~ zalloc_insert32(zptr, off, elem);
//~ zalloc_insert32_str(zptr, off, elem);
//~ zalloc_insert64(zptr, off, elem);
//~ zalloc_insert64_str(zptr, off, elem);
zptr = zalloc_append8(zptr, 'a');
zptr4_str = zalloc_append8_str(zptr4_str, 'E');
puts(zptr4_str);
zptr = zalloc_append16(zptr, 12345);
zptr4_str = zalloc_append16_str(zptr4_str, ('H' << 8) + 'H');
puts(zptr4_str);
zptr = zalloc_append32(zptr, 65489498L);
zptr4_str = zalloc_append32_str(zptr4_str, (((((('4' << 8) + '4') << 8) + '4') << 8) + '4'));
puts(zptr4_str);
zptr3 = zalloc_append64(zptr3, 3232423423423LLU);
int64_t i64 = 1561;
int i;
for (i = 0; i < 8; i++)
i64 = (i64 << 8) + '8';
printf("%x %x %x %x\n", *((char *)&i64 + 0), *((char *)&i64 + 1), *((char *)&i64 + 2), *((char *)&i64 + 3));
zptr4_str = zalloc_append64_str(zptr4_str, i64);
puts(zptr4_str);
/* Cut/Copy/Insert functions
*/
zptr3 = zalloc_cut(zptr3, 6547, 564);
zptr4_str = zalloc_cut_str(zptr4_str, 5, 7);
puts(zptr4_str);
void *zptr5 = zalloc_copy(zptr2, 8424, 345);
void *zptr6_str = zalloc_copy_str(zptr4_str, 6, 13);
puts(zptr6_str);
zptr5 = zalloc_insert(zptr5, 0, zptr);
zptr4_str = zalloc_insert_str(zptr4_str, 31, zptr6_str);
puts(zptr4_str);
void *arr2 = zmalloc(54547);
zptr2 = zalloc_insert_usual(zptr2, zalloc_size(zptr2) - 3, arr2, zalloc_size(arr2));
zptr4_str = zalloc_insert_usual_str(zptr4_str, 5, ":zalloc_insert_usual_str():");
puts(zptr4_str);
zptr5 = zalloc_insert8(zptr5, 9874, 'd');
zptr6_str = zalloc_insert8_str(zptr6_str, 0, '0');
puts(zptr6_str);
zptr5 = zalloc_insert16(zptr5, 9874, 5478);
zptr6_str = zalloc_insert16_str(zptr6_str, 1, ('1' << 8) + '1');
puts(zptr6_str);
zptr5 = zalloc_insert32(zptr5, 9874, 5478323);
zptr6_str = zalloc_insert32_str(zptr6_str, 0, (((((('4' << 8) + '4') << 8) + '4') << 8) + '4'));
puts(zptr6_str);
zptr5 = zalloc_insert64(zptr5, 9874, 5478433443LU);
zptr6_str = zalloc_insert64_str(zptr6_str, zalloc_size(zptr6_str) - 1, i64);
puts(zptr6_str);
return EXIT_SUCCESS;
}