-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk_QueueTest.ino
54 lines (53 loc) · 1.24 KB
/
k_QueueTest.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
#if (TEST == TEST_QUEUE)
void setup()
{
setupSerial();
testQueue1();
testQueue2();
testQueue3();
}
void testQueue1()
{
queue_t queue;
initQueue(&queue);
for(uint8_t i = 0; i < 5; i++)
{
compareUnsignedNumbers(0, popFromQueue(&queue));
compareTrue(isQueueEmpty(&queue));
}
}
void testQueue2()
{
queue_t queue;
initQueue(&queue);
pushToQueue(&queue, 45);
compareUnsignedNumbers(45, popFromQueue(&queue));
compareUnsignedNumbers(0, popFromQueue(&queue));
}
void testQueue3()
{
queue_t queue;
initQueue(&queue);
compareTrue(isQueueEmpty(&queue));
pushToQueue(&queue, 45);
compareFalse(isQueueEmpty(&queue));
pushToQueue(&queue, 67);
compareFalse(isQueueEmpty(&queue));
pushToQueue(&queue, 89);
compareFalse(isQueueEmpty(&queue));
pushToQueue(&queue, 10);
compareFalse(isQueueEmpty(&queue));
compareUnsignedNumbers(45, popFromQueue(&queue));
compareFalse(isQueueEmpty(&queue));
compareUnsignedNumbers(67, popFromQueue(&queue));
compareFalse(isQueueEmpty(&queue));
compareUnsignedNumbers(89, popFromQueue(&queue));
compareFalse(isQueueEmpty(&queue));
compareUnsignedNumbers(10, popFromQueue(&queue));
compareTrue(isQueueEmpty(&queue));
compareUnsignedNumbers(0, popFromQueue(&queue));
compareTrue(isQueueEmpty(&queue));
}
#endif
*/