Skip to content

Commit

Permalink
converted from g_test_add() to g_test_add_func()
Browse files Browse the repository at this point in the history
fixed errors

fixed errors in functions

solved comment issue
  • Loading branch information
sashreek committed Jan 9, 2020
1 parent 146a950 commit 190e862
Show file tree
Hide file tree
Showing 15 changed files with 454 additions and 1,121 deletions.
87 changes: 23 additions & 64 deletions modulemd/tests/test-modulemd-buildopts.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef struct _BuildoptsFixture
} BuildoptsFixture;

static void
buildopts_test_construct (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_construct (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_auto (GStrv) whitelist = NULL;
Expand Down Expand Up @@ -60,7 +60,7 @@ buildopts_test_construct (BuildoptsFixture *fixture, gconstpointer user_data)


static void
buildopts_test_equals (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_equals (void)
{
g_autoptr (ModulemdBuildopts) b_1 = NULL;
g_autoptr (ModulemdBuildopts) b_2 = NULL;
Expand Down Expand Up @@ -210,7 +210,7 @@ buildopts_test_equals (BuildoptsFixture *fixture, gconstpointer user_data)


static void
buildopts_test_copy (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_copy (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_autoptr (ModulemdBuildopts) b_copy = NULL;
Expand Down Expand Up @@ -342,8 +342,7 @@ buildopts_test_copy (BuildoptsFixture *fixture, gconstpointer user_data)


static void
buildopts_test_get_set_rpm_macros (BuildoptsFixture *fixture,
gconstpointer user_data)
buildopts_test_get_set_rpm_macros (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_autofree gchar *rpm_macros;
Expand Down Expand Up @@ -372,7 +371,7 @@ buildopts_test_get_set_rpm_macros (BuildoptsFixture *fixture,
}

static void
buildopts_test_whitelist (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_whitelist (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_auto (GStrv) whitelist = NULL;
Expand Down Expand Up @@ -409,7 +408,7 @@ buildopts_test_whitelist (BuildoptsFixture *fixture, gconstpointer user_data)
}

static void
buildopts_test_arches (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_arches (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_auto (GStrv) arches = NULL;
Expand Down Expand Up @@ -447,7 +446,7 @@ buildopts_test_arches (BuildoptsFixture *fixture, gconstpointer user_data)


static void
buildopts_test_parse_yaml (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_parse_yaml (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_autoptr (GError) error = NULL;
Expand Down Expand Up @@ -487,7 +486,7 @@ buildopts_test_parse_yaml (BuildoptsFixture *fixture, gconstpointer user_data)


static void
buildopts_test_emit_yaml (BuildoptsFixture *fixture, gconstpointer user_data)
buildopts_test_emit_yaml (void)
{
g_autoptr (ModulemdBuildopts) b = NULL;
g_autoptr (GError) error = NULL;
Expand Down Expand Up @@ -557,61 +556,21 @@ main (int argc, char *argv[])

// Define the tests.

g_test_add ("/modulemd/v2/buildopts/construct",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_construct,
NULL);

g_test_add ("/modulemd/v2/buildopts/equals",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_equals,
NULL);

g_test_add ("/modulemd/v2/buildopts/copy",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_copy,
NULL);

g_test_add ("/modulemd/v2/buildopts/get_set_rpm_macros",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_get_set_rpm_macros,
NULL);

g_test_add ("/modulemd/v2/buildopts/whitelist",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_whitelist,
NULL);

g_test_add ("/modulemd/v2/buildopts/arches",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_arches,
NULL);

g_test_add ("/modulemd/v2/buildopts/yaml/parse",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_parse_yaml,
NULL);

g_test_add ("/modulemd/v2/buildopts/yaml/emit",
BuildoptsFixture,
NULL,
NULL,
buildopts_test_emit_yaml,
NULL);
g_test_add_func ("/modulemd/v2/buildopts/construct",buildopts_test_construct);

g_test_add_func ("/modulemd/v2/buildopts/equals",buildopts_test_equals);

g_test_add_func ("/modulemd/v2/buildopts/copy",buildopts_test_copy);

g_test_add_func ("/modulemd/v2/buildopts/get_set_rpm_macros",buildopts_test_get_set_rpm_macros);

g_test_add_func ("/modulemd/v2/buildopts/whitelist",buildopts_test_whitelist);

g_test_add_func ("/modulemd/v2/buildopts/arches",buildopts_test_arches);

g_test_add_func ("/modulemd/v2/buildopts/yaml/parse",buildopts_test_parse_yaml);

g_test_add_func ("/modulemd/v2/buildopts/yaml/emit",buildopts_test_emit_yaml);

return g_test_run ();
}
58 changes: 14 additions & 44 deletions modulemd/tests/test-modulemd-component-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ sigtrap_handler (int sig_num)
}

static void
component_module_test_construct (ComponentModuleFixture *fixture,
gconstpointer user_data)
component_module_test_construct (void)
{
g_autoptr (ModulemdComponentModule) m = NULL;
ModulemdComponent *mc = NULL;
Expand Down Expand Up @@ -110,8 +109,7 @@ component_module_test_construct (ComponentModuleFixture *fixture,


static void
component_module_test_equals (ComponentModuleFixture *fixture,
gconstpointer user_data)
component_module_test_equals (void)
{
g_autoptr (ModulemdComponentModule) m_1 = NULL;
g_autoptr (ModulemdComponentModule) m_2 = NULL;
Expand Down Expand Up @@ -233,8 +231,7 @@ component_module_test_equals (ComponentModuleFixture *fixture,


static void
component_module_test_copy (ComponentModuleFixture *fixture,
gconstpointer user_data)
component_module_test_copy (void)
{
g_autoptr (ModulemdComponentModule) m_orig = NULL;
g_autoptr (ModulemdComponentModule) m = NULL;
Expand Down Expand Up @@ -283,8 +280,7 @@ component_module_test_copy (ComponentModuleFixture *fixture,


static void
component_module_test_emit_yaml (ComponentModuleFixture *fixture,
gconstpointer user_data)
component_module_test_emit_yaml (void)
{
g_autoptr (ModulemdComponentModule) m = NULL;
g_autoptr (GError) error = NULL;
Expand Down Expand Up @@ -339,8 +335,7 @@ component_module_test_emit_yaml (ComponentModuleFixture *fixture,


static void
component_module_test_parse_yaml (ComponentModuleFixture *fixture,
gconstpointer user_data)
component_module_test_parse_yaml (void)
{
g_autoptr (ModulemdComponentModule) m = NULL;
g_autoptr (GError) error = NULL;
Expand Down Expand Up @@ -393,40 +388,15 @@ main (int argc, char *argv[])
g_test_bug_base ("https://bugzilla.redhat.com/show_bug.cgi?id=");

// Define the tests.
g_test_add ("/modulemd/v2/component/module/construct",
ComponentModuleFixture,
NULL,
NULL,
component_module_test_construct,
NULL);

g_test_add ("/modulemd/v2/component/module/equals",
ComponentModuleFixture,
NULL,
NULL,
component_module_test_equals,
NULL);

g_test_add ("/modulemd/v2/component/module/copy",
ComponentModuleFixture,
NULL,
NULL,
component_module_test_copy,
NULL);

g_test_add ("/modulemd/v2/component/module/yaml/emit",
ComponentModuleFixture,
NULL,
NULL,
component_module_test_emit_yaml,
NULL);

g_test_add ("/modulemd/v2/component/module/yaml/parse",
ComponentModuleFixture,
NULL,
NULL,
component_module_test_parse_yaml,
NULL);
g_test_add_func ("/modulemd/v2/component/module/construct",component_module_test_construct);

g_test_add_func ("/modulemd/v2/component/module/equals",component_module_test_equals);

g_test_add_func ("/modulemd/v2/component/module/copy",component_module_test_copy);

g_test_add_func ("/modulemd/v2/component/module/yaml/emit",component_module_test_emit_yaml);

g_test_add_func ("/modulemd/v2/component/module/yaml/parse",component_module_test_parse_yaml);

return g_test_run ();
}
69 changes: 17 additions & 52 deletions modulemd/tests/test-modulemd-component-rpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ typedef struct _ComponentRpmFixture


static void
component_rpm_test_construct (ComponentRpmFixture *fixture,
gconstpointer user_data)
component_rpm_test_construct (void)
{
g_autoptr (ModulemdComponentRpm) r = NULL;
ModulemdComponent *mc = NULL;
Expand Down Expand Up @@ -84,8 +83,7 @@ component_rpm_test_construct (ComponentRpmFixture *fixture,


static void
component_rpm_test_equals (ComponentRpmFixture *fixture,
gconstpointer user_data)
component_rpm_test_equals (void)
{
g_autoptr (ModulemdComponentRpm) r_1 = NULL;
g_autoptr (ModulemdComponentRpm) r_2 = NULL;
Expand Down Expand Up @@ -195,7 +193,7 @@ component_rpm_test_equals (ComponentRpmFixture *fixture,


static void
component_rpm_test_copy (ComponentRpmFixture *fixture, gconstpointer user_data)
component_rpm_test_copy (void)
{
g_autoptr (ModulemdComponentRpm) r_orig = NULL;
g_autoptr (ModulemdComponentRpm) r = NULL;
Expand Down Expand Up @@ -281,8 +279,7 @@ component_rpm_test_copy (ComponentRpmFixture *fixture, gconstpointer user_data)


static void
component_rpm_test_emit_yaml (ComponentRpmFixture *fixture,
gconstpointer user_data)
component_rpm_test_emit_yaml (void)
{
g_autoptr (ModulemdComponentRpm) r = NULL;
g_autoptr (GError) error = NULL;
Expand Down Expand Up @@ -349,8 +346,7 @@ component_rpm_test_emit_yaml (ComponentRpmFixture *fixture,


static void
component_rpm_test_parse_yaml (ComponentRpmFixture *fixture,
gconstpointer user_data)
component_rpm_test_parse_yaml (void)
{
g_autoptr (ModulemdComponentRpm) r = NULL;
g_autoptr (GError) error = NULL;
Expand Down Expand Up @@ -406,8 +402,7 @@ component_rpm_test_parse_yaml (ComponentRpmFixture *fixture,
}

static void
component_rpm_test_override_name (ComponentRpmFixture *fixture,
gconstpointer user_data)
component_rpm_test_override_name (void)
{
g_autoptr (ModulemdComponentRpm) r = NULL;

Expand Down Expand Up @@ -453,47 +448,17 @@ main (int argc, char *argv[])
g_test_bug_base ("https://bugzilla.redhat.com/show_bug.cgi?id=");

// Define the tests.
g_test_add ("/modulemd/v2/component/rpm/construct",
ComponentRpmFixture,
NULL,
NULL,
component_rpm_test_construct,
NULL);

g_test_add ("/modulemd/v2/component/rpm/equals",
ComponentRpmFixture,
NULL,
NULL,
component_rpm_test_equals,
NULL);

g_test_add ("/modulemd/v2/component/rpm/copy",
ComponentRpmFixture,
NULL,
NULL,
component_rpm_test_copy,
NULL);

g_test_add ("/modulemd/v2/component/rpm/yaml/emit",
ComponentRpmFixture,
NULL,
NULL,
component_rpm_test_emit_yaml,
NULL);

g_test_add ("/modulemd/v2/component/rpm/yaml/parse",
ComponentRpmFixture,
NULL,
NULL,
component_rpm_test_parse_yaml,
NULL);

g_test_add ("/modulemd/v2/component/rpm/override_name",
ComponentRpmFixture,
NULL,
NULL,
component_rpm_test_override_name,
NULL);
g_test_add_func ("/modulemd/v2/component/rpm/construct",component_rpm_test_construct);

g_test_add_func ("/modulemd/v2/component/rpm/equals",component_rpm_test_equals);

g_test_add_func ("/modulemd/v2/component/rpm/copy",component_rpm_test_copy);

g_test_add_func ("/modulemd/v2/component/rpm/yaml/emit",component_rpm_test_emit_yaml);

g_test_add_func ("/modulemd/v2/component/rpm/yaml/parse",component_rpm_test_parse_yaml);

g_test_add_func ("/modulemd/v2/component/rpm/override_name",component_rpm_test_override_name);

return g_test_run ();
}
Loading

0 comments on commit 190e862

Please sign in to comment.