summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2010-02-23 11:31:10 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2010-02-23 11:34:40 (GMT)
commit57f716aab87ad517ccd6a36bdd5ca8178c561572 (patch)
treef138620aec30f2ca860a332afe36c0f942958d8f /tests
parent12b1dbb1a0911d421d9e19129291dcd8151c3f50 (diff)
downloadQt-57f716aab87ad517ccd6a36bdd5ca8178c561572.zip
Qt-57f716aab87ad517ccd6a36bdd5ca8178c561572.tar.gz
Qt-57f716aab87ad517ccd6a36bdd5ca8178c561572.tar.bz2
Improve test coverage of QScriptString::toArrayIndex()
Test decimals and scientific notation. "0.0" is not a valid array index even though it can be converted to a whole integer, because the number converted back to a string again is "0", which is different from "0.0". (See ECMA 15.4)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qscriptstring/tst_qscriptstring.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qscriptstring/tst_qscriptstring.cpp b/tests/auto/qscriptstring/tst_qscriptstring.cpp
index 808b643..ea4a92b 100644
--- a/tests/auto/qscriptstring/tst_qscriptstring.cpp
+++ b/tests/auto/qscriptstring/tst_qscriptstring.cpp
@@ -177,6 +177,12 @@ void tst_QScriptString::toArrayIndex_data()
QTest::newRow("101a") << QString::fromLatin1("101a") << false << quint32(0xffffffff);
QTest::newRow("4294967294") << QString::fromLatin1("4294967294") << true << quint32(0xfffffffe);
QTest::newRow("4294967295") << QString::fromLatin1("4294967295") << false << quint32(0xffffffff);
+ QTest::newRow("0.0") << QString::fromLatin1("0.0") << false << quint32(0xffffffff);
+ QTest::newRow("1.0") << QString::fromLatin1("1.0") << false << quint32(0xffffffff);
+ QTest::newRow("1.5") << QString::fromLatin1("1.5") << false << quint32(0xffffffff);
+ QTest::newRow("1.") << QString::fromLatin1("1.") << false << quint32(0xffffffff);
+ QTest::newRow(".1") << QString::fromLatin1(".1") << false << quint32(0xffffffff);
+ QTest::newRow("1e0") << QString::fromLatin1("1e0") << false << quint32(0xffffffff);
}
void tst_QScriptString::toArrayIndex()