Debian Codegraph @

test/unit/default-constructor-method-test.cpp

raw symbols SCIP
1 /*
2 * %injeqt copyright begin%
3 * Copyright 2014 Rafał Malinowski ([email protected])
4 * %injeqt copyright end%
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "expect.h"cxx . . $ `<file>/test/unit/expect.h`/
22 #include "utils.h"cxx . . $ `<file>/test/unit/utils.h`/
23
24 #include "internal/default-constructor-method.h"cxx . . $ `<file>/src/internal/default-constructor-method.h`/
25
26 #include <QtTest/QtTest>
27 #include <string>
28
29 using namespace injeqtcxx . . $ injeqt/::internal;
30 using namespace injeqtcxx . . $ injeqt/::v1;
31
32 class no_default_constructorcxx . . $ no_default_constructor# : public QObjectcxx . . $ QObject#
33 {
34 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
35
36 public:
37 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! no_default_constructorcxx . . $ no_default_constructor#no_default_constructor(d4f767463ce0a6b3).(int a) { (void)a; }
38 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! no_default_constructorcxx . . $ no_default_constructor#no_default_constructor(8d4ab0a187bf9331).(stdcxx . . $ std/::stringcxx . . $ std/string# a) { (void)a; }
39
40 };
41
42 class default_not_invokable_constructorcxx . . $ default_not_invokable_constructor# : public QObjectcxx . . $ QObject#
43 {
44 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
45
46 public:
47 default_not_invokable_constructorcxx . . $ default_not_invokable_constructor#default_not_invokable_constructor(49f6e7a06ebc5aa8).() {}
48
49 };
50
51 class default_invokable_constructorcxx . . $ default_invokable_constructor# : public QObjectcxx . . $ QObject#
52 {
53 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
54
55 public:
56 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! default_invokable_constructorcxx . . $ default_invokable_constructor#default_invokable_constructor(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent = nullptr) : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).{parent} {}
57
58 };
59
60 class default_invokable_constructor_no_parameterscxx . . $ default_invokable_constructor_no_parameters# : public QObjectcxx . . $ QObject#
61 {
62 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
63
64 public:
65 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! default_invokable_constructor_no_parameterscxx . . $ default_invokable_constructor_no_parameters#default_invokable_constructor_no_parameters(49f6e7a06ebc5aa8).() {}
66
67 };
68
69 class default_constructor_method_testcxx . . $ default_constructor_method_test# : public QObjectcxx . . $ QObject#
70 {
71 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
72
73 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
74 void should_return_empty_when_default_constructedcxx . . $ default_constructor_method_test#should_return_empty_when_default_constructed(49f6e7a06ebc5aa8).();
75 void should_return_empty_when_created_with_not_default_constructorcxx . . $ default_constructor_method_test#should_return_empty_when_created_with_not_default_constructor(49f6e7a06ebc5aa8).();
76 void should_return_empty_when_created_with_not_invokable_constructorcxx . . $ default_constructor_method_test#should_return_empty_when_created_with_not_invokable_constructor(49f6e7a06ebc5aa8).();
77 void should_create_valid_with_invokable_constructorcxx . . $ default_constructor_method_test#should_create_valid_with_invokable_constructor(49f6e7a06ebc5aa8).();
78 void should_create_object_with_default_constructorcxx . . $ default_constructor_method_test#should_create_object_with_default_constructor(49f6e7a06ebc5aa8).();
79 void should_properly_comparecxx . . $ default_constructor_method_test#should_properly_compare(49f6e7a06ebc5aa8).();
80
81 };
82
83 void default_constructor_method_testcxx . . $ default_constructor_method_test#::should_return_empty_when_default_constructedcxx . . $ default_constructor_method_test#should_return_empty_when_default_constructed(49f6e7a06ebc5aa8).()
84 {
85 auto c = default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#default_constructor_method(49f6e7a06ebc5aa8).{};
86 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(c.is_empty());
87 }
88
89 void default_constructor_method_testcxx . . $ default_constructor_method_test#::should_return_empty_when_created_with_not_default_constructorcxx . . $ default_constructor_method_test#should_return_empty_when_created_with_not_default_constructor(49f6e7a06ebc5aa8).()
90 {
91 auto c = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<no_default_constructorcxx . . $ no_default_constructor#>());
92 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(c.is_empty());
93 }
94
95 void default_constructor_method_testcxx . . $ default_constructor_method_test#::should_return_empty_when_created_with_not_invokable_constructorcxx . . $ default_constructor_method_test#should_return_empty_when_created_with_not_invokable_constructor(49f6e7a06ebc5aa8).()
96 {
97 auto c = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_not_invokable_constructorcxx . . $ default_not_invokable_constructor#>());
98 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(c.is_empty());
99 }
100
101 void default_constructor_method_testcxx . . $ default_constructor_method_test#::should_create_valid_with_invokable_constructorcxx . . $ default_constructor_method_test#should_create_valid_with_invokable_constructor(49f6e7a06ebc5aa8).()
102 {
103 auto c = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_invokable_constructorcxx . . $ default_invokable_constructor#>());
104 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!c.is_empty());
105 QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(c.object_type(), make_type<default_invokable_constructor>());
106 }
107
108 void default_constructor_method_testcxx . . $ default_constructor_method_test#::should_create_object_with_default_constructorcxx . . $ default_constructor_method_test#should_create_object_with_default_constructor(49f6e7a06ebc5aa8).()
109 {
110 auto c = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_invokable_constructorcxx . . $ default_invokable_constructor#>());
111 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(!c.is_empty());
112
113 auto object = ccxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4)..invokecxx . . $ injeqt/internal/default_constructor_method#invoke(5b92897074bb3200).();
114 auto cast = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<default_invokable_constructorcxx . . $ default_invokable_constructor# *>(object.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).());
115 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(cast != nullptr);
116 }
117
118 void default_constructor_method_testcxx . . $ default_constructor_method_test#::should_properly_comparecxx . . $ default_constructor_method_test#should_properly_compare(49f6e7a06ebc5aa8).()
119 {
120 auto c_empty = default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#default_constructor_method(49f6e7a06ebc5aa8).{};
121 auto c1a = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_invokable_constructorcxx . . $ default_invokable_constructor#>());
122 auto c1b = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_invokable_constructorcxx . . $ default_invokable_constructor#>());
123 auto c2a = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_invokable_constructor_no_parameterscxx . . $ default_invokable_constructor_no_parameters#>());
124 auto c2b = make_default_constructor_methodcxx . . $ injeqt/internal/make_default_constructor_method(84114e33f83ca37c).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_invokable_constructor_no_parameterscxx . . $ default_invokable_constructor_no_parameters#>());
125
126 test_comparecxx . . $ injeqt/v1/test_compare(1f10a48923f889af).<default_constructor_methodcxx . . $ injeqt/internal/default_constructor_method#>({cxx . . $ std/vector#vector(9619226211e5a241).{c_empty}, {c1a, c1b}, {c2a, c2b}});
127 }
128
129 QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(default_constructor_method_test)
130 #include "default-constructor-method-test.moc"cxx . . $ `<file>/build/test/default-constructor-method-test_autogen/include/default-constructor-method-test.moc`/