#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h> // for EXIT_FAILURE
/*#include <int_list.h>*/

#include <int_stack.h>
/*#include <stack.h>*/

// Macro to compute length of a C array
#define LEN(x) (sizeof(x)/sizeof(x[0]))

/*
 * Stub test program for the list implementation in list.c.
 *
 * Author: Niclas Borlin (niclas.borlin@cs.umu.se).
 *
 * Version information:
 *   2018-01-28: v1.0.  First public version.
 *   2019-01-23: v1.1.  Added file comment. Removed memory cleanup on failure.
 *   2023-01-21: v2.0.  Complete re-write. Semi-serious attempt at a complete test program for
 *                      int_list.
 *   2023-01-21: v2.01. Updated print identification command.
 *   2023-03-23: v2.1.  Renamed list_pos_are_equal to list_pos_is_equal.
 *   2023-03-23: v2.2.  Removed empty if statements in test code.
 */

#define VERSION "v2.2"
#define VERSION_DATE "2023-03-23"

/*
 * Function to compare the values stored in the list.
 */
bool value_equal(int v1, int v2)
{
    return v1 == v2;
}

/*
 * empty_returns_non_null() - Test that the stack_empty() function returns a non-null pointer.
 * Precondition: None.
 */
void empty_returns_non_null(void)
{
    // Print a starting message
    fprintf(stderr,"Starting empty_returns_non_null()...");

    // create an empty stack
    stack s = stack_empty();
    
    
    // l should be non-NULL
    if (s == NULL) {
        // Fail with error message
        fprintf(stderr, "FAIL: Expected a list pointer, got NULL.\n");
        exit(EXIT_FAILURE);
    }

    // Everything went well, clean up
    fprintf(stderr,"cleaning up...");
    list_kill(s);
    fprintf(stderr,"done.\n");
}



int main(void)
{
    printf("%s, %s %s: Test program for the typed int_stack datatype.\n",
           __FILE__, VERSION, VERSION_DATE);
    printf("Code base version %s.\n\n", CODE_BASE_VERSION);

    empty_returns_non_null();
   

    fprintf(stderr,"\nSUCCESS: Implementation passed all tests. Normal exit.\n");
    return 0;
}
