/*
 * Copyright (C) 2011-2024 Gary Kramlich <grim@reaperworld.com>
 *
 * This library 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 of the License, or (at your option) any later version.
 *
 * This library 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 library; if not, see <https://www.gnu.org/licenses/>.
 */

#include <glib.h>

#include <gplugin.h>

/******************************************************************************
 * Tests
 *****************************************************************************/
static void
test_gplugin_manager_new(void)
{
	GPluginManager *manager = NULL;

	manager = g_object_new(GPLUGIN_TYPE_MANAGER, NULL);

	g_assert_true(GPLUGIN_IS_MANAGER(manager));

	g_assert_finalize_object(manager);
}

static void
test_gplugin_manager_find_plugin_with_filename_not_found(void)
{
	GPluginManager *manager = NULL;
	GPluginPlugin *plugin = NULL;

	manager = g_object_new(GPLUGIN_TYPE_MANAGER, NULL);

	plugin = gplugin_manager_find_plugin_with_filename(
		manager,
		"doest-not-exist.xyz");
	g_assert_null(plugin);

	g_assert_finalize_object(manager);
}

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

	g_test_set_nonfatal_assertions();

	g_test_add_func("/manager/new", test_gplugin_manager_new);

	g_test_add_func(
		"/manager/find-plugin/with-filename/not-found",
		test_gplugin_manager_find_plugin_with_filename_not_found);

	return g_test_run();
}
