Cellular Automata CHEM274B Group Project
Contributor(s): Chongye Feng, Emmanuel Cortes, Trevor Oldham
Loading...
Searching...
No Matches
Functions
unit_test_CA_utils.cpp File Reference

The program contains unit tests to test the correctness of the various functions defined in CA_utils.cpp. More...

#include "CAdatatypes.h"
#include <cassert>
#include <iostream>
#include <vector>
#include <utility>

Functions

void print_success (std::string message)
 Prints that a specific test passed. More...
 
void test_get_periodic_moore_neighbor_index (int radius)
 Check returned periodic Moore neighbor index follows the same pattern used to create the flatten neighborhood array. More...
 
void test_get_periodic_von_neumann_neighbor_index (int radius)
 Check returned periodic Moore neighbor index follows the same pattern used to create the flatten neighborhood array. More...
 
void test_get_neighborhood_size_assert (std::vector< std::pair< int, int > > test_arg_and_expected_value, int rank, CAEnums::Neighborhood nt)
 Calls get_neighborhood_size and asserts that the returned value equals the expected value. More...
 
void test_get_neighborhood_size ()
 Tests every type of combination possible that get_neighborhood_size is supposed to support.
 
void test_is_diagonal_neighboring_cell_2d ()
 Tests the correctness of the is_diagonal_neighboring_cell_2d method.
 
void test_is_diagonal_neighboring_cell_3d ()
 Tests the correctness of the is_diagonal_neighboring_cell_3d method.
 
void test_get_periodic_index ()
 Tests the correctness of the get_periodic_index method.
 
int main ()
 

Detailed Description

The program contains unit tests to test the correctness of the various functions defined in CA_utils.cpp.

Author
Emmanuel Cortes (ecort.nosp@m.es@b.nosp@m.erkel.nosp@m.ey.e.nosp@m.du)

Contributor(s)
  

Date
2022-12-11

Function Documentation

◆ print_success()

void print_success ( std::string  message)

Prints that a specific test passed.

Parameters
messagethe test function name

◆ test_get_neighborhood_size_assert()

void test_get_neighborhood_size_assert ( std::vector< std::pair< int, int > >  test_arg_and_expected_value,
int  rank,
CAEnums::Neighborhood  nt 
)

Calls get_neighborhood_size and asserts that the returned value equals the expected value.

Parameters
test_arg_and_expected_valueVector of pairs where first is radius test case and second is the expect value
rankcell data rank
ntneighborhood type

◆ test_get_periodic_moore_neighbor_index()

void test_get_periodic_moore_neighbor_index ( int  radius)

Check returned periodic Moore neighbor index follows the same pattern used to create the flatten neighborhood array.

Parameters
radiusneighborhood radius

◆ test_get_periodic_von_neumann_neighbor_index()

void test_get_periodic_von_neumann_neighbor_index ( int  radius)

Check returned periodic Moore neighbor index follows the same pattern used to create the flatten neighborhood array.

Parameters
radiusneighborhood radius