BCI-base/test/test_stack.c

35 lines
451 B
C

#include <stdio.h>
#include "../stack.h"
#include <assert.h>
int main(void)
{
bci_stack_t stack = NULL;
int i;
uint16_t res;
char status = 0;
for(i = 0; i < 10; i++)
{
bci_stack_t_push(&stack, (uint16_t) i);
}
--i;
while(!status)
{
status = bci_stack_t_pop(&stack, &res);
if(!status)
{
assert(res == i--);
}
}
for(i = 0; i < 10; i++)
{
bci_stack_t_push(&stack, (uint16_t) i);
}
bci_stack_t_del(&stack);
return 0;
}