Debian Codegraph @

test/unit/provider-by-default-constructor-configuration-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
23 #include <injeqt/exception/default-constructor-not-found.h>cxx . . $ `<file>/include/injeqt/exception/default-constructor-not-found.h`/
24 #include <injeqt/exception/qobject-type.h>cxx . . $ `<file>/include/injeqt/exception/qobject-type.h`/
25
26 #include "internal/injector-core.h"cxx . . $ `<file>/src/internal/injector-core.h`/
27 #include "internal/provider-by-default-constructor-configuration.h"cxx . . $ `<file>/src/internal/provider-by-default-constructor-configuration.h`/
28
29 #include <QtTest/QtTest>
30 #include <memory>
31
32 using namespace injeqtcxx . . $ injeqt/::v1;
33 using namespace injeqtcxx . . $ injeqt/::internal;
34
35 class default_constructor_typecxx . . $ default_constructor_type# : public QObjectcxx . . $ QObject#
36 {
37 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
38
39 public:
40 Q_INVOKABLEcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:124:9`! default_constructor_typecxx . . $ default_constructor_type#default_constructor_type(49f6e7a06ebc5aa8).() {}
41
42 };
43
44 class not_default_constructor_typecxx . . $ not_default_constructor_type# : public QObjectcxx . . $ QObject#
45 {
46 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
47 };
48
49 class provider_by_default_constructor_configuration_testcxx . . $ provider_by_default_constructor_configuration_test# : public QObjectcxx . . $ QObject#
50 {
51 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
52
53 private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!:
54 void should_accept_qobject_type_and_throw_on_createcxx . . $ provider_by_default_constructor_configuration_test#should_accept_qobject_type_and_throw_on_create(49f6e7a06ebc5aa8).();
55 void should_accept_type_without_default_constructor_and_throw_on_createcxx . . $ provider_by_default_constructor_configuration_test#should_accept_type_without_default_constructor_and_throw_on_create(49f6e7a06ebc5aa8).();
56 void should_accept_valid_configurationcxx . . $ provider_by_default_constructor_configuration_test#should_accept_valid_configuration(49f6e7a06ebc5aa8).();
57
58 };
59
60 void provider_by_default_constructor_configuration_testcxx . . $ provider_by_default_constructor_configuration_test#::should_accept_qobject_type_and_throw_on_createcxx . . $ provider_by_default_constructor_configuration_test#should_accept_qobject_type_and_throw_on_create(49f6e7a06ebc5aa8).()
61 {
62 auto pc = provider_by_default_constructor_configurationcxx . . $ injeqt/internal/provider_by_default_constructor_configuration#provider_by_default_constructor_configuration(766db27e681b24a).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<QObjectcxx . . $ QObject#>()};
63
64 expectcxx . . $ expect(13411efb8aeb1b14).<exceptioncxx . . $ injeqt/v1/exception/::qobject_typecxx . . $ injeqt/v1/exception/qobject_type#>([cxx . . $ std/function#function(a4b4b0c4acad1616).&](){
65 pc.create_providercxx . . $ injeqt/internal/provider_by_default_constructor_configuration#create_provider(2c251cf15db9f22d).({cxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).});
66 });
67 }
68
69 void provider_by_default_constructor_configuration_testcxx . . $ provider_by_default_constructor_configuration_test#::should_accept_type_without_default_constructor_and_throw_on_createcxx . . $ provider_by_default_constructor_configuration_test#should_accept_type_without_default_constructor_and_throw_on_create(49f6e7a06ebc5aa8).()
70 {
71 auto pc = provider_by_default_constructor_configurationcxx . . $ injeqt/internal/provider_by_default_constructor_configuration#provider_by_default_constructor_configuration(766db27e681b24a).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<not_default_constructor_typecxx . . $ not_default_constructor_type#>()};
72
73 expectcxx . . $ expect(13411efb8aeb1b14).<exceptioncxx . . $ injeqt/v1/exception/::default_constructor_not_foundcxx . . $ injeqt/v1/exception/default_constructor_not_found#>([cxx . . $ std/function#function(a4b4b0c4acad1616).&](){
74 pc.create_providercxx . . $ injeqt/internal/provider_by_default_constructor_configuration#create_provider(2c251cf15db9f22d).({cxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).});
75 });
76 }
77
78 void provider_by_default_constructor_configuration_testcxx . . $ provider_by_default_constructor_configuration_test#::should_accept_valid_configurationcxx . . $ provider_by_default_constructor_configuration_test#should_accept_valid_configuration(49f6e7a06ebc5aa8).()
79 {
80 auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{};
81 auto pc = provider_by_default_constructor_configurationcxx . . $ injeqt/internal/provider_by_default_constructor_configuration#provider_by_default_constructor_configuration(766db27e681b24a).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<default_constructor_typecxx . . $ default_constructor_type#>()};
82 auto p = pccxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4)..create_providercxx . . $ injeqt/internal/provider_by_default_constructor_configuration#create_provider(2c251cf15db9f22d).({cxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).});
83
84 QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(nullptr != p->provide(i));
85 }
86
87 QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(provider_by_default_constructor_configuration_test)
88 #include "provider-by-default-constructor-configuration-test.moc"cxx . . $ `<file>/build/test/provider-by-default-constructor-configuration-test_autogen/include/provider-by-default-constructor-configuration-test.moc`/