INF2004-Project v0.1
 
Loading...
Searching...
No Matches
floodfill_tests.c File Reference

This file contains the tests for the floodfill algorithm. More...

#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include "pathfinding/floodfill.h"
#include "pathfinding/maze.h"
Include dependency graph for floodfill_tests.c:

Macros

#define DEBUG_PRINT(...)   printf(__VA_ARGS__)
 Debug print macro. Only prints if NDEBUG is not defined. More...
 

Enumerations

enum  constants_t {
  GRID_ROWS = 6 , GRID_COLS = 4 , TEST_BUFFER_SIZE = 2048u , INITIALISE_WAIT = 5000u ,
  GRID_ROWS = 5 , GRID_COLS = 5 , GRID_ROWS = 5 , GRID_COLS = 5 ,
  GRID_ROWS = 10 , GRID_COLS = 10
}
 This enum contains constants used in the tests. More...
 

Functions

int floodfill_tests (int argc, char *argv[])
 Runs the tests for the floodfill algorithm. More...
 

Variables

volatile maze_grid_t g_true_grid = { .p_grid_array = NULL, .rows = GRID_ROWS, .columns = GRID_COLS }
 Global true grid for testing. More...
 

Detailed Description

This file contains the tests for the floodfill algorithm.

Author
Christopher Kok (chris.nosp@m.@for.nosp@m.celig.nosp@m.htni.nosp@m.ng.xy.nosp@m.z)
Version
0.1
Date
2023-11-07

Macro Definition Documentation

◆ DEBUG_PRINT

#define DEBUG_PRINT (   ...)    printf(__VA_ARGS__)

Debug print macro. Only prints if NDEBUG is not defined.

Parameters
...Variable arguments to be printed.

Enumeration Type Documentation

◆ constants_t

This enum contains constants used in the tests.

Enumerator
GRID_ROWS 

Number of rows in the grid.

GRID_COLS 

Number of columns in the grid.

TEST_BUFFER_SIZE 

Size of the test buffer for serialisation.

INITIALISE_WAIT 

Time to wait for the user to open the serial terminal.

GRID_ROWS 

Number of rows in the grid.

GRID_COLS 

Number of columns in the grid.

GRID_ROWS 

Number of rows in the grid.

GRID_COLS 

Number of columns in the grid.

GRID_ROWS 

Number of rows in the grid.

GRID_COLS 

Number of columns in the grid.

Function Documentation

◆ floodfill_tests()

int floodfill_tests ( int  argc,
char *  argv[] 
)

Runs the tests for the floodfill algorithm.

Parameters
argcArgument count.
argvArgument vector.
Returns
int 0 if successful, -1 otherwise.

Variable Documentation

◆ g_true_grid

volatile maze_grid_t g_true_grid = { .p_grid_array = NULL, .rows = GRID_ROWS, .columns = GRID_COLS }

Global true grid for testing.