void test_telephone_number_if_within_the_range_of_10000000_and_99999999_should_return_1(void)

{

 int tel;

 PersonInfo telinfo;

 tel = setTelephone(&telinfo, 12345678);

 UnityAssertEqualNumber((_U_SINT)((1)), (_U_SINT)((tel)), (((void *)0)), (_U_UINT)216, UNITY_DISPLAY_STYLE_INT);

}
void test_telephone_number_greater_than_99999999_should_return_0(void)

{

 int tel;

 PersonInfo telinfo;

 tel = setTelephone(&telinfo, 100000000);

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((tel)), (((void *)0)), (_U_UINT)208, UNITY_DISPLAY_STYLE_INT);

}
void test_telephone_number_smaller_than_10000000_should_return_0(void)

{

 int telnumber;

 PersonInfo TelInfo;

 telnumber = setTelephone(&TelInfo, 9999);

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((telnumber)), (((void *)0)), (_U_UINT)200, UNITY_DISPLAY_STYLE_INT);

}
示例#4
0
void test_telephone_given_long_integer_start_with_0_return_0(void)

{

 int telnumber;

 PersonInfo BananaInfo;

 telnumber = setTelephone(&BananaInfo, 0111);

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((telnumber)), (((void *)0)), (_U_UINT)67, UNITY_DISPLAY_STYLE_INT);

}
void test_setTelephone_given_12345678_should_return_0(void)

{

 int result;

 struct PersonInfo_t PersonInfo;



 result = setTelephone(&PersonInfo,123456789);

 UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((result)), (((void *)0)), (_U_UINT)168, UNITY_DISPLAY_STYLE_INT);

}
示例#6
0
/*
 * Read system locales using org.freedesktop.locale1 dbus interface
 */
void
EnabledLocalesModel::updateSystemLocales()
{
    QDBusInterface dbusInterface( "org.freedesktop.locale1",
                                  "/org/freedesktop/locale1",
                                  "org.freedesktop.locale1",
                                  QDBusConnection::systemBus() );

    QStringList localeEnviromentVariables = dbusInterface.property( "Locale" ).toStringList();

    QModelIndex defaultIndex = QModelIndex();

    for ( QString lev : localeEnviromentVariables )
    {
        if ( lev.startsWith( "LANG=" ) )
        {
            int defaultLocaleRow = findKey( lev.section( '=', 1 ) );
            defaultIndex = index( defaultLocaleRow,0 );
        }
    }

    setAddress( defaultIndex );
    setCollate( defaultIndex );
    setCtype( defaultIndex );
    setIdentification( defaultIndex );
    setLang( defaultIndex );
    setLanguage( defaultIndex );
    setMeasurement( defaultIndex );
    setMonetary( defaultIndex );
    setMessages( defaultIndex );
    setName( defaultIndex );
    setNumeric( defaultIndex );
    setPaper( defaultIndex );
    setTelephone( defaultIndex );
    setTime( defaultIndex );

    for ( QString lev : localeEnviromentVariables )
    {
        QString value = lev.section( '=', 1 );
        if ( lev.startsWith( "LC_ADDRESS=" ) )
        {
            if ( value.isEmpty() )
                setAddress( defaultIndex );
            else
            {
                int row = findKey( value );
                setAddress( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_COLLATE=" ) )
        {
            if ( value.isEmpty() )
                setCollate( defaultIndex );
            else
            {
                int row = findKey( value );
                setCollate( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_CTYPE=" ) )
        {
            if ( value.isEmpty() )
                setCtype( defaultIndex );
            else
            {
                int row = findKey( value );
                setCtype( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_IDENTIFICATION=" ) )
        {
            if ( value.isEmpty() )
                setIdentification( defaultIndex );
            else
            {
                int row = findKey( value );
                setIdentification( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LANG=" ) )
        {
            if ( value.isEmpty() )
                setLang( defaultIndex );
            else
            {
                int row = findKey( value );
                setLang( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LANGUAGE=" ) )
        {
            if ( value.isEmpty() )
                setLanguage( defaultIndex );
            else
            {
                int row = findKey( value );
                setLanguage( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_MEASUREMENT=" ) )
        {
            if ( value.isEmpty() )
                setMeasurement( defaultIndex );
            else
            {
                int row = findKey( value );
                setMeasurement( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_MESSAGES=" ) )
        {
            if ( value.isEmpty() )
                setMessages( defaultIndex );
            else
            {
                int row = findKey( value );
                setMessages( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_MONETARY=" ) )
        {
            if ( value.isEmpty() )
                setMonetary( defaultIndex );
            else
            {
                int row = findKey( value );
                setMonetary( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_NAME=" ) )
        {
            if ( value.isEmpty() )
                setName( defaultIndex );
            else
            {
                int row = findKey( value );
                setName( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_NUMERIC=" ) )
        {
            if ( value.isEmpty() )
                setNumeric( defaultIndex );
            else
            {
                int row = findKey( value );
                setNumeric( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_PAPER=" ) )
        {
            if ( value.isEmpty() )
                setPaper( defaultIndex );
            else
            {
                int row = findKey( value );
                setPaper( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_TELEPHONE=" ) )
        {
            if ( value.isEmpty() )
                setTelephone( defaultIndex );
            else
            {
                int row = findKey( value );
                setTelephone( index( row, 0 ) );
            }
        }
        else if ( lev.startsWith( "LC_TIME=" ) )
        {
            if ( value.isEmpty() )
                setTime( defaultIndex );
            else
            {
                int row = findKey( value );
                setTime( index( row, 0 ) );
            }
        }
    }
}