Sha256: 9bfc7c861e2a493f333b91f3f2f3267f6b6724bd782d2d6d19095a7e91d201ea

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

#include "../foundationallib.h"
#include <assert.h>
#include <stddef.h>
#include <stdio.h>

FOUNDATIONAL_LIB_FUNC int equal_array_of_longs(const long *array, const long *array2, size_t size)
{
    for (size_t i = 0; i < size; i++)
    {
        if (array[i] != array2[i])
        {
            return 0;
        }
    }
    return 1;
}

int main()
{
    // Test case 1: Arrays are equal
    long array1[] = {1, 2, 3, 4};
    long array2[] = {1, 2, 3, 4};
    assert(equal_array_of_longs(array1, array2, 4) == 1);

    // Test case 2: Arrays are not equal
    long array3[] = {1, 2, 3, 4};
    long array4[] = {1, 2, 3, 5};
    assert(equal_array_of_longs(array3, array4, 4) == 0);

    // Test case 3: Arrays are empty
    long *array5 = NULL;
    long *array6 = NULL;
    assert(equal_array_of_longs(array5, array6, 0) == 1);

    // Test case 4: Arrays have one element and are equal
    long array7[] = {1000};
    long array8[] = {1000};
    assert(equal_array_of_longs(array7, array8, 1) == 1);

    // Test case 5: Arrays have one element and are not equal
    long array9[] = {1000};
    long array10[] = {999};
    assert(equal_array_of_longs(array9, array10, 1) == 0);

    printf("All tests passed successfully!\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_equal_array_of_longs.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_equal_array_of_longs.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_equal_array_of_longs.c