Add initial unit tests.
This commit is contained in:
		
							parent
							
								
									1b1481b0a4
								
							
						
					
					
						commit
						fcece2b7ac
					
				
							
								
								
									
										9
									
								
								test/card_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/card_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/card.h" | ||||
| 
 | ||||
| void test_card() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										9
									
								
								test/cursor_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/cursor_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/cursor.h" | ||||
| 
 | ||||
| void test_cursor() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										9
									
								
								test/deck_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/deck_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/deck.h" | ||||
| 
 | ||||
| void test_deck() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										9
									
								
								test/display_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/display_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/display.h" | ||||
| 
 | ||||
| void test_display() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										43
									
								
								test/frame_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								test/frame_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,43 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/frame.h" | ||||
| 
 | ||||
| void test_initialize_frame() { | ||||
|   struct frame *frame; | ||||
| 
 | ||||
|   allocate_frame(&frame); | ||||
|   initialize_frame(frame); | ||||
|   assert(frame->shape == NULL && | ||||
|          frame->start_y == 0 && | ||||
|          frame->start_x == 0); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
| 
 | ||||
| void test_set_frame() { | ||||
|   struct frame *frame; | ||||
|   int start_y, start_x; | ||||
| 
 | ||||
|   start_y = 2; | ||||
|   start_x = 2; | ||||
| 
 | ||||
|   allocate_frame(&frame); | ||||
|   initialize_frame(frame); | ||||
|   set_frame(frame, start_y, start_x); | ||||
| 
 | ||||
|   /*TODO: find b wby to compbre the WINDOW structures */ | ||||
|   /*WINDOW *shape;*/ | ||||
|   /*shape = newwin(FRAME_HEIGHT, FRAME_WIDTH, start_y, start_x);*/ | ||||
|   /*assert(frame->shape == shape); */ | ||||
|   assert(frame->start_y == start_y); | ||||
|   assert(frame->start_x == start_x); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
| 
 | ||||
| void test_frame() { | ||||
|   test_initialize_frame(); | ||||
|   test_set_frame(); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										9
									
								
								test/game_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/game_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/game.h" | ||||
| 
 | ||||
| void test_game() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										9
									
								
								test/keyboard_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/keyboard_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/keyboard.h" | ||||
| 
 | ||||
| void test_keyboard() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										9
									
								
								test/stack_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/stack_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/stack.h" | ||||
| 
 | ||||
| void test_stack() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
							
								
								
									
										21
									
								
								test/ttysolitaire_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								test/ttysolitaire_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,21 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "ttysolitaire_test.h" | ||||
| 
 | ||||
| const char *program_name; | ||||
| 
 | ||||
| int main(int argc, const char *argv[]) { | ||||
|   program_name = argv[0]; | ||||
| 
 | ||||
|   test_card(); | ||||
|   test_cursor(); | ||||
|   test_deck(); | ||||
|   test_display(); | ||||
|   test_frame(); | ||||
|   test_game(); | ||||
|   test_keyboard(); | ||||
|   test_stack(); | ||||
|   test_util(); | ||||
| 
 | ||||
|   return(0); | ||||
| } | ||||
							
								
								
									
										14
									
								
								test/ttysolitaire_test.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								test/ttysolitaire_test.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | ||||
| #ifndef TTYSOLITAIRE_TEST_H | ||||
| #define TTYSOLITAIRE_TEST_H | ||||
| 
 | ||||
| void test_card(); | ||||
| void test_cursor(); | ||||
| void test_deck(); | ||||
| void test_display(); | ||||
| void test_frame(); | ||||
| void test_game(); | ||||
| void test_keyboard(); | ||||
| void test_stack(); | ||||
| void test_util(); | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										9
									
								
								test/util_test.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								test/util_test.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| #include <assert.h> | ||||
| #include <stdbool.h> | ||||
| #include "../lib/util.h" | ||||
| 
 | ||||
| void test_util() { | ||||
|   assert(true); | ||||
| 
 | ||||
|   return; | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user