// File: /workspace/github_c_makefile_star2_O2/Enes1313[P]DataStructures/Test/main.c
// Function: testDynamicArray
void testDynamicArray()
{
	size_t i, x;
	eaDSDynamicArray dynamicArray;

	puts("********************************************");
	puts("Dinamik Array");
	puts("********************************************");

	if (EXIT_FAILURE == eaDSDynamicArrayInit(&dynamicArray, intCreateAndCopy, intCompare, free))
	{
		puts("dynamicArray olusmadi!");
		return;
	}

	for(i = 0; i < 13; i++)
	{
		x = (unsigned int) rand() % 50;

		if(EXIT_SUCCESS == eaDSDynamicArrayAdd(&dynamicArray, &x))
		{
			printf("DynamicArray'e eleman eklendi : %d \n", (int)x);
		}
		else
		{
			puts("DynamicArray'e eleman eklenemedi!");
		}
	}

	x = 50;

	if(EXIT_SUCCESS == eaDSDynamicArrayInsert(&dynamicArray, &x, 2))
	{
		printf("DynamicArray'in 3. sirasina eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("DynamicArray'in 3. sirasina eleman eklenemedi!");
	}
	
	x = 51;
/*
	if(EXIT_SUCCESS == eaDSDynamicArrayInsert(&dynamicArray, &x, 6))
	{
		printf("DynamicArray'in 6. sirasina eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("DynamicArray'in 6. sirasina eleman eklenemedi!");
	}*/

	x = 10;

	printf("DynamicArray'den siliniyor : %d\n", (int)x);
	eaDSDynamicArrayRemove(&dynamicArray, &x);

	printf("DynamicArray'den 2. eleman atiliyor!\n");
	eaDSDynamicArrayRemoveAt(&dynamicArray, 1);

	for(i = 0; i < eaDSDynamicArrayGetCount(&dynamicArray); i++)
	{
		void * data = eaDSDynamicArrayGetFrom(&dynamicArray, i);

		if(NULL != data)
		{
			printf("DynamicArray'den %d. eleman alindi : %d\n", (int)i + 1, *(int *)data);
			free(data);
		}
		else
		{
			printf("DynamicArray'den %d. eleman alma basarisiz\n", (int)i + 1);
		}
	}

	printf("DynamicArray siralaniyor...\n");
	eaDSDynamicArraySort(&dynamicArray);

	for(i = 0; i < eaDSDynamicArrayGetCount(&dynamicArray); i++)
	{
		void * data = eaDSDynamicArrayGetAddressFrom(&dynamicArray, i);

		if(NULL != data)
		{
			printf("DynamicArray'den %d. eleman alindi : %d\n", (int)i + 1, *(int *)data);
		}
		else
		{
			printf("DynamicArray'den %d. eleman alma basarisiz\n", (int)i + 1);
		}
	}

	printf("DynamicArray eleman sayisi : %d.\n", (int)eaDSDynamicArrayGetCount(&dynamicArray));

	printf("DynamicArray resetleniyor.\n");
	eaDSDynamicArrayReset(&dynamicArray);

	printf("DynamicArray eleman sayisi : %d.\n", (int)eaDSDynamicArrayGetCount(&dynamicArray));

	x = (unsigned int) rand() % 50;

	if(EXIT_SUCCESS == eaDSDynamicArrayAdd(&dynamicArray, &x))
	{
		printf("DynamicArray'e eleman eklendi : %d\n", (int)x);
	}
	else
	{
		puts("DynamicArray'e eleman eklenemedi!");
	}

	printf("DynamicArray eleman sayisi : %d.\n", (int)eaDSDynamicArrayGetCount(&dynamicArray));

	printf("DynamicArray siliniyor.\n");
	eaDSDynamicArrayClear(&dynamicArray);

	puts("********************************************");
	puts("Dinamik Array");
	puts("********************************************");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0x922(%rip), %rbx       # 0x306f
movq %rbx, %rdi
callq 0x1030
leaq 0x9db(%rip), %rdi       # 0x3137
callq 0x1030
movq %rbx, %rdi
callq 0x1030
leaq -0x52(%rip), %rsi       # 0x271e
leaq -0x47(%rip), %rdx       # 0x2730
movq 0x383a(%rip), %rcx      # 0x5fb8
leaq 0x10(%rsp), %rdi
callq 0x1530
cmpl $0x1, %eax
jne 0x2799
leaq 0x9b1(%rip), %rbx       # 0x3145
jmp 0x2a0c
pushq $0xd
popq %rbp
pushq $0x32
popq %rbx
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x9ac(%rip), %r12       # 0x315c
leaq 0x9ca(%rip), %r13       # 0x3181
subq $0x1, %rbp
jb 0x27f4
callq 0x10b0
xorl %edx, %edx
divl %ebx
movq %rdx, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x174b
testl %eax, %eax
je 0x27e4
movq %r13, %rdi
callq 0x1030
jmp 0x27b7
movl 0x8(%rsp), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x1050
jmp 0x27b7
leaq 0x8(%rsp), %rsi
movq $0x32, (%rsi)
leaq 0x10(%rsp), %rdi
pushq $0x2
popq %rdx
callq 0x17cc
testl %eax, %eax
je 0x281f
leaq 0x9bc(%rip), %rdi       # 0x31d4
callq 0x1030
jmp 0x2831
movl 0x8(%rsp), %esi
leaq 0x979(%rip), %rdi       # 0x31a3
xorl %eax, %eax
callq 0x1050
leaq 0x8(%rsp), %r15
movq $0xa, (%r15)
leaq 0x9bf(%rip), %rdi       # 0x3203
pushq $0xa
popq %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x1878
leaq 0xc8a(%rip), %rdi       # 0x34ef
callq 0x1030
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x19e1
leaq 0x9d1(%rip), %r15       # 0x324d
leaq 0x9a1(%rip), %r12       # 0x3224
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x1741
cmpq %rax, %r13
jae 0x28d1
movq %r14, %rdi
movq %r13, %rsi
callq 0x1a9e
incq %r13
testq %rax, %rax
je 0x28c2
movq %rax, %rbp
movl (%rax), %edx
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %rbp, %rdi
callq 0x10c0
jmp 0x2886
movq %r15, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x2886
leaq 0xc3c(%rip), %rdi       # 0x3514
callq 0x1030
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x16da
leaq 0x95c(%rip), %r15       # 0x324d
leaq 0x92c(%rip), %r12       # 0x3224
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x1741
cmpq %rax, %r13
jae 0x293b
movq %r14, %rdi
movq %r13, %rsi
callq 0x1ab4
incq %r13
testq %rax, %rax
je 0x292c
movl (%rax), %edx
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x28fb
movq %r15, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x28fb
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x1741
leaq 0x92a(%rip), %r15       # 0x3279
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0xbce(%rip), %rdi       # 0x3530
callq 0x1030
movq %r14, %rdi
callq 0x161f
movq %r14, %rdi
callq 0x1741
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
callq 0x10b0
xorl %edx, %edx
divl %ebx
leaq 0x8(%rsp), %rsi
movq %rdx, (%rsi)
movq %r14, %rdi
callq 0x174b
testl %eax, %eax
je 0x29ae
leaq 0x7da(%rip), %rdi       # 0x3181
callq 0x1030
jmp 0x29c0
movl 0x8(%rsp), %esi
leaq 0x8e2(%rip), %rdi       # 0x329b
xorl %eax, %eax
callq 0x1050
leaq 0x6a8(%rip), %rbx       # 0x306f
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x1741
leaq 0x89e(%rip), %rdi       # 0x3279
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0xb60(%rip), %rdi       # 0x354b
callq 0x1030
movq %r14, %rdi
callq 0x16a8
movq %rbx, %rdi
callq 0x1030
leaq 0x730(%rip), %rdi       # 0x3137
callq 0x1030
movq %rbx, %rdi
callq 0x1030
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq