summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2012-05-10 14:21:56 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-16 15:34:56 +0200
commit8bd99b5f8b6fad92c84178c1bd8e10f05fefb222 (patch)
tree4bf710cbf3f2f8fe0f2fe1020c5b040d2e9b886d
parentd16b852410542268e815e3fc3e895ab0c9b4f625 (diff)
downloadqtscript-8bd99b5f8b6fad92c84178c1bd8e10f05fefb222.tar.gz
Remove the test generator for the test qscriptvaluegenerated.
The data will not be re-generated any more since the module is done. See also 58f53b807fafcadf76282f0c8c7f20451c7a97a5. Change-Id: Ida365dbb2e0a70b1cf7d5f0714e5df4cc7084d30 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
-rw-r--r--tests/auto/qscriptvaluegenerated/testgen/data.txt167
-rwxr-xr-xtests/auto/qscriptvaluegenerated/testgen/gen.py246
-rw-r--r--tests/auto/qscriptvaluegenerated/testgen/main.cpp62
-rw-r--r--tests/auto/qscriptvaluegenerated/testgen/testgen.pro18
-rw-r--r--tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp813
-rw-r--r--tests/auto/qscriptvaluegenerated/testgen/testgenerator.h75
-rw-r--r--tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp4
-rw-r--r--tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp4
-rw-r--r--tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp4
-rw-r--r--tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp4
-rw-r--r--tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp4
11 files changed, 0 insertions, 1401 deletions
diff --git a/tests/auto/qscriptvaluegenerated/testgen/data.txt b/tests/auto/qscriptvaluegenerated/testgen/data.txt
deleted file mode 100644
index 2cc1229..0000000
--- a/tests/auto/qscriptvaluegenerated/testgen/data.txt
+++ /dev/null
@@ -1,167 +0,0 @@
-# Data set for QScriptValue autotest.
-
-# Each line is a c++ code that should return a QScriptValue object.
-# Lines that are empty or start with '#' will be ignored
-
-QScriptValue()
-
-#Unbound values
-QScriptValue(QScriptValue::UndefinedValue)
-QScriptValue(QScriptValue::NullValue)
-QScriptValue(true)
-QScriptValue(false)
-QScriptValue(int(122))
-QScriptValue(uint(124))
-QScriptValue(0)
-QScriptValue(0.0)
-QScriptValue(123.0)
-QScriptValue(6.37e-8)
-QScriptValue(-6.37e-8)
-QScriptValue(0x43211234)
-QScriptValue(0x10000)
-QScriptValue(0x10001)
-QScriptValue(qSNaN())
-QScriptValue(qQNaN())
-QScriptValue(qInf())
-QScriptValue(-qInf())
-QScriptValue("NaN")
-QScriptValue("Infinity")
-QScriptValue("-Infinity")
-QScriptValue("ciao")
-QScriptValue(QString::fromLatin1("ciao"))
-QScriptValue(QString(""))
-QScriptValue(QString())
-QScriptValue(QString("0"))
-QScriptValue(QString("123"))
-QScriptValue(QString("12.4"))
-#QScriptValue(QString::fromUtf8("ąśćżźółńę"))
-
-#Unbound values (bound to a null engine)
-QScriptValue(0, QScriptValue::UndefinedValue)
-QScriptValue(0, QScriptValue::NullValue)
-QScriptValue(0, true)
-QScriptValue(0, false)
-QScriptValue(0, int(122))
-QScriptValue(0, uint(124))
-QScriptValue(0, 0)
-QScriptValue(0, 0.0)
-QScriptValue(0, 123.0)
-QScriptValue(0, 6.37e-8)
-QScriptValue(0, -6.37e-8)
-QScriptValue(0, 0x43211234)
-QScriptValue(0, 0x10000)
-QScriptValue(0, 0x10001)
-QScriptValue(0, qSNaN())
-QScriptValue(0, qQNaN())
-QScriptValue(0, qInf())
-QScriptValue(0, -qInf())
-QScriptValue(0, "NaN")
-QScriptValue(0, "Infinity")
-QScriptValue(0, "-Infinity")
-QScriptValue(0, "ciao")
-QScriptValue(0, QString::fromLatin1("ciao"))
-QScriptValue(0, QString(""))
-QScriptValue(0, QString())
-QScriptValue(0, QString("0"))
-QScriptValue(0, QString("123"))
-QScriptValue(0, QString("12.3"))
-#QScriptValue(0, QString::fromUtf8("ąśćżźółńę"))
-
-#Bound values
-QScriptValue(engine, QScriptValue::UndefinedValue)
-QScriptValue(engine, QScriptValue::NullValue)
-QScriptValue(engine, true)
-QScriptValue(engine, false)
-QScriptValue(engine, int(122))
-QScriptValue(engine, uint(124))
-QScriptValue(engine, 0)
-QScriptValue(engine, 0.0)
-QScriptValue(engine, 123.0)
-QScriptValue(engine, 6.37e-8)
-QScriptValue(engine, -6.37e-8)
-QScriptValue(engine, 0x43211234)
-QScriptValue(engine, 0x10000)
-QScriptValue(engine, 0x10001)
-QScriptValue(engine, qSNaN())
-QScriptValue(engine, qQNaN())
-QScriptValue(engine, qInf())
-QScriptValue(engine, -qInf())
-QScriptValue(engine, "NaN")
-QScriptValue(engine, "Infinity")
-QScriptValue(engine, "-Infinity")
-QScriptValue(engine, "ciao")
-QScriptValue(engine, QString::fromLatin1("ciao"))
-QScriptValue(engine, QString(""))
-QScriptValue(engine, QString())
-QScriptValue(engine, QString("0"))
-QScriptValue(engine, QString("123"))
-QScriptValue(engine, QString("1.23"))
-
-# evaluate
-engine->evaluate("[]")
-engine->evaluate("{}")
-engine->evaluate("Object.prototype")
-engine->evaluate("Date.prototype")
-engine->evaluate("Array.prototype")
-engine->evaluate("Function.prototype")
-engine->evaluate("Error.prototype")
-engine->evaluate("Object")
-engine->evaluate("Array")
-engine->evaluate("Number")
-engine->evaluate("Function")
-engine->evaluate("(function() { return 1; })")
-engine->evaluate("(function() { return 'ciao'; })")
-engine->evaluate("(function() { throw new Error('foo'); })")
-engine->evaluate("/foo/")
-engine->evaluate("new Object()")
-engine->evaluate("new Array()")
-engine->evaluate("new Error()")
-engine->evaluate("new Boolean(true)")
-engine->evaluate("new Boolean(false)")
-engine->evaluate("new Number(123)")
-engine->evaluate("new RegExp('foo', 'gim')")
-engine->evaluate("new String('ciao')")
-engine->evaluate("a = new Object(); a.foo = 22; a.foo")
-engine->evaluate("Undefined")
-engine->evaluate("Null")
-engine->evaluate("True")
-engine->evaluate("False")
-
-engine->evaluate("undefined")
-engine->evaluate("null")
-engine->evaluate("true")
-engine->evaluate("false")
-engine->evaluate("122")
-engine->evaluate("124")
-engine->evaluate("0")
-engine->evaluate("0.0")
-engine->evaluate("123.0")
-engine->evaluate("6.37e-8")
-engine->evaluate("-6.37e-8")
-engine->evaluate("0x43211234")
-engine->evaluate("0x10000")
-engine->evaluate("0x10001")
-engine->evaluate("NaN")
-engine->evaluate("Infinity")
-engine->evaluate("-Infinity")
-engine->evaluate("'ciao'")
-engine->evaluate("''")
-engine->evaluate("'0'")
-engine->evaluate("'123'")
-engine->evaluate("'12.4'")
-#engine->evaluate(QString::fromUtf8("'ąśćżźółńę'"))
-
-#other
-engine->nullValue()
-engine->undefinedValue()
-engine->newObject()
-engine->newArray()
-engine->newArray(10)
-engine->newDate(QDateTime())
-engine->newQMetaObject(&QObject::staticMetaObject)
-engine->newRegExp("foo", "gim")
-engine->newVariant(QVariant())
-engine->newVariant(QVariant(123))
-engine->newVariant(QVariant(false))
-engine->newQObject(0)
-engine->newQObject(engine)
diff --git a/tests/auto/qscriptvaluegenerated/testgen/gen.py b/tests/auto/qscriptvaluegenerated/testgen/gen.py
deleted file mode 100755
index d94c28a..0000000
--- a/tests/auto/qscriptvaluegenerated/testgen/gen.py
+++ /dev/null
@@ -1,246 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#############################################################################
-##
-## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-## Contact: http://www.qt-project.org/
-##
-## $QT_BEGIN_LICENSE:LGPL$
-## GNU Lesser General Public License Usage
-## 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.
-##
-## GNU General Public License Usage
-## Alternatively, this file may be used under the terms of the GNU General
-## Public License version 3.0 as published by the Free Software Foundation
-## and appearing in the file LICENSE.GPL included in the packaging of this
-## file. Please review the following information to ensure the GNU General
-## Public License version 3.0 requirements will be met:
-## http://www.gnu.org/copyleft/gpl.html.
-##
-## Other Usage
-## Alternatively, this file may be used in accordance with the terms and
-## conditions contained in a signed written agreement between you and Nokia.
-##
-##
-##
-##
-##
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-from __future__ import with_statement
-from string import Template
-
-class Options():
- """Option manager. It parse and check all paramteres, set internal variables."""
- def __init__(self, args):
- import logging as log
- log.basicConfig()
- #comand line options parser
- from optparse import OptionParser
- #load some directory searching stuff
- import os.path, sys
-
- opt = OptionParser("%prog [options] path_to_input_file path_to_output_file.")
-
- self._o, self._a = opt.parse_args(args)
-
- try:
- if not (os.path.exists(self._a[0])):
- raise Exception("Path doesn't exist")
- if len(self._a) != 2:
- raise IndexError("Only two files!")
- self._o.ipath = self._a[0]
- self._o.opath = self._a[1]
- except IndexError:
- log.error("Bad usage. Please try -h or --help")
- sys.exit(1)
- except Exception:
- log.error("Path '" + self._a[0] + " or " + self._a[1] + "' don't exist")
- sys.exit(2)
-
- def __getattr__(self, attr):
- """map all options properties into this object (remove one level of indirection)"""
- return getattr(self._o, attr)
-
-
-mainTempl = Template("""/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-////////////////////////////////////////////////////////////////
-// THIS FILE IS AUTOGENERATED, ALL MODIFICATIONS WILL BE LAST //
-////////////////////////////////////////////////////////////////
-
-#include "testgenerator.h"
-
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qvector.h>
-#include <QtScript/qscriptvalue.h>
-#include <QtScript/qscriptengine.h>
-
-
-
-typedef bool (QScriptValue::*ComparisionType) (const QScriptValue&) const;
-static QVector<bool> compare(ComparisionType compare, QScriptValue value, const QScriptValueList& values) {
- QVector<bool> result;
- result.reserve(${count});
-
- QScriptValueList::const_iterator i = values.constBegin();
- for (; i != values.constEnd(); ++i) {
- result << (value.*compare)(*i);
- }
- return result;
-}
-
-static void dump(QDataStream& out, QScriptValue& value, const QString& expression, const QScriptValueList& allValues)
-{
- out << QString(expression);
-
- out << value.isValid();
- out << value.isBool();
- out << value.isBoolean();
- out << value.isNumber();
- out << value.isFunction();
- out << value.isNull();
- out << value.isString();
- out << value.isUndefined();
- out << value.isVariant();
- out << value.isQObject();
- out << value.isQMetaObject();
- out << value.isObject();
- out << value.isDate();
- out << value.isRegExp();
- out << value.isArray();
- out << value.isError();
-
- out << value.toString();
- out << value.toNumber();
- out << value.toBool();
- out << value.toBoolean();
- out << value.toInteger();
- out << value.toInt32();
- out << value.toUInt32();
- out << value.toUInt16();
-
- out << compare(&QScriptValue::equals, value, allValues);
- out << compare(&QScriptValue::strictlyEquals, value, allValues);
- out << compare(&QScriptValue::lessThan, value, allValues);
- out << compare(&QScriptValue::instanceOf, value, allValues);
-
- out << qscriptvalue_cast<QString>(value);
- out << qscriptvalue_cast<qsreal>(value);
- out << qscriptvalue_cast<bool>(value);
- out << qscriptvalue_cast<qint32>(value);
- out << qscriptvalue_cast<quint32>(value);
- out << qscriptvalue_cast<quint16>(value);
-}
-
-void TestGenerator::prepareData()
-{
- QScriptEngine* engine = new QScriptEngine;
-
- QScriptValueList allValues;
- allValues << ${values};
- QVector<QString> allDataTags;
- allDataTags.reserve(${count});
- allDataTags << ${dataTags};
- QDataStream out(&m_tempFile);
- out << allDataTags;
-
- for(unsigned i = 0; i < ${count}; ++i)
- dump(out, allValues[i], allDataTags[i], allValues);
-
- delete engine;
-}
-""")
-qsvTempl = Template("""
- {
- QScriptValue value = ${expr};
- dump(out, value, "${expr_esc}", allValues);
- }""")
-
-
-
-if __name__ == '__main__':
- import sys
- o = Options(sys.argv[1:])
- out = []
- qsv = []
- # load input file
- with open(o.ipath) as f:
- for row in f.readlines():
- qsv.append(row)
-
- #skip comments and empty lines
- qsv = filter(lambda w: len(w.strip()) and not w.startswith('#'), qsv)
-
- escape = lambda w: w.replace('\\','\\\\').replace('"','\\"')
-
- for row in qsv:
- row = row.replace('\n','')
- row_esc = escape(row)
- out.append(qsvTempl.substitute(expr = row, expr_esc = row_esc))
-
- result = mainTempl.safe_substitute(dump= "".join(out) \
- , values = (11 * ' ' + '<< ').join(qsv) \
- , count = len(qsv) \
- , dataTags = (11 * ' ' + '<< ').join(map(lambda w: '"' + escape(w.replace('\n','')) + '"\n', qsv)))
-
- with open(o.opath, 'w') as f:
- f.write(result)
-
-
diff --git a/tests/auto/qscriptvaluegenerated/testgen/main.cpp b/tests/auto/qscriptvaluegenerated/testgen/main.cpp
deleted file mode 100644
index 0e8f214..0000000
--- a/tests/auto/qscriptvaluegenerated/testgen/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "testgenerator.h"
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/QCoreApplication>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication a(argc, argv);
-
- if (argc != 2) {
- qWarning() << "./prog outputdir";
- exit(1);
- }
-
- //Procced
- TestGenerator gen(a.arguments()[1]);
- gen.run();
-
- return 0;
-}
diff --git a/tests/auto/qscriptvaluegenerated/testgen/testgen.pro b/tests/auto/qscriptvaluegenerated/testgen/testgen.pro
deleted file mode 100644
index 47709a8..0000000
--- a/tests/auto/qscriptvaluegenerated/testgen/testgen.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-QT += core script
-TARGET = testgen
-CONFIG += console
-CONFIG -= app_bundle
-TEMPLATE = app
-
-SOURCES += main.cpp \
- testgenerator.cpp
-HEADERS += testgenerator.h
-
-
-INPUT_DATASET = data.txt
-dataset.name = Generating QScraiptValue autotest's dataset
-dataset.output = autogenerated.cpp
-dataset.commands = python gen.py data.txt autogenerated.cpp
-dataset.input = INPUT_DATASET
-dataset.variable_out = SOURCES
-QMAKE_EXTRA_COMPILERS += dataset
diff --git a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp
deleted file mode 100644
index 7458a8a..0000000
--- a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.cpp
+++ /dev/null
@@ -1,813 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "testgenerator.h"
-
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qnumeric.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qtextstream.h>
-#include <QtCore/qvariant.h>
-#include <QtScript/qscriptvalue.h>
-
-void TestGenerator::save(const QHash<QString, QString>& data)
-{
- foreach(const QString& name, data.keys()) {
- QFile ofile(m_opath + "tst_qscriptvalue_generated_" + name + ".cpp");
- if (!ofile.open(QIODevice::WriteOnly | QIODevice::Text)) {
- qWarning() << "Can't open output file: " << ofile.fileName();
- exit(2);
- }
- QTextStream out(&ofile);
- out << data[name];
- }
-}
-
-static QString escape(QString txt)
-{
- return txt.replace("\\","\\\\").replace("\"","\\\"").replace("\n","\\n");
-}
-
-template<typename T>
-QString prepareToInsert(T value) {return QString::fromLatin1("\"") + escape(value) + "\"";}
-template<>
-QString prepareToInsert<qsreal>(qsreal value)
-{
- if (qIsNaN(value))
- return "qQNaN()";
- if (qIsInf(value))
- return "qInf()";
- return QString::number(value, 'g', 16);
-}
-template<>
-QString prepareToInsert<qint32>(qint32 value) {return QString::number(value);}
-template<>
-QString prepareToInsert<quint32>(quint32 value) {return QString::number(value);}
-template<>
-QString prepareToInsert<quint16>(quint16 value) {return QString::number(value);}
-template<>
-QString prepareToInsert<bool>(bool value) {return value ? "true" : "false";}
-template<>
-QString prepareToInsert<QString>(QString value) {return QString::fromLatin1("\"") + escape(value) + "\"";}
-
-template<typename T>
-QString typeName() {return QString();}
-template<>
-QString typeName<qsreal>() {return "qsreal";}
-template<>
-QString typeName<qint32>() {return "qint32";}
-template<>
-QString typeName<quint32>() {return "quint32";}
-template<>
-QString typeName<quint16>() {return "quint16";}
-template<>
-QString typeName<bool>() {return "bool";}
-template<>
-QString typeName<QString>() {return "QString";}
-
-static QString generateLicence()
-{
- return "/****************************************************************************\n"
- "**\n"
- "** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n"
- "** Contact: http://www.qt-project.org/\n"
- "**\n"
- "** This file is part of the test suite of the Qt Toolkit.\n"
- "**\n"
- "** $QT_BEGIN_LICENSE:LGPL$\n"
- "** GNU Lesser General Public License Usage\n"
- "** This file may be used under the terms of the GNU Lesser General Public\n"
- "** License version 2.1 as published by the Free Software Foundation and\n"
- "** appearing in the file LICENSE.LGPL included in the packaging of this\n"
- "** file. Please review the following information to ensure the GNU Lesser\n"
- "** General Public License version 2.1 requirements will be met:\n"
- "** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n"
- "**\n"
- "** In addition, as a special exception, Nokia gives you certain additional\n"
- "** rights. These rights are described in the Nokia Qt LGPL Exception\n"
- "** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n"
- "**\n"
- "** GNU General Public License Usage\n"
- "** Alternatively, this file may be used under the terms of the GNU General\n"
- "** Public License version 3.0 as published by the Free Software Foundation\n"
- "** and appearing in the file LICENSE.GPL included in the packaging of this\n"
- "** file. Please review the following information to ensure the GNU General\n"
- "** Public License version 3.0 requirements will be met:\n"
- "** http://www.gnu.org/copyleft/gpl.html.\n"
- "**\n"
- "** Other Usage\n"
- "** Alternatively, this file may be used in accordance with the terms and\n"
- "** conditions contained in a signed written agreement between you and Nokia.\n"
- "**\n"
- "**\n"
- "**\n"
- "**\n"
- "**\n"
- "**\n"
- "** $QT_END_LICENSE$\n"
- "**\n"
- "****************************************************************************/\n"
- "\n"\
- "/****************************************************************************\n"\
- "*************** This file has been generated. DO NOT MODIFY! ****************\n"
- "****************************************************************************/\n\n"\
- "#include \"tst_qscriptvalue.h\"\n\n";
-}
-
-static QString generateIsXXXDef(const QString& name, const QList<QString>& list)
-{
- static const QString templ("void tst_QScriptValueGenerated::%1_initData()\n"\
- "{\n"\
- " QTest::addColumn<bool>(\"expected\");\n"\
- " initScriptValues();\n"\
- "}\n"\
- "\n"\
- "static QString %1_array[] = {%2};\n\n"\
- "void tst_QScriptValueGenerated::%1_makeData(const char* expr)\n"\
- "{\n"\
- " static QSet<QString> %1;\n"\
- " if (%1.isEmpty()) {\n"\
- " %1.reserve(%3);\n"\
- " for (unsigned i = 0; i < %3; ++i)\n"\
- " %1.insert(%1_array[i]);\n"\
- " }\n"\
- " newRow(expr) << %1.contains(expr);\n"\
- "}\n"\
- "\n"\
- "void tst_QScriptValueGenerated::%1_test(const char*, const QScriptValue& value)\n"\
- "{\n"\
- " QFETCH(bool, expected);\n"\
- " QCOMPARE(value.%1(), expected);\n"\
- " QCOMPARE(value.%1(), expected);\n"\
- "}\n"\
- "\n"\
- "DEFINE_TEST_FUNCTION(%1)\n"\
- "\n");
-
- if (!list.size()) {
- qWarning() << name << ": nothing to add!" ;
- return QString();
- }
-
- QString result = templ;
- QStringList set;
- set.reserve(3 * list.count());
- foreach(const QString& t, list) {
- if (!set.isEmpty())
- set.append("\",");
- set.append("\n \"");
- set.append(escape(t));
- }
- if (!list.isEmpty())
- set.append("\"\n");
-
- return result.arg(name, set.join(QString()), QString::number(list.count()));
-}
-
-template<typename T>
-static QString generateToXXXDef(const QString& name, const QList<QPair<QString, T> >& list)
-{
- static const QString templ = "\n"\
- "void tst_QScriptValueGenerated::%1_initData()\n"\
- "{\n"\
- " QTest::addColumn<%2>(\"expected\");\n"\
- " initScriptValues();\n"\
- "}\n"\
- "\n"\
- "static QString %1_tagArray[] = {%4};\n\n"\
- "static %2 %1_valueArray[] = {%5};\n\n"\
- "void tst_QScriptValueGenerated::%1_makeData(const char* expr)\n"\
- "{\n"\
- " static QHash<QString, %2> %1;\n"\
- " if (%1.isEmpty()) {\n"\
- " %1.reserve(%3);\n"\
- " for (unsigned i = 0; i < %3; ++i)\n"\
- " %1.insert(%1_tagArray[i], %1_valueArray[i]);\n"\
- " }\n"\
- " newRow(expr) << %1.value(expr);\n"\
- "}\n"\
- "\n"\
- "void tst_QScriptValueGenerated::%1_test(const char*, const QScriptValue& value)\n"\
- "{\n"\
- " QFETCH(%2, expected);\n"\
- " QCOMPARE(value.%1(), expected);\n"\
- " QCOMPARE(value.%1(), expected);\n"\
- "}\n"\
- "\n"\
- "DEFINE_TEST_FUNCTION(%1)\n";
- QString result = templ;
-
- typename QList<QPair<QString, T> >::const_iterator i = list.constBegin();
- QStringList tagSet, valueSet;
- tagSet.reserve(4 * list.count());
- valueSet.reserve(3 * list.count());
- for(int lineBreaker = 0; i != list.constEnd(); ++i) {
- QPair<QString, T> t = *i;
- t.first = escape(t.first);
- if (!valueSet.isEmpty()) {
- valueSet.append(QString(","));
- tagSet.append(QString::fromLatin1(","));
- }
- tagSet.append(QString("\n \""));
- tagSet.append(t.first);
- tagSet.append(QString::fromLatin1("\""));
- if (!((lineBreaker++)%2))
- valueSet.append(QString("\n "));
- else
- valueSet.append(QString::fromLatin1(" "));
- valueSet.append(prepareToInsert<T>(t.second));
- }
- return result.arg(name,
- typeName<T>(),
- QString::number(list.count()),
- tagSet.join(QString()),
- valueSet.join(QString()));
-}
-
-
-template<>
-QString generateToXXXDef<qsreal>(const QString& name, const QList<QPair<QString, qsreal> >& list)
-{
- static const QString templ = "\n"\
- "void tst_QScriptValueGenerated::%1_initData()\n"\
- "{\n"\
- " QTest::addColumn<%2>(\"expected\");\n"\
- " initScriptValues();\n"\
- "}\n"\
- "\n"\
- "static QString %1_tagArray[] = {%3};\n"\
- "static %2 %1_valueArray[] = {%4};\n"\
- "void tst_QScriptValueGenerated::%1_makeData(const char* expr)\n"\
- "{\n"\
- " static QHash<QString, %2> %1;\n"\
- " if (%1.isEmpty()) {\n"\
- " %1.reserve(%5);\n"\
- " for (unsigned i = 0; i < %5; ++i)\n"\
- " %1.insert(%1_tagArray[i], %1_valueArray[i]);\n"\
- " }\n"\
- " newRow(expr) << %1.value(expr);\n"\
- "}\n"\
- "\n"\
- "void tst_QScriptValueGenerated::%1_test(const char*, const QScriptValue& value)\n"\
- "{\n"\
- " QFETCH(%2, expected);\n"\
- "%666"
- " if (qIsInf(expected)) {\n"\
- " QVERIFY(qIsInf(value.%1()));\n"\
- " QVERIFY(qIsInf(value.%1()));\n"\
- " return;\n"\
- " }\n"\
- " QCOMPARE(value.%1(), expected);\n"\
- " QCOMPARE(value.%1(), expected);\n"\
- "}\n"\
- "\n"\
- "DEFINE_TEST_FUNCTION(%1)\n";
- QString result = templ;
-
- QList<QPair<QString, qsreal> >::const_iterator i = list.constBegin();
- QStringList tagSet, valueSet;
- tagSet.reserve(4 * list.count());
- valueSet.reserve(3 * list.count());
- for(int lineBreaker = 0; i != list.constEnd(); ++i) {
- QPair<QString, qsreal> t = *i;
- t.first = escape(t.first);
- if (!valueSet.isEmpty()) {
- valueSet.append(QString(","));
- tagSet.append(QString::fromLatin1(","));
- }
- tagSet.append(QString("\n \""));
- tagSet.append(t.first);
- tagSet.append(QString::fromLatin1("\""));
- if (!((lineBreaker++)%10))
- valueSet.append(QString("\n "));
- else
- valueSet.append(QString::fromLatin1(" "));
- valueSet.append(prepareToInsert<qsreal>(t.second));
- }
-
- // toInteger shouldn't return NaN, so it would be nice to catch the case.
- QString hook;
- if (name == "toNumber") {
- hook =
- " if (qIsNaN(expected)) {\n"\
- " QVERIFY(qIsNaN(value.toNumber()));\n"\
- " return;\n"\
- " }\n";
- }
- return result.arg(name,
- typeName<qsreal>(),
- tagSet.join(QString()),
- valueSet.join(QString()),
- QString::number(list.count()),
- hook);
-}
-
-template<typename T>
-static QString generateCastDef(const QList<QPair<QString, T> >& list)
-{
- static const QString templ = "\n"\
- "void tst_QScriptValueGenerated::qscriptvalue_cast%1_initData()\n"\
- "{\n"\
- " QTest::addColumn<%1>(\"expected\");\n"\
- " initScriptValues();\n"\
- "}\n"\
- "\n"\
- "static QString qscriptvalue_cast%1_tagArray[] = {%2};\n"\
- "static %1 qscriptvalue_cast%1_valueArray[] = {%3};\n"\
- "void tst_QScriptValueGenerated::qscriptvalue_cast%1_makeData(const char* expr)\n"\
- "{\n"\
- " static QHash<QString, %1> value;\n"\
- " if (value.isEmpty()) {\n"\
- " value.reserve(%4);\n"\
- " for (unsigned i = 0; i < %4; ++i)\n"\
- " value.insert(qscriptvalue_cast%1_tagArray[i], qscriptvalue_cast%1_valueArray[i]);\n"\
- " }\n"\
- " newRow(expr) << value.value(expr);\n"\
- "}\n"\
- "\n"\
- "void tst_QScriptValueGenerated::qscriptvalue_cast%1_test(const char*, const QScriptValue& value)\n"\
- "{\n"\
- " QFETCH(%1, expected);\n"\
- " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\
- " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\
- "}\n"\
- "\n"\
- "DEFINE_TEST_FUNCTION(qscriptvalue_cast%1)\n";
- QString result = templ;
-
- typename QList<QPair<QString, T> >::const_iterator i = list.constBegin();
- QStringList tagSet, valueSet;
- tagSet.reserve(4 * list.count());
- valueSet.reserve(3 * list.count());
- for(int lineBreaker = 0; i != list.constEnd(); ++i) {
- QPair<QString, T> t = *i;
- t.first = escape(t.first);
- if (!valueSet.isEmpty()) {
- valueSet.append(QString(","));
- tagSet.append(QString::fromLatin1(","));
- }
- tagSet.append(QString("\n \""));
- tagSet.append(t.first);
- tagSet.append(QString::fromLatin1("\""));
- if (!((lineBreaker++)%2))
- valueSet.append(QString("\n "));
- else
- valueSet.append(QString::fromLatin1(" "));
- valueSet.append(prepareToInsert<T>(t.second));
- }
- return result.arg(typeName<T>(), tagSet.join(QString()), valueSet.join(QString()), QString::number(list.count()));
-}
-
-template<>
-QString generateCastDef<qsreal>(const QList<QPair<QString, qsreal> >& list)
-{
- static const QString templ = "\n"\
- "void tst_QScriptValueGenerated::qscriptvalue_cast%1_initData()\n"\
- "{\n"\
- " QTest::addColumn<%1>(\"expected\");\n"\
- " initScriptValues();\n"\
- "}\n"\
- "\n"\
- "static QString qscriptvalue_cast%1_tagArray[] = {%2};\n"\
- "static %1 qscriptvalue_cast%1_valueArray[] = {%3};\n"\
- "void tst_QScriptValueGenerated::qscriptvalue_cast%1_makeData(const char* expr)\n"\
- "{\n"\
- " static QHash<QString, %1> value;\n"\
- " if (value.isEmpty()) {\n"\
- " value.reserve(%4);\n"\
- " for (unsigned i = 0; i < %4; ++i)\n"\
- " value.insert(qscriptvalue_cast%1_tagArray[i], qscriptvalue_cast%1_valueArray[i]);\n"\
- " }\n"\
- " newRow(expr) << value.value(expr);\n"\
- "}\n"\
- "\n"\
- "void tst_QScriptValueGenerated::qscriptvalue_cast%1_test(const char*, const QScriptValue& value)\n"\
- "{\n"\
- " QFETCH(%1, expected);\n"\
- " if (qIsNaN(expected)) {\n"
- " QVERIFY(qIsNaN(qscriptvalue_cast<%1>(value)));\n"
- " QVERIFY(qIsNaN(qscriptvalue_cast<%1>(value)));\n"
- " return;\n"
- " }\n"\
- " if (qIsInf(expected)) {\n"
- " QVERIFY(qIsInf(qscriptvalue_cast<%1>(value)));\n"
- " QVERIFY(qIsInf(qscriptvalue_cast<%1>(value)));\n"
- " return;\n"
- " }\n"
- " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\
- " QCOMPARE(qscriptvalue_cast<%1>(value), expected);\n"\
- "}\n"\
- "\n"\
- "DEFINE_TEST_FUNCTION(qscriptvalue_cast%1)\n";
- QString result = templ;
-
- QList<QPair<QString, qsreal> >::const_iterator i = list.constBegin();
- QStringList tagSet, valueSet;
- tagSet.reserve(4 * list.count());
- valueSet.reserve(3 * list.count());
- for(int lineBreaker = 0; i != list.constEnd(); ++i) {
- QPair<QString, qsreal> t = *i;
- t.first = escape(t.first);
- if (!valueSet.isEmpty()) {
- valueSet.append(QString(","));
- tagSet.append(QString::fromLatin1(","));
- }
- tagSet.append(QString("\n \""));
- tagSet.append(t.first);
- tagSet.append(QString::fromLatin1("\""));
- if (!((lineBreaker++)%10))
- valueSet.append(QString("\n "));
- else
- valueSet.append(QString::fromLatin1(" "));
- valueSet.append(prepareToInsert<qsreal>(t.second));
- }
- return result.arg(typeName<qsreal>(),
- tagSet.join(QString()),
- valueSet.join(QString()),
- QString::number(list.count()));
-}
-
-static QString generateCompareDef(const QString& comparisonType, const QList<QString> tags)
-{
- static const QString templ = "\n"\
- "void tst_QScriptValueGenerated::%1_initData()\n"\
- "{\n"\
- " QTest::addColumn<QScriptValue>(\"other\");\n"\
- " QTest::addColumn<bool>(\"expected\");\n"\
- " initScriptValues();\n"\
- "}\n"\
- "\n"\
- "static QString %1_array[] = {%2};\n\n"\
- "void tst_QScriptValueGenerated::%1_makeData(const char *expr)\n"\
- "{\n"\
- " static QSet<QString> equals;\n"\
- " if (equals.isEmpty()) {\n"\
- " equals.reserve(%3);\n"\
- " for (unsigned i = 0; i < %3; ++i)\n"\
- " equals.insert(%1_array[i]);\n"\
- " }\n"\
- " QHash<QString, QScriptValue>::const_iterator it;\n"\
- " for (it = m_values.constBegin(); it != m_values.constEnd(); ++it) {\n"\
- " QString tag = QString::fromLatin1(\"%20 <=> %21\").arg(expr).arg(it.key());\n"\
- " newRow(tag.toLatin1()) << it.value() << equals.contains(tag);\n"\
- " }\n"\
- "}\n"\
- "\n"\
- "void tst_QScriptValueGenerated::%1_test(const char *, const QScriptValue& value)\n"\
- "{\n"\
- " QFETCH(QScriptValue, other);\n"\
- " QFETCH(bool, expected);\n"\
- " QCOMPARE(value.%1(other), expected);\n"\
- "}\n"\
- "\n"\
- "DEFINE_TEST_FUNCTION(%1)\n";
- if (comparisonType != "strictlyEquals"
- && comparisonType != "equals"
- && comparisonType != "lessThan"
- && comparisonType != "instanceOf")
- qFatal("%s: Unknown comparisonType: %s", Q_FUNC_INFO, qPrintable(comparisonType));
- QString result = templ;
-
- QStringList set;
- set.reserve(4 * tags.count());
- foreach(const QString& tmp, tags) {
- if (!set.isEmpty())
- set.append(",");
- set.append("\n \"");
- set.append(escape(tmp));
- set.append("\"");
- }
- return result.arg(comparisonType, set.join(""), QString::number(tags.count()));
-}
-
-static QString generateInitDef(const QVector<QString>& allDataTags)
-{
- static const QString templ = "void tst_QScriptValueGenerated::initScriptValues()\n"\
- "{\n"\
- " m_values.clear();\n"\
- " if (engine)\n"\
- " delete engine;\n"\
- " engine = new QScriptEngine;\n"\
- "%1\n}\n\n";
- QString result = templ;
- QStringList set;
- foreach(const QString tag, allDataTags) {
- set.append(" DEFINE_TEST_VALUE(" + tag + ");");
- }
-
- return result.arg(set.join("\n"));
-}
-
-static void squashTags(QString dataTag, const QVector<bool>& results, QList<QString>& tags, QVector<QString> dataTags)
-{
- for(int i = 0; i < results.count(); ++i) {
- if (results.at(i))
- tags.append(dataTag + " <=> " + dataTags[i]);
- }
-}
-
-static QString streamStatusString(QDataStream::Status s)
-{
- switch (s) {
- case QDataStream::ReadPastEnd:
- return QString("ReadPastEnd");
- case QDataStream::ReadCorruptData:
- return QString("ReadCorruptData");
- default:
- return QString("Unknown (%1)").arg(static_cast<int>(s));
- }
-}
-
-QHash<QString, QString> TestGenerator::generateTest()
-{
- // All data tags keept in one place.
- QVector<QString> dataTags;
-
- // Data tags for values that return true in isXXX call
- QList<QString> isValidList;
- QList<QString> isBoolList;
- QList<QString> isBooleanList;
- QList<QString> isNumberList;
- QList<QString> isFunctionList;
- QList<QString> isNullList;
- QList<QString> isStringList;
- QList<QString> isUndefinedList;
- QList<QString> isVariantList;
- QList<QString> isQObjectList;
- QList<QString> isQMetaObjectList;
- QList<QString> isObjectList;
- QList<QString> isDateList;
- QList<QString> isRegExpList;
- QList<QString> isArrayList;
- QList<QString> isErrorList;
-
- // List of pairs data tag and value returned from toXXX call
- QList<QPair<QString, QString> > toStringList;
- QList<QPair<QString, qsreal> > toNumberList;
- QList<QPair<QString, bool> > toBoolList;
- QList<QPair<QString, bool> > toBooleanList;
- QList<QPair<QString, qsreal> > toIntegerList;
- QList<QPair<QString, qint32> > toInt32List;
- QList<QPair<QString, quint32> > toUInt32List;
- QList<QPair<QString, quint16> > toUInt16List;
-
- // List of complex tags returning true
- QList<QString> equalsList;
- QList<QString> strictlyEqualsList;
- QList<QString> lessThanList;
- QList<QString> instanceOfList;
-
- QList<QPair<QString, QString> > castStringList;
- QList<QPair<QString, qsreal> > castSRealList;
- QList<QPair<QString, bool> > castBoolList;
- QList<QPair<QString, qint32> > castInt32List;
- QList<QPair<QString, quint32> > castUInt32List;
- QList<QPair<QString, quint16> > castUInt16List;
-
- // Load.
- m_tempFile.seek(0);
- QDataStream in(&m_tempFile);
- in >> dataTags;
- if (in.status() != in.Ok)
- qFatal("%s: stream has bad status %s after reading dataTags",
- Q_FUNC_INFO,
- qPrintable(streamStatusString(in.status())));
-
- while(!in.atEnd())
- {
- bool isValidRes;
- bool isBoolRes;
- bool isBooleanRes;
- bool isNumberRes;
- bool isFunctionRes;
- bool isNullRes;
- bool isStringRes;
- bool isUndefinedRes;
- bool isVariantRes;
- bool isQObjectRes;
- bool isQMetaObjectRes;
- bool isObjectRes;
- bool isDateRes;
- bool isRegExpRes;
- bool isArrayRes;
- bool isErrorRes;
-
- QString toStringRes;
- qsreal toNumberRes;
- bool toBoolRes;
- bool toBooleanRes;
- qsreal toIntegerRes;
- qint32 toInt32Res;
- quint32 toUInt32Res;
- quint16 toUInt16Res;
- //toVariantRes;
- //toDateTimeRes;
-
- QVector<bool> equalsRes;
- QVector<bool> strictlyEqualsRes;
- QVector<bool> lessThanRes;
- QVector<bool> instanceOfRes;
-
- QString castStringRes;
- qsreal castSRealRes;
- bool castBoolRes;
- qint32 castInt32Res;
- quint32 castUInt32Res;
- quint16 castUInt16Res;
-
- QString dataTag;
- in >> dataTag;
- in >> isValidRes;
- in >> isBoolRes;
- in >> isBooleanRes;
- in >> isNumberRes;
- in >> isFunctionRes;
- in >> isNullRes;
- in >> isStringRes;
- in >> isUndefinedRes;
- in >> isVariantRes;
- in >> isQObjectRes;
- in >> isQMetaObjectRes;
- in >> isObjectRes;
- in >> isDateRes;
- in >> isRegExpRes;
- in >> isArrayRes;
- in >> isErrorRes;
-
- if (isValidRes) isValidList.append(dataTag);
- if (isBoolRes) isBoolList.append(dataTag);
- if (isBooleanRes) isBooleanList.append(dataTag);
- if (isNumberRes) isNumberList.append(dataTag);
- if (isFunctionRes) isFunctionList.append(dataTag);
- if (isNullRes) isNullList.append(dataTag);
- if (isStringRes) isStringList.append(dataTag);
- if (isUndefinedRes) isUndefinedList.append(dataTag);
- if (isVariantRes) isVariantList.append(dataTag);
- if (isQObjectRes) isQObjectList.append(dataTag);
- if (isQMetaObjectRes) isQMetaObjectList.append(dataTag);
- if (isObjectRes) isObjectList.append(dataTag);
- if (isDateRes) isDateList.append(dataTag);
- if (isRegExpRes) isRegExpList.append(dataTag);
- if (isArrayRes) isArrayList.append(dataTag);
- if (isErrorRes) isErrorList.append(dataTag);
-
- in >> toStringRes;
- in >> toNumberRes;
- in >> toBoolRes;
- in >> toBooleanRes;
- in >> toIntegerRes;
- in >> toInt32Res;
- in >> toUInt32Res;
- in >> toUInt16Res;
- //in >> toVariantRes;
- //in >> toDateTimeRes;
-
- toStringList.append(QPair<QString, QString>(dataTag, toStringRes));
- toNumberList.append(QPair<QString, qsreal>(dataTag, toNumberRes));
- toBoolList.append(QPair<QString, bool>(dataTag, toBoolRes));
- toBooleanList.append(QPair<QString, bool>(dataTag, toBooleanRes));
- toIntegerList.append(QPair<QString, qsreal>(dataTag, toIntegerRes));
- toInt32List.append(QPair<QString, qint32>(dataTag, toInt32Res));
- toUInt32List.append(QPair<QString, quint32>(dataTag, toUInt32Res));
- toUInt16List.append(QPair<QString, quint16>(dataTag, toUInt16Res));
-
- in >> equalsRes;
- in >> strictlyEqualsRes;
- in >> lessThanRes;
- in >> instanceOfRes;
-
- squashTags(dataTag, equalsRes, equalsList, dataTags);
- squashTags(dataTag, strictlyEqualsRes, strictlyEqualsList, dataTags);
- squashTags(dataTag, lessThanRes, lessThanList, dataTags);
- squashTags(dataTag, instanceOfRes, instanceOfList, dataTags);
-
- in >> castStringRes;
- in >> castSRealRes;
- in >> castBoolRes;
- in >> castInt32Res;
- in >> castUInt32Res;
- in >> castUInt16Res;
-
- castStringList.append(QPair<QString, QString>(dataTag, castStringRes));
- castSRealList.append(QPair<QString, qsreal>(dataTag, castSRealRes));
- castBoolList.append(QPair<QString, bool>(dataTag, castBoolRes));
- castInt32List.append(QPair<QString, qint32>(dataTag, castInt32Res));
- castUInt32List.append(QPair<QString, quint32>(dataTag, castUInt32Res));
- castUInt16List.append(QPair<QString, quint16>(dataTag, castUInt16Res));
-
- if (in.status() != in.Ok)
- qFatal("%s: stream has bad status %s after reading data items",
- Q_FUNC_INFO,
- qPrintable(streamStatusString(in.status())));
- }
- if (!in.atEnd())
- qFatal("%s: stream has more data after reading all data items", Q_FUNC_INFO);
-
- // Generate.
- QHash<QString, QString> result;
- QStringList tmp;
- tmp.append(generateLicence());
- tmp.append(generateInitDef(dataTags));
- result.insert("init", tmp.join("\n"));
- tmp.clear();
-
- tmp.append(generateLicence());
- tmp.append(generateIsXXXDef("isValid", isValidList));
- tmp.append(generateIsXXXDef("isBool", isBoolList));
- tmp.append(generateIsXXXDef("isBoolean", isBooleanList));
- tmp.append(generateIsXXXDef("isNumber", isNumberList));
- tmp.append(generateIsXXXDef("isFunction", isFunctionList));
- tmp.append(generateIsXXXDef("isNull", isNullList));
- tmp.append(generateIsXXXDef("isString", isStringList));
- tmp.append(generateIsXXXDef("isUndefined", isUndefinedList));
- tmp.append(generateIsXXXDef("isVariant", isVariantList));
- tmp.append(generateIsXXXDef("isQObject", isQObjectList));
- tmp.append(generateIsXXXDef("isQMetaObject", isQMetaObjectList));
- tmp.append(generateIsXXXDef("isObject", isObjectList));
- tmp.append(generateIsXXXDef("isDate", isDateList));
- tmp.append(generateIsXXXDef("isRegExp", isRegExpList));
- tmp.append(generateIsXXXDef("isArray", isArrayList));
- tmp.append(generateIsXXXDef("isError", isErrorList));
- result.insert("isXXX", tmp.join("\n"));
- tmp.clear();
-
- tmp.append(generateLicence());
- tmp.append(generateToXXXDef<QString>("toString", toStringList));
- tmp.append(generateToXXXDef<qsreal>("toNumber", toNumberList));
- tmp.append(generateToXXXDef<bool>("toBool", toBoolList));
- tmp.append(generateToXXXDef<bool>("toBoolean", toBooleanList));
- tmp.append(generateToXXXDef<qsreal>("toInteger", toIntegerList));
- tmp.append(generateToXXXDef<qint32>("toInt32", toInt32List));
- tmp.append(generateToXXXDef<quint32>("toUInt32", toUInt32List));
- tmp.append(generateToXXXDef<quint16>("toUInt16", toUInt16List));
- result.insert("toXXX", tmp.join("\n"));
- tmp.clear();
-
- tmp.append(generateLicence());
- tmp.append(generateCompareDef("equals", equalsList));
- tmp.append(generateCompareDef("strictlyEquals", strictlyEqualsList));
- tmp.append(generateCompareDef("lessThan", lessThanList));
- tmp.append(generateCompareDef("instanceOf", instanceOfList));
- result.insert("comparison", tmp.join("\n"));
- tmp.clear();
-
- tmp.append(generateLicence());
- tmp.append(generateCastDef(castStringList));
- tmp.append(generateCastDef(castSRealList));
- tmp.append(generateCastDef(castBoolList));
- tmp.append(generateCastDef(castInt32List));
- tmp.append(generateCastDef(castUInt32List));
- tmp.append(generateCastDef(castUInt16List));
- result.insert("cast", tmp.join("\n"));
-
- return result;
-}
-
-
-
-
-
-
-
-
-
diff --git a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h b/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h
deleted file mode 100644
index d82a882..0000000
--- a/tests/auto/qscriptvaluegenerated/testgen/testgenerator.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef TESTGENERATOR_H
-#define TESTGENERATOR_H
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qtemporaryfile.h>
-
-class TestGenerator {
-public:
- TestGenerator(QString& outputpath)
- : m_opath(outputpath)
- {
- if (!m_opath.endsWith('/'))
- m_opath.append('/');
- m_tempFile.open();
- }
-
- void run()
- {
- prepareData();
- if (!m_tempFile.size())
- qFatal("%s: prepareData failed to generate any data", Q_FUNC_INFO);
- save(generateTest());
- }
-
- void prepareData();
- QHash<QString, QString> generateTest();
- void save(const QHash<QString, QString>& data);
-private:
- QString m_opath;
- QTemporaryFile m_tempFile;
-};
-
-#endif // TESTGENERATOR_H
diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp
index 47eab4b..a43fec5 100644
--- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp
+++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_cast.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/****************************************************************************
-*************** This file has been generated. DO NOT MODIFY! ****************
-****************************************************************************/
-
#include "tst_qscriptvalue.h"
diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp
index d983d0d..1dd5d97 100644
--- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp
+++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_comparison.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/****************************************************************************
-*************** This file has been generated. DO NOT MODIFY! ****************
-****************************************************************************/
-
#include "tst_qscriptvalue.h"
diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp
index dc09450..2457017 100644
--- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp
+++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_init.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/****************************************************************************
-*************** This file has been generated. DO NOT MODIFY! ****************
-****************************************************************************/
-
#include "tst_qscriptvalue.h"
diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp
index c790725..3200dba 100644
--- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp
+++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_isXXX.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/****************************************************************************
-*************** This file has been generated. DO NOT MODIFY! ****************
-****************************************************************************/
-
#include "tst_qscriptvalue.h"
diff --git a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp
index 2c7db4a..902e4b3 100644
--- a/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp
+++ b/tests/auto/qscriptvaluegenerated/tst_qscriptvalue_generated_toXXX.cpp
@@ -39,10 +39,6 @@
**
****************************************************************************/
-/****************************************************************************
-*************** This file has been generated. DO NOT MODIFY! ****************
-****************************************************************************/
-
#include "tst_qscriptvalue.h"