unit_test_v2.c

/*
 * Unit Test Bootstrap
 * Autor: Tomasz Jaworski, 2018-2019
 *
 * Test dla zadania Histogram
 * Autor testowanej odpowiedzi: Szymon Ptak
 * Test wygenerowano automatycznie o 2019-08-21 14:24:02.947165
 *
 * Debug: 
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <signal.h>
#include <setjmp.h>
#include <assert.h>

#define _RLDEBUG_API_
#include "unit_helper_v2.h"
#include "rdebug.h"

#include "tested_declarations.h"
#include "rdebug.h"

//
// Elementy globalne dla całego testu
//




//
//  Test 1: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST1(void)
{
    // informacje o teście
    test_start(1, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0};
                int output[] = {-1, 1, 1, -1, 0, -1, 1, -2, 1, 2, 2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){1.562668, 7.928497}, 2, output, 11);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 11; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 11; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 2: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST2(void)
{
    // informacje o teście
    test_start(2, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {10, 8, 8, 9, 6, 3, 16, 6, 12, 10, 10};
                int output[] = {-2, 0, 1, 0, -2, -1, 1, -2, 2, 1, -1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){9.366245, 3.436215, 6.044355, 7.550183, 6.863965, 9.204622, 8.560112, 0.238243, 6.297528, 9.815594, 3.339507, 7.929423, 4.097896, 9.488541, 2.172779, 8.981706, 6.652563, 8.366032, 0.886543, 8.256893, 6.225758, 7.718674, 10.580358, 3.099533, 10.170841, 8.940681, 6.999329, 9.073648, 4.081553, 2.362245, 6.015781, 6.377450, 8.354868, 6.374136, 3.990643, 6.615741, 2.146146, 2.843477, 1.565296, 3.842828, 0.320093, 3.144301, 6.592671, 1.164048, 1.916072, 0.093377, 6.894656, 1.116431, 1.891768, 8.902647, 10.153203, 9.644689, 3.885795, 2.468546, 1.104135, 10.707557, 4.884366, 0.349432, 10.643061, 4.844950, 1.239526, 7.601816, 10.982252, 9.132030, 4.264823, 2.176297, 8.769161, 9.450776, 6.239521, 1.921960, 9.085478, 0.155057, 5.826289, 6.557053, 0.494407, 2.620408, 5.247511, 6.073847, 9.087242, 10.486652, 10.155185, 8.349154, 10.501732, 3.264181, 4.514849, 0.088063, 5.849596, 8.115023, 8.980767, 8.186800, 10.407455, 0.821569, 0.244426, 7.690936, 2.005980, 3.063472, 6.769759, 7.913806}, 98, output, 11);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 11; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [10, 8, 8, 9, 6, 3, 16, 6, 12, 10, 10]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 11; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 3: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST3(void)
{
    // informacje o teście
    test_start(3, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {19, 6, 7, 14, 14, 6, 6, 8, 7, 7, 13};
                int output[] = {-2, -1, -2, 2, 2, 1, -1, 0, -1, 0, 1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){0.672547, 8.350878, 5.950526, 0.816829, 10.221208, 0.513634, 3.885334, 6.724856, 8.010068, 0.273432, 1.102732, 7.861498, 4.090338, 7.921531, 3.330807, 4.559557, 3.589384, 10.360330, 4.086697, 4.013565, 5.122033, 4.082400, 3.805365, 10.822602, 8.447572, 2.123684, 6.240887, 5.974822, 8.125703, 3.712092, 2.801248, 0.145709, 10.920491, 0.207487, 0.594741, 3.050819, 4.579033, 1.387436, 3.103743, 1.688306, 10.162907, 0.234363, 0.488439, 7.598996, 0.580900, 3.875341, 3.951042, 9.614754, 8.458772, 7.463782, 8.242150, 5.943499, 0.179385, 5.803736, 7.371206, 4.026571, 0.546768, 2.827385, 2.801159, 10.427836, 5.260748, 0.231946, 1.282665, 1.131664, 10.706878, 4.961140, 8.973952, 4.124580, 0.065754, 10.526426, 10.546804, 3.950300, 7.062161, 0.033394, 0.020736, 3.126860, 10.936827, 4.956042, 6.910669, 6.221205, 10.727930, 1.654257, 0.267467, 9.895423, 2.481841, 2.197933, 9.387266, 4.766128, 3.478710, 6.519270, 4.547520, 0.827692, 10.402441, 4.906340, 2.374841, 0.231863, 9.619055, 3.263959, 9.417709, 7.193685, 3.402092, 6.942271, 9.215029, 9.737669, 10.797294, 7.853538, 4.287204}, 107, output, 11);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 11; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [19, 6, 7, 14, 14, 6, 6, 8, 7, 7, 13]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 11; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 4: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST4(void)
{
    // informacje o teście
    test_start(4, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0};
                int output[] = {-2, -2, 2, -2, 2, -1, 2, 0, -2, 1, 1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){-3.223462, 9.262781, -6.639828, 8.336736}, 4, output, 11);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 11; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 11; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 5: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST5(void)
{
    // informacje o teście
    test_start(5, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {6, 2, 6, 3, 5, 3, 1, 3, 6, 8, 0};
                int output[] = {2, 0, 1, 2, 2, -1, -2, 0, 1, -1, 0};
        
                printf("#####START#####");
                int res = create_histogram((float[]){0.342231, 0.537782, -0.819523, 9.182910, -0.355424, 4.137331, -4.960526, -1.775950, -9.615349, -8.507573, -3.777730, -1.025828, 2.849693, 7.095783, 8.765862, 8.581111, 0.089323, -9.571999, 8.405833, -9.312884, 5.512632, 0.849415, 9.373299, 4.373248, 9.609346, 5.165901, -3.186859, -0.686533, 3.198341, -6.439382, -5.842670, 9.007743, -5.669805, 9.844354, -3.273388, 2.238836, 3.954922, 5.455759, -0.295406, 8.164013, 9.636796, 0.054551, -0.613756, -5.082950, -7.966443, 6.511806, 4.363818, -0.562472, -5.709948, 1.789770, 2.619580, -9.473481, 3.011534, 9.384186, 4.477625, -2.883064, -2.898142, -1.319240, -6.758433, -3.354801, -4.494327, -7.998673, 9.034125, 8.679160, -3.994956, -5.856388, 2.490711, -3.082827, 7.263100, -4.724775, 2.753806, 0.121599, 7.527482, 4.863094, -5.052525, 8.015916, -0.677189, -1.284474, 1.530706, 2.047424}, 80, output, 11);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 11; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [6, 2, 6, 3, 5, 3, 1, 3, 6, 8, 0]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 11; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 6: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST6(void)
{
    // informacje o teście
    test_start(6, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {2, 1, 3, 2, 6, 5, 3, 4, 3, 2, 5, 2, 5, 2, 3, 1, 1, 1, 3, 4, 0};
                int output[] = {1, 1, -2, 2, 1, 2, 1, 1, 1, 1, -2, -1, -2, 1, 0, -2, 0, -1, 0, 0, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){13.243721, 1.518165, 4.034422, 10.116738, 7.108813, 14.391541, 5.531416, 14.559878, 12.487440, 19.727003, 17.443382, 4.504543, 18.561189, 11.361639, 6.503502, 15.338166, 6.876811, 2.851510, 19.546116, 12.812900, 12.797911, 4.266704, 10.179482, 8.769453, 7.728113, 5.067957, 10.183172, 4.380400, 16.235970, 13.251556, 6.143835, 5.591445, 3.391497, 18.780678, 7.647885, 8.282216, 5.329881, 14.596276, 0.671016, 8.266435, 4.975315, 10.827705, 11.408830, 9.334817, 10.631400, 12.296249, 2.754382, 12.508749, 4.808047, 19.625078, 2.917819, 9.074069, 3.166258, 0.820507, 19.554899, 18.400138, 5.982465, 7.817167}, 58, output, 21);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 21; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [2, 1, 3, 2, 6, 5, 3, 4, 3, 2, 5, 2, 5, 2, 3, 1, 1, 1, 3, 4, 0]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 21; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 7: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST7(void)
{
    // informacje o teście
    test_start(7, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {4, 5, 8, 10, 9, 3, 4, 5, 10, 9, 5, 6, 6, 10, 9, 5, 6, 6, 4, 5, 8, 2, 6, 5, 6, 4, 8, 10, 3, 5, 5, 6, 8, 5, 7, 13, 8, 9, 7, 8, 6, 15, 5, 6, 10, 5, 4, 4, 7, 3, 7, 5, 9, 7, 10, 4, 11, 7, 4, 3, 6, 9, 9, 6, 9, 8, 5, 5, 3, 10, 5, 5, 8, 3, 7, 5, 10, 4, 5, 6, 6, 9, 5, 6, 6, 7, 6, 7, 8, 8, 10, 9, 7, 8, 0};
                int output[] = {1, -1, 2, -2, -1, 0, -1, 2, -1, -1, 0, -1, 1, 2, -1, 1, 1, -1, -2, -1, 1, -1, -1, -1, 2, -1, -2, 1, 2, -2, -2, -2, 2, -1, -2, 1, 1, 2, -2, 0, 2, 0, 0, 2, 1, -2, -2, 2, -2, 0, 1, 0, 0, 1, -2, -2, -2, 0, 2, 1, 1, -2, 0, -1, 0, -1, 1, 1, 1, 0, -1, 1, 0, -2, -1, 2, -2, 2, -2, 2, -1, -2, 2, -1, -2, 0, 1, 2, -1, -2, -1, 1, -2, 0, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){12.790722, 40.529128, 17.248804, 8.127029, 74.890788, 88.496764, 50.145263, 2.021323, 19.740148, 37.359891, 44.972084, 69.684042, 88.671985, 36.658175, 72.953393, 0.893796, 4.554876, 54.253295, 54.939757, 38.790908, 24.780837, 15.073097, 27.912419, 6.439373, 42.961331, 79.638576, 20.319689, 9.618507, 5.180066, 31.092392, 55.915608, 32.411408, 68.115874, 37.580163, 41.501453, 24.354857, 62.622151, 92.092508, 79.947334, 39.951347, 89.867542, 62.852632, 56.247784, 71.501146, 9.471247, 52.428867, 22.062848, 21.895495, 4.720079, 26.387451, 61.787271, 93.609983, 69.413257, 56.893058, 32.853226, 7.670182, 67.115207, 48.225267, 10.939371, 18.776131, 29.455721, 80.395609, 15.855406, 66.731617, 14.826865, 48.447162, 69.359058, 65.236197, 92.593866, 42.522815, 64.902554, 37.777806, 4.342127, 26.017938, 35.925866, 62.881130, 62.374371, 78.693028, 45.803432, 9.714222, 16.879456, 16.424626, 71.572971, 1.487746, 19.013232, 92.990521, 37.725688, 90.707474, 53.803660, 18.808880, 56.520781, 38.626746, 90.722319, 11.711976, 60.175020, 15.405504, 60.476746, 6.875524, 34.030664, 33.549110, 24.338164, 60.117946, 9.945762, 52.910169, 88.590151, 48.453344, 65.198527, 64.281895, 93.826051, 49.333161, 52.461729, 11.133402, 74.912852, 64.133558, 47.955407, 20.102928, 46.782867, 88.470809, 38.062995, 71.668767, 4.192500, 26.876645, 73.729424, 59.794653, 42.496051, 81.652829, 67.044895, 4.273915, 81.492546, 13.910746, 2.115373, 45.643756, 83.546128, 82.317003, 1.234300, 8.105614, 54.952226, 58.138469, 17.115883, 13.010329, 30.755979, 9.489461, 63.673235, 37.394293, 55.566345, 69.660490, 65.022645, 56.298214, 87.633285, 89.168511, 62.181935, 48.555856, 24.012798, 40.534088, 63.094945, 3.117868, 17.815608, 41.264364, 29.251486, 81.151466, 60.537055, 78.092262, 77.963140, 44.784508, 67.491595, 38.512758, 12.580579, 27.072205, 42.310082, 3.787799, 41.148904, 45.007934, 80.130493, 79.090971, 3.313299, 23.644689, 61.182808, 25.309362, 85.753714, 29.154239, 8.495682, 56.237478, 28.102210, 32.392202, 70.924133, 50.047726, 22.013187, 3.328816, 71.365402, 40.545034, 89.576639, 18.655808, 12.483946, 36.234338, 27.479618, 93.063369, 92.484091, 29.697626, 22.005062, 38.493750, 91.022058, 64.490175, 26.134301, 12.307413, 69.371810, 75.789600, 53.925774, 60.229851, 41.434382, 16.705851, 43.835179, 2.648100, 81.433785, 31.820874, 54.651318, 22.031102, 27.585217, 61.380050, 25.874032, 41.955727, 90.809910, 17.875541, 69.625077, 51.761962, 90.655838, 41.613784, 11.811735, 35.935908, 13.470954, 92.717705, 39.209569, 45.227388, 56.912094, 36.398665, 59.853878, 16.727207, 76.614089, 18.133984, 81.832318, 30.301453, 29.460334, 14.677577, 41.084332, 44.502002, 56.445983, 75.302587, 14.679176, 82.923230, 80.654533, 72.967289, 37.685810, 42.015797, 24.887103, 61.540801, 91.197626, 74.503619, 35.364941, 9.046183, 52.058682, 5.689835, 30.144572, 0.756336, 14.460881, 72.163938, 8.711588, 66.898586, 93.048080, 39.866278, 91.552966, 33.594186, 30.322379, 33.890166, 13.128786, 86.487567, 54.090461, 93.151400, 39.853121, 2.628623, 66.533233, 52.338760, 76.531257, 45.828678, 58.072142, 19.958939, 90.626958, 19.586590, 10.495487, 65.191212, 76.320611, 22.251642, 44.448768, 4.897212, 48.804044, 77.282118, 40.221700, 39.271278, 17.634712, 4.633774, 16.703855, 81.502966, 91.258634, 57.552956, 36.420708, 31.159109, 90.061639, 57.683570, 46.422158, 43.675776, 43.759579, 51.623234, 28.729191, 54.598089, 20.173174, 41.083156, 26.501394, 35.197179, 31.225730, 87.984906, 47.532773, 32.534760, 69.298728, 7.845574, 58.611484, 89.862025, 53.143815, 75.903369, 86.347247, 80.414608, 11.047015, 31.777972, 86.107324, 41.074248, 31.906309, 39.850605, 63.226691, 62.245825, 36.319801, 61.702649, 39.802704, 88.692738, 76.664894, 79.945739, 80.057734, 58.064211, 93.684344, 26.609242, 25.503756, 32.071656, 88.542704, 2.703364, 84.321563, 57.171844, 3.566507, 76.506873, 54.755309, 83.255059, 76.643941, 14.099081, 3.977580, 1.461464, 2.766083, 67.917170, 34.754624, 38.176836, 44.904924, 27.389248, 50.575086, 87.594683, 35.437235, 81.515267, 25.241307, 88.811825, 89.367733, 85.851159, 73.404158, 35.712236, 13.574416, 41.016015, 52.902958, 41.839918, 51.136168, 16.878814, 85.083071, 14.021903, 41.663564, 34.076614, 63.689146, 35.463576, 35.963998, 23.143781, 74.663619, 55.482613, 71.816213, 57.372746, 35.125011, 9.051200, 72.497730, 54.246249, 76.267687, 91.312463, 1.241412, 87.491264, 83.216756, 15.331311, 84.821042, 7.515442, 43.312869, 61.833998, 3.885452, 21.491101, 20.756756, 47.215195, 93.326699, 13.497211, 83.025452, 47.023549, 7.054037, 59.698803, 69.979645, 80.743909, 78.567369, 84.360501, 19.969203, 83.594928, 70.440315, 54.405145, 89.560143, 35.014586, 50.543159, 70.036011, 77.702025, 82.062591, 44.863679, 52.905659, 48.197238, 44.920673, 52.618118, 27.674292, 10.788555, 37.675769, 86.250931, 76.697739, 11.980516, 46.493658, 62.696557, 89.131164, 72.943156, 35.080384, 64.745591, 23.616324, 4.298242, 13.942509, 5.923370, 20.125999, 74.335103, 87.486605, 57.326099, 6.823665, 38.024882, 60.088971, 90.528266, 74.360228, 91.902503, 49.051150, 43.541624, 91.110153, 34.644594, 51.685061, 20.657555, 36.379176, 27.450957, 32.904572, 90.970684, 64.120544, 41.722268, 84.510476, 7.911226, 90.174769, 2.243633, 3.519815, 85.323964, 13.487327, 8.643039, 91.765405, 49.885538, 23.591876, 53.054251, 67.682167, 63.391667, 8.766637, 4.962827, 3.547713, 2.891095, 44.260331, 57.521848, 14.590302, 48.063788, 13.691262, 93.446317, 17.016817, 78.711346, 76.202163, 37.289369, 28.982673, 92.570072, 61.513478, 68.737888, 53.240122, 52.951378, 56.471446, 36.325927, 88.593703, 8.226975, 8.880622, 87.545811, 36.535095, 61.442502, 64.179717, 84.199220, 91.484948, 54.282778, 41.180057, 20.854217, 9.322700, 10.447328, 72.085062, 8.907232, 30.916021, 86.144010, 15.877172, 66.467874, 23.945635, 55.400973, 34.866434, 61.351971, 50.859722, 65.706961, 40.733339, 66.361519, 12.839118, 68.934779, 3.483837, 12.900745, 65.639891, 27.432364, 43.150642, 22.280948, 11.270651, 56.579872, 87.615895, 14.088917, 72.451425, 9.300168, 82.097517, 32.423812, 44.155996, 41.534646, 6.484600, 53.279955, 65.941861, 65.654360, 13.700438, 27.037481, 34.123560, 56.977303, 90.922607, 64.927615, 35.860399, 26.362489, 86.494401, 76.183366, 35.271471, 37.172142, 77.150263, 84.901926, 73.471151, 82.697590, 63.385819, 46.928624, 62.104273, 79.340868, 44.798696, 24.367204, 81.872536, 39.931557, 26.529060, 56.970090, 50.279079, 1.579984, 34.620645, 69.075790, 62.079689, 72.432004, 10.666823, 85.094952, 33.215827, 89.062126, 53.358067, 83.840486, 64.110048, 14.852598, 75.970165, 69.124132, 75.195767, 8.000174, 0.957683, 32.033871, 79.487358, 74.920533, 85.218376, 50.139047, 20.223043, 0.652882, 57.263421, 85.329544, 81.874894, 51.149558, 92.145802, 78.804803, 70.710170, 27.890310, 33.271029, 40.877534, 70.502497}, 624, output, 95);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 95; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [4, 5, 8, 10, 9, 3, 4, 5, 10, 9, 5, 6, 6, 10, 9, 5, 6, 6, 4, 5, 8, 2, 6, 5, 6, 4, 8, 10, 3, 5, 5, 6, 8, 5, 7, 13, 8, 9, 7, 8, 6, 15, 5, 6, 10, 5, 4, 4, 7, 3, 7, 5, 9, 7, 10, 4, 11, 7, 4, 3, 6, 9, 9, 6, 9, 8, 5, 5, 3, 10, 5, 5, 8, 3, 7, 5, 10, 4, 5, 6, 6, 9, 5, 6, 6, 7, 6, 7, 8, 8, 10, 9, 7, 8, 0]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 95; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 8: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST8(void)
{
    // informacje o teście
    test_start(8, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {2, 6, 6};
                int output[] = {-1, 0, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){3.273666, 1.176377, 8.582959, 7.689587, 7.500567, 7.570834, 5.411201, 6.937581, 1.200751, 7.146269, 9.103877, 0.898193, 3.924651, 5.925226, 0.626792, 8.363926, 2.186387, 5.431851, 2.783268, 8.449946, 1.674101, 10.182223, 6.881651, 10.023792, 10.134348, 4.658053, 7.771028, 6.001920, 10.525417, 4.277715, 1.573958, 1.663959, 1.486714, 5.949885, 5.918046, 8.115269, 3.209141, 6.567450, 10.122041, 4.852866, 2.650854, 10.666236, 4.408382, 9.245279, 7.439480, 7.859759, 4.275311, 9.779434, 6.057466, 6.621724, 3.419219, 3.114902, 2.639996, 2.667264, 2.594199, 3.673313}, 56, output, 3);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 3; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [2, 6, 6]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 3; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 9: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST9(void)
{
    // informacje o teście
    test_start(9, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0};
                int output[] = {-1, 2, 2, -1, -1, 0, 2, -1, 2, 0, 1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){8.823663}, 1, output, 11);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 11; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 11; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 10: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST10(void)
{
    // informacje o teście
    test_start(10, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    
        
                const int expected_array[] = {5};
                int output[] = {2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){4.561798, 1.295565, 1.988604, 1.059511, 10.263003, 0.342784, 5.371031, 10.853686, 3.001022, 0.796543, 2.791917, 10.514878, 10.008464, 2.462594, 8.348674, 0.304616, 8.002494, 10.272409, 4.523096, 2.218900, 7.110524, 1.983820, 2.769366, 6.985232, 5.783767, 3.025335, 8.401624, 5.164200, 9.741354, 3.084410, 7.690273, 0.705229, 8.381766, 0.308674, 9.366011, 9.770489, 4.906425, 2.692625, 6.433775, 1.172657, 3.052562, 1.442362, 3.468735, 4.511203, 2.706786, 6.533671, 3.387005, 6.854544, 2.269442}, 49, output, 1);
                printf("#####END#####");
                test_error(res == 0, "Funkcja create_histogram() powinna zwrócić 0, a zwróciłą %d", res);


                int ok = 0;        
                for (int i = 0; i < 1; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [5]\n");

                    printf("\nTablica po wywołaniu funkcji create_histogram: ");

                    for (int i = 0; i < 1; ++i)
                        printf("%d ", output[i]);            

                    printf("\n");

                    test_error(ok == 0, "Funkcja create_histogram() niepoprawnie wypełniła tablicę");
                }


            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 11: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST11(void)
{
    // informacje o teście
    test_start(11, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            printf("#####START#####");
            int res = create_histogram((float[]){1.562668, 7.928497}, 14, NULL, 16);
            printf("#####END#####");
            test_error(res == 1, "Funkcja create_histogram() powinna zwrócić 1, a zwróciłą %d", res);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 12: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST12(void)
{
    // informacje o teście
    test_start(12, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int output[] = {-2, 2, 0, 1, 0, 0, 0, 2, 2, 0, 2};

            printf("#####START#####");
            int res = create_histogram(NULL, 12, output, 18);
            printf("#####END#####");
            test_error(res == 1, "Funkcja create_histogram() powinna zwrócić 1, a zwróciłą %d", res);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 13: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST13(void)
{
    // informacje o teście
    test_start(13, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int output[] = {-2, 2, 0, 1, 0, 0, 0, 2, 2, 0, 2};

            printf("#####START#####");
            int res = create_histogram((float[]){1.562668, 7.928497}, 0, output, 11);
            printf("#####END#####");
            test_error(res == 1, "Funkcja create_histogram() powinna zwrócić 1, a zwróciłą %d", res);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 14: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST14(void)
{
    // informacje o teście
    test_start(14, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int output[] = {-2, 2, 0, 1, 0, 0, 0, 2, 2, 0, 2};

            printf("#####START#####");
            int res = create_histogram((float[]){1.562668, 7.928497}, 13, output, 0);
            printf("#####END#####");
            test_error(res == 1, "Funkcja create_histogram() powinna zwrócić 1, a zwróciłą %d", res);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 15: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST15(void)
{
    // informacje o teście
    test_start(15, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int output[] = {-2, 2, 0, 1, 0, 0, 0, 2, 2, 0, 2};

            printf("#####START#####");
            int res = create_histogram((float[]){1.562668, 7.928497}, -12, output, 19);
            printf("#####END#####");
            test_error(res == 1, "Funkcja create_histogram() powinna zwrócić 1, a zwróciłą %d", res);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 16: Sprawdzanie poprawności działania funkcji create_histogram
//
void UTEST16(void)
{
    // informacje o teście
    test_start(16, "Sprawdzanie poprawności działania funkcji create_histogram", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int output[] = {-2, 2, 0, 1, 0, 0, 0, 2, 2, 0, 2};

            printf("#####START#####");
            int res = create_histogram((float[]){1.562668, 7.928497}, 17, output, -14);
            printf("#####END#####");
            test_error(res == 1, "Funkcja create_histogram() powinna zwrócić 1, a zwróciłą %d", res);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 17: Sprawdzanie poprawności działania funkcji display
//
void UTEST17(void)
{
    // informacje o teście
    test_start(17, "Sprawdzanie poprawności działania funkcji display", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    


                int tab[] = {0, 5, 6, -4, 4, 1};

        //-------------1-----------------------
                printf("\n***TEST 1***\n\n");
                printf("***START***\n");
                display_vector(tab, 0);
                printf("***END***\n");


        //-------------2-----------------------

                printf("\n***TEST 2***\n\n");
                printf("***START***\n");
                display_vector(tab, -6);
                printf("***END***\n");

        //-------------3-----------------------

                printf("\n***TEST 3***\n\n");
                printf("***START***\n");
                display_vector(tab, 6);
                printf("***END***\n");

        //-------------4-----------------------

                printf("\n***TEST 4***\n\n");
                printf("***START***\n");
                display_vector(tab, 6 - 1);
                printf("***END***\n");

            onerror_terminate(); // przerwanie wszystkich testów jednostkowych (np. coś jest mocno nie tak z kodem)

            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 18: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST18(void)
{
    // informacje o teście
    test_start(18, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    


                const int expected_result = 7;
                const float expected_array[] = {-1.000000, -2.000000, -1.000000, -8.000000, -7.000000, 7.000000, -6.000000, 0.000000};
                float dest[8]; 
                int result = read_vector_float(dest, 8, 0);           

                test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
                int ok = 0;
                for (int i = 0; i < expected_result; ++i)
                    ok += !(expected_array[i] + 0.001 >= dest[i] && expected_array[i] - 0.001 <= dest[i]);

                test_error(ok == 0, "Funkcja read_vector_float() niepoprawnie pobrałá dane od użytkownika");
                if (ok)
                {
                    printf("Powinno być: [-1.000000, -2.000000, -1.000000, -8.000000, -7.000000, 7.000000, -6.000000, 0.000000]\n");
                    printf("Jest: [");
                    for (int i = 0; i < expected_result - 1; ++i)
                        printf("%f, ", dest[i]);

                    printf("%f] ", dest[expected_result - 1]);

                }

            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 19: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST19(void)
{
    // informacje o teście
    test_start(19, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    


                const int expected_result = 11;
                const float expected_array[] = {10.000000, -7.000000, 0.000000, 1.000000, -5.000000, 0.000000, -10.000000, 2.000000, -9.000000, 3.000000, 8.000000, -3.000000};
                float dest[12]; 
                int result = read_vector_float(dest, 12, -3);           

                test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
                int ok = 0;
                for (int i = 0; i < expected_result; ++i)
                    ok += !(expected_array[i] + 0.001 >= dest[i] && expected_array[i] - 0.001 <= dest[i]);

                test_error(ok == 0, "Funkcja read_vector_float() niepoprawnie pobrałá dane od użytkownika");
                if (ok)
                {
                    printf("Powinno być: [10.000000, -7.000000, 0.000000, 1.000000, -5.000000, 0.000000, -10.000000, 2.000000, -9.000000, 3.000000, 8.000000, -3.000000]\n");
                    printf("Jest: [");
                    for (int i = 0; i < expected_result - 1; ++i)
                        printf("%f, ", dest[i]);

                    printf("%f] ", dest[expected_result - 1]);

                }

            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 20: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST20(void)
{
    // informacje o teście
    test_start(20, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    


                const int expected_result = 0;
                const float expected_array[] = {0.000000};
                float dest[5]; 
                int result = read_vector_float(dest, 5, 0);           

                test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
                int ok = 0;
                for (int i = 0; i < expected_result; ++i)
                    ok += !(expected_array[i] + 0.001 >= dest[i] && expected_array[i] - 0.001 <= dest[i]);

                test_error(ok == 0, "Funkcja read_vector_float() niepoprawnie pobrałá dane od użytkownika");
                if (ok)
                {
                    printf("Powinno być: [0.000000]\n");
                    printf("Jest: [");
                    for (int i = 0; i < expected_result - 1; ++i)
                        printf("%f, ", dest[i]);

                    printf("%f] ", dest[expected_result - 1]);

                }

            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 21: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST21(void)
{
    // informacje o teście
    test_start(21, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    


                const int expected_result = 10;
                const float expected_array[] = {5.000000, 5.000000, 5.000000, 2.000000, -4.000000, 1.000000, -4.000000, 0.000000, 3.000000, 6.000000};
                float dest[10]; 
                int result = read_vector_float(dest, 10, -5);           

                test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
                int ok = 0;
                for (int i = 0; i < expected_result; ++i)
                    ok += !(expected_array[i] + 0.001 >= dest[i] && expected_array[i] - 0.001 <= dest[i]);

                test_error(ok == 0, "Funkcja read_vector_float() niepoprawnie pobrałá dane od użytkownika");
                if (ok)
                {
                    printf("Powinno być: [5.000000, 5.000000, 5.000000, 2.000000, -4.000000, 1.000000, -4.000000, 0.000000, 3.000000, 6.000000]\n");
                    printf("Jest: [");
                    for (int i = 0; i < expected_result - 1; ++i)
                        printf("%f, ", dest[i]);

                    printf("%f] ", dest[expected_result - 1]);

                }

            
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 22: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST22(void)
{
    // informacje o teście
    test_start(22, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int expected_result = -1;
            float dest[7]; 
            printf("#####START#####");
            int result = read_vector_float(dest, 0, 3);           
            printf("#####END#####");

            test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 23: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST23(void)
{
    // informacje o teście
    test_start(23, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int expected_result = -1;
            float dest[5]; 
            printf("#####START#####");
            int result = read_vector_float(dest, -3, -6);           
            printf("#####END#####");

            test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}

//
//  Test 24: Sprawdzanie poprawności działania funkcji read_vector_float
//
void UTEST24(void)
{
    // informacje o teście
    test_start(24, "Sprawdzanie poprawności działania funkcji read_vector_float", __LINE__);

    // uwarunkowanie zasobów - pamięci, itd...
    test_file_write_limit_setup(33554432);
    rldebug_reset_limits();
    
    //
    // -----------
    //
    

            int expected_result = -1; 
            printf("#####START#####");
            int result = read_vector_float(NULL, -10, -3);           
            printf("#####END#####");

            test_error(result == expected_result, "Funkcja read_vector_float() powinna zwrócić %d, a zwróciła %d", expected_result, result);
        
    //
    // -----------
    //

    // przywrócenie podstawowych parametów przydzielania zasobów (jeśli to tylko możliwe)
    rldebug_reset_limits();
    test_file_write_limit_restore();
    
    test_ok();
}




enum run_mode_t { rm_normal_with_rld = 0, rm_unit_test = 1, rm_main_test = 2 };

int __wrap_main(volatile int _argc, char** _argv, char** _envp)
{
    int volatile vargc = _argc;
    char ** volatile vargv = _argv, ** volatile venvp = _envp;
    volatile enum run_mode_t run_mode = rm_unit_test; // -1
    volatile int selected_test = -1;

    if (vargc > 1)
    {
        char* smode = strtok(vargv[1], ",");
        char* stest = strtok(NULL, "");
        char *errptr = NULL;
        run_mode = (enum run_mode_t)strtol(smode, &errptr, 10);
        if (*errptr == '\x0')
        {
            memmove(vargv + 1, vargv + 2, sizeof(char*) * (vargc - 1));
            vargc--;

            if (stest != NULL)
            {
                int val = (int)strtol(stest, &errptr, 10);
                if (*errptr == '\x0')
                    selected_test = val;
            }
        }
    }

    // printf("runmode=%d; selected_test=%d\n", run_mode, selected_test);

    // inicjuj testy jednostkowe
    unit_test_init(run_mode, "unit_test_v2.c");
    test_limit_init();
    rldebug_set_reported_severity_level(MSL_FAILURE);

    if (run_mode == rm_normal_with_rld)
    {
        // konfiguracja ograniczników
        rldebug_reset_limits();
        

        // uruchom funkcję main Studenta a potem wyświetl podsumowanie sterty i zasobów
        volatile int ret_code = rdebug_call_main(tested_main, vargc, vargv, venvp);

        rldebug_reset_limits();
        

        int leaks_detected = rldebug_show_leaked_resources(0);
        if (leaks_detected)
            raise(SIGHEAP);

        return ret_code;
    }

    
    if (run_mode == rm_unit_test)
    {
        test_title("Testy jednostkowe");

        void (*pfcn[])(void) =
        { 
            UTEST1, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST2, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST3, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST4, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST5, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST6, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST7, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST8, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST9, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST10, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST11, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST12, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST13, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST14, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST15, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST16, // Sprawdzanie poprawności działania funkcji create_histogram
            UTEST17, // Sprawdzanie poprawności działania funkcji display
            UTEST18, // Sprawdzanie poprawności działania funkcji read_vector_float
            UTEST19, // Sprawdzanie poprawności działania funkcji read_vector_float
            UTEST20, // Sprawdzanie poprawności działania funkcji read_vector_float
            UTEST21, // Sprawdzanie poprawności działania funkcji read_vector_float
            UTEST22, // Sprawdzanie poprawności działania funkcji read_vector_float
            UTEST23, // Sprawdzanie poprawności działania funkcji read_vector_float
            UTEST24, // Sprawdzanie poprawności działania funkcji read_vector_float
            NULL
        };

        for (int idx = 0; pfcn[idx] != NULL && !test_get_session_termination_flag(); idx++)
        {
            if (selected_test == -1 || selected_test == idx + 1)
                pfcn[idx]();

            // limit niezaliczonych testów, po jakim testy jednostkowe zostaną przerwane
            if (test_session_get_fail_count() >= 1000)
                test_terminate_session();
        }


        test_title("RLDebug :: Analiza wycieku zasobów");
        // sprawdź wycieki pamięci
        int leaks_detected = rldebug_show_leaked_resources(1);
        test_set_session_leaks(leaks_detected);

        // poinformuj serwer Mrówka o wyniku testu - podsumowanie
        test_title("Podsumowanie");
        if (selected_test == -1)
            test_summary(24); // wszystkie testy muszą zakończyć się sukcesem
        else
            test_summary(1); // tylko jeden (selected_test) test musi zakończyć się sukcesem
        return EXIT_SUCCESS;
    }
    

    if (run_mode == rm_main_test)
    {
        test_title("Testy funkcji main()");

        void (*pfcn[])(int, char**, char**) =
        { 
            NULL
        };

        for (volatile int idx = 0; pfcn[idx] != NULL && !test_get_session_termination_flag(); idx++)
        {
            if (selected_test == -1 || selected_test == idx + 1)
                pfcn[idx](vargc, vargv, venvp);

            // limit niezaliczonych testów, po jakim testy jednostkowe zostaną przerwane
            if (test_session_get_fail_count() >= 1000)
                test_terminate_session();
        }


        test_title("RLDebug :: Analiza wycieku zasobów");
        // sprawdź wycieki pamięci
        int leaks_detected = rldebug_show_leaked_resources(1);
        test_set_session_leaks(leaks_detected);

        // poinformuj serwer Mrówka o wyniku testu - podsumowanie
        test_title("Podsumowanie");
        if (selected_test == -1)
            test_summary(0); // wszystkie testy muszą zakończyć się sukcesem
        else
            test_summary(1); // tylko jeden (selected_test) test musi zakończyć się sukcesem

        return EXIT_SUCCESS;
    }

    printf("*** Nieznana wartość RunMode: %d", (int)run_mode);
    abort();
}