/*
 * SPDX-FileCopyrightText: 2024-2026 Sébastien Helleu <flashcode@flashtux.org>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

/* Test relay API protocol (general functions) */

#include "CppUTest/TestHarness.h"

extern "C"
{
#include "src/plugins/relay/relay.h"
#include "src/plugins/relay/relay-client.h"
#include "src/plugins/relay/api/relay-api.h"
}

TEST_GROUP(RelayApi)
{
};

/*
 * Test functions:
 *   relay_api_search_colors
 */

TEST(RelayApi, SearchColors)
{
    LONGS_EQUAL(-1, relay_api_search_colors (NULL));
    LONGS_EQUAL(-1, relay_api_search_colors (""));
    LONGS_EQUAL(-1, relay_api_search_colors ("xxx"));
    LONGS_EQUAL(-1, relay_api_search_colors ("ANSI"));
    LONGS_EQUAL(-1, relay_api_search_colors ("WEECHAT"));
    LONGS_EQUAL(-1, relay_api_search_colors ("STRIP"));

    LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("ansi"));
    LONGS_EQUAL(RELAY_API_COLORS_WEECHAT, relay_api_search_colors ("weechat"));
    LONGS_EQUAL(RELAY_API_COLORS_STRIP, relay_api_search_colors ("strip"));
}

/*
 * Test functions:
 *   relay_api_hook_signals
 */

TEST(RelayApi, HookSignals)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_unhook_signals
 */

TEST(RelayApi, UnhookSignals)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_recv_http
 */

TEST(RelayApi, RecvHttp)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_recv_json
 */

TEST(RelayApi, RecvJson)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_close_connection
 */

TEST(RelayApi, CloseConnection)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_alloc
 */

TEST(RelayApi, Alloc)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_alloc_with_infolist
 */

TEST(RelayApi, AllocWithInfolist)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_get_initial_status
 */

TEST(RelayApi, GetInitialStatus)
{
    LONGS_EQUAL(RELAY_STATUS_AUTHENTICATING, relay_api_get_initial_status (NULL));
}

/*
 * Test functions:
 *   relay_api_free
 */

TEST(RelayApi, Free)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_add_to_infolist
 */

TEST(RelayApi, AddToInfolist)
{
    /* TODO: write tests */
}

/*
 * Test functions:
 *   relay_api_print_log
 */

TEST(RelayApi, PrintLog)
{
    /* TODO: write tests */
}
