package sudoku;

import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

import sudoku.io.SudokuPrinter;
import sudoku.io.SudokuSerializer;

public class SudokuSerializerTest {

    void testSerializeWithSize(int blockWidth, int blockHeight) {
        var sudoku = SudokuFactory.createBasicEmptyRectangleSudoku(blockWidth, blockHeight);
        SudokuPrinter.printRectangleSudoku(sudoku.getSubGrid(0), blockWidth, blockHeight);
        String data = SudokuSerializer.serializeSudoku(sudoku);
        MultiDoku multiDoku = SudokuSerializer.deserializeSudoku(data);
        assertTrue(data.equals(SudokuSerializer.serializeSudoku(multiDoku)));
    }

    @Test
    void testSerialize() {
        int blockWidth = 3;
        int blockHeight = 3;
        testSerializeWithSize(blockWidth, blockHeight);
    }

}
