Skip to content

Commit

Permalink
Make order of names returned by avail_normalizations() deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Sep 18, 2023
1 parent 491de18 commit 7c05341
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/libhictk/hic/include/hictk/hic/impl/file_reader_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,8 @@ inline std::vector<balancing::Method> HiCFileReader::list_avail_normalizations(

std::vector<balancing::Method> methods_{methods.size()};
std::copy(methods.begin(), methods.end(), methods_.begin());
std::sort(methods_.begin(), methods_.end(),
[&](const auto &m1, const auto &m2) { return m1.to_string() < m2.to_string(); });
return methods_;
}

Expand Down
4 changes: 2 additions & 2 deletions test/units/hic/hic_file_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ TEST_CASE("HiC: file accessors", "[hic][short]") {
CHECK(f.avail_resolutions().back() == 1000);

CHECK(f.avail_normalizations().size() == 4);
CHECK(f.avail_normalizations().front() == "VC_SQRT");
CHECK(f.avail_normalizations().back() == "VC");
CHECK(f.avail_normalizations().front() == "KR");
CHECK(f.avail_normalizations().back() == "VC_SQRT");

CHECK(f.open(2'500'000).resolution() == 2'500'000);

Expand Down

0 comments on commit 7c05341

Please sign in to comment.