-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jade Meskill and Roy van de Water
authored and
Roy van de Water
committed
Dec 7, 2013
1 parent
2f9c8d0
commit aa1c25e
Showing
5 changed files
with
85 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "../src/char_queue.h" | ||
#include <assert.h> | ||
|
||
class CharQueueTest { | ||
public: | ||
CharQueue *char_queue; | ||
|
||
CharQueueTest() { | ||
setup(); | ||
} | ||
|
||
void setup() { | ||
char_queue = new CharQueue(); | ||
} | ||
|
||
void test_constructor() { | ||
setup(); | ||
} | ||
|
||
void test_push() { | ||
setup(); | ||
char_queue->push('h'); | ||
} | ||
|
||
void test_size_when_empty() { | ||
setup(); | ||
assert( char_queue->size() == 0 ); | ||
} | ||
|
||
void test_size_with_one_item() { | ||
setup(); | ||
char_queue->push('h'); | ||
assert( char_queue->size() == 1 ); | ||
} | ||
|
||
void test_size_with_two_items() { | ||
setup(); | ||
char_queue->push('h'); | ||
char_queue->push('x'); | ||
assert( char_queue->size() == 2 ); | ||
} | ||
|
||
void test_size_after_a_push_and_a_pop() { | ||
setup(); | ||
char_queue->push('h'); | ||
char_queue->pop(); | ||
assert( char_queue->size() == 0 ); | ||
} | ||
|
||
void test_size_after_two_pushes_and_a_pop() { | ||
setup(); | ||
char_queue->push('h'); | ||
char_queue->push('x'); | ||
char_queue->pop(); | ||
assert( char_queue->size() == 1 ); | ||
} | ||
}; | ||
|
||
|
||
void char_queue_test(){ | ||
CharQueueTest *test = new CharQueueTest(); | ||
test->test_constructor(); | ||
test->test_push(); | ||
test->test_size_when_empty(); | ||
test->test_size_with_one_item(); | ||
test->test_size_with_two_items(); | ||
test->test_size_after_a_push_and_a_pop(); | ||
test->test_size_after_two_pushes_and_a_pop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
#include "char_test.h" | ||
#include "char_queue_test.h" | ||
|
||
int main() { | ||
char_test(); | ||
char_queue_test(); | ||
return 0; | ||
} |