UserInterface/Do_Option_Tests [ Functions ]

FUNCTION

Run a series of tests on the options that the user specified. These tests are specified in option_tests.

SYNOPSIS

static int Do_Option_Tests(
    void )

RESULT

SOURCE

{
    struct RB_Option_Test *cur_option_test = NULL;
    int                 result = EXIT_SUCCESS;
    int                 final_result = EXIT_SUCCESS;

    RB_Say( "Checking the option semantics.\n", SAY_INFO );
    Create_Test_Data(  );
    cur_option_test = option_tests;

    assert( cur_option_test );

    for ( ; cur_option_test; cur_option_test = cur_option_test->next )
    {
        switch ( cur_option_test->kind )
        {
        case TEST_MUTUAL_EXCLUDE:
            RB_Say( "Checking for mutual excluding options.\n", SAY_INFO );
            result = Do_Mutual_Exlcude_Test( cur_option_test );
            break;
        case TEST_COUNT:       /* TODO Create */
            RB_Say( "Checking for duplicate options.\n", SAY_INFO );
            result = Do_Count_Test( cur_option_test );
            break;
        case TEST_SHOULD_EXISTS:       /* TODO Create */
        case TEST_NO_EFFECT:   /* TODO Create */
        case TEST_SPELLING:    /* TODO Create */
        default:
            assert( 0 );
        }
        /* If one of the tests fails the final result is a fail. */
        if ( result == EXIT_FAILURE )
        {
            final_result = EXIT_FAILURE;
            if ( cur_option_test->severity == OPTION_FATAL )
            {
                break;
            }
        }
    }

    return final_result;
}