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:53.088939
 *
 * 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[] = {2, 0, 0, 1, 2, 1, 0, 1, 0, 1, 0};
                int output[] = {2, -2, -1, 1, 1, 2, 0, -1, -2, -2, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){4.967337, 3.466350, 7.991343, 5.197234, 0.491938, 4.295230, 9.374572, 0.679137}, 8, 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ć: [2, 0, 0, 1, 2, 1, 0, 1, 0, 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 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[] = {7, 6, 7, 9, 6, 3, 7, 5, 8, 7, 6};
                int output[] = {-2, -2, 2, 0, 1, 2, -2, 0, 0, 1, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){10.686575, 6.634749, 10.840967, 4.615006, 2.158166, 8.096098, 8.497495, 4.268879, 9.465057, 7.869469, 2.728436, 0.817316, 2.770059, 2.851716, 0.929933, 10.300020, 4.484198, 1.972232, 8.812176, 0.008086, 0.130953, 6.531064, 7.816841, 6.627117, 2.680153, 2.813067, 5.147882, 9.413658, 9.238314, 7.467336, 3.835558, 3.343182, 10.360313, 9.887973, 9.991252, 0.407072, 6.262527, 1.066199, 10.497659, 4.501716, 3.730293, 8.246685, 5.409735, 3.255846, 7.892849, 1.676755, 9.135442, 1.434933, 1.169622, 3.495017, 8.221714, 8.679772, 8.735040, 3.357017, 6.719809, 1.464922, 5.435348, 0.227046, 9.422938, 7.760726, 4.151157, 3.508646, 4.295218, 3.117089, 0.507058, 8.711364, 10.622569, 6.697305, 6.301776, 3.881627, 2.715560}, 71, 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ć: [7, 6, 7, 9, 6, 3, 7, 5, 8, 7, 6]\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[] = {8, 11, 11, 14, 17, 15, 14, 11, 11, 14, 9};
                int output[] = {-1, 0, 1, 1, -1, -2, -1, 0, 1, 2, 2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){0.531651, 5.377425, 4.005320, 4.654865, 3.997010, 5.185003, 1.701227, 6.237650, 8.328255, 9.915104, 4.680872, 4.899741, 9.290725, 5.458907, 6.249419, 0.013954, 6.563167, 5.612666, 10.945622, 5.986950, 10.534059, 3.734447, 3.261909, 5.519259, 6.685759, 2.676292, 1.845957, 5.006140, 4.590558, 6.924455, 3.003803, 9.825268, 5.047303, 7.517968, 2.809130, 4.912963, 4.537133, 5.454676, 2.868131, 10.768863, 10.834954, 8.607923, 7.969191, 5.001645, 8.213441, 2.851494, 6.628272, 10.120087, 4.350666, 8.638504, 8.266526, 9.024908, 8.032532, 2.933996, 4.882445, 7.217413, 9.130529, 8.362979, 9.059935, 3.926794, 3.410850, 2.232244, 1.789047, 5.914230, 6.655980, 4.428291, 1.785807, 1.388199, 4.069148, 7.625238, 3.694001, 9.824764, 10.404396, 8.999642, 0.714486, 7.466518, 0.316621, 5.066579, 1.330163, 6.623576, 7.855533, 4.761322, 2.887514, 3.892651, 10.395802, 1.246357, 5.478258, 5.852931, 9.582516, 4.312695, 10.571748, 2.198634, 6.876693, 10.557036, 2.607288, 9.094625, 4.442491, 1.811995, 3.714559, 7.448266, 2.425652, 9.380474, 6.775243, 8.994069, 3.043738, 8.849942, 6.279463, 0.334987, 7.773866, 0.110558, 4.187104, 7.014598, 2.313945, 9.423816, 6.927620, 5.641061, 3.944730, 1.641697, 7.942186, 9.835414, 1.899544, 8.399258, 6.636249, 6.972376, 4.812824, 9.842544, 3.593306, 7.313166, 3.775730, 4.911713, 9.727711, 0.196016, 0.712051, 1.983194, 3.986737}, 135, 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ć: [8, 11, 11, 14, 17, 15, 14, 11, 11, 14, 9]\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, 1, 0, 1, 1, 0, 1, 0};
                int output[] = {-2, 1, 1, 0, -1, 2, 1, -2, 1, 2, -1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){9.186731, 6.025671, -9.937258, 4.276526, 7.802845, -4.381363, -2.017401, -7.778521, -8.320345}, 9, 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, 1, 0, 1, 1, 0, 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[] = {3, 3, 4, 3, 3, 3, 2, 1, 2, 5, 0};
                int output[] = {-1, 1, 2, 1, 2, -2, 1, -1, 0, 0, 1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){1.957987, -0.143909, 9.207287, -8.028548, 5.054553, 6.068298, -0.141579, 2.124559, 9.123876, 8.365494, -8.640763, -0.049840, 0.608856, -1.501180, -6.674539, -3.291387, 4.208376, -9.380799, -6.177078, 6.251078, 0.714598, 3.775939, 1.399400, -0.875771, 2.064614, 1.756962, 4.648652, 9.338198, -5.501801, 5.801279, -4.129038, 8.800813, -0.931709, -5.054633, -5.572575, -2.215764, -1.313360, -0.110349, -1.117128, 9.205925, -4.778340, -1.766080, -8.107248, 2.642558, -8.018410, 3.861423, 0.548261, 3.168399, -4.041465, -8.944532, 2.750196, -8.729546, -6.649406, 4.176047, -4.421491, -8.583100, 9.416410, -3.626611, -6.860683, -9.709307, 7.951222, 5.238407, -6.759990, -3.132155, -5.683076, -7.177303}, 66, 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ć: [3, 3, 4, 3, 3, 3, 2, 1, 2, 5, 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[] = {3, 2, 6, 8, 3, 3, 4, 3, 5, 4, 4, 3, 5, 5, 2, 4, 8, 4, 5, 3, 0};
                int output[] = {0, 1, 1, 0, 0, 1, 1, 1, 0, -1, -1, -1, 0, 0, 2, 1, -1, -2, 1, 1, -1};
        
                printf("#####START#####");
                int res = create_histogram((float[]){3.835383, 1.325516, 3.441337, 16.512138, 3.774229, 8.659329, 18.201714, 19.585664, 19.671291, 0.714353, 2.781063, 10.482950, 9.322724, 16.944180, 17.555817, 7.716914, 8.007926, 1.677119, 11.560772, 7.599799, 6.984508, 8.736698, 17.222024, 13.123064, 16.037398, 3.456150, 0.553665, 16.817160, 9.017122, 9.575345, 18.368455, 18.644888, 4.842830, 5.420284, 15.837230, 2.744366, 11.680892, 3.462304, 5.173350, 0.888705, 13.426902, 2.262253, 2.174549, 6.730694, 12.701083, 10.401230, 4.973916, 2.778052, 6.135012, 7.599683, 10.933908, 2.450355, 4.825623, 8.292728, 6.083690, 14.687510, 15.844749, 13.762737, 5.083734, 18.007661, 3.403438, 15.624112, 17.248902, 18.839898, 3.651415, 17.186180, 12.002978, 11.206353, 13.512898, 16.723220, 19.736344, 8.097146, 10.176856, 14.080279, 13.252904, 3.890849, 16.340994, 15.069116, 16.250914, 12.974478, 12.551668, 16.832974, 12.712529, 9.877938}, 84, 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ć: [3, 2, 6, 8, 3, 3, 4, 3, 5, 4, 4, 3, 5, 5, 2, 4, 8, 4, 5, 3, 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[] = {10, 15, 5, 13, 14, 11, 10, 16, 8, 10, 12, 14, 13, 5, 12, 15, 11, 12, 9, 13, 13, 9, 9, 8, 11, 13, 12, 13, 15, 12, 9, 11, 12, 9, 17, 13, 20, 9, 13, 14, 11, 12, 9, 4, 8, 12, 15, 7, 12, 12, 13, 10, 6, 8, 10, 12, 18, 6, 9, 12, 15, 7, 8, 14, 12, 10, 7, 16, 7, 7, 13, 7, 10, 6, 8, 9, 8, 10, 21, 14, 15, 8, 7, 10, 13, 13, 0};
                int output[] = {1, -1, 1, 0, 2, -2, 0, 2, -2, 2, 0, -2, 1, 0, 1, 2, 2, -2, -1, 2, 0, 1, -2, -1, 2, -1, -1, -1, 1, 0, 0, 1, -2, 0, 0, 2, 0, 2, 2, 2, -1, 0, 1, -1, 2, -1, 1, -1, 2, 1, 2, -2, 0, 0, 1, -1, -1, -1, 1, 0, 0, 0, 2, -1, 1, -2, -2, -2, 2, 0, -2, 1, -1, -1, 2, 1, -1, -2, -2, 1, 1, 2, -2, 0, 1, 0, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){30.982785, 32.656811, 4.343573, 78.731690, 64.583782, 66.542124, 8.605938, 74.428435, 80.213810, 84.743258, 25.633653, 54.538927, 14.851387, 10.625880, 46.643770, 37.430521, 7.932750, 36.810176, 61.432443, 31.843379, 32.843072, 7.997361, 41.686462, 22.617989, 67.082629, 10.270802, 45.888997, 80.390912, 20.199752, 34.146449, 67.728079, 7.983003, 35.484339, 50.932136, 40.931323, 71.573593, 84.085828, 60.836672, 56.286603, 32.941084, 25.515029, 82.199040, 81.499460, 50.071062, 36.183703, 15.934801, 26.749572, 30.658996, 7.979445, 45.696910, 75.797534, 2.219617, 42.013321, 78.125276, 78.708096, 22.140019, 80.110808, 38.790706, 8.761292, 31.242659, 84.488058, 33.376464, 60.702074, 26.634788, 58.819133, 41.918424, 12.366561, 1.424301, 56.740625, 32.149509, 26.740278, 37.507192, 28.086555, 33.062626, 80.282333, 67.717494, 56.001967, 14.808003, 45.826162, 23.498533, 55.125158, 21.092898, 19.563934, 33.130491, 59.264168, 83.937088, 39.541669, 5.924914, 7.385746, 83.930488, 56.386812, 15.125930, 85.824248, 67.423997, 11.660521, 11.958973, 10.920485, 36.533612, 23.093798, 36.713590, 19.081707, 28.740325, 5.031552, 20.179863, 28.739358, 51.090413, 45.306686, 54.771558, 60.874540, 43.951614, 5.581888, 43.594011, 46.917393, 2.198627, 17.937137, 0.384334, 13.616196, 77.542719, 79.757810, 12.897165, 32.343981, 50.386604, 35.523753, 38.841351, 29.092308, 17.726494, 18.041738, 19.365736, 20.183654, 31.403245, 8.855197, 34.647965, 70.359216, 5.540074, 22.171676, 37.952079, 50.967466, 31.581399, 39.401697, 78.068086, 72.111132, 41.066268, 85.235932, 30.399851, 34.493457, 57.017192, 20.627101, 25.285217, 14.948498, 70.190613, 9.548679, 0.668697, 62.685579, 59.026904, 40.404380, 10.676497, 46.520334, 85.182327, 72.073738, 15.356088, 34.450264, 83.495772, 8.736321, 34.202554, 38.285953, 12.826962, 85.352220, 54.862492, 25.772455, 28.573979, 60.838908, 53.796249, 81.272302, 29.888767, 49.480025, 35.248639, 21.605413, 47.908555, 36.294485, 48.325996, 38.953688, 67.640927, 81.385478, 21.095967, 80.164256, 71.451775, 10.813392, 83.576952, 47.167285, 18.045684, 66.282868, 15.774510, 35.510788, 19.074752, 54.726036, 7.457315, 61.894496, 78.310067, 37.761293, 57.159953, 62.007507, 30.695470, 50.302569, 85.489766, 0.735654, 34.132952, 19.536666, 46.264789, 45.661152, 13.587820, 19.025116, 2.902763, 20.220724, 21.719316, 69.574498, 8.060218, 17.921745, 36.880089, 15.931941, 37.570633, 29.948560, 83.929299, 10.150445, 7.809337, 44.038467, 50.246808, 42.921753, 19.635354, 75.018887, 55.260300, 7.133208, 69.542852, 81.829164, 1.224378, 10.324082, 39.123447, 32.126686, 76.296491, 79.686714, 80.727804, 1.157870, 74.442036, 58.652186, 51.549063, 32.479102, 63.851590, 55.719146, 79.595504, 85.694039, 32.354815, 60.043578, 70.782526, 64.294776, 48.515446, 28.433756, 59.483138, 36.803311, 4.975507, 28.251269, 29.485636, 37.417297, 79.259254, 76.807487, 60.642901, 11.385265, 3.427208, 12.275573, 4.530807, 40.423155, 67.811499, 14.708244, 68.206936, 71.959117, 67.711216, 56.424909, 36.520753, 31.863621, 27.977645, 0.003327, 34.272131, 28.141267, 49.213035, 14.679497, 38.168424, 11.460866, 0.638563, 65.987822, 51.786381, 4.071775, 76.376404, 70.071677, 48.468169, 83.423948, 73.750131, 3.999288, 20.101295, 60.130911, 26.741699, 78.389256, 48.027281, 58.225072, 17.174748, 5.553575, 36.788916, 29.170994, 70.655554, 60.285656, 56.047017, 81.712422, 32.961363, 28.147063, 59.421546, 45.665788, 12.951548, 75.369864, 39.173630, 32.744162, 16.314818, 20.886246, 63.397933, 21.089410, 34.384506, 79.970672, 8.389539, 26.891008, 43.679221, 22.831020, 60.033627, 30.920477, 85.130287, 34.574602, 4.832146, 67.580044, 63.448563, 5.524578, 33.825355, 29.102770, 80.933868, 34.631248, 57.923120, 47.588923, 42.306785, 39.111972, 79.698052, 61.218438, 15.078427, 60.064566, 25.660252, 29.163688, 37.237942, 67.977905, 36.746557, 66.574990, 84.707981, 26.021161, 63.599993, 7.927134, 61.592592, 36.031181, 82.494972, 50.594791, 46.960901, 32.388520, 50.135736, 59.695040, 40.369975, 58.187058, 34.459721, 55.434355, 69.944278, 13.216738, 49.428303, 65.633924, 62.855961, 63.891880, 3.629887, 51.699160, 64.659829, 68.025443, 6.687408, 49.096103, 35.994698, 24.755264, 56.764489, 78.653793, 84.282011, 46.254329, 25.619084, 49.263570, 63.553939, 25.878804, 18.980015, 40.277788, 54.177240, 1.688506, 82.113075, 12.514001, 82.257313, 68.600785, 40.204767, 57.429746, 23.941061, 67.290391, 12.516691, 41.962667, 58.772416, 77.302480, 36.293829, 54.381526, 57.705152, 31.163904, 2.614258, 72.587487, 50.830510, 35.235316, 78.897153, 11.643708, 50.532250, 8.102966, 16.208483, 9.510158, 23.749386, 16.958218, 10.352611, 65.463201, 44.321512, 75.882825, 20.872971, 78.010974, 12.543780, 9.610539, 19.052037, 67.749418, 81.794651, 14.818296, 48.842791, 44.551360, 82.512614, 64.321358, 39.426708, 50.200469, 41.246919, 4.146650, 33.751100, 27.947165, 6.981668, 3.622966, 6.024808, 49.454488, 10.467583, 40.626414, 33.634501, 22.715120, 67.099937, 35.369747, 72.842654, 73.158487, 43.237504, 28.307996, 9.672118, 9.117189, 19.839300, 38.746060, 13.489558, 34.027928, 68.749664, 53.978397, 15.435429, 64.200955, 12.190408, 46.587917, 49.518969, 25.249537, 82.980255, 14.711848, 67.225213, 38.895476, 74.070205, 24.481906, 48.427257, 38.877741, 84.067717, 11.728203, 81.085594, 52.935178, 53.695983, 0.813946, 59.115226, 62.026209, 72.856530, 3.185416, 25.812368, 45.832487, 18.101107, 51.822338, 9.900439, 75.464913, 81.176253, 11.894190, 36.906863, 47.427060, 38.451926, 41.292743, 85.298639, 25.365827, 73.621224, 56.043310, 3.914327, 3.481405, 39.587460, 6.721868, 64.432828, 65.534763, 65.556115, 69.155457, 75.929577, 4.911050, 38.165947, 14.084897, 84.185568, 12.710969, 24.106955, 59.298442, 16.521931, 75.619465, 7.190884, 25.767584, 1.373162, 27.192231, 29.044146, 71.074817, 64.415597, 56.574973, 53.756387, 11.325740, 10.964748, 12.900277, 68.725116, 77.974047, 11.429963, 45.191927, 42.231964, 28.927956, 34.136937, 79.981443, 27.828224, 74.642677, 16.874133, 85.964018, 0.699451, 30.306770, 56.072508, 8.960621, 15.186132, 55.896190, 61.286449, 17.328512, 84.043087, 26.243972, 39.262150, 3.187844, 70.473960, 20.797469, 5.828695, 1.093799, 29.901430, 22.570863, 39.327361, 46.736685, 20.922258, 19.999351, 31.061211, 79.619077, 79.490569, 79.241256, 6.789615, 61.504382, 42.274783, 18.533942, 47.061787, 84.353746, 16.231186, 23.517670, 15.785373, 52.846052, 24.155832, 80.091358, 53.939829, 67.589650, 64.531041, 63.184788, 39.885518, 33.019089, 77.909017, 83.374468, 4.489603, 72.212035, 63.852900, 53.000520, 20.790510, 60.865810, 58.965767, 37.891440, 83.727636, 61.467107, 65.445938, 60.061572, 19.619016, 83.854509, 22.320138, 72.497504, 80.085784, 54.571218, 73.057169, 51.042207, 77.703252, 44.066272, 55.693411, 56.925778, 63.350941, 18.471400, 14.815188, 24.064620, 78.313757, 38.092884, 27.849026, 35.375379, 11.135317, 6.894466, 23.971048, 42.404506, 15.827379, 4.798810, 84.841395, 5.429259, 28.470558, 42.885481, 15.801436, 63.162097, 26.485483, 64.177825, 27.425796, 49.849021, 33.658653, 78.554140, 27.795329, 16.535327, 4.498694, 55.628671, 77.122115, 3.547735, 17.738362, 24.697827, 15.484212, 48.401339, 3.830373, 52.072929, 34.951046, 76.517947, 58.480905, 78.640230, 17.240062, 65.164132, 17.426401, 39.280875, 69.180274, 76.701469, 31.754987, 78.857229, 76.570240, 49.782027, 35.369232, 80.764001, 49.599313, 52.729749, 79.821363, 7.348980, 14.521056, 40.046384, 53.656599, 48.319274, 85.586556, 1.027954, 7.062864, 26.398750, 27.574068, 80.334490, 21.721217, 64.065153, 38.686513, 20.839839, 35.793343, 27.751624, 19.635191, 71.418707, 31.021007, 51.413259, 56.761750, 78.063140, 49.220940, 21.748565, 83.822742, 73.483708, 45.699305, 45.730486, 15.783807, 84.169289, 11.716325, 41.490022, 54.746508, 38.077757, 79.567045, 41.071436, 15.671633, 56.101171, 58.012324, 48.916319, 36.576248, 48.780202, 46.087114, 1.504457, 55.965698, 58.092225, 7.642177, 36.532807, 26.858788, 68.672574, 67.823749, 74.410619, 40.693416, 4.534451, 9.354327, 32.281469, 0.375439, 44.874775, 5.361505, 60.794602, 29.648209, 84.076870, 28.558277, 17.669477, 1.838210, 16.702940, 37.217640, 13.698410, 14.480394, 84.074765, 30.506251, 10.905233, 56.000026, 26.211990, 46.190667, 80.106045, 16.934776, 23.401383, 46.082721, 2.511723, 44.030428, 77.207148, 6.618494, 31.096798, 0.984343, 70.778771, 48.391616, 56.379330, 78.158588, 5.283324, 12.081367, 41.867854, 20.025090, 27.912169, 70.109005, 85.556726, 7.739589, 22.208513, 24.255294, 24.720605, 18.424699, 55.767529, 59.703336, 28.344578, 39.488651, 63.212120, 7.899784, 57.148867, 63.276334, 46.307005, 46.404147, 59.912098, 73.215800, 24.105516, 70.730940, 65.794703, 31.642510, 1.023000, 69.683171, 53.828388, 47.597174, 62.778889, 79.505560, 46.802777, 74.150717, 64.998770, 4.909382, 28.862726, 70.913895, 44.666996, 33.458576, 66.624527, 77.133033, 18.986714, 51.002166, 70.149677, 42.891483, 36.403909, 55.245136, 17.321390, 41.708656, 40.530264, 4.710811, 70.656654, 16.513927, 35.452131, 35.303597, 78.728715, 72.468002, 24.432342, 68.441920, 66.777096, 56.741643, 19.688183, 41.549361, 9.275090, 26.992516, 34.948393, 55.796594, 7.595521, 36.568711, 64.744161, 78.900514, 29.377950, 18.783368, 16.818132, 59.253333, 74.169246, 63.323345, 9.190264, 65.322124, 72.317986, 17.379678, 46.704768, 67.462762, 21.618339, 25.508007, 80.855901, 6.367725, 75.860785, 49.612849, 14.572948, 85.670779, 71.993371, 78.831478, 28.238394, 62.619967, 36.077040, 60.512438, 0.020786, 1.111367, 47.160048, 78.701145, 36.098718, 63.832488, 27.424764, 5.111994, 69.382483, 3.389749, 65.158928, 15.460883, 34.670186, 62.681438, 70.556371, 1.376011, 27.201344, 6.563755, 48.721733, 12.876480, 56.455350, 45.009122, 30.538284, 59.685204, 1.173195, 50.548282, 6.000072, 11.775451, 66.051430, 77.780597, 74.809773, 76.224256, 78.725123, 4.450457, 77.607360, 66.696579, 29.555674, 54.394062, 59.977180, 41.645967, 23.496791, 82.297771, 51.415857, 9.357218, 52.143971, 27.722957, 56.330612, 52.426816, 11.133054, 30.168737, 10.203344, 80.214780, 34.697953, 24.715573, 39.902271, 44.597560, 51.806908, 25.686390, 3.249879, 71.067367, 3.281848, 1.417896, 45.050967, 11.202941, 79.321237, 55.861374, 39.836141, 72.183182, 36.668422, 85.884055, 76.654224, 75.263678, 42.468183, 50.786721, 21.076635, 78.644352, 22.871587, 1.684182, 17.991951, 40.544968, 60.763052, 54.798947, 80.730106, 62.450128, 35.090246}, 951, output, 87);
                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 < 87; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [10, 15, 5, 13, 14, 11, 10, 16, 8, 10, 12, 14, 13, 5, 12, 15, 11, 12, 9, 13, 13, 9, 9, 8, 11, 13, 12, 13, 15, 12, 9, 11, 12, 9, 17, 13, 20, 9, 13, 14, 11, 12, 9, 4, 8, 12, 15, 7, 12, 12, 13, 10, 6, 8, 10, 12, 18, 6, 9, 12, 15, 7, 8, 14, 12, 10, 7, 16, 7, 7, 13, 7, 10, 6, 8, 9, 8, 10, 21, 14, 15, 8, 7, 10, 13, 13, 0]\n");

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

                    for (int i = 0; i < 87; ++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[] = {4, 3, 10, 6};
                int output[] = {1, 2, -1, -2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){8.127359, 8.892032, 10.193411, 2.677477, 3.281925, 6.215261, 7.149908, 8.933853, 9.124890, 0.945722, 6.846494, 2.473108, 0.200317, 1.211434, 6.772518, 8.192413, 9.406793, 9.796260, 5.519041, 2.044837, 2.860447, 0.688950, 6.633956, 6.065674, 0.605261, 8.862676, 7.928048, 2.865406, 8.470138, 9.188834, 3.302407, 8.436575, 6.662100, 6.053907, 9.458286, 3.872834, 9.019677, 6.692527, 1.741158, 2.824271, 2.341595, 9.605811, 7.784817, 3.400767, 10.781570, 9.788129, 9.220107, 2.668090, 4.494327, 3.418956, 1.980423, 5.422970, 2.635208, 5.979908, 3.478801, 7.081417, 6.220247, 2.042306}, 58, output, 4);
                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 < 4; ++i)
                    ok += output[i] != expected_array[i];
                    
                if (ok)
                {         
                    printf("Powinno być: [4, 3, 10, 6]\n");

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

                    for (int i = 0; i < 4; ++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, 1, 0, 0, 0, 0};
                int output[] = {-2, -2, 0, 2, -2, 2, 2, 2, -1, -1, 0};
        
                printf("#####START#####");
                int res = create_histogram((float[]){6.643954}, 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, 1, 0, 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 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[] = {2};
                int output[] = {2};
        
                printf("#####START#####");
                int res = create_histogram((float[]){5.582026, 0.451391, 6.977733, 6.486880, 6.312605, 2.729136, 5.797147, 3.008618, 4.937650, 4.603724, 9.876804, 6.494611, 5.231779, 5.340545, 9.413094, 5.089956, 7.300172, 8.647148, 10.947675, 2.957156, 10.947068, 6.395072, 10.972858, 6.469416, 1.689190, 6.064735, 5.841018, 9.623235, 8.060214, 8.868691, 3.750033, 9.027741, 5.585714, 7.953840, 2.060980, 4.518288, 1.160407, 0.845552, 2.938029, 9.687745, 2.252107, 1.905885, 1.014849, 4.511984}, 44, 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ć: [2]\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[]){4.967337, 3.466350, 7.991343, 5.197234, 0.491938, 4.295230, 9.374572, 0.679137}, 17, NULL, 13);
            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[] = {1, 1, -1, 0, -1, 0, 0, 2, 0, 2, -1};

            printf("#####START#####");
            int res = create_histogram(NULL, 11, output, 12);
            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[] = {1, 1, -1, 0, -1, 0, 0, 2, 0, 2, -1};

            printf("#####START#####");
            int res = create_histogram((float[]){4.967337, 3.466350, 7.991343, 5.197234, 0.491938, 4.295230, 9.374572, 0.679137}, 0, 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 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[] = {1, 1, -1, 0, -1, 0, 0, 2, 0, 2, -1};

            printf("#####START#####");
            int res = create_histogram((float[]){4.967337, 3.466350, 7.991343, 5.197234, 0.491938, 4.295230, 9.374572, 0.679137}, 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[] = {1, 1, -1, 0, -1, 0, 0, 2, 0, 2, -1};

            printf("#####START#####");
            int res = create_histogram((float[]){4.967337, 3.466350, 7.991343, 5.197234, 0.491938, 4.295230, 9.374572, 0.679137}, -19, 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[] = {1, 1, -1, 0, -1, 0, 0, 2, 0, 2, -1};

            printf("#####START#####");
            int res = create_histogram((float[]){4.967337, 3.466350, 7.991343, 5.197234, 0.491938, 4.295230, 9.374572, 0.679137}, 10, output, -17);
            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[] = {-8, 0, -6, 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, -4);
                printf("***END***\n");

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

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

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

                printf("\n***TEST 4***\n\n");
                printf("***START***\n");
                display_vector(tab, 4 - 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 = 10;
                const float expected_array[] = {1.000000, -7.000000, -4.000000, -2.000000, 8.000000, -3.000000, 3.000000, -6.000000, 6.000000, 2.000000, 0.000000};
                float dest[11]; 
                int result = read_vector_float(dest, 11, 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, -7.000000, -4.000000, -2.000000, 8.000000, -3.000000, 3.000000, -6.000000, 6.000000, 2.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 = 9;
                const float expected_array[] = {-9.000000, -10.000000, -5.000000, -7.000000, -3.000000, 0.000000, 0.000000, 7.000000, -10.000000, -1.000000};
                float dest[10]; 
                int result = read_vector_float(dest, 10, -1);           

                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ć: [-9.000000, -10.000000, -5.000000, -7.000000, -3.000000, 0.000000, 0.000000, 7.000000, -10.000000, -1.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 = 9;
                const float expected_array[] = {9.000000, 1.000000, 0.000000, 10.000000, 4.000000, 3.000000, 1.000000, 0.000000, 8.000000};
                float dest[9]; 
                int result = read_vector_float(dest, 9, -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ć: [9.000000, 1.000000, 0.000000, 10.000000, 4.000000, 3.000000, 1.000000, 0.000000, 8.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[8]; 
            printf("#####START#####");
            int result = read_vector_float(dest, 0, -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 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[8]; 
            printf("#####START#####");
            int result = read_vector_float(dest, -10, -5);           
            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, -9, 10);           
            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();
}