// File: /workspace/github_c_makefile_star2_O1/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 0x183a(%rip), %rbx      # 0x406f
movq %rbx, %rdi
callq 0x1030
leaq 0x18f3(%rip), %rdi      # 0x4137
callq 0x1030
movq %rbx, %rdi
callq 0x1030
leaq -0x5f(%rip), %rsi       # 0x27f9
leaq -0x52(%rip), %rdx       # 0x280d
movq 0x4752(%rip), %rcx      # 0x6fb8
leaq 0x10(%rsp), %rdi
callq 0x15c8
cmpl $0x1, %eax
jne 0x2881
leaq 0x18c9(%rip), %rbx      # 0x4145
jmp 0x2b2b
movl $0xd, %ebp
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
leaq 0x18c5(%rip), %r12      # 0x415c
leaq 0x18e3(%rip), %r13      # 0x4181
callq 0x10b0
movl %eax, %ecx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
shrq $0x24, %rcx
imull $0x32, %ecx, %ecx
subl %ecx, %eax
movq %rax, 0x8(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x17c6
testl %eax, %eax
je 0x28d3
movq %r13, %rdi
callq 0x1030
jmp 0x28e1
movl 0x8(%rsp), %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x1050
decq %rbp
jne 0x289e
leaq 0x8(%rsp), %rsi
movq $0x32, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x2, %edx
callq 0x1845
testl %eax, %eax
je 0x2913
leaq 0x18c8(%rip), %rdi      # 0x41d4
callq 0x1030
jmp 0x2925
movl 0x8(%rsp), %esi
leaq 0x1885(%rip), %rdi      # 0x41a3
xorl %eax, %eax
callq 0x1050
leaq 0x8(%rsp), %r14
movq $0xa, (%r14)
leaq 0x18cb(%rip), %rdi      # 0x4203
movl $0xa, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x18fb
leaq 0x1b94(%rip), %rdi      # 0x44ef
callq 0x1030
movl $0x1, %esi
movq %r15, %rdi
callq 0x1a6b
movq %r15, %rdi
callq 0x17bc
testq %rax, %rax
je 0x29d9
leaq 0x10(%rsp), %r14
leaq 0x18c7(%rip), %r15      # 0x424d
leaq 0x1897(%rip), %r12      # 0x4224
xorl %r13d, %r13d
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b2f
incq %r13
testq %rax, %rax
je 0x29bf
movq %rax, %rbp
movl (%rax), %edx
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %rbp, %rdi
callq 0x10c0
jmp 0x29cc
movq %r15, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x17bc
cmpq %rax, %r13
jb 0x2990
leaq 0x1b34(%rip), %rdi      # 0x4514
callq 0x1030
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x1754
movq %r14, %rdi
callq 0x17bc
testq %rax, %rax
je 0x2a53
leaq 0x10(%rsp), %r14
leaq 0x1842(%rip), %r15      # 0x424d
leaq 0x1812(%rip), %r12      # 0x4224
xorl %r13d, %r13d
movq %r14, %rdi
movq %r13, %rsi
callq 0x1b45
incq %r13
testq %rax, %rax
je 0x2a39
movl (%rax), %edx
movq %r12, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x2a46
movq %r15, %rdi
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
movq %r14, %rdi
callq 0x17bc
cmpq %rax, %r13
jb 0x2a15
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x17bc
leaq 0x1812(%rip), %r15      # 0x4279
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x1ab6(%rip), %rdi      # 0x4530
callq 0x1030
movq %r14, %rdi
callq 0x1697
movq %r14, %rdi
callq 0x17bc
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
callq 0x10b0
movl %eax, %ecx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
shrq $0x24, %rcx
imull $0x32, %ecx, %ecx
subl %ecx, %eax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x17c6
testl %eax, %eax
je 0x2ad4
leaq 0x16b4(%rip), %rdi      # 0x4181
callq 0x1030
jmp 0x2ae6
movl 0x8(%rsp), %esi
leaq 0x17bc(%rip), %rdi      # 0x429b
xorl %eax, %eax
callq 0x1050
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x17bc
leaq 0x177f(%rip), %rdi      # 0x4279
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x1a41(%rip), %rdi      # 0x454b
callq 0x1030
movq %r14, %rdi
callq 0x1722
movq %rbx, %rdi
callq 0x1030
leaq 0x1611(%rip), %rdi      # 0x4137
callq 0x1030
movq %rbx, %rdi
callq 0x1030
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq