tests/cfg_yaml_ut.cpp
/* Test Fixture. */
/*************************************************************/
/**
 * Verify that the yaml_find_file API
 * - finds the expected values from a good manifest file
 ****************************************************************/
Test Fixture.
Verify that the yaml_find_file API
- finds the expected values from a good manifest file
Test Fixture . Verify that the yaml_find_file API - finds the expected values from a good manifest file
TEST_F(CfgYamlTestSuite, cfg_003_yaml_find_file) {
    char    cwd[1024];
    int     rc = 0;
    const YamlFile    *yfp = NULL;
    rc = snprintf(cwd, sizeof(cwd), "%s/%s", CFG_YAML_UT_FILE_DIR, "yaml_files");
    ASSERT_GT(rc, 0);
    unlink_file(cwd, MANIFEST_FILE);
    link_file(cwd, GOOD_MANIFEST, MANIFEST_FILE);
    printf("Create a new base SUBSYSTEM.\n");
    rc = yaml_add_subsystem(cy_handle, BASE_SUBSYSTEM, cwd);
    ASSERT_EQ(rc, 0);
    printf("Parse devices with valid subsystem.\n");
    rc = yaml_parse_devices(cy_handle, BASE_SUBSYSTEM);
    ASSERT_EQ(rc, 0);
    printf("Get info for devices from manifest file.\n");
    yfp = yaml_find_file(cy_handle, BASE_SUBSYSTEM, "devices");
    ASSERT_EQ(strcmp(yfp->name,"devices"), 0);
    ASSERT_EQ(strcmp(yfp->filename,"devices.yaml"), 0);
    unlink_file(cwd, MANIFEST_FILE);
}
TEST_F ( CfgYamlTestSuite , cfg_003_yaml_find_file ) { char cwd [ 1024 ] ; int rc = 0 ; const YamlFile * yfp = NULL ; rc = snprintf ( cwd , sizeof ( cwd ) , " " , CFG_YAML_UT_FILE_DIR , " " ) ; ASSERT_GT ( rc , 0 ) ; unlink_file ( cwd , MANIFEST_FILE ) ; link_file ( cwd , GOOD_MANIFEST , MANIFEST_FILE ) ; printf ( " \n " ) ; rc = yaml_add_subsystem ( cy_handle , BASE_SUBSYSTEM , cwd ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; rc = yaml_parse_devices ( cy_handle , BASE_SUBSYSTEM ) ; ASSERT_EQ ( rc , 0 ) ; printf ( " \n " ) ; yfp = yaml_find_file ( cy_handle , BASE_SUBSYSTEM , " " ) ; ASSERT_EQ ( strcmp ( yfp -> name , " " ) , 0 ) ; ASSERT_EQ ( strcmp ( yfp -> filename , " " ) , 0 ) ; unlink_file ( cwd , MANIFEST_FILE ) ; }
Test Fixture.
Test Fixture .
/* Test YAML files are stored in ./yaml_files dir. */ /* Try creating a subsystem. It should PASS. */ /* Call yaml_parse_devices() with valid subsystem,
     * and valid directory. The call should pass */ /* Call yaml_find_file() to get info from manifest file */