// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include <QObject>
#include <QTest>

class TestDolphinSerializer : public QObject
{
    Q_OBJECT

private slots:

    // Binary serialization (4 tests)
    void testBinarySaveSingleItem();
    void testBinaryLoadSingleItem();
    void testBinaryRoundTrip();
    void testBinaryWithMultipleColumns();

    // CSV serialization (4 tests)
    void testCSVSaveSingleItem();
    void testCSVLoadSingleItem();
    void testCSVRoundTrip();
    void testCSVWithMultipleRows();

    // Edge cases (3 tests)
    void testEmptyModelBinary();
    void testEmptyModelCSV();
    void testCorruptedDataHandling();

    // Regression: D20 — negative row count must throw, not UB-resize
    void testLoadBinaryRejectsNegativeRows();
    void testLoadCSVRejectsNegativeRows();

    // libFuzzer regression (Tests/Fuzz/regressions/) — legacy .dolphin header
    // with a fuzz-controlled app-name length must be rejected before allocation.
    void testReadDolphinHeaderRejectsLargeAppName();

    // Regression: issue #453 — legacy beWavedDolphin header's raw UTF-16
    // app-name probe must still parse correctly after the -Wcast-align fix.
    void testReadDolphinHeaderParsesLegacyAppName();
};
