| 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 "../mocks/mocked-provider.h"cxx . . $ `<file>/test/mocks/mocked-provider.h`/ |
| 22 | #include "expect.h"cxx . . $ `<file>/test/unit/expect.h`/ |
| 23 | #include "utils.h"cxx . . $ `<file>/test/unit/utils.h`/ |
| 24 | |
| 25 | #include <injeqt/exception/ambiguous-types.h>cxx . . $ `<file>/include/injeqt/exception/ambiguous-types.h`/ |
| 26 | #include <injeqt/exception/invalid-setter.h>cxx . . $ `<file>/include/injeqt/exception/invalid-setter.h`/ |
| 27 | #include <injeqt/exception/unavailable-required-types.h>cxx . . $ `<file>/include/injeqt/exception/unavailable-required-types.h`/ |
| 28 | #include <injeqt/exception/unknown-type.h>cxx . . $ `<file>/include/injeqt/exception/unknown-type.h`/ |
| 29 | |
| 30 | #include "internal/injector-core.h"cxx . . $ `<file>/src/internal/injector-core.h`/ |
| 31 | |
| 32 | #include <QtTest/QtTest> |
| 33 | #include <string> |
| 34 | |
| 35 | using namespace injeqtcxx . . $ injeqt/::internal; |
| 36 | using namespace injeqtcxx . . $ injeqt/::v1; |
| 37 | |
| 38 | class type_1cxx . . $ type_1# : public QObjectcxx . . $ QObject# |
| 39 | { |
| 40 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 41 | }; |
| 42 | |
| 43 | class type_1_subtype_1cxx . . $ type_1_subtype_1# : public type_1cxx . . $ type_1# |
| 44 | { |
| 45 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 46 | }; |
| 47 | |
| 48 | class type_1_subtype_2cxx . . $ type_1_subtype_2# : public type_1cxx . . $ type_1# |
| 49 | { |
| 50 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 51 | }; |
| 52 | |
| 53 | class type_2cxx . . $ type_2# : public QObjectcxx . . $ QObject# |
| 54 | { |
| 55 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 56 | |
| 57 | public: |
| 58 | type_1cxx . . $ type_1# *ocxx . . $ type_2#o. = nullptr; |
| 59 | |
| 60 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 61 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_1cxx . . $ type_2#set_type_1(2eff8f70aeb41f67).(type_1cxx . . $ type_1# *x) { ocxx . . $ type_2#o. = x; } |
| 62 | }; |
| 63 | |
| 64 | class type_3cxx . . $ type_3# : public QObjectcxx . . $ QObject# |
| 65 | { |
| 66 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 67 | }; |
| 68 | |
| 69 | class type_4cxx . . $ type_4#; |
| 70 | class type_5cxx . . $ type_5#; |
| 71 | class type_6cxx . . $ type_6#; |
| 72 | |
| 73 | class type_4cxx . . $ type_4# : public QObjectcxx . . $ QObject# |
| 74 | { |
| 75 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 76 | |
| 77 | public: |
| 78 | type_5cxx . . $ type_5# *ocxx . . $ type_4#o. = nullptr; |
| 79 | |
| 80 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 81 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_5cxx . . $ type_4#set_type_5(154f0224626187d).(type_5cxx . . $ type_5# *x) { ocxx . . $ type_4#o. = x; } |
| 82 | }; |
| 83 | |
| 84 | class type_5cxx . . $ type_5# : public QObjectcxx . . $ QObject# |
| 85 | { |
| 86 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 87 | |
| 88 | public: |
| 89 | type_6cxx . . $ type_6# *ocxx . . $ type_5#o. = nullptr; |
| 90 | |
| 91 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 92 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_6cxx . . $ type_5#set_type_6(ccb2659b8fe2a812).(type_6cxx . . $ type_6# *x) { ocxx . . $ type_5#o. = x; } |
| 93 | }; |
| 94 | |
| 95 | class type_6cxx . . $ type_6# : public QObjectcxx . . $ QObject# |
| 96 | { |
| 97 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 98 | |
| 99 | public: |
| 100 | type_4cxx . . $ type_4# *ocxx . . $ type_6#o. = nullptr; |
| 101 | |
| 102 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 103 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_4cxx . . $ type_6#set_type_4(2f6a55641d967b40).(type_4cxx . . $ type_4# *x) { ocxx . . $ type_6#o. = x; } |
| 104 | }; |
| 105 | |
| 106 | class type_7cxx . . $ type_7# : public QObjectcxx . . $ QObject# |
| 107 | { |
| 108 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 109 | }; |
| 110 | |
| 111 | class type_8cxx . . $ type_8# : public QObjectcxx . . $ QObject# |
| 112 | { |
| 113 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 114 | }; |
| 115 | |
| 116 | class type_9cxx . . $ type_9# : public QObjectcxx . . $ QObject# |
| 117 | { |
| 118 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 119 | |
| 120 | public: |
| 121 | type_7cxx . . $ type_7# *o7cxx . . $ type_9#o7. = nullptr; |
| 122 | type_8cxx . . $ type_8# *o8cxx . . $ type_9#o8. = nullptr; |
| 123 | |
| 124 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 125 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_7cxx . . $ type_9#set_type_7(4313941b5f759572).(type_7cxx . . $ type_7# *x) { o7cxx . . $ type_9#o7. = x; } |
| 126 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_8cxx . . $ type_9#set_type_8(8e88071fac36fc72).(type_8cxx . . $ type_8# *x) { o8cxx . . $ type_9#o8. = x; } |
| 127 | }; |
| 128 | |
| 129 | |
| 130 | class unregistered_typecxx . . $ unregistered_type# : public QObjectcxx . . $ QObject# |
| 131 | { |
| 132 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 133 | |
| 134 | public: |
| 135 | type_1cxx . . $ type_1# *o1cxx . . $ unregistered_type#o1.; |
| 136 | type_2cxx . . $ type_2# *o2cxx . . $ unregistered_type#o2.; |
| 137 | |
| 138 | unregistered_typecxx . . $ unregistered_type#unregistered_type(49f6e7a06ebc5aa8).() : QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).{}, o1cxx . . $ unregistered_type#o1.{nullptr}, o2cxx . . $ unregistered_type#o2.{nullptr} {} |
| 139 | |
| 140 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 141 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_1cxx . . $ unregistered_type#set_type_1(2eff8f70aeb41f67).(type_1cxx . . $ type_1# *x) { o1cxx . . $ unregistered_type#o1. = x; } |
| 142 | INJEQT_SETcxx . . $ `include/injeqt/injeqt.h:34:11`! void set_type_1cxx . . $ unregistered_type#set_type_1(710a7ba155b447df).(type_2cxx . . $ type_2# *x) { o2cxx . . $ unregistered_type#o2. = x; } |
| 143 | }; |
| 144 | |
| 145 | class injector_core_testcxx . . $ injector_core_test# : public QObjectcxx . . $ QObject# |
| 146 | { |
| 147 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 148 | |
| 149 | private: |
| 150 | template<typename T> |
| 151 | T * getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).(injector_corecxx . . $ injeqt/internal/injector_core# &i) { return qobject_castcxx . . $ qobject_cast(529b296f76edd7b).<T *>(i.getcxx . . $ injeqt/internal/injector_core#get(e1ed43d1af855660).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<T>())); } |
| 152 | |
| 153 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 154 | void should_create_empty_injector_corecxx . . $ injector_core_test#should_create_empty_injector_core(49f6e7a06ebc5aa8).(); |
| 155 | void should_create_simple_injector_core_and_return_objectcxx . . $ injector_core_test#should_create_simple_injector_core_and_return_object(49f6e7a06ebc5aa8).(); |
| 156 | void should_not_accept_doubled_typecxx . . $ injector_core_test#should_not_accept_doubled_type(49f6e7a06ebc5aa8).(); |
| 157 | void should_not_accept_type_and_subtypecxx . . $ injector_core_test#should_not_accept_type_and_subtype(49f6e7a06ebc5aa8).(); |
| 158 | void should_not_accept_subtype_and_typecxx . . $ injector_core_test#should_not_accept_subtype_and_type(49f6e7a06ebc5aa8).(); |
| 159 | void should_accept_two_subtypescxx . . $ injector_core_test#should_accept_two_subtypes(49f6e7a06ebc5aa8).(); |
| 160 | void should_not_accept_unresolvable_dependencycxx . . $ injector_core_test#should_not_accept_unresolvable_dependency(49f6e7a06ebc5aa8).(); |
| 161 | void should_accept_resolvable_dependencycxx . . $ injector_core_test#should_accept_resolvable_dependency(49f6e7a06ebc5aa8).(); |
| 162 | void should_accept_resolvable_supertype_dependencycxx . . $ injector_core_test#should_accept_resolvable_supertype_dependency(49f6e7a06ebc5aa8).(); |
| 163 | void should_not_accept_ambiguous_supertype_dependencycxx . . $ injector_core_test#should_not_accept_ambiguous_supertype_dependency(49f6e7a06ebc5aa8).(); |
| 164 | void should_not_accept_unknown_required_typecxx . . $ injector_core_test#should_not_accept_unknown_required_type(49f6e7a06ebc5aa8).(); |
| 165 | void should_accept_known_required_typecxx . . $ injector_core_test#should_accept_known_required_type(49f6e7a06ebc5aa8).(); |
| 166 | void should_accept_known_required_supertypecxx . . $ injector_core_test#should_accept_known_required_supertype(49f6e7a06ebc5aa8).(); |
| 167 | void should_not_accept_ambiguous_required_supertypecxx . . $ injector_core_test#should_not_accept_ambiguous_required_supertype(49f6e7a06ebc5aa8).(); |
| 168 | void should_accept_cyclic_dependenciescxx . . $ injector_core_test#should_accept_cyclic_dependencies(49f6e7a06ebc5aa8).(); |
| 169 | void should_accept_dependencies_that_are_requiredcxx . . $ injector_core_test#should_accept_dependencies_that_are_required(49f6e7a06ebc5aa8).(); |
| 170 | void should_inject_into_unregistered_typecxx . . $ injector_core_test#should_inject_into_unregistered_type(49f6e7a06ebc5aa8).(); |
| 171 | void should_not_inject_into_when_unknown_dependenciescxx . . $ injector_core_test#should_not_inject_into_when_unknown_dependencies(49f6e7a06ebc5aa8).(); |
| 172 | // TODO: https://github.com/vogel/injeqt/issues/3 |
| 173 | /* |
| 174 | void should_not_accept_cyclic_required_types(); |
| 175 | void should_not_accept_dependent_as_required_type(); |
| 176 | */ |
| 177 | |
| 178 | }; |
| 179 | |
| 180 | void injector_core_testcxx . . $ injector_core_test#::should_create_empty_injector_corecxx . . $ injector_core_test#should_create_empty_injector_core(49f6e7a06ebc5aa8).() |
| 181 | { |
| 182 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{}; |
| 183 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::unknown_typecxx . . $ injeqt/v1/exception/unknown_type#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 184 | i.getcxx . . $ injeqt/internal/injector_core#get(e1ed43d1af855660).(make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1cxx . . $ type_1#>()); |
| 185 | }); |
| 186 | } |
| 187 | |
| 188 | void injector_core_testcxx . . $ injector_core_test#::should_create_simple_injector_core_and_return_objectcxx . . $ injector_core_test#should_create_simple_injector_core_and_return_object(49f6e7a06ebc5aa8).() |
| 189 | { |
| 190 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1cxx . . $ type_1#>(); |
| 191 | auto type_1_provider = type_1_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 192 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 193 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 194 | |
| 195 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 196 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_1_provider->object() == nullptr); |
| 197 | |
| 198 | auto o1 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_1cxx . . $ type_1#>(i); |
| 199 | auto o2 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_1cxx . . $ type_1#>(i); |
| 200 | |
| 201 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 != nullptr); |
| 202 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == o2); |
| 203 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_1_provider->object() == o1); |
| 204 | } |
| 205 | |
| 206 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_doubled_typecxx . . $ injector_core_test#should_not_accept_doubled_type(49f6e7a06ebc5aa8).() |
| 207 | { |
| 208 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 209 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1cxx . . $ type_1#>()); |
| 210 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1cxx . . $ type_1#>()); |
| 211 | |
| 212 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::ambiguous_typescxx . . $ injeqt/v1/exception/ambiguous_types#>({cxx . . $ std/vector#vector(49f6e7a06ebc5aa8).}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 213 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 214 | }); |
| 215 | } |
| 216 | |
| 217 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_type_and_subtypecxx . . $ injector_core_test#should_not_accept_type_and_subtype(49f6e7a06ebc5aa8).() |
| 218 | { |
| 219 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 220 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1cxx . . $ type_1#>()); |
| 221 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_1cxx . . $ type_1_subtype_1#>()); |
| 222 | |
| 223 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::ambiguous_typescxx . . $ injeqt/v1/exception/ambiguous_types#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 224 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 225 | }); |
| 226 | } |
| 227 | |
| 228 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_subtype_and_typecxx . . $ injector_core_test#should_not_accept_subtype_and_type(49f6e7a06ebc5aa8).() |
| 229 | { |
| 230 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 231 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_1cxx . . $ type_1_subtype_1#>()); |
| 232 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1cxx . . $ type_1#>()); |
| 233 | |
| 234 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::ambiguous_typescxx . . $ injeqt/v1/exception/ambiguous_types#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 235 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 236 | }); |
| 237 | } |
| 238 | |
| 239 | void injector_core_testcxx . . $ injector_core_test#::should_accept_two_subtypescxx . . $ injector_core_test#should_accept_two_subtypes(49f6e7a06ebc5aa8).() |
| 240 | { |
| 241 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 242 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_1cxx . . $ type_1_subtype_1#>()); |
| 243 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_2cxx . . $ type_1_subtype_2#>()); |
| 244 | |
| 245 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 246 | auto o1 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_1_subtype_1cxx . . $ type_1_subtype_1#>(i); |
| 247 | auto o2 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_1_subtype_2cxx . . $ type_1_subtype_2#>(i); |
| 248 | |
| 249 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 != nullptr); |
| 250 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o2 != nullptr); |
| 251 | |
| 252 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::unknown_typecxx . . $ injeqt/v1/exception/unknown_type#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 253 | getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_1cxx . . $ type_1#>(i); |
| 254 | }); |
| 255 | } |
| 256 | |
| 257 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_unresolvable_dependencycxx . . $ injector_core_test#should_not_accept_unresolvable_dependency(49f6e7a06ebc5aa8).() |
| 258 | { |
| 259 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 260 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_2cxx . . $ type_2#>()); |
| 261 | |
| 262 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::invalid_settercxx . . $ injeqt/v1/exception/invalid_setter#>({cxx . . $ std/vector#vector(9619226211e5a241)."set_type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ // TODO: figure out better exception name |
| 263 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 264 | }); |
| 265 | } |
| 266 | |
| 267 | void injector_core_testcxx . . $ injector_core_test#::should_accept_resolvable_dependencycxx . . $ injector_core_test#should_accept_resolvable_dependency(49f6e7a06ebc5aa8).() |
| 268 | { |
| 269 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1cxx . . $ type_1#>(); |
| 270 | auto type_1_provider = type_1_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 271 | auto type_2_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_2cxx . . $ type_2#>(); |
| 272 | auto type_2_provider = type_2_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 273 | |
| 274 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 275 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 276 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_2_provider_p)); |
| 277 | |
| 278 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1cxx . . $ type_1#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_2cxx . . $ type_2#>()}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 279 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_1_provider->object() == nullptr); |
| 280 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_2_provider->object() == nullptr); |
| 281 | |
| 282 | auto o2 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_2cxx . . $ type_2#>(i); |
| 283 | auto o1 = type_1_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 284 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 != nullptr); |
| 285 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o2 != nullptr); |
| 286 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == get<type_1>(i)); |
| 287 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == o2->o); |
| 288 | } |
| 289 | |
| 290 | void injector_core_testcxx . . $ injector_core_test#::should_accept_resolvable_supertype_dependencycxx . . $ injector_core_test#should_accept_resolvable_supertype_dependency(49f6e7a06ebc5aa8).() |
| 291 | { |
| 292 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1_subtype_1cxx . . $ type_1_subtype_1#>(); |
| 293 | auto type_1_provider = type_1_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 294 | auto type_2_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_2cxx . . $ type_2#>(); |
| 295 | auto type_2_provider = type_2_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 296 | |
| 297 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 298 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 299 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_2_provider_p)); |
| 300 | |
| 301 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1cxx . . $ type_1#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1_subtype_1cxx . . $ type_1_subtype_1#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_2cxx . . $ type_2#>()}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 302 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_1_provider->object() == nullptr); |
| 303 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_2_provider->object() == nullptr); |
| 304 | |
| 305 | auto o2 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_2cxx . . $ type_2#>(i); |
| 306 | auto o1 = type_1_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 307 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 != nullptr); |
| 308 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o2 != nullptr); |
| 309 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == get<type_1>(i)); |
| 310 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == get<type_1_subtype_1>(i)); |
| 311 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 = o2->o); |
| 312 | } |
| 313 | |
| 314 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_ambiguous_supertype_dependencycxx . . $ injector_core_test#should_not_accept_ambiguous_supertype_dependency(49f6e7a06ebc5aa8).() |
| 315 | { |
| 316 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 317 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_1cxx . . $ type_1_subtype_1#>()); |
| 318 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_2cxx . . $ type_1_subtype_2#>()); |
| 319 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_2cxx . . $ type_2#>()); |
| 320 | |
| 321 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::invalid_settercxx . . $ injeqt/v1/exception/invalid_setter#>({cxx . . $ std/vector#vector(9619226211e5a241)."set_type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ // better exception name |
| 322 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 323 | }); |
| 324 | } |
| 325 | |
| 326 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_unknown_required_typecxx . . $ injector_core_test#should_not_accept_unknown_required_type(49f6e7a06ebc5aa8).() |
| 327 | { |
| 328 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 329 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_3cxx . . $ type_3#, type_1cxx . . $ type_1#>()); |
| 330 | |
| 331 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::unavailable_required_typescxx . . $ injeqt/v1/exception/unavailable_required_types#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 332 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 333 | }); |
| 334 | } |
| 335 | |
| 336 | void injector_core_testcxx . . $ injector_core_test#::should_accept_known_required_typecxx . . $ injector_core_test#should_accept_known_required_type(49f6e7a06ebc5aa8).() |
| 337 | { |
| 338 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1cxx . . $ type_1#>(); |
| 339 | auto type_1_provider = type_1_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 340 | auto type_3_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_3cxx . . $ type_3#, type_1cxx . . $ type_1#>(); |
| 341 | auto type_3_provider = type_3_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 342 | |
| 343 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 344 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 345 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_3_provider_p)); |
| 346 | |
| 347 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 348 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_1_provider->object() == nullptr); |
| 349 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_3_provider->object() == nullptr); |
| 350 | |
| 351 | auto o3 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_3cxx . . $ type_3#>(i); |
| 352 | auto o1 = type_1_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 353 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o3 != nullptr); |
| 354 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 != nullptr); |
| 355 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == get<type_1>(i)); |
| 356 | } |
| 357 | |
| 358 | void injector_core_testcxx . . $ injector_core_test#::should_accept_known_required_supertypecxx . . $ injector_core_test#should_accept_known_required_supertype(49f6e7a06ebc5aa8).() |
| 359 | { |
| 360 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1_subtype_1cxx . . $ type_1_subtype_1#>(); |
| 361 | auto type_1_provider = type_1_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 362 | auto type_3_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_3cxx . . $ type_3#, type_1cxx . . $ type_1#>(); |
| 363 | auto type_3_provider = type_3_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 364 | |
| 365 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 366 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 367 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_3_provider_p)); |
| 368 | |
| 369 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 370 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_1_provider->object() == nullptr); |
| 371 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_3_provider->object() == nullptr); |
| 372 | |
| 373 | auto o3 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_3cxx . . $ type_3#>(i); |
| 374 | auto o1 = type_1_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 375 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o3 != nullptr); |
| 376 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 != nullptr); |
| 377 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == get<type_1>(i)); |
| 378 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o1 == get<type_1_subtype_1>(i)); |
| 379 | } |
| 380 | |
| 381 | void injector_core_testcxx . . $ injector_core_test#::should_not_accept_ambiguous_required_supertypecxx . . $ injector_core_test#should_not_accept_ambiguous_required_supertype(49f6e7a06ebc5aa8).() |
| 382 | { |
| 383 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 384 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_3cxx . . $ type_3#, type_1cxx . . $ type_1#>()); |
| 385 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_1cxx . . $ type_1_subtype_1#>()); |
| 386 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).<type_1_subtype_2cxx . . $ type_1_subtype_2#>()); |
| 387 | |
| 388 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::unavailable_required_typescxx . . $ injeqt/v1/exception/unavailable_required_types#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_1"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 389 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(49f6e7a06ebc5aa8).{}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 390 | }); |
| 391 | } |
| 392 | |
| 393 | void injector_core_testcxx . . $ injector_core_test#::should_accept_cyclic_dependenciescxx . . $ injector_core_test#should_accept_cyclic_dependencies(49f6e7a06ebc5aa8).() |
| 394 | { |
| 395 | auto type_4_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_4cxx . . $ type_4#>(); |
| 396 | auto type_4_provider = type_4_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 397 | auto type_5_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_5cxx . . $ type_5#>(); |
| 398 | auto type_5_provider = type_5_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 399 | auto type_6_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_6cxx . . $ type_6#>(); |
| 400 | auto type_6_provider = type_6_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 401 | |
| 402 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 403 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_4_provider_p)); |
| 404 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_5_provider_p)); |
| 405 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_6_provider_p)); |
| 406 | |
| 407 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_4cxx . . $ type_4#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_5cxx . . $ type_5#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_6cxx . . $ type_6#>()}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 408 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_4_provider->object() == nullptr); |
| 409 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_5_provider->object() == nullptr); |
| 410 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_6_provider->object() == nullptr); |
| 411 | |
| 412 | auto o5 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_5cxx . . $ type_5#>(i); |
| 413 | auto o4 = type_4_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 414 | auto o6 = type_6_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 415 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o4 != nullptr); |
| 416 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o5 != nullptr); |
| 417 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o6 != nullptr); |
| 418 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o4 == get<type_4>(i)); |
| 419 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o6 == get<type_6>(i)); |
| 420 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o4 == get<type_6>(i)->o); |
| 421 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o5 == get<type_4>(i)->o); |
| 422 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o6 == get<type_5>(i)->o); |
| 423 | } |
| 424 | |
| 425 | void injector_core_testcxx . . $ injector_core_test#::should_accept_dependencies_that_are_requiredcxx . . $ injector_core_test#should_accept_dependencies_that_are_required(49f6e7a06ebc5aa8).() |
| 426 | { |
| 427 | auto type_7_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_7cxx . . $ type_7#>(); |
| 428 | auto type_7_provider = type_7_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 429 | auto type_8_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_8cxx . . $ type_8#, type_7cxx . . $ type_7#>(); |
| 430 | auto type_8_provider = type_8_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 431 | auto type_9_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_9cxx . . $ type_9#>(); |
| 432 | auto type_9_provider = type_8_provider_p.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).(); |
| 433 | |
| 434 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 435 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_7_provider_p)); |
| 436 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_8_provider_p)); |
| 437 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_9_provider_p)); |
| 438 | |
| 439 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_7cxx . . $ type_7#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_8cxx . . $ type_8#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_9cxx . . $ type_9#>()}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 440 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_7_provider->object() == nullptr); |
| 441 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_8_provider->object() == nullptr); |
| 442 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(type_9_provider->object() == nullptr); |
| 443 | |
| 444 | auto o9 = getcxx . . $ injector_core_test#get(1ee43c356f1d4cb0).<type_9cxx . . $ type_9#>(i); |
| 445 | auto o7 = type_7_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 446 | auto o8 = type_8_provider->objectcxx . . $ mocked_provider#object(2dbb680a34285c44).(); |
| 447 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o9 != nullptr); |
| 448 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o7 != nullptr); |
| 449 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o8 != nullptr); |
| 450 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o7 == get<type_7>(i)); |
| 451 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(o8 == get<type_8>(i)); |
| 452 | } |
| 453 | |
| 454 | void injector_core_testcxx . . $ injector_core_test#::should_inject_into_unregistered_typecxx . . $ injector_core_test#should_inject_into_unregistered_type(49f6e7a06ebc5aa8).() |
| 455 | { |
| 456 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1cxx . . $ type_1#>(); |
| 457 | auto type_2_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_2cxx . . $ type_2#>(); |
| 458 | |
| 459 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 460 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 461 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_2_provider_p)); |
| 462 | |
| 463 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1cxx . . $ type_1#>(), make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_2cxx . . $ type_2#>()}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 464 | auto unregistered = stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::unique_ptrcxx . . $ std/unique_ptr#<unregistered_typecxx . . $ unregistered_type#>(new unregistered_typecxx . . $ unregistered_type#{}); |
| 465 | i.inject_intocxx . . $ injeqt/internal/injector_core#inject_into(749de1b6ae65bddd).(unregistered.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).()); |
| 466 | |
| 467 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(unregistered->o1 != nullptr); |
| 468 | QVERIFYcxx . . $ `<external>/8602788698586413231/qtestcase.h:63:9`!(unregistered->o2 != nullptr); |
| 469 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(unregistered->o1, get<type_1>(i)); |
| 470 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(unregistered->o2, get<type_2>(i)); |
| 471 | } |
| 472 | |
| 473 | void injector_core_testcxx . . $ injector_core_test#::should_not_inject_into_when_unknown_dependenciescxx . . $ injector_core_test#should_not_inject_into_when_unknown_dependencies(49f6e7a06ebc5aa8).() |
| 474 | { |
| 475 | auto type_1_provider_p = make_mocked_providercxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).<type_1cxx . . $ type_1#>(); |
| 476 | |
| 477 | auto configuration = stdcxx . . $ std/vector#vector(b1ea180184b47f03).::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>>{}; |
| 478 | configuration.push_backcxx . . $ std/vector#push_back(fe7a8a4d1eddb70).(stdcxx . . $ std/unique_ptr#unique_ptr(9ad45c7d2296bc38).::movecxx . . $ std/move(e7c6c0c8363dcc46).(type_1_provider_p)); |
| 479 | |
| 480 | auto i = injector_corecxx . . $ injeqt/internal/injector_core#injector_core(528a6fa5a342ea28).{types_by_namecxx . . $ injeqt/internal/sorted_unique_vector#sorted_unique_vector(27fd641105185d40).{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1cxx . . $ type_1#>()}, stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(configuration)}; |
| 481 | auto unregistered = stdcxx . . $ std/unique_ptr#unique_ptr(d6762fce684538e4).::unique_ptrcxx . . $ std/unique_ptr#<unregistered_typecxx . . $ unregistered_type#>(new unregistered_typecxx . . $ unregistered_type#{}); |
| 482 | |
| 483 | expectcxx . . $ expect(d99b926da2bbc072).<exceptioncxx . . $ injeqt/v1/exception/::invalid_settercxx . . $ injeqt/v1/exception/invalid_setter#>({cxx . . $ std/vector#vector(9619226211e5a241)."type_2"}, [cxx . . $ std/function#function(a4b4b0c4acad1616).&](){ |
| 484 | i.inject_intocxx . . $ injeqt/internal/injector_core#inject_into(749de1b6ae65bddd).(unregistered.getcxx . . $ std/unique_ptr#get(ca399b2b6292c808).()); |
| 485 | }); |
| 486 | } |
| 487 | |
| 488 | // TODO: https://github.com/vogel/injeqt/issues/3 |
| 489 | /* |
| 490 | void injector_core_test::should_not_accept_cyclic_required_types() |
| 491 | { |
| 492 | auto configuration = std::vector<std::unique_ptr<provider>>{}; |
| 493 | configuration.push_back(make_mocked_provider<type_1, type_7>()); |
| 494 | configuration.push_back(make_mocked_provider<type_7, type_8>()); |
| 495 | configuration.push_back(make_mocked_provider<type_8, type_1>()); |
| 496 | |
| 497 | expect<exception::exception>([&](){ |
| 498 | auto i = injector_core{std::move(configuration)}; |
| 499 | }); |
| 500 | } |
| 501 | |
| 502 | void injector_core_test::should_not_accept_dependent_as_required_type() |
| 503 | { |
| 504 | auto configuration = std::vector<std::unique_ptr<provider>>{}; |
| 505 | configuration.push_back(make_mocked_provider<type_2>()); |
| 506 | configuration.push_back(make_mocked_provider<type_1, type_2>()); |
| 507 | |
| 508 | expect<exception::exception>([&](){ |
| 509 | auto i = injector_core{std::move(configuration)}; |
| 510 | }); |
| 511 | } |
| 512 | */ |
| 513 | |
| 514 | QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(injector_core_test) |
| 515 | #include "injector-core-test.moc"cxx . . $ `<file>/build/test/injector-core-test_autogen/include/injector-core-test.moc`/ |