tests/auto/qscriptstring/tst_qscriptstring.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the test suite of the Qt Toolkit.
     7 ** This file is part of the test suite of the Qt Toolkit.
     8 **
     8 **
    85         QScriptString str1(str);
    85         QScriptString str1(str);
    86         QVERIFY(!str1.isValid());
    86         QVERIFY(!str1.isValid());
    87 
    87 
    88         QScriptString str2 = str;
    88         QScriptString str2 = str;
    89         QVERIFY(!str2.isValid());
    89         QVERIFY(!str2.isValid());
       
    90 
       
    91         QCOMPARE(str.toArrayIndex(), quint32(0xffffffff));
    90     }
    92     }
    91 
    93 
    92     for (int x = 0; x < 2; ++x) {
    94     for (int x = 0; x < 2; ++x) {
    93         QString ciao = QString::fromLatin1("ciao");
    95         QString ciao = QString::fromLatin1("ciao");
    94         QScriptString str = eng.toStringHandle(ciao);
    96         QScriptString str = eng.toStringHandle(ciao);
   170     QTest::newRow("123") << QString::fromLatin1("123") << true << quint32(123);
   172     QTest::newRow("123") << QString::fromLatin1("123") << true << quint32(123);
   171     QTest::newRow("-1") << QString::fromLatin1("-1") << false << quint32(0xffffffff);
   173     QTest::newRow("-1") << QString::fromLatin1("-1") << false << quint32(0xffffffff);
   172     QTest::newRow("0a") << QString::fromLatin1("0a") << false << quint32(0xffffffff);
   174     QTest::newRow("0a") << QString::fromLatin1("0a") << false << quint32(0xffffffff);
   173     QTest::newRow("0x1") << QString::fromLatin1("0x1") << false << quint32(0xffffffff);
   175     QTest::newRow("0x1") << QString::fromLatin1("0x1") << false << quint32(0xffffffff);
   174     QTest::newRow("01") << QString::fromLatin1("01") << false << quint32(0xffffffff);
   176     QTest::newRow("01") << QString::fromLatin1("01") << false << quint32(0xffffffff);
       
   177     QTest::newRow("101a") << QString::fromLatin1("101a") << false << quint32(0xffffffff);
   175     QTest::newRow("4294967294") << QString::fromLatin1("4294967294") << true << quint32(0xfffffffe);
   178     QTest::newRow("4294967294") << QString::fromLatin1("4294967294") << true << quint32(0xfffffffe);
   176     QTest::newRow("4294967295") << QString::fromLatin1("4294967295") << false << quint32(0xffffffff);
   179     QTest::newRow("4294967295") << QString::fromLatin1("4294967295") << false << quint32(0xffffffff);
   177 }
   180 }
   178 
   181 
   179 void tst_QScriptString::toArrayIndex()
   182 void tst_QScriptString::toArrayIndex()