Added lookup table for the colors for optimization

Made test output a bit prettier
Made tests run function 10 times for higher accuracy
This commit is contained in:
Nikola
2026-07-14 00:15:07 +02:00
parent 1318798ac2
commit f9bd827b2c
5 changed files with 96 additions and 23 deletions
+42 -8
View File
@@ -76,13 +76,47 @@ unsigned tests(void) {
}
printf("\nTest 1: Default image, not coloured\n");
benchmarking(3,0,-2.0f - 0.5f*I, width, height, 0.001f, 200, false, tempArrNotColored);
printf("\nTest 2: Default image, coloured\n");
benchmarking(3,0,-2.0f - 0.5f*I, width, height, 0.001f, 200, true, tempArrColored);
printf("\nTest 3: High iteration count\n");
benchmarking(3,0,-2.0f - 0.5f*I, width, height, 0.001f, 5000, false, tempArrNotColored);
printf("\nTest 4: Zoomed image\n");
benchmarking(3,0,-0.5f - 0.5f*I, 1024, 1024, 0.0005f, 500, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,0,-2.0f - 0.5f*I, width, height, 0.001f, 200, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,1,-2.0f - 0.5f*I, width, height, 0.001f, 200, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,2,-2.0f - 0.5f*I, width, height, 0.001f, 200, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,3,-2.0f - 0.5f*I, width, height, 0.001f, 200, false, tempArrNotColored);
printf("\n\n\nTest 2: Default image, coloured\n");
printf("\n\n");
benchmarking(10,0,-2.0f - 0.5f*I, width, height, 0.001f, 200, true, tempArrColored);
printf("\n\n");
benchmarking(10,1,-2.0f - 0.5f*I, width, height, 0.001f, 200, true, tempArrColored);
printf("\n\n");
benchmarking(10,2,-2.0f - 0.5f*I, width, height, 0.001f, 200, true, tempArrColored);
printf("\n\n");
benchmarking(10,3,-2.0f - 0.5f*I, width, height, 0.001f, 200, true, tempArrColored);
printf("\n\n\nTest 3: High iteration count\n");
printf("\n\n");
benchmarking(10,0,-2.0f - 0.5f*I, width, height, 0.001f, 5000, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,1,-2.0f - 0.5f*I, width, height, 0.001f, 5000, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,2,-2.0f - 0.5f*I, width, height, 0.001f, 5000, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,3,-2.0f - 0.5f*I, width, height, 0.001f, 5000, false, tempArrNotColored);
printf("\n\n\nTest 4: Zoomed image\n");
printf("\n\n");
benchmarking(10,0,-0.5f - 0.5f*I, 1024, 1024, 0.0005f, 500, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,1,-0.5f - 0.5f*I, 1024, 1024, 0.0005f, 500, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,2,-0.5f - 0.5f*I, 1024, 1024, 0.0005f, 500, false, tempArrNotColored);
printf("\n\n");
benchmarking(10,3,-0.5f - 0.5f*I, 1024, 1024, 0.0005f, 500, false, tempArrNotColored);
free(tempArrColored);
free(tempArrNotColored);
@@ -217,7 +251,7 @@ int main(int argc, char** argv)
if (version_to_use < 0 || version_to_use > 5 || end == optarg || *end != '\0')
{
fprintf(stderr,"Invalid version to use: V%s. Available versions are : V0,V1,V2,V3,V4,V5\n", optarg);
fprintf(stderr,"Invalid version to use: V%s. Available versions are : V0,V1,V2,V3\n", optarg);
return EXIT_FAILURE;
}
printf("version is %d\n", version_to_use);