| 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 <QtTest/QtTest> |
| 22 | |
| 23 | #include <injeqt/type.h>cxx . . $ `<file>/include/injeqt/type.h`/ |
| 24 | |
| 25 | #include "internal/type-relations.h"cxx . . $ `<file>/src/internal/type-relations.h`/ |
| 26 | |
| 27 | using namespace injeqtcxx . . $ injeqt/::internal; |
| 28 | using namespace injeqtcxx . . $ injeqt/::v1; |
| 29 | |
| 30 | class type_1cxx . . $ type_1# : public QObjectcxx . . $ QObject# |
| 31 | { |
| 32 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 33 | }; |
| 34 | |
| 35 | class type_1_sub_1cxx . . $ type_1_sub_1# : public type_1cxx . . $ type_1# |
| 36 | { |
| 37 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 38 | }; |
| 39 | |
| 40 | class type_1_sub_1_sub_1cxx . . $ type_1_sub_1_sub_1# : public type_1_sub_1cxx . . $ type_1_sub_1# |
| 41 | { |
| 42 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 43 | }; |
| 44 | |
| 45 | class type_1_sub_1_sub_2cxx . . $ type_1_sub_1_sub_2# : public type_1_sub_1cxx . . $ type_1_sub_1# |
| 46 | { |
| 47 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 48 | }; |
| 49 | |
| 50 | class type_1_sub_2cxx . . $ type_1_sub_2# : public type_1cxx . . $ type_1# |
| 51 | { |
| 52 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 53 | }; |
| 54 | |
| 55 | class type_2cxx . . $ type_2# : public QObjectcxx . . $ QObject# |
| 56 | { |
| 57 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 58 | }; |
| 59 | |
| 60 | class type_2_sub_1cxx . . $ type_2_sub_1# : public type_2cxx . . $ type_2# |
| 61 | { |
| 62 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 63 | }; |
| 64 | |
| 65 | class type_relations_testcxx . . $ type_relations_test# : public QObjectcxx . . $ QObject# |
| 66 | { |
| 67 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 68 | |
| 69 | public: |
| 70 | type_relations_testcxx . . $ type_relations_test#type_relations_test(49f6e7a06ebc5aa8).(); |
| 71 | |
| 72 | private slotscxx . . $ `<external>/1208926524888476972/qobjectdefs.h:88:14`!: |
| 73 | void should_create_empty_relationscxx . . $ type_relations_test#should_create_empty_relations(49f6e7a06ebc5aa8).(); |
| 74 | void should_create_empty_relations_for_no_typescxx . . $ type_relations_test#should_create_empty_relations_for_no_types(49f6e7a06ebc5aa8).(); |
| 75 | void should_create_unique_relations_for_unrelated_typescxx . . $ type_relations_test#should_create_unique_relations_for_unrelated_types(49f6e7a06ebc5aa8).(); |
| 76 | void should_create_unique_relations_for_unrelated_subtypescxx . . $ type_relations_test#should_create_unique_relations_for_unrelated_subtypes(49f6e7a06ebc5aa8).(); |
| 77 | void should_create_unique_relations_for_type_with_supertypescxx . . $ type_relations_test#should_create_unique_relations_for_type_with_supertypes(49f6e7a06ebc5aa8).(); |
| 78 | void should_create_ambiguous_relations_for_the_same_typecxx . . $ type_relations_test#should_create_ambiguous_relations_for_the_same_type(49f6e7a06ebc5aa8).(); |
| 79 | void should_create_mixed_relations_for_subtypescxx . . $ type_relations_test#should_create_mixed_relations_for_subtypes(49f6e7a06ebc5aa8).(); |
| 80 | void should_create_mixed_relations_for_type_and_subtypecxx . . $ type_relations_test#should_create_mixed_relations_for_type_and_subtype(49f6e7a06ebc5aa8).(); |
| 81 | void should_create_mixed_relations_for_subtype_and_typecxx . . $ type_relations_test#should_create_mixed_relations_for_subtype_and_type(49f6e7a06ebc5aa8).(); |
| 82 | |
| 83 | private: |
| 84 | typecxx . . $ injeqt/v1/type# type_1_typecxx . . $ type_relations_test#type_1_type.; |
| 85 | typecxx . . $ injeqt/v1/type# type_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_type.; |
| 86 | typecxx . . $ injeqt/v1/type# type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type.; |
| 87 | typecxx . . $ injeqt/v1/type# type_1_sub_1_sub_2_typecxx . . $ type_relations_test#type_1_sub_1_sub_2_type.; |
| 88 | typecxx . . $ injeqt/v1/type# type_1_sub_2_typecxx . . $ type_relations_test#type_1_sub_2_type.; |
| 89 | typecxx . . $ injeqt/v1/type# type_2_typecxx . . $ type_relations_test#type_2_type.; |
| 90 | typecxx . . $ injeqt/v1/type# type_2_sub_1_typecxx . . $ type_relations_test#type_2_sub_1_type.; |
| 91 | |
| 92 | }; |
| 93 | |
| 94 | type_relations_testcxx . . $ type_relations_test#::type_relations_testcxx . . $ type_relations_test#type_relations_test(49f6e7a06ebc5aa8).() : |
| 95 | type_1_typecxx . . $ type_relations_test#type_1_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1cxx . . $ type_1#>()}, |
| 96 | type_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1_sub_1cxx . . $ type_1_sub_1#>()}, |
| 97 | type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1_sub_1_sub_1cxx . . $ type_1_sub_1_sub_1#>()}, |
| 98 | type_1_sub_1_sub_2_typecxx . . $ type_relations_test#type_1_sub_1_sub_2_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1_sub_1_sub_2cxx . . $ type_1_sub_1_sub_2#>()}, |
| 99 | type_1_sub_2_typecxx . . $ type_relations_test#type_1_sub_2_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_1_sub_2cxx . . $ type_1_sub_2#>()}, |
| 100 | type_2_typecxx . . $ type_relations_test#type_2_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_2cxx . . $ type_2#>()}, |
| 101 | type_2_sub_1_typecxx . . $ type_relations_test#type_2_sub_1_type.{make_typecxx . . $ injeqt/v1/make_type(10a1ed948a80d481).<type_2_sub_1cxx . . $ type_2_sub_1#>()} |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | void type_relations_testcxx . . $ type_relations_test#::should_create_empty_relationscxx . . $ type_relations_test#should_create_empty_relations(49f6e7a06ebc5aa8).() |
| 106 | { |
| 107 | auto result = type_relationscxx . . $ injeqt/internal/type_relations#type_relations(49f6e7a06ebc5aa8).{}; |
| 108 | |
| 109 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), implemented_by_mapping{}); |
| 110 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{}); |
| 111 | } |
| 112 | |
| 113 | void type_relations_testcxx . . $ type_relations_test#::should_create_empty_relations_for_no_typescxx . . $ type_relations_test#should_create_empty_relations_for_no_types(49f6e7a06ebc5aa8).() |
| 114 | { |
| 115 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(49f6e7a06ebc5aa8).}); |
| 116 | |
| 117 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), implemented_by_mapping{}); |
| 118 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{}); |
| 119 | } |
| 120 | |
| 121 | void type_relations_testcxx . . $ type_relations_test#::should_create_unique_relations_for_unrelated_typescxx . . $ type_relations_test#should_create_unique_relations_for_unrelated_types(49f6e7a06ebc5aa8).() |
| 122 | { |
| 123 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_typecxx . . $ type_relations_test#type_1_type., type_2_typecxx . . $ type_relations_test#type_2_type.}); |
| 124 | |
| 125 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), (implemented_by_mapping |
| 126 | { |
| 127 | implemented_by{type_1_type, type_1_type}, |
| 128 | implemented_by{type_2_type, type_2_type} |
| 129 | })); |
| 130 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{}); |
| 131 | } |
| 132 | |
| 133 | void type_relations_testcxx . . $ type_relations_test#::should_create_unique_relations_for_unrelated_subtypescxx . . $ type_relations_test#should_create_unique_relations_for_unrelated_subtypes(49f6e7a06ebc5aa8).() |
| 134 | { |
| 135 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type., type_2_sub_1_typecxx . . $ type_relations_test#type_2_sub_1_type.}); |
| 136 | |
| 137 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), (implemented_by_mapping |
| 138 | { |
| 139 | implemented_by{type_1_type, type_1_sub_1_sub_1_type}, |
| 140 | implemented_by{type_1_sub_1_type, type_1_sub_1_sub_1_type}, |
| 141 | implemented_by{type_1_sub_1_sub_1_type, type_1_sub_1_sub_1_type}, |
| 142 | implemented_by{type_2_type, type_2_sub_1_type}, |
| 143 | implemented_by{type_2_sub_1_type, type_2_sub_1_type} |
| 144 | })); |
| 145 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{}); |
| 146 | } |
| 147 | |
| 148 | void type_relations_testcxx . . $ type_relations_test#::should_create_unique_relations_for_type_with_supertypescxx . . $ type_relations_test#should_create_unique_relations_for_type_with_supertypes(49f6e7a06ebc5aa8).() |
| 149 | { |
| 150 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type.}); |
| 151 | |
| 152 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), (implemented_by_mapping |
| 153 | { |
| 154 | implemented_by{type_1_type, type_1_sub_1_sub_1_type}, |
| 155 | implemented_by{type_1_sub_1_type, type_1_sub_1_sub_1_type}, |
| 156 | implemented_by{type_1_sub_1_sub_1_type, type_1_sub_1_sub_1_type} |
| 157 | })); |
| 158 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{}); |
| 159 | } |
| 160 | |
| 161 | void type_relations_testcxx . . $ type_relations_test#::should_create_ambiguous_relations_for_the_same_typecxx . . $ type_relations_test#should_create_ambiguous_relations_for_the_same_type(49f6e7a06ebc5aa8).() |
| 162 | { |
| 163 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_typecxx . . $ type_relations_test#type_1_type., type_1_typecxx . . $ type_relations_test#type_1_type.}); |
| 164 | |
| 165 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), implemented_by_mapping{}); |
| 166 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{type_1_type}); |
| 167 | } |
| 168 | |
| 169 | void type_relations_testcxx . . $ type_relations_test#::should_create_mixed_relations_for_subtypescxx . . $ type_relations_test#should_create_mixed_relations_for_subtypes(49f6e7a06ebc5aa8).() |
| 170 | { |
| 171 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type., type_1_sub_1_sub_2_typecxx . . $ type_relations_test#type_1_sub_1_sub_2_type.}); |
| 172 | |
| 173 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), (implemented_by_mapping |
| 174 | { |
| 175 | implemented_by{type_1_sub_1_sub_1_type, type_1_sub_1_sub_1_type}, |
| 176 | implemented_by{type_1_sub_1_sub_2_type, type_1_sub_1_sub_2_type} |
| 177 | })); |
| 178 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), (types{type_1_type, type_1_sub_1_type})); |
| 179 | } |
| 180 | |
| 181 | void type_relations_testcxx . . $ type_relations_test#::should_create_mixed_relations_for_type_and_subtypecxx . . $ type_relations_test#should_create_mixed_relations_for_type_and_subtype(49f6e7a06ebc5aa8).() |
| 182 | { |
| 183 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_typecxx . . $ type_relations_test#type_1_type., type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type.}); |
| 184 | |
| 185 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), (implemented_by_mapping |
| 186 | { |
| 187 | implemented_by{type_1_sub_1_type, type_1_sub_1_sub_1_type}, |
| 188 | implemented_by{type_1_sub_1_sub_1_type, type_1_sub_1_sub_1_type} |
| 189 | })); |
| 190 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{type_1_type}); |
| 191 | } |
| 192 | |
| 193 | void type_relations_testcxx . . $ type_relations_test#::should_create_mixed_relations_for_subtype_and_typecxx . . $ type_relations_test#should_create_mixed_relations_for_subtype_and_type(49f6e7a06ebc5aa8).() |
| 194 | { |
| 195 | auto result = make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).({cxx . . $ std/vector#vector(9619226211e5a241).type_1_sub_1_sub_1_typecxx . . $ type_relations_test#type_1_sub_1_sub_1_type., type_1_typecxx . . $ type_relations_test#type_1_type.}); |
| 196 | |
| 197 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.unique(), (implemented_by_mapping |
| 198 | { |
| 199 | implemented_by{type_1_sub_1_type, type_1_sub_1_sub_1_type}, |
| 200 | implemented_by{type_1_sub_1_sub_1_type, type_1_sub_1_sub_1_type} |
| 201 | })); |
| 202 | QCOMPAREcxx . . $ `<external>/8602788698586413231/qtestcase.h:86:9`!(result.ambiguous(), types{type_1_type}); |
| 203 | } |
| 204 | |
| 205 | QTEST_APPLESS_MAINcxx . . $ `<external>/4204159469433502174/qtest.h:442:9`!(type_relations_test); |
| 206 | |
| 207 | #include "type-relations-test.moc"cxx . . $ `<file>/build/test/type-relations-test_autogen/include/type-relations-test.moc`/ |