[Libosinfo] [libosinfo PATCH] test-os: Add test_resources_inheritance()

Pino Toscano ptoscano at redhat.com
Mon Nov 12 15:31:22 UTC 2018


On Monday, 12 November 2018 15:07:24 CET Fabiano Fidêncio wrote:
> +static void
> +test_resources_inheritance_basic(void)
> +{
> +    OsinfoLoader *loader = osinfo_loader_new();
> +    OsinfoDb *db;
> +    OsinfoOs *os1, *os2;
> +    OsinfoResourcesList *os1_minimum_list, *os1_recommended_list;
> +    OsinfoResourcesList *os2_minimum_list, *os2_recommended_list;
> +    OsinfoResources *os1_minimum, *os1_recommended;
> +    OsinfoResources *os2_minimum, *os2_recommended;
> +    GError *error = NULL;
> +
> +    osinfo_loader_process_path(loader, SRCDIR "/tests/dbdata", &error);
> +    g_assert_no_error(error);
> +    db = g_object_ref(osinfo_loader_get_db(loader));
> +    g_object_unref(loader);
> +
> +    os1 = osinfo_db_get_os(db, "http://libosinfo.org/test/os/resources/inheritance/1");
> +    g_assert(OSINFO_IS_OS(os1));

g_assert_true

> +    os1_minimum = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(os1_minimum_list), 0));
> +    g_assert(OSINFO_IS_RESOURCES(os1_minimum));

g_assert_true

> +    os1_recommended = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(os1_recommended_list), 0));
> +    g_assert(OSINFO_IS_RESOURCES(os1_recommended));

g_assert_true

> +    os2 = osinfo_db_get_os(db, "http://libosinfo.org/test/os/resources/inheritance/2");
> +    g_assert(OSINFO_IS_OS(os2));

g_assert_true

> +    os2_minimum = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(os2_minimum_list), 0));
> +    g_assert(OSINFO_IS_RESOURCES(os2_minimum));

g_assert_true

> +    os2_recommended = OSINFO_RESOURCES(osinfo_list_get_nth(OSINFO_LIST(os2_recommended_list), 0));
> +    g_assert(OSINFO_IS_RESOURCES(os2_recommended));

g_assert_true

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20181112/a7be9198/attachment.sig>


More information about the Libosinfo mailing list