Ejemplo n.º 1
0
void trn_game_destroy(TrnGame * game)
{
    free(game->current_piece);
    free(game->next_piece);
    trn_grid_destroy(game->grid);
    free(game);
}
Ejemplo n.º 2
0
void test_grid_new_destroy()
{
    // Create a grid.
    int numberOfRows = 3;
    int numberOfColumns = 2;
    TrnGrid* grid = trn_grid_new(numberOfRows, numberOfColumns);

    // Check that values are initialized to TRN_TETROMINO_VOID
    int rowIndex;
    for (rowIndex = 0 ; rowIndex < grid->numberOfRows; rowIndex++){
        assert_row_value(grid, rowIndex, TRN_TETROMINO_VOID);
    }

    // Free memory.
    trn_grid_destroy(grid);
}
Ejemplo n.º 3
0
void test_grid_new_destroy()
{
    // Create a grid.
    int numberOfRows = 3;
    int numberOfColumns = 2;
    TrnGrid* grid = trn_grid_new(numberOfRows, numberOfColumns);

    // Check that values are initialized to TRN_TETROMINO_VOID
    int rowIndex;
    int columnIndex;
    for (rowIndex = 0 ; rowIndex < grid->numberOfRows; rowIndex++) {
        for (columnIndex = 0 ; columnIndex < grid->numberOfColumns ; columnIndex++) {
            CU_ASSERT(grid->tetrominoTypes[rowIndex][columnIndex] == TRN_TETROMINO_VOID);
        }
    }

    // Free memory.
    trn_grid_destroy(grid);
}