/*
 * Ibis - IRCv3 Library
 * Copyright (C) Ibis Developers
 *
 * Ibis is the legal property of its developers, whose names are too numerous
 * to list here. Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, see <https://www.gnu.org/licenses/>.
 */

#include <glib.h>

#include <ibis.h>

/******************************************************************************
 * Tests
 *****************************************************************************/
static void
test_ibis_mode_change_new(void) {
	IbisModeChange *mode_change = NULL;

	mode_change = ibis_mode_change_new('o', TRUE, "grim");

	g_assert_nonnull(mode_change);
	g_assert_cmpint(mode_change->mode, ==, 'o');
	g_assert_true(mode_change->add);
	g_assert_cmpstr(mode_change->parameter, ==, "grim");

	ibis_mode_change_free(mode_change);
}

static void
test_ibis_mode_change_copy(void) {
	IbisModeChange *mode_change = NULL;
	IbisModeChange *copy = NULL;

	mode_change = ibis_mode_change_new('o', TRUE, "grim");

	copy = ibis_mode_change_copy(mode_change);
	ibis_mode_change_free(mode_change);

	g_assert_nonnull(copy);
	g_assert_cmpint(copy->mode, ==, 'o');
	g_assert_true(copy->add);
	g_assert_cmpstr(copy->parameter, ==, "grim");

	ibis_mode_change_free(copy);
}

/******************************************************************************
 * Main
 *****************************************************************************/
int
main(int argc, char *argv[]) {
	g_test_init(&argc, &argv, NULL);

	g_test_add_func("/ibis/mode-change/new", test_ibis_mode_change_new);
	g_test_add_func("/ibis/mode-change/copy", test_ibis_mode_change_copy);

	return g_test_run();
}
