mirror of
https://github.com/cellos51/balatro-gba.git
synced 2026-09-09 09:26:15 -05:00
42 lines
798 B
C
42 lines
798 B
C
#include "stack.h"
|
|
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
#define STACK_SIZE 64
|
|
|
|
STACK_DEFINE(coolstack, STACK_SIZE)
|
|
|
|
void test_stack(void)
|
|
{
|
|
int int_arr[STACK_SIZE];
|
|
|
|
for(int i = 0; i < STACK_SIZE; i++)
|
|
{
|
|
int_arr[i] = i;
|
|
}
|
|
|
|
for(int i = 0; i < STACK_SIZE; i++)
|
|
{
|
|
stack_push(&coolstack, &int_arr[i]);
|
|
}
|
|
|
|
for(int i = STACK_SIZE - 1; i >= 0; i--)
|
|
{
|
|
assert(*(int*)stack_pop(&coolstack) == i);
|
|
}
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
printf("Testing Stack.\n");
|
|
test_stack();
|
|
|
|
printf("-------------------------------------------------------------------------------\n");
|
|
printf("Stack Tests Passed :)\n");
|
|
printf("-------------------------------------------------------------------------------\n");
|
|
|
|
return 0;
|
|
}
|