aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/tests/libsample/main.cpp')
-rw-r--r--sources/shiboken6/tests/libsample/main.cpp249
1 files changed, 107 insertions, 142 deletions
diff --git a/sources/shiboken6/tests/libsample/main.cpp b/sources/shiboken6/tests/libsample/main.cpp
index 336551ea2..1b44642ae 100644
--- a/sources/shiboken6/tests/libsample/main.cpp
+++ b/sources/shiboken6/tests/libsample/main.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <iostream>
#include <list>
@@ -37,207 +12,197 @@
#include "listuser.h"
#include "samplenamespace.h"
-using namespace std;
-
int
main(int argv, char **argc)
{
- cout << endl;
+ std::cout << std::endl;
Derived derived;
- cout << endl;
+ std::cout << std::endl;
derived.unpureVirtual();
derived.pureVirtual();
derived.callPureVirtual();
- cout << endl;
- Abstract* abs;
- abs = Abstract::createObject();
- cout << "Abstract::createObject(): " << abs << endl << endl;
+ std::cout << std::endl;
+ auto *abs = Abstract::createObject();
+ std::cout << "Abstract::createObject(): " << abs << std::endl << std::endl;
delete abs;
abs = Derived::createObject();
- cout << "Derived::createObject() : ";
+ std::cout << "Derived::createObject() : ";
abs->show();
- cout << endl;
+ std::cout << std::endl;
delete abs;
- cout << endl;
+ std::cout << std::endl;
abs = Derived::createObject();
- cout << "Derived::createObject() : ";
+ std::cout << "Derived::createObject() : ";
abs->show();
- cout << endl;
+ std::cout << std::endl;
delete abs;
- cout << endl;
+ std::cout << std::endl;
- cout << endl << "-----------------------------------------" << endl;
+ std::cout << "\n-----------------------------------------\n";
KinderGarten kg;
- Derived* d[] = { 0, 0, 0 };
+ Derived *d[] = { 0, 0, 0 };
for (int i = 0; i < 3; i++) {
d[i] = new Derived(i);
d[i]->show();
- cout << endl;
+ std::cout << std::endl;
kg.addChild(d[i]);
}
kg.show();
- cout << endl;
+ std::cout << std::endl;
- cout << endl << "* kill child ";
+ std::cout << "\n* kill child ";
d[2]->show();
- cout << " ----------------" << endl;
+ std::cout << " ----------------\n";
kg.killChild(d[2]);
kg.show();
- cout << endl;
+ std::cout << std::endl;
- cout << endl << "* release child ";
+ std::cout << "\n* release child ";
d[1]->show();
- cout << " -------------" << endl;
- Abstract* released = kg.releaseChild(d[1]);
- cout << "released: ";
+ std::cout << " -------------\n";
+ Abstract *released = kg.releaseChild(d[1]);
+ std::cout << "released: ";
released->show();
- cout << endl;
+ std::cout << std::endl;
kg.show();
- cout << endl;
-
- cout << endl << "* kill children ------------------------------------" << endl;
+ std::cout << "\n\n* kill children ------------------------------------\n";
kg.killChildren();
kg.show();
- cout << endl << endl;
-
- cout << "-----------------------------------------" << endl;
+ std::cout << "\n\n-----------------------------------------\n";
ListUser lu;
- cout << "ListUser::createList()" << endl;
+ std::cout << "ListUser::createList()\n";
std::list<int> intlist = lu.createList();
- for (std::list<int>::iterator it = intlist.begin(); it != intlist.end(); it++) {
- cout << "* " << *it << endl;
- }
+ for (std::list<int>::iterator it = intlist.begin(); it != intlist.end(); it++)
+ std::cout << "* " << *it << std::endl;
- cout << "ListUser::createComplexList" << endl;
+ std::cout << "ListUser::createComplexList\n";
std::list<Complex> cpxlist = ListUser::createComplexList(Complex(1.1, 2.2), Complex(3.3, 4.4));
for (std::list<Complex>::iterator it = cpxlist.begin(); it != cpxlist.end(); it++) {
- cout << "* ";
+ std::cout << "* ";
(*it).show();
- cout << endl;
+ std::cout << std::endl;
}
- cout << endl;
-
- cout << "-----------------------------------------" << endl;
- cout << "SampleNamespace" << endl;
-
- cout << "SampleNamespace::RandomNumber: ";
- cout << SampleNamespace::getNumber(SampleNamespace::RandomNumber);
- cout << endl;
- cout << "SampleNamespace::UnixTime: ";
- cout << SampleNamespace::getNumber(SampleNamespace::UnixTime);
- cout << endl;
+ std::cout << "\n-----------------------------------------\n"
+ << "SampleNamespace\n";
+
+ std::cout << "SampleNamespace::RandomNumber: ";
+ std::cout << SampleNamespace::getNumber(SampleNamespace::RandomNumber);
+ std::cout << std::endl;
+ std::cout << "SampleNamespace::UnixTime: ";
+ std::cout << SampleNamespace::getNumber(SampleNamespace::UnixTime);
+ std::cout << std::endl;
double val_d = 1.3;
- cout << "SampleNamespace::powerOfTwo(" << val_d << "): ";
- cout << SampleNamespace::powerOfTwo(val_d) << endl;
+ std::cout << "SampleNamespace::powerOfTwo(" << val_d << "): ";
+ std::cout << SampleNamespace::powerOfTwo(val_d) << std::endl;
int val_i = 7;
- cout << "SampleNamespace::powerOfTwo(" << val_i << "): ";
- cout << SampleNamespace::powerOfTwo(val_i) << endl;
- cout << endl;
+ std::cout << "SampleNamespace::powerOfTwo(" << val_i << "): ";
+ std::cout << SampleNamespace::powerOfTwo(val_i) << std::endl;
+ std::cout << std::endl;
- cout << "-----------------------------------------" << endl;
- cout << "Point" << endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << "Point" << std::endl;
Point p1(1.1, 2.2);
- cout << "p1: ";
+ std::cout << "p1: ";
p1.show();
- cout << endl;
+ std::cout << std::endl;
Point p2(3.4, 5.6);
- cout << "p2: ";
+ std::cout << "p2: ";
p2.show();
- cout << endl;
+ std::cout << std::endl;
- cout << "p1 + p2 == ";
+ std::cout << "p1 + p2 == ";
(p1 + p2).show();
- cout << endl;
+ std::cout << std::endl;
- cout << "p1 * 2.0 == ";
+ std::cout << "p1 * 2.0 == ";
(p1 * 2.0).show();
- cout << endl;
+ std::cout << std::endl;
- cout << "1.5 * p2 == ";
+ std::cout << "1.5 * p2 == ";
(1.5 * p2).show();
- cout << endl;
+ std::cout << std::endl;
- cout << "p1: ";
+ std::cout << "p1: ";
p1.show();
- cout << endl << "p2: ";
+ std::cout << std::endl << "p2: ";
p2.show();
- cout << endl << "p1 += p2" << endl;
+ std::cout << std::endl << "p1 += p2" << std::endl;
p1 += p2;
- cout << "p1: ";
+ std::cout << "p1: ";
p1.show();
- cout << endl;
+ std::cout << std::endl;
- cout << "p1 == p2 ? " << ((p1 == p2) ? "true" : "false") << endl;
- cout << "p1 == p1 ? " << ((p1 == p1) ? "true" : "false") << endl;
- cout << "p2 == p2 ? " << ((p2 == p2) ? "true" : "false") << endl;
+ std::cout << "p1 == p2 ? " << ((p1 == p2) ? "true" : "false") << std::endl;
+ std::cout << "p1 == p1 ? " << ((p1 == p1) ? "true" : "false") << std::endl;
+ std::cout << "p2 == p2 ? " << ((p2 == p2) ? "true" : "false") << std::endl;
- cout << "-----------------------------------------" << endl;
- cout << "Size" << endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << "Size" << std::endl;
Size s1(2, 2);
- cout << "s1: ";
+ std::cout << "s1: ";
s1.show();
- cout << ", area: " << s1.calculateArea();
- cout << endl;
+ std::cout << ", area: " << s1.calculateArea();
+ std::cout << std::endl;
Size s2(3, 5);
- cout << "s2: ";
+ std::cout << "s2: ";
s2.show();
- cout << ", area: " << s2.calculateArea();
- cout << endl;
-
- cout << endl;
-
- cout << "s1 == s2 ? " << ((s1 == s2) ? "true" : "false") << endl;
- cout << "s1 != s2 ? " << ((s1 != s2) ? "true" : "false") << endl;
-
- cout << "s1 < s2 ? " << ((s1 < s2) ? "true" : "false") << endl;
- cout << "s1 <= s2 ? " << ((s1 <= s2) ? "true" : "false") << endl;
- cout << "s1 > s2 ? " << ((s1 > s2) ? "true" : "false") << endl;
- cout << "s1 >= s2 ? " << ((s1 >= s2) ? "true" : "false") << endl;
-
- cout << "s1 < 10 ? " << ((s1 < 10) ? "true" : "false") << endl;
- cout << "s1 <= 10 ? " << ((s1 <= 10) ? "true" : "false") << endl;
- cout << "s1 > 10 ? " << ((s1 > 10) ? "true" : "false") << endl;
- cout << "s1 >= 10 ? " << ((s1 >= 10) ? "true" : "false") << endl;
- cout << "s2 < 10 ? " << ((s2 < 10) ? "true" : "false") << endl;
- cout << "s2 <= 10 ? " << ((s2 <= 10) ? "true" : "false") << endl;
- cout << "s2 > 10 ? " << ((s2 > 10) ? "true" : "false") << endl;
- cout << "s2 >= 10 ? " << ((s2 >= 10) ? "true" : "false") << endl;
- cout << endl;
-
- cout << "s1: ";
+ std::cout << ", area: " << s2.calculateArea();
+ std::cout << std::endl;
+
+ std::cout << std::endl;
+
+ std::cout << "s1 == s2 ? " << ((s1 == s2) ? "true" : "false") << std::endl;
+ std::cout << "s1 != s2 ? " << ((s1 != s2) ? "true" : "false") << std::endl;
+
+ std::cout << "s1 < s2 ? " << ((s1 < s2) ? "true" : "false") << std::endl;
+ std::cout << "s1 <= s2 ? " << ((s1 <= s2) ? "true" : "false") << std::endl;
+ std::cout << "s1 > s2 ? " << ((s1 > s2) ? "true" : "false") << std::endl;
+ std::cout << "s1 >= s2 ? " << ((s1 >= s2) ? "true" : "false") << std::endl;
+
+ std::cout << "s1 < 10 ? " << ((s1 < 10) ? "true" : "false") << std::endl;
+ std::cout << "s1 <= 10 ? " << ((s1 <= 10) ? "true" : "false") << std::endl;
+ std::cout << "s1 > 10 ? " << ((s1 > 10) ? "true" : "false") << std::endl;
+ std::cout << "s1 >= 10 ? " << ((s1 >= 10) ? "true" : "false") << std::endl;
+ std::cout << "s2 < 10 ? " << ((s2 < 10) ? "true" : "false") << std::endl;
+ std::cout << "s2 <= 10 ? " << ((s2 <= 10) ? "true" : "false") << std::endl;
+ std::cout << "s2 > 10 ? " << ((s2 > 10) ? "true" : "false") << std::endl;
+ std::cout << "s2 >= 10 ? " << ((s2 >= 10) ? "true" : "false") << std::endl;
+ std::cout << std::endl;
+
+ std::cout << "s1: ";
s1.show();
- cout << endl << "s2: ";
+ std::cout << std::endl << "s2: ";
s2.show();
- cout << endl << "s1 += s2" << endl;
+ std::cout << std::endl << "s1 += s2" << std::endl;
s1 += s2;
- cout << "s1: ";
+ std::cout << "s1: ";
s1.show();
- cout << endl;
+ std::cout << std::endl;
- cout << endl;
+ std::cout << std::endl;
- cout << "s1: ";
+ std::cout << "s1: ";
s1.show();
- cout << endl << "s1 *= 2.0" << endl;
+ std::cout << std::endl << "s1 *= 2.0" << std::endl;
s1 *= 2.0;
- cout << "s1: ";
+ std::cout << "s1: ";
s1.show();
- cout << endl;
+ std::cout << std::endl;
- cout << endl;
+ std::cout << std::endl;
return 0;
}