@@ -3223,6 +3223,44 @@ namespace {
3223
3223
);
3224
3224
}
3225
3225
3226
+ /* TEST_F(Syntax_Test, run_tests_for_input_output_c) {
3227
+ auto request = testUtils::createFileRequest(projectName, suitePath, buildDirRelativePath,
3228
+ srcPaths, input_output_c,
3229
+ GrpcUtils::UTBOT_AUTO_TARGET_PATH, true, false);
3230
+ auto testGen = FileTestGen(*request, writer.get(), TESTMODE);
3231
+ testGen.setTargetForSource(input_output_c);
3232
+ Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest(testGen, writer.get());
3233
+ ASSERT_TRUE(status.ok()) << status.error_message();
3234
+ EXPECT_EQ(testUtils::getNumberOfTests(testGen.tests), 63); // 61 regression tests and 2 error
3235
+
3236
+ fs::path testsDirPath = getTestFilePath("tests");
3237
+
3238
+ fs::path input_output_test_cpp = Paths::sourcePathToTestPath(
3239
+ utbot::ProjectContext(projectName, suitePath, testsDirPath, buildDirRelativePath),
3240
+ input_output_c);
3241
+ auto testFilter = GrpcUtils::createTestFilterForFile(input_output_test_cpp);
3242
+ auto runRequest = testUtils::createCoverageAndResultsRequest(
3243
+ projectName, suitePath, testsDirPath, buildDirRelativePath, std::move(testFilter));
3244
+
3245
+ static auto coverageAndResultsWriter =
3246
+ std::make_unique<ServerCoverageAndResultsWriter>(nullptr);
3247
+ CoverageAndResultsGenerator coverageGenerator{ runRequest.get(),
3248
+ coverageAndResultsWriter.get() };
3249
+ utbot::SettingsContext settingsContext{
3250
+ true, false, 45, 0, false, false, ErrorMode::FAILING
3251
+ };
3252
+ coverageGenerator.generate(false, settingsContext);
3253
+
3254
+ EXPECT_FALSE(coverageGenerator.hasExceptions());
3255
+ ASSERT_TRUE(coverageGenerator.getCoverageMap().empty());
3256
+
3257
+ auto resultMap = coverageGenerator.getTestResultMap();
3258
+ auto tests = coverageGenerator.getTestsToLaunch();
3259
+
3260
+ StatusCountMap expectedStatusCountMap{ {testsgen::TEST_PASSED, 61}, {testsgen::TEST_FAILED, 2} };
3261
+ testUtils::checkStatusesCount(resultMap, tests, expectedStatusCountMap);
3262
+ }*/
3263
+
3226
3264
TEST_F (Syntax_Test, file_fgetc) {
3227
3265
auto [testGen, status] = createTestForFunction (file_c, 5 );
3228
3266
@@ -3377,6 +3415,44 @@ namespace {
3377
3415
);
3378
3416
}
3379
3417
3418
+ TEST_F (Syntax_Test, run_tests_for_file_c) {
3419
+ auto request =
3420
+ testUtils::createFileRequest (projectName, suitePath, buildDirRelativePath, srcPaths,
3421
+ file_c, GrpcUtils::UTBOT_AUTO_TARGET_PATH, true , false );
3422
+ auto testGen = FileTestGen (*request, writer.get (), TESTMODE);
3423
+ testGen.setTargetForSource (file_c);
3424
+ Status status = Server::TestsGenServiceImpl::ProcessBaseTestRequest (testGen, writer.get ());
3425
+ ASSERT_TRUE (status.ok ()) << status.error_message ();
3426
+ EXPECT_EQ (testUtils::getNumberOfTests (testGen.tests ), 33 );
3427
+
3428
+ fs::path testsDirPath = getTestFilePath (" tests" );
3429
+
3430
+ fs::path file_test_cpp = Paths::sourcePathToTestPath (
3431
+ utbot::ProjectContext (projectName, suitePath, testsDirPath, buildDirRelativePath),
3432
+ file_c);
3433
+ auto testFilter = GrpcUtils::createTestFilterForFile (file_test_cpp);
3434
+ auto runRequest = testUtils::createCoverageAndResultsRequest (
3435
+ projectName, suitePath, testsDirPath, buildDirRelativePath, std::move (testFilter));
3436
+
3437
+ static auto coverageAndResultsWriter =
3438
+ std::make_unique<ServerCoverageAndResultsWriter>(nullptr );
3439
+ CoverageAndResultsGenerator coverageGenerator{ runRequest.get (),
3440
+ coverageAndResultsWriter.get () };
3441
+ utbot::SettingsContext settingsContext{
3442
+ true , false , 45 , 0 , false , false , ErrorMode::FAILING
3443
+ };
3444
+ coverageGenerator.generate (false , settingsContext);
3445
+
3446
+ EXPECT_FALSE (coverageGenerator.hasExceptions ());
3447
+ ASSERT_TRUE (coverageGenerator.getCoverageMap ().empty ());
3448
+
3449
+ auto resultMap = coverageGenerator.getTestResultMap ();
3450
+ auto tests = coverageGenerator.getTestsToLaunch ();
3451
+
3452
+ StatusCountMap expectedStatusCountMap{ { testsgen::TEST_PASSED, 33 } };
3453
+ testUtils::checkStatusesCount (resultMap, tests, expectedStatusCountMap);
3454
+ }
3455
+
3380
3456
template <typename T>
3381
3457
bool checkBitfieldFit (const std::shared_ptr<tests::AbstractValueView> &fieldView, size_t size) {
3382
3458
T val = StringUtils::stot<T>(fieldView->getEntryValue (nullptr ));
0 commit comments