diff options
author | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2010-10-29 11:32:57 (GMT) |
---|---|---|
committer | Jedrzej Nowacki <jedrzej.nowacki@nokia.com> | 2010-11-01 07:57:38 (GMT) |
commit | 1a11073cb13b655943addf0afc7fb839725d128e (patch) | |
tree | c955d1fa2b008734c5a88a58c13804b4f5a4369f /tests | |
parent | 3ecb6db4a3e71582e5249c3c2101f2f4ddf39510 (diff) | |
download | Qt-1a11073cb13b655943addf0afc7fb839725d128e.zip Qt-1a11073cb13b655943addf0afc7fb839725d128e.tar.gz Qt-1a11073cb13b655943addf0afc7fb839725d128e.tar.bz2 |
Separate generated tests from hand written ones.
QScriptValue test suit was way too big, so it was difficult to maintain.
Reviewed-by: Kent Hansen
Diffstat (limited to 'tests')
19 files changed, 506 insertions, 366 deletions
diff --git a/tests/auto/qscriptvalue/qscriptvalue.pro b/tests/auto/qscriptvalue/qscriptvalue.pro index c3e9912..0474c32 100644 --- a/tests/auto/qscriptvalue/qscriptvalue.pro +++ b/tests/auto/qscriptvalue/qscriptvalue.pro @@ -3,14 +3,6 @@ QT = core gui script SOURCES += tst_qscriptvalue.cpp HEADERS += tst_qscriptvalue.h -# Generated by testgen -SOURCES += \ - tst_qscriptvalue_generated_init.cpp \ - tst_qscriptvalue_generated_cast.cpp \ - tst_qscriptvalue_generated_comparison.cpp \ - tst_qscriptvalue_generated_isXXX.cpp \ - tst_qscriptvalue_generated_toXXX.cpp - win32-msvc* { # With -O2, MSVC takes up to 24 minutes to compile this test! QMAKE_CXXFLAGS_RELEASE -= -O1 -O2 diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index ce9e8d1..e29b5d0 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -59,60 +59,6 @@ tst_QScriptValue::~tst_QScriptValue() delete engine; } -void tst_QScriptValue::dataHelper(InitDataFunction init, DefineDataFunction define) -{ - QTest::addColumn<QString>("__expression__"); - (this->*init)(); - QHash<QString,QScriptValue>::const_iterator it; - for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { - m_currentExpression = it.key(); - (this->*define)(it.key().toLatin1()); - } - m_currentExpression = QString(); -} - -QTestData &tst_QScriptValue::newRow(const char *tag) -{ - return QTest::newRow(tag) << m_currentExpression; -} - -void tst_QScriptValue::testHelper(TestFunction fun) -{ - QFETCH(QString, __expression__); - QScriptValue value = m_values.value(__expression__); - (this->*fun)(__expression__.toLatin1(), value); -} - -void tst_QScriptValue::assignAndCopyConstruct_initData() -{ - QTest::addColumn<int>("dummy"); - initScriptValues(); -} - -void tst_QScriptValue::assignAndCopyConstruct_makeData(const char *expr) -{ - newRow(expr) << 0; -} - -void tst_QScriptValue::assignAndCopyConstruct_test(const char *, const QScriptValue &value) -{ - QScriptValue copy(value); - QCOMPARE(copy.strictlyEquals(value), !value.isNumber() || !qIsNaN(value.toNumber())); - QCOMPARE(copy.engine(), value.engine()); - - QScriptValue assigned = copy; - QCOMPARE(assigned.strictlyEquals(value), !copy.isNumber() || !qIsNaN(copy.toNumber())); - QCOMPARE(assigned.engine(), assigned.engine()); - - QScriptValue other(!value.toBool()); - assigned = other; - QVERIFY(!assigned.strictlyEquals(copy)); - QVERIFY(assigned.strictlyEquals(other)); - QCOMPARE(assigned.engine(), other.engine()); -} - -DEFINE_TEST_FUNCTION(assignAndCopyConstruct) - void tst_QScriptValue::ctor_invalid() { QScriptEngine eng; diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.h b/tests/auto/qscriptvalue/tst_qscriptvalue.h index 6274a69..e17fcca 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.h +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.h @@ -49,8 +49,6 @@ #include <QtScript/qscriptvalue.h> #include <QtTest/QtTest> -#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr) - Q_DECLARE_METATYPE(QVariant) Q_DECLARE_METATYPE(QScriptValue) @@ -63,129 +61,6 @@ public: virtual ~tst_QScriptValue(); private slots: - // Generated test functions - void isArray_data(); - void isArray(); - - void isBool_data(); - void isBool(); - - void isBoolean_data(); - void isBoolean(); - - void isDate_data(); - void isDate(); - - void isError_data(); - void isError(); - - void isFunction_data(); - void isFunction(); - - void isNull_data(); - void isNull(); - - void isNumber_data(); - void isNumber(); - - void isObject_data(); - void isObject(); - - void isQMetaObject_data(); - void isQMetaObject(); - - void isQObject_data(); - void isQObject(); - - void isRegExp_data(); - void isRegExp(); - - void isString_data(); - void isString(); - - void isUndefined_data(); - void isUndefined(); - - void isValid_data(); - void isValid(); - - void isVariant_data(); - void isVariant(); - - void toBool_data(); - void toBool(); - - void toBoolean_data(); - void toBoolean(); - -// void toDateTime_data(); -// void toDateTime(); - - void toInt32_data(); - void toInt32(); - - void toInteger_data(); - void toInteger(); - - void toNumber_data(); - void toNumber(); - -// void toQMetaObject_data(); -// void toQMetaObject(); - -// void toQObject_data(); -// void toQObject(); - -// void toRegExp_data(); -// void toRegExp(); - - void toString_data(); - void toString(); - - void toUInt16_data(); - void toUInt16(); - - void toUInt32_data(); - void toUInt32(); - -// void toVariant_data(); -// void toVariant(); - - void equals_data(); - void equals(); - - void strictlyEquals_data(); - void strictlyEquals(); - - void lessThan_data(); - void lessThan(); - - void instanceOf_data(); - void instanceOf(); - - void assignAndCopyConstruct_data(); - void assignAndCopyConstruct(); - - void qscriptvalue_castQString_data(); - void qscriptvalue_castQString(); - - void qscriptvalue_castqsreal_data(); - void qscriptvalue_castqsreal(); - - void qscriptvalue_castbool_data(); - void qscriptvalue_castbool(); - - void qscriptvalue_castqint32_data(); - void qscriptvalue_castqint32(); - - void qscriptvalue_castquint32_data(); - void qscriptvalue_castquint32(); - - void qscriptvalue_castquint16_data(); - void qscriptvalue_castquint16(); - - // Non-generated test functions - void toObject(); void ctor_invalid(); @@ -253,186 +128,7 @@ private slots: void nestedObjectToVariant(); private: - typedef void (tst_QScriptValue::*InitDataFunction)(); - typedef void (tst_QScriptValue::*DefineDataFunction)(const char *); - void dataHelper(InitDataFunction init, DefineDataFunction define); - QTestData &newRow(const char *tag); - - typedef void (tst_QScriptValue::*TestFunction)(const char *, const QScriptValue &); - void testHelper(TestFunction fun); - - // Generated functions - - void initScriptValues(); - - void isArray_initData(); - void isArray_makeData(const char *expr); - void isArray_test(const char *expr, const QScriptValue &value); - - void isBool_initData(); - void isBool_makeData(const char *expr); - void isBool_test(const char *expr, const QScriptValue &value); - - void isBoolean_initData(); - void isBoolean_makeData(const char *expr); - void isBoolean_test(const char *expr, const QScriptValue &value); - - void isDate_initData(); - void isDate_makeData(const char *expr); - void isDate_test(const char *expr, const QScriptValue &value); - - void isError_initData(); - void isError_makeData(const char *expr); - void isError_test(const char *expr, const QScriptValue &value); - - void isFunction_initData(); - void isFunction_makeData(const char *expr); - void isFunction_test(const char *expr, const QScriptValue &value); - - void isNull_initData(); - void isNull_makeData(const char *expr); - void isNull_test(const char *expr, const QScriptValue &value); - - void isNumber_initData(); - void isNumber_makeData(const char *expr); - void isNumber_test(const char *expr, const QScriptValue &value); - - void isObject_initData(); - void isObject_makeData(const char *expr); - void isObject_test(const char *expr, const QScriptValue &value); - - void isQMetaObject_initData(); - void isQMetaObject_makeData(const char *expr); - void isQMetaObject_test(const char *expr, const QScriptValue &value); - - void isQObject_initData(); - void isQObject_makeData(const char *expr); - void isQObject_test(const char *expr, const QScriptValue &value); - - void isRegExp_initData(); - void isRegExp_makeData(const char *expr); - void isRegExp_test(const char *expr, const QScriptValue &value); - - void isString_initData(); - void isString_makeData(const char *expr); - void isString_test(const char *expr, const QScriptValue &value); - - void isUndefined_initData(); - void isUndefined_makeData(const char *expr); - void isUndefined_test(const char *expr, const QScriptValue &value); - - void isValid_initData(); - void isValid_makeData(const char *expr); - void isValid_test(const char *expr, const QScriptValue &value); - - void isVariant_initData(); - void isVariant_makeData(const char *expr); - void isVariant_test(const char *expr, const QScriptValue &value); - - void toBool_initData(); - void toBool_makeData(const char *); - void toBool_test(const char *, const QScriptValue &value); - - void toBoolean_initData(); - void toBoolean_makeData(const char *); - void toBoolean_test(const char *, const QScriptValue &value); - - void toDateTime_initData(); - void toDateTime_makeData(const char *); - void toDateTime_test(const char *, const QScriptValue &value); - - void toInt32_initData(); - void toInt32_makeData(const char *); - void toInt32_test(const char *, const QScriptValue &value); - - void toInteger_initData(); - void toInteger_makeData(const char *); - void toInteger_test(const char *, const QScriptValue &value); - - void toNumber_initData(); - void toNumber_makeData(const char *); - void toNumber_test(const char *, const QScriptValue &value); - - void toQMetaObject_initData(); - void toQMetaObject_makeData(const char *); - void toQMetaObject_test(const char *, const QScriptValue &value); - - void toQObject_initData(); - void toQObject_makeData(const char *); - void toQObject_test(const char *, const QScriptValue &value); - - void toRegExp_initData(); - void toRegExp_makeData(const char *); - void toRegExp_test(const char *, const QScriptValue &value); - - void toString_initData(); - void toString_makeData(const char *); - void toString_test(const char *, const QScriptValue &value); - - void toUInt16_initData(); - void toUInt16_makeData(const char *); - void toUInt16_test(const char *, const QScriptValue &value); - - void toUInt32_initData(); - void toUInt32_makeData(const char *); - void toUInt32_test(const char *, const QScriptValue &value); - - void toVariant_initData(); - void toVariant_makeData(const char *); - void toVariant_test(const char *, const QScriptValue &value); - - void equals_initData(); - void equals_makeData(const char *); - void equals_test(const char *, const QScriptValue &value); - - void strictlyEquals_initData(); - void strictlyEquals_makeData(const char *); - void strictlyEquals_test(const char *, const QScriptValue &value); - - void lessThan_initData(); - void lessThan_makeData(const char *); - void lessThan_test(const char *, const QScriptValue &value); - - void instanceOf_initData(); - void instanceOf_makeData(const char *); - void instanceOf_test(const char *, const QScriptValue &value); - - void assignAndCopyConstruct_initData(); - void assignAndCopyConstruct_makeData(const char *); - void assignAndCopyConstruct_test(const char *, const QScriptValue &value); - - void qscriptvalue_castQString_initData(); - void qscriptvalue_castQString_makeData(const char *); - void qscriptvalue_castQString_test(const char *, const QScriptValue &value); - - void qscriptvalue_castqsreal_initData(); - void qscriptvalue_castqsreal_makeData(const char *); - void qscriptvalue_castqsreal_test(const char *, const QScriptValue &value); - - void qscriptvalue_castbool_initData(); - void qscriptvalue_castbool_makeData(const char *); - void qscriptvalue_castbool_test(const char *, const QScriptValue &value); - - void qscriptvalue_castqint32_initData(); - void qscriptvalue_castqint32_makeData(const char *); - void qscriptvalue_castqint32_test(const char *, const QScriptValue &value); - - void qscriptvalue_castquint32_initData(); - void qscriptvalue_castquint32_makeData(const char *); - void qscriptvalue_castquint32_test(const char *, const QScriptValue &value); - - void qscriptvalue_castquint16_initData(); - void qscriptvalue_castquint16_makeData(const char *); - void qscriptvalue_castquint16_test(const char *, const QScriptValue &value); - -private: QScriptEngine *engine; - QHash<QString, QScriptValue> m_values; - QString m_currentExpression; }; -#define DEFINE_TEST_FUNCTION(name) \ -void tst_QScriptValue::name##_data() { dataHelper(&tst_QScriptValue::name##_initData, &tst_QScriptValue::name##_makeData); } \ -void tst_QScriptValue::name() { testHelper(&tst_QScriptValue::name##_test); } - #endif diff --git a/tests/auto/qscriptvaluegenerated/.gitignore b/tests/auto/qscriptvaluegenerated/.gitignore new file mode 100644 index 0000000..f724cb9 --- /dev/null +++ b/tests/auto/qscriptvaluegenerated/.gitignore @@ -0,0 +1 @@ +tst_qscriptvalue diff --git a/tests/auto/qscriptvaluegenerated/qscriptvaluegenerated.pro b/tests/auto/qscriptvaluegenerated/qscriptvaluegenerated.pro new file mode 100644 index 0000000..c3e9912 --- /dev/null +++ b/tests/auto/qscriptvaluegenerated/qscriptvaluegenerated.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +QT = core gui script +SOURCES += tst_qscriptvalue.cpp +HEADERS += tst_qscriptvalue.h + +# Generated by testgen +SOURCES += \ + tst_qscriptvalue_generated_init.cpp \ + tst_qscriptvalue_generated_cast.cpp \ + tst_qscriptvalue_generated_comparison.cpp \ + tst_qscriptvalue_generated_isXXX.cpp \ + tst_qscriptvalue_generated_toXXX.cpp + +win32-msvc* { + # With -O2, MSVC takes up to 24 minutes to compile this test! + QMAKE_CXXFLAGS_RELEASE -= -O1 -O2 + QMAKE_CXXFLAGS_RELEASE += -Od +} diff --git a/tests/auto/qscriptvalue/testgen/data.txt b/tests/auto/qscriptvaluegenerated/testgen/data.txt index 73677ec..73677ec 100644 --- a/tests/auto/qscriptvalue/testgen/data.txt +++ b/tests/auto/qscriptvaluegenerated/testgen/data.txt diff --git a/tests/auto/qscriptvalue/testgen/gen.py b/tests/auto/qscriptvaluegenerated/testgen/gen.py index 6e48f46..6e48f46 100755 --- a/tests/auto/qscriptvalue/testgen/gen.py +++ b/tests/auto/qscriptvaluegenerated/testgen/gen.py diff --git a/tests/auto/qscriptvalue/testgen/main.cpp b/tests/auto/qscriptvaluegenerated/testgen/main.cpp index 0672635..0672635 100644 --- a/tests/auto/qscriptvalue/testgen/main.cpp +++ b/tests/auto/qscriptvaluegenerated/testgen/main.cpp diff --git a/tests/auto/qscriptvalue/testgen/testgen.pro b/tests/auto/qscriptvaluegenerated/testgen/testgen.pro index 47709a8..47709a8 100644 --- a/tests/auto/qscriptvalue/testgen/testgen.pro +++ b/tests/auto/qscriptvaluegenerated/testgen/testgen.pro diff --git a/tests/auto/qscriptvalue/testgen/testgenerator.cpp b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp index 9d7d33d..9d7d33d 100644 --- a/tests/auto/qscriptvalue/testgen/testgenerator.cpp +++ b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp diff --git a/tests/auto/qscriptvalue/testgen/testgenerator.h b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h index 1c61fc5..1c61fc5 100644 --- a/tests/auto/qscriptvalue/testgen/testgenerator.h +++ b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp new file mode 100644 index 0000000..3856a6d --- /dev/null +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "tst_qscriptvalue.h" +#include <QtGui/QPushButton> + +//TESTED_CLASS= +//TESTED_FILES= + +QT_BEGIN_NAMESPACE +extern bool qt_script_isJITEnabled(); +QT_END_NAMESPACE + +tst_QScriptValue::tst_QScriptValue() + : engine(0) +{ +} + +tst_QScriptValue::~tst_QScriptValue() +{ + delete engine; +} + +void tst_QScriptValue::dataHelper(InitDataFunction init, DefineDataFunction define) +{ + QTest::addColumn<QString>("__expression__"); + (this->*init)(); + QHash<QString,QScriptValue>::const_iterator it; + for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) { + m_currentExpression = it.key(); + (this->*define)(it.key().toLatin1()); + } + m_currentExpression = QString(); +} + +QTestData &tst_QScriptValue::newRow(const char *tag) +{ + return QTest::newRow(tag) << m_currentExpression; +} + +void tst_QScriptValue::testHelper(TestFunction fun) +{ + QFETCH(QString, __expression__); + QScriptValue value = m_values.value(__expression__); + (this->*fun)(__expression__.toLatin1(), value); +} + +void tst_QScriptValue::assignAndCopyConstruct_initData() +{ + QTest::addColumn<int>("dummy"); + initScriptValues(); +} + +void tst_QScriptValue::assignAndCopyConstruct_makeData(const char *expr) +{ + newRow(expr) << 0; +} + +void tst_QScriptValue::assignAndCopyConstruct_test(const char *, const QScriptValue &value) +{ + QScriptValue copy(value); + QCOMPARE(copy.strictlyEquals(value), !value.isNumber() || !qIsNaN(value.toNumber())); + QCOMPARE(copy.engine(), value.engine()); + + QScriptValue assigned = copy; + QCOMPARE(assigned.strictlyEquals(value), !copy.isNumber() || !qIsNaN(copy.toNumber())); + QCOMPARE(assigned.engine(), assigned.engine()); + + QScriptValue other(!value.toBool()); + assigned = other; + QVERIFY(!assigned.strictlyEquals(copy)); + QVERIFY(assigned.strictlyEquals(other)); + QCOMPARE(assigned.engine(), other.engine()); +} + +DEFINE_TEST_FUNCTION(assignAndCopyConstruct) + +QTEST_MAIN(tst_QScriptValue) diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h new file mode 100644 index 0000000..50ab878 --- /dev/null +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue.h @@ -0,0 +1,370 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TST_QSCRIPTVALUE_H +#define TST_QSCRIPTVALUE_H + +#include <QtCore/qobject.h> +#include <QtCore/qnumeric.h> +#include <QtScript/qscriptclass.h> +#include <QtScript/qscriptengine.h> +#include <QtScript/qscriptvalue.h> +#include <QtTest/QtTest> + +#define DEFINE_TEST_VALUE(expr) m_values.insert(QString::fromLatin1(#expr), expr) + +Q_DECLARE_METATYPE(QVariant) +Q_DECLARE_METATYPE(QScriptValue) + +class tst_QScriptValue : public QObject +{ + Q_OBJECT + +public: + tst_QScriptValue(); + virtual ~tst_QScriptValue(); + +private slots: + // Generated test functions + void isArray_data(); + void isArray(); + + void isBool_data(); + void isBool(); + + void isBoolean_data(); + void isBoolean(); + + void isDate_data(); + void isDate(); + + void isError_data(); + void isError(); + + void isFunction_data(); + void isFunction(); + + void isNull_data(); + void isNull(); + + void isNumber_data(); + void isNumber(); + + void isObject_data(); + void isObject(); + + void isQMetaObject_data(); + void isQMetaObject(); + + void isQObject_data(); + void isQObject(); + + void isRegExp_data(); + void isRegExp(); + + void isString_data(); + void isString(); + + void isUndefined_data(); + void isUndefined(); + + void isValid_data(); + void isValid(); + + void isVariant_data(); + void isVariant(); + + void toBool_data(); + void toBool(); + + void toBoolean_data(); + void toBoolean(); + +// void toDateTime_data(); +// void toDateTime(); + + void toInt32_data(); + void toInt32(); + + void toInteger_data(); + void toInteger(); + + void toNumber_data(); + void toNumber(); + +// void toQMetaObject_data(); +// void toQMetaObject(); + +// void toQObject_data(); +// void toQObject(); + +// void toRegExp_data(); +// void toRegExp(); + + void toString_data(); + void toString(); + + void toUInt16_data(); + void toUInt16(); + + void toUInt32_data(); + void toUInt32(); + +// void toVariant_data(); +// void toVariant(); + + void equals_data(); + void equals(); + + void strictlyEquals_data(); + void strictlyEquals(); + + void lessThan_data(); + void lessThan(); + + void instanceOf_data(); + void instanceOf(); + + void assignAndCopyConstruct_data(); + void assignAndCopyConstruct(); + + void qscriptvalue_castQString_data(); + void qscriptvalue_castQString(); + + void qscriptvalue_castqsreal_data(); + void qscriptvalue_castqsreal(); + + void qscriptvalue_castbool_data(); + void qscriptvalue_castbool(); + + void qscriptvalue_castqint32_data(); + void qscriptvalue_castqint32(); + + void qscriptvalue_castquint32_data(); + void qscriptvalue_castquint32(); + + void qscriptvalue_castquint16_data(); + void qscriptvalue_castquint16(); + +private: + typedef void (tst_QScriptValue::*InitDataFunction)(); + typedef void (tst_QScriptValue::*DefineDataFunction)(const char *); + void dataHelper(InitDataFunction init, DefineDataFunction define); + QTestData &newRow(const char *tag); + + typedef void (tst_QScriptValue::*TestFunction)(const char *, const QScriptValue &); + void testHelper(TestFunction fun); + + // Generated functions + + void initScriptValues(); + + void isArray_initData(); + void isArray_makeData(const char *expr); + void isArray_test(const char *expr, const QScriptValue &value); + + void isBool_initData(); + void isBool_makeData(const char *expr); + void isBool_test(const char *expr, const QScriptValue &value); + + void isBoolean_initData(); + void isBoolean_makeData(const char *expr); + void isBoolean_test(const char *expr, const QScriptValue &value); + + void isDate_initData(); + void isDate_makeData(const char *expr); + void isDate_test(const char *expr, const QScriptValue &value); + + void isError_initData(); + void isError_makeData(const char *expr); + void isError_test(const char *expr, const QScriptValue &value); + + void isFunction_initData(); + void isFunction_makeData(const char *expr); + void isFunction_test(const char *expr, const QScriptValue &value); + + void isNull_initData(); + void isNull_makeData(const char *expr); + void isNull_test(const char *expr, const QScriptValue &value); + + void isNumber_initData(); + void isNumber_makeData(const char *expr); + void isNumber_test(const char *expr, const QScriptValue &value); + + void isObject_initData(); + void isObject_makeData(const char *expr); + void isObject_test(const char *expr, const QScriptValue &value); + + void isQMetaObject_initData(); + void isQMetaObject_makeData(const char *expr); + void isQMetaObject_test(const char *expr, const QScriptValue &value); + + void isQObject_initData(); + void isQObject_makeData(const char *expr); + void isQObject_test(const char *expr, const QScriptValue &value); + + void isRegExp_initData(); + void isRegExp_makeData(const char *expr); + void isRegExp_test(const char *expr, const QScriptValue &value); + + void isString_initData(); + void isString_makeData(const char *expr); + void isString_test(const char *expr, const QScriptValue &value); + + void isUndefined_initData(); + void isUndefined_makeData(const char *expr); + void isUndefined_test(const char *expr, const QScriptValue &value); + + void isValid_initData(); + void isValid_makeData(const char *expr); + void isValid_test(const char *expr, const QScriptValue &value); + + void isVariant_initData(); + void isVariant_makeData(const char *expr); + void isVariant_test(const char *expr, const QScriptValue &value); + + void toBool_initData(); + void toBool_makeData(const char *); + void toBool_test(const char *, const QScriptValue &value); + + void toBoolean_initData(); + void toBoolean_makeData(const char *); + void toBoolean_test(const char *, const QScriptValue &value); + + void toDateTime_initData(); + void toDateTime_makeData(const char *); + void toDateTime_test(const char *, const QScriptValue &value); + + void toInt32_initData(); + void toInt32_makeData(const char *); + void toInt32_test(const char *, const QScriptValue &value); + + void toInteger_initData(); + void toInteger_makeData(const char *); + void toInteger_test(const char *, const QScriptValue &value); + + void toNumber_initData(); + void toNumber_makeData(const char *); + void toNumber_test(const char *, const QScriptValue &value); + + void toQMetaObject_initData(); + void toQMetaObject_makeData(const char *); + void toQMetaObject_test(const char *, const QScriptValue &value); + + void toQObject_initData(); + void toQObject_makeData(const char *); + void toQObject_test(const char *, const QScriptValue &value); + + void toRegExp_initData(); + void toRegExp_makeData(const char *); + void toRegExp_test(const char *, const QScriptValue &value); + + void toString_initData(); + void toString_makeData(const char *); + void toString_test(const char *, const QScriptValue &value); + + void toUInt16_initData(); + void toUInt16_makeData(const char *); + void toUInt16_test(const char *, const QScriptValue &value); + + void toUInt32_initData(); + void toUInt32_makeData(const char *); + void toUInt32_test(const char *, const QScriptValue &value); + + void toVariant_initData(); + void toVariant_makeData(const char *); + void toVariant_test(const char *, const QScriptValue &value); + + void equals_initData(); + void equals_makeData(const char *); + void equals_test(const char *, const QScriptValue &value); + + void strictlyEquals_initData(); + void strictlyEquals_makeData(const char *); + void strictlyEquals_test(const char *, const QScriptValue &value); + + void lessThan_initData(); + void lessThan_makeData(const char *); + void lessThan_test(const char *, const QScriptValue &value); + + void instanceOf_initData(); + void instanceOf_makeData(const char *); + void instanceOf_test(const char *, const QScriptValue &value); + + void assignAndCopyConstruct_initData(); + void assignAndCopyConstruct_makeData(const char *); + void assignAndCopyConstruct_test(const char *, const QScriptValue &value); + + void qscriptvalue_castQString_initData(); + void qscriptvalue_castQString_makeData(const char *); + void qscriptvalue_castQString_test(const char *, const QScriptValue &value); + + void qscriptvalue_castqsreal_initData(); + void qscriptvalue_castqsreal_makeData(const char *); + void qscriptvalue_castqsreal_test(const char *, const QScriptValue &value); + + void qscriptvalue_castbool_initData(); + void qscriptvalue_castbool_makeData(const char *); + void qscriptvalue_castbool_test(const char *, const QScriptValue &value); + + void qscriptvalue_castqint32_initData(); + void qscriptvalue_castqint32_makeData(const char *); + void qscriptvalue_castqint32_test(const char *, const QScriptValue &value); + + void qscriptvalue_castquint32_initData(); + void qscriptvalue_castquint32_makeData(const char *); + void qscriptvalue_castquint32_test(const char *, const QScriptValue &value); + + void qscriptvalue_castquint16_initData(); + void qscriptvalue_castquint16_makeData(const char *); + void qscriptvalue_castquint16_test(const char *, const QScriptValue &value); + +private: + QScriptEngine *engine; + QHash<QString, QScriptValue> m_values; + QString m_currentExpression; +}; + +#define DEFINE_TEST_FUNCTION(name) \ +void tst_QScriptValue::name##_data() { dataHelper(&tst_QScriptValue::name##_initData, &tst_QScriptValue::name##_makeData); } \ +void tst_QScriptValue::name() { testHelper(&tst_QScriptValue::name##_test); } + +#endif diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_cast.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp index e651810..e651810 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_cast.cpp +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp index 6e1f8ee..6e1f8ee 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_comparison.cpp +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_init.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp index a9eb2ca..a9eb2ca 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_init.cpp +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_isXXX.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp index 106043b..106043b 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_isXXX.cpp +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_toXXX.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp index 754f4e0..754f4e0 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue_generated_toXXX.cpp +++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp diff --git a/tests/auto/script.pro b/tests/auto/script.pro index 420bd74..c4d0544 100644 --- a/tests/auto/script.pro +++ b/tests/auto/script.pro @@ -13,5 +13,6 @@ SUBDIRS=\ qscriptstring \ qscriptv8testsuite \ qscriptvalue \ + qscriptvaluegenerated \ qscriptvalueiterator \ |