Sha256: e3796dc77cd261cad835d332f2531ce028038fad7715f8a895aa42814a12b76d

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

#include "../foundationallib.h"

#include <assert.h>
#include <stddef.h>
#include <stdio.h>
int main()
{
    // Test case 1: Minimum at the beginning of the array
    {
        int arr[] = {1, 2, 3, 4, 5};
        size_t size = sizeof(arr) / sizeof(arr[0]);
        int min = find_min_int_in_array(arr, size);
        assert(min == 1);
    }

    // Test case 2: Minimum at the end of the array
    {
        int arr[] = {5, 4, 3, 2, 1};
        size_t size = sizeof(arr) / sizeof(arr[0]);
        int min = find_min_int_in_array(arr, size);
        assert(min == 1);
    }

    // Test case 3: Minimum in the middle of the array
    {
        int arr[] = {5, 4, 1, 2, 3};
        size_t size = sizeof(arr) / sizeof(arr[0]);
        int min = find_min_int_in_array(arr, size);
        assert(min == 1);
    }

    // Test case 4: Array with only one element
    {
        int arr[] = {5};
        size_t size = sizeof(arr) / sizeof(arr[0]);
        int min = find_min_int_in_array(arr, size);
        assert(min == 5);
    }

    // Test case 5: Array with negative numbers
    {
        int arr[] = {-5, -3, -1, -2, -4};
        size_t size = sizeof(arr) / sizeof(arr[0]);
        int min = find_min_int_in_array(arr, size);
        assert(min == -5);
    }

    // Test case 6: Array with duplicate minimum elements
    {
        int arr[] = {3, 1, 2, 1, 4};
        size_t size = sizeof(arr) / sizeof(arr[0]);
        int min = find_min_int_in_array(arr, size);
        assert(min == 1);
    }

    printf("All test cases passed!\n");
    return 0;
}

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
foundational_lib-1.0.1 ./tests/more/experimental/third_test_suite/non_production_ready_test_suite/test_every_relevant_function_in_a_separate_thorough_program/work_in_progress_code/src/test_find_min_int_in_array.c
foundational_lib2-1.0 ./tests/more/experimental/third_test_suite/non_production_ready_test_suite/test_every_relevant_function_in_a_separate_thorough_program/work_in_progress_code/src/test_find_min_int_in_array.c
foundational_lib-1.0 ./tests/more/experimental/third_test_suite/non_production_ready_test_suite/test_every_relevant_function_in_a_separate_thorough_program/work_in_progress_code/src/test_find_min_int_in_array.c