Skip to content

Commit

Permalink
Add unit tests to see coverage increase (#2267)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Omnès <[email protected]>
  • Loading branch information
payetvin and flomnes authored Jul 25, 2024
1 parent b8c8285 commit 0359290
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libs/antares/study/study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ void Study::resizeAllTimeseriesNumbers(uint n)
bindingConstraintsGroups.resizeAllTimeseriesNumbers(n);
}

// TODO VP: Could be removed with the GUI
bool Study::checkForFilenameLimits(bool output, const String& chfolder) const
{
enum
Expand Down
20 changes: 20 additions & 0 deletions src/tests/src/libs/antares/study/test_study.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,24 @@ BOOST_AUTO_TEST_CASE(version_parsing)
BOOST_CHECK(!v.fromString("4.5"));
BOOST_CHECK(v == StudyVersion::unknown());
}

BOOST_FIXTURE_TEST_CASE(check_filename_limit, OneAreaStudy)
{
auto s = std::make_unique<Study>();
BOOST_CHECK(s->checkForFilenameLimits(true)); // empty areas should return true

BOOST_CHECK(study->checkForFilenameLimits(true));
BOOST_CHECK(study->checkForFilenameLimits(false));
BOOST_CHECK(study->checkForFilenameLimits(true, "abc"));

#ifdef YUNI_OS_WINDOWS
std::string area1name(128, 'a');
std::string area2name(128, 'b');
auto areaB = study->areaAdd(area1name);
auto areaC = study->areaAdd(area2name);
AreaAddLinkBetweenAreas(areaB, areaC);
BOOST_CHECK(!study->checkForFilenameLimits(true));
#endif
}

BOOST_AUTO_TEST_SUITE_END() // version

0 comments on commit 0359290

Please sign in to comment.