-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.pwn
47 lines (37 loc) · 937 Bytes
/
test.pwn
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
#define RUN_TESTS
#include <a_samp>
#include "stack.inc"
#include <YSI_Core\y_testing>
Test:PushPop() {
new Stack:stack = Stack_New();
Stack_Push(stack, 10);
Stack_Push(stack, 15);
Stack_Push(stack, 20);
ASSERT(Stack_Pop(stack) == 20);
ASSERT(Stack_Pop(stack) == 15);
ASSERT(Stack_Pop(stack) == 10);
}
Test:Peek() {
new Stack:stack = Stack_New();
Stack_Push(stack, 10);
ASSERT(Stack_Peek(stack) == 10);
Stack_Push(stack, 15);
ASSERT(Stack_Peek(stack) == 15);
Stack_Push(stack, 20);
ASSERT(Stack_Peek(stack) == 20);
}
Test:IsEmpty() {
new Stack:stack = Stack_New();
ASSERT(Stack_IsEmpty(stack));
Stack_Push(stack, 10);
ASSERT(!Stack_IsEmpty(stack));
Stack_Pop(stack);
ASSERT(Stack_IsEmpty(stack));
}
Test:CreateMany() {
const size = 500;
new Stack:stacks[size];
for(new i = 0; i < size; i++) {
stacks[i] = Stack_New(50);
}
}