@@ -14,6 +14,27 @@ static void updateIfNotCompleteType(types::TypeSupport &typeSupport,
14
14
}
15
15
}
16
16
17
+ bool hasPrivateArray (const types::Type &type, const types::TypesHandler &typesHandler) {
18
+ switch (typesHandler.getTypeKind (type)) {
19
+ case types::TypeKind::STRUCT_LIKE:
20
+ for (const auto &field: typesHandler.getStructInfo (type).fields ) {
21
+ if (field.type .isArray () && field.accessSpecifier != types::AccessSpecifier::AS_pubic) {
22
+ return true ;
23
+ }
24
+ return hasPrivateArray (field.type , typesHandler);
25
+ }
26
+ break ;
27
+ case types::TypeKind::OBJECT_POINTER:
28
+ case types::TypeKind::ARRAY:
29
+ case types::TypeKind::PRIMITIVE:
30
+ case types::TypeKind::ENUM:
31
+ case types::TypeKind::UNKNOWN:
32
+ default :
33
+ return false ;
34
+ }
35
+ return false ;
36
+ }
37
+
17
38
void FeaturesFilter::filter (utbot::SettingsContext const &settingsContext,
18
39
const types::TypesHandler &typesHandler,
19
40
tests::TestsMap &testsMap,
@@ -80,6 +101,66 @@ void FeaturesFilter::filter(utbot::SettingsContext const &settingsContext,
80
101
tests.commentBlocks .push_back (message.str ());
81
102
return true ;
82
103
}
104
+
105
+ if (method.isClassMethod () &&
106
+ !typesHandler.getStructInfo (method.classObj ->type ).hasDefaultPublicConstructor ) {
107
+ std::stringstream message;
108
+ message
109
+ << " Method '" << method.name
110
+ << " ' was skipped, as class '" << method.getClassTypeName ().value ()
111
+ << " ' can't be construct in current version" ;
112
+ LOG_S (DEBUG) << message.str ();
113
+ tests.commentBlocks .push_back (message.str ());
114
+ return true ;
115
+ }
116
+
117
+ if (method.isClassMethod () &&
118
+ hasPrivateArray (method.classObj ->type , typesHandler)) {
119
+ std::stringstream message;
120
+ message
121
+ << " Method '" << method.name
122
+ << " ' was skipped, as class '" << method.classObj ->type .typeName ()
123
+ << " ' has private field" ;
124
+ LOG_S (DEBUG) << message.str ();
125
+ tests.commentBlocks .push_back (message.str ());
126
+ return true ;
127
+ }
128
+
129
+ for (const auto ¶m: method.params ) {
130
+ if (typesHandler.isStructLike (param.type ) && hasPrivateArray (param.type , typesHandler)) {
131
+ std::stringstream message;
132
+ message
133
+ << " Method '" << method.name
134
+ << " ' was skipped, as parameter '" << param.type .typeName ()
135
+ << " ' has private field" ;
136
+ LOG_S (DEBUG) << message.str ();
137
+ tests.commentBlocks .push_back (message.str ());
138
+ return true ;
139
+ }
140
+ }
141
+
142
+ if (typesHandler.isStructLike (method.returnType ) && hasPrivateArray (method.returnType , typesHandler)) {
143
+ std::stringstream message;
144
+ message
145
+ << " Method '" << method.name
146
+ << " ' was skipped, as return type '" << method.returnType .typeName ()
147
+ << " ' has private field" ;
148
+ LOG_S (DEBUG) << message.str ();
149
+ tests.commentBlocks .push_back (message.str ());
150
+ return true ;
151
+ }
152
+
153
+ if (method.accessSpecifier != types::AS_pubic) {
154
+ std::stringstream message;
155
+ message
156
+ << " Method '" << method.name
157
+ << " ' from class '" << method.getClassTypeName ().value_or (" " )
158
+ << " ' was skipped, as private" ;
159
+ LOG_S (DEBUG) << message.str ();
160
+ tests.commentBlocks .push_back (message.str ());
161
+ return true ;
162
+ }
163
+
83
164
unsupportedStatistics[" passed features filter" ]++;
84
165
85
166
return false ;
0 commit comments