Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "linear_sequence.h"
- int main() {
- LSQ_HandleT handle;
- LSQ_IteratorT iter;
- int size, el;
- handle = LSQ_CreateSequence();
- LSQ_InsertFrontElement(handle, 33);
- LSQ_InsertFrontElement(handle, 32);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- LSQ_InsertRearElement(handle, 20);
- LSQ_InsertRearElement(handle, 21);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "before deleting rear element\n");
- LSQ_DeleteRearElement(handle);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- LSQ_DeleteFrontElement(handle);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- iter = LSQ_GetElementByIndex(handle, 1);
- LSQ_InsertElementBeforeGiven(iter, 76);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- LSQ_InsertElementBeforeGiven(iter, 54);
- LSQ_InsertElementBeforeGiven(iter, 100);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- LSQ_AdvanceOneElement(iter);
- LSQ_AdvanceOneElement(iter);
- LSQ_RewindOneElement(iter);
- LSQ_DeleteGivenElement(iter);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- LSQ_ShiftPosition(iter, 1);
- LSQ_InsertElementBeforeGiven(iter, 0);
- size = LSQ_GetSize(handle);
- printf("%s %d ", "size", size);
- printf("%s", "\n");
- LSQ_DisplaySequence(handle);
- printf("%s", "\n");
- LSQ_DestroyIterator(iter);
- iter = LSQ_GetPastRearElement(handle);
- if(LSQ_IsIteratorPastRear(iter)) {
- printf("%s", "iterator past rear\n");
- }
- LSQ_DestroyIterator(iter);
- iter = LSQ_GetFrontElement(handle);
- LSQ_RewindOneElement(iter);
- if(LSQ_IsIteratorBeforeFirst(iter)) {
- printf("%s", "iterator before first\n");
- }
- if(LSQ_IsIteratorDereferencable(iter)) {
- printf("%s", "iterator dereferencable");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement