reload ("func_queue_stack", 1, 1);





################################
# Test for queue
################################
report_msg ("Initializing the queue q1");
queue_init (q1);
tl_step ("queue_init", (queue_length (q1) == 0) ? 0 : -1, "queue length should be 0: "& queue_length (q1));

report_msg ("Adding '50' to q1");
queue_push (q1, 50);

report_msg ("Adding '60' to q1");
queue_push (q1, 60);

tl_step ("queue_length", (queue_length (q1) == 2) ? 0 : -1, "queue length should be 2: "& queue_length (q1));

report_msg ("Removing 1 element from q1");
queue_pop (q1, tmp);

tl_step ("queue_pop", (tmp == 50) ? 0 : -1, "queue_pop should get us 50: "& tmp);
tl_step ("queue_length", (queue_length (q1) == 1) ? 0 : -1, "queue length should be 1: "& queue_length (q1));


report_msg ("Adding '10' to q1");
queue_push (q1, 10);
tl_step ("queue_length", (queue_length (q1) == 2) ? 0 : -1, "queue length should be 2: "& queue_length (q1));

report_msg ("Removing 1 element from q1");
dequeue (q1, tmp);
tl_step ("queue_pop", (tmp == 60) ? 0 : -1, "queue_pop should get us 60: "& tmp);
tl_step ("queue_length", (queue_length (q1) == 1) ? 0 : -1, "queue length should be 1: "& queue_length (q1));

# New
report_msg ("Inserting \"newone\" to the front of the queue");
queue_unpop (q1, "newone");
tl_step ("queue_length", (queue_length (q1) == 2) ? 0 : -1, "queue length should be 2: "& queue_length (q1));

report_msg ("Removing 1 element from q1");
dequeue (q1, tmp);
tl_step ("queue_pop", (tmp == "newone") ? 0 : -1, "queue_pop should get us \"newone\": "& tmp);
tl_step ("queue_length", (queue_length (q1) == 1) ? 0 : -1, "queue length should be 1: "& queue_length (q1));

report_msg ("Removing 1 element from q1");
queue_pop (q1, tmp);
tl_step ("queue_pop", (tmp == 10) ? 0 : -1, "queue_pop should get us 10: "& tmp);
tl_step ("queue_length", (queue_length (q1) == 0) ? 0 : -1, "queue length should be 0: "& queue_length (q1));


report_msg ("===================================");

################################
# Test for Stack
################################
report_msg ("Initializing the stack s1");
stack_init (s1);
tl_step ("stack_init", (stack_length (s1) == 0) ? 0 : -1, "stack length should be 0: "& stack_length (s1));

report_msg ("Adding '50' to s1");
stack_push (s1, 50);

report_msg ("Adding '60' to s1");
stack_push (s1, 60);
tl_step ("stack_init", (stack_length (s1) == 2) ? 0 : -1, "stack length should be 2: "& stack_length (s1));

report_msg ("Removing 1 element from s1");
stack_pop (s1, tmp);
tl_step ("stack_pop", (tmp == 60) ? 0 : -1, "stack_pop should get us 60: "& tmp);

report_msg ("Adding '10' to s1");
stack_push (s1, 10);

report_msg ("Removing 1 element from s1");
stack_pop (s1, tmp);
tl_step ("stack_pop", (tmp == 10) ? 0 : -1, "stack_pop should get us 10: "& tmp);

report_msg ("Removing 1 element from s1");
stack_pop (s1, tmp);
tl_step ("stack_pop", (tmp == 50) ? 0 : -1, "stack_pop should get us 50: "& tmp);

tl_step ("stack_length", (stack_length (s1) == 0) ? 0 : -1, "stack length should be 0: "& stack_length (s1));
