@@ -285,8 +285,9 @@ namespace tests {
285
285
struct InitReference {
286
286
std::string varName;
287
287
std::string refName;
288
- InitReference (std::string varName, std::string refName)
289
- : varName(std::move(varName)), refName(std::move(refName)) {
288
+ std::string typeName;
289
+ InitReference (std::string varName, std::string refName, std::string typeName)
290
+ : varName(std::move(varName)), refName(std::move(refName)), typeName(std::move(typeName)) {
290
291
}
291
292
};
292
293
@@ -300,6 +301,7 @@ namespace tests {
300
301
: type(std::move(type)), varName(std::move(varName)) {
301
302
}
302
303
};
304
+
303
305
struct MethodParam {
304
306
types::Type type;
305
307
string name;
@@ -340,6 +342,8 @@ namespace tests {
340
342
string name;
341
343
std::optional<uint64_t > alignment;
342
344
shared_ptr<AbstractValueView> view;
345
+ vector<MethodParam> lazyParams;
346
+ vector<TestCaseParamValue> lazyValues;
343
347
TestCaseParamValue () = default ;
344
348
TestCaseParamValue (string name,
345
349
std::optional<uint64_t > alignment,
@@ -357,7 +361,7 @@ namespace tests {
357
361
vector<MethodParam> stubValuesTypes;
358
362
vector<TestCaseParamValue> stubValues;
359
363
360
- MapAddressName fromAddressToName ;
364
+ MapAddressName lazyAddressToName ;
361
365
vector<InitReference> lazyReferences;
362
366
363
367
vector<TestCaseParamValue> funcParamValues;
@@ -376,25 +380,23 @@ namespace tests {
376
380
vector<TestCaseParamValue> globalPreValues;
377
381
vector<TestCaseParamValue> globalPostValues;
378
382
std::optional <TestCaseParamValue> stdinValue;
379
- vector<TypeAndVarName> lazyVariables;
380
383
vector<InitReference> lazyReferences;
381
384
vector<UTBotKTestObject> objects;
382
385
383
- MapAddressName fromAddressToName ;
386
+ MapAddressName lazyAddressToName ;
384
387
385
388
vector<MethodParam> stubValuesTypes;
386
389
vector<TestCaseParamValue> stubValues;
387
390
388
391
vector<TestCaseParamValue> paramValues;
389
392
vector<TestCaseParamValue> paramPostValues;
390
- vector<TestCaseParamValue> lazyValues;
391
393
vector<TestCaseParamValue> stubParamValues;
392
394
vector<MethodParam> stubParamTypes;
393
- shared_ptr<AbstractValueView> returnValueView ;
395
+ TestCaseParamValue returnValue ;
394
396
std::optional<TestCaseParamValue> classPreValues;
395
397
std::optional<TestCaseParamValue> classPostValues;
396
398
397
- bool isError () const ;
399
+ [[nodiscard]] bool isError () const ;
398
400
};
399
401
400
402
struct Modifiers {
@@ -463,7 +465,7 @@ namespace tests {
463
465
return method;
464
466
}
465
467
466
- bool hasChangeable () const {
468
+ [[nodiscard]] bool hasChangeable () const {
467
469
for (const auto & i : params) {
468
470
if (i.isChangeable ()) {
469
471
return true ;
@@ -472,18 +474,18 @@ namespace tests {
472
474
return false ;
473
475
}
474
476
475
- bool isClassMethod () const {
477
+ [[nodiscard]] bool isClassMethod () const {
476
478
return classObj.has_value ();
477
479
}
478
480
479
- std::optional<std::string> getClassName () const {
481
+ [[nodiscard]] std::optional<std::string> getClassName () const {
480
482
if (isClassMethod ()) {
481
483
return std::make_optional (classObj->name );
482
484
}
483
485
return std::nullopt;
484
486
}
485
487
486
- std::optional<std::string> getClassTypeName () const {
488
+ [[nodiscard]] std::optional<std::string> getClassTypeName () const {
487
489
if (isClassMethod ()) {
488
490
return std::make_optional (classObj->type .typeName ());
489
491
}
@@ -579,9 +581,14 @@ namespace tests {
579
581
}
580
582
};
581
583
582
- struct JsonNumAndType {
583
- int num;
584
- types::Type type;
584
+ struct JsonIndAndParam {
585
+ size_t jsonInd;
586
+ Tests::MethodParam param;
587
+ Tests::TestCaseParamValue& paramValue;
588
+ JsonIndAndParam (size_t jsonInd, Tests::MethodParam param,
589
+ Tests::TestCaseParamValue& paramValue) : jsonInd(jsonInd),
590
+ param (std::move(param)), paramValue(paramValue) {
591
+ }
585
592
};
586
593
587
594
/* *
@@ -714,20 +721,32 @@ namespace tests {
714
721
const std::unordered_map<string, types::Type>& methodNameToReturnTypeMap,
715
722
vector<RawKleeParam> &rawKleeParams);
716
723
724
+ static void addToOrder (const vector<UTBotKTestObject> &objects,
725
+ const std::string ¶mName,
726
+ const types::Type ¶mType,
727
+ Tests::TestCaseParamValue ¶mValue,
728
+ std::vector<bool > &visited,
729
+ std::queue<JsonIndAndParam>& order);
730
+
717
731
void assignTypeUnnamedVar (Tests::MethodTestCase &testCase,
718
732
const Tests::MethodDescription &methodDescription);
719
733
720
734
void assignTypeStubVar (Tests::MethodTestCase &testCase,
721
735
const Tests::MethodDescription &methodDescription);
722
736
723
- void workWithStructInBFS (std::queue<JsonNumAndType> &order, std::vector<bool > &visited,
724
- const Offset &off, std::vector<UTBotKTestObject> &objects, const types::StructInfo &structInfo);
725
-
726
- int findFieldIndex (const types::StructInfo &structInfo, size_t offset);
737
+ size_t findFieldIndex (const types::StructInfo &structInfo, size_t offset);
727
738
728
- int findObjectIndex (const std::vector<UTBotKTestObject> &objects, const std::string &name);
739
+ types::Type traverseLazyInStruct (vector<bool > &visited,
740
+ const types::Type &curVarType,
741
+ size_t offset,
742
+ const Tests::MethodTestCase &testCase,
743
+ const Tests::MethodDescription &methodDescription);
729
744
730
- types::Type traverseStruct (const types::StructInfo &structInfo, size_t offset);
745
+ shared_ptr<AbstractValueView> getLazyPointerView (const MapAddressName &fromAddressToName,
746
+ vector<InitReference> &initReferences,
747
+ const string &name,
748
+ std::string res,
749
+ const types::Type ¶mType) const ;
731
750
};
732
751
/* *
733
752
* @brief This function is used for converting primiive value of a specific type
0 commit comments