diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-05-10 11:26:05 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-10 12:34:42 +0200 |
commit | 58f53b807fafcadf76282f0c8c7f20451c7a97a5 (patch) | |
tree | 01522c659562d19a0232b977f955ead7d6c057cb /tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h | |
parent | 406402dc639db7f5d785961717326467026fb6f1 (diff) | |
download | qtscript-58f53b807fafcadf76282f0c8c7f20451c7a97a5.tar.gz |
Remove large, static QString[] arrays from test qscriptvaluegenerated.
They seems to trigger a compiler error for linux-arm-gnueabi-g++
(32bit).
Use const char *-arrays and introduce utility functions
to populate the static hashes, sets. Fix some string and iterator
usage errors.
Change-Id: I4e32c6ffa004e141bc04c3a2971c379f71072b38
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h')
-rw-r--r-- | tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h index 182e836..301d51a 100644 --- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h @@ -363,6 +363,34 @@ private: QString m_currentExpression; }; +static inline QSet<QString> charArrayToQStringSet(const char **array, int size) +{ + QSet<QString> result; + result.reserve(size); + for (int i = 0; i < size; ++i) + result.insert(QLatin1String(array[i])); + return result; +} + +static inline QHash<QString, QString> charArraysToStringHash(const char **keys, const char **values, int size) +{ + QHash<QString, QString > result; + result.reserve(size); + for (int i = 0; i < size; ++i) + result.insert(QLatin1String(keys[i]), QLatin1String(values[i])); + return result; +} + +template <class Value> +QHash<QString, Value> charValueArraysToHash(const char **keys, const Value *values, int size) +{ + QHash<QString, Value> result; + result.reserve(size); + for (int i = 0; i < size; ++i) + result.insert(QLatin1String(keys[i]), values[i]); + return result; +} + #define DEFINE_TEST_FUNCTION(name) \ void tst_QScriptValueGenerated::name##_data() { dataHelper(&tst_QScriptValueGenerated::name##_initData, &tst_QScriptValueGenerated::name##_makeData); } \ void tst_QScriptValueGenerated::name() { testHelper(&tst_QScriptValueGenerated::name##_test); } |