diff options
Diffstat (limited to 'src/tests/heap.cpp')
-rw-r--r-- | src/tests/heap.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tests/heap.cpp b/src/tests/heap.cpp new file mode 100644 index 0000000..e93749f --- /dev/null +++ b/src/tests/heap.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | #include <stdlib.h> | ||
2 | #include <stdio.h> | ||
3 | |||
4 | #include "bu/heap.h" | ||
5 | |||
6 | int main() | ||
7 | { | ||
8 | Bu::Heap<int> hInt; | ||
9 | |||
10 | for( int j = 0; j < 15; j++ ) | ||
11 | { | ||
12 | int r = rand()%10; | ||
13 | printf("Pushing: %d, top: ", r ); | ||
14 | hInt.push( r ); | ||
15 | printf("%d\n", hInt.peek() ); | ||
16 | } | ||
17 | |||
18 | for( int j = 0; j < 15; j++ ) | ||
19 | { | ||
20 | printf("%d ", hInt.peek() ); | ||
21 | hInt.pop(); | ||
22 | } | ||
23 | printf("\n"); | ||
24 | |||
25 | // hInt.print(); | ||
26 | |||
27 | return 0; | ||
28 | } | ||
29 | |||