# Problem Description
This is a matrix generation problem where we need to create a character matrix based on a specific pattern. The input N determines the size of the output matrix, where each cell contains either '+' or '-' characters. The output matrix should follow a specific pattern of 2x2 blocks, and the actual size of the matrix is 2N × 2N (each N unit represents a 2x2 block).

# Visual Facts
1. For N=1:
   - Matrix size is 2×2
   - All cells contain "-"
   - Forms a single 2×2 block

2. For N=2:
   - Matrix size is 4×4
   - Contains both "+" and "-" symbols
   - Arranged in 2×2 blocks
   - Total of four 2×2 blocks

3. For N=3:
   - Matrix size is 6×6
   - Contains both "+" and "-" symbols
   - Arranged in 2×2 blocks
   - Total of nine 2×2 blocks

# Visual Patterns
1. Size Pattern:
   - Final matrix size is always 2N × 2N
   - Matrix is divided into N × N blocks, where each block is 2×2

2. Symbol Pattern:
   - Symbols are always placed in 2×2 blocks (all four cells in a block have the same symbol)
   - Adjacent 2×2 blocks always have opposite symbols
   - If a block has "-", its horizontal and vertical neighbors must have "+"
   - If a block has "+", its horizontal and vertical neighbors must have "-"

3. Initial State Pattern:
   - The top-left 2×2 block always contains "-" symbols
   - For N > 1, the pattern alternates between "-" and "+" blocks in a checkerboard fashion


# Solution
from typing import List

def solution(N: int) -> List[str]:
    """
    Generates a character matrix of size N x N based on the pattern shown in the image.

    Parameters:
    N (int): The size of the matrix (both the number of rows and columns).

    Returns:
    List[str]: The generated character matrix, where each row is a string.
    """
    matrix = []
    for i in range(N * 2):
        row = []
        for j in range(N * 2):
            if (i // 2 + j // 2) % 2 == 0:
                row.append('-')
            else:
                row.append('+')
        matrix.append(''.join(row))
    return matrix


# Test Script
def test():
    test_cases = [
        (1, ['--', 
             '--']),
        (2, ['--++', 
             '--++', 
             '++--', 
             '++--']),
        (3, ['--++--',
             '--++--', 
             '++--++', 
             '++--++', 
             '--++--', 
             '--++--']),
        (4, ['--++--++', 
             '--++--++', 
             '++--++--', 
             '++--++--', 
             '--++--++', 
             '--++--++', 
             '++--++--', 
             '++--++--']),
        (5, ['--++--++--', 
             '--++--++--', 
             '++--++--++', 
             '++--++--++', 
             '--++--++--', 
             '--++--++--', 
             '++--++--++', 
             '++--++--++', 
             '--++--++--', 
             '--++--++--'])
    ]
    for N, expected_output in test_cases:
        try:
            output = solution(N)
        except Exception as e:
            error_message = (
                f"An exception occurred while running the test case:\n"
                f"`N`: {N}\n\n"
                f"Exception: '{str(e)}'"
            )
            assert False, error_message

        if output != expected_output:
            error_message = (
                f"The following Test Case failed:\n"
                f"`N`: {N}\n\n"
                f"Actual Output:\n"
                f"{'\n'.join(output)}\n\n"
                f"Expected Output:\n"
                f"{'\n'.join(expected_output)}"
            )
            assert False, error_message

test()