From 98655f0ee6bdccd79721e8ea56211714725d981f Mon Sep 17 00:00:00 2001 From: Robert Applin <40830825+robertapplin@users.noreply.github.com> Date: Thu, 4 Oct 2018 14:27:11 +0100 Subject: [PATCH] Refs #23463. Add unit test --- .../Indirect/test/IndirectFitDataTest.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h b/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h index a7f9f87032a..13cb2eec06d 100644 --- a/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h +++ b/qt/scientific_interfaces/Indirect/test/IndirectFitDataTest.h @@ -84,6 +84,23 @@ public: TS_ASSERT_EQUALS(*it, spectraVec[it - spectra.begin()]); } + void test_that_DiscontinuousSpectra_is_sorted_before_being_stored() { + auto data = getIndirectFitData(11, 3); + + std::vector<std::string> const inputStrings{"8,5-0,6,10", " 8,10, 7", + "1,2,4-3,10"}; + std::vector<Spectra> const anwserSpectra{ + DiscontinuousSpectra<std::size_t>("0-6,8,10"), + DiscontinuousSpectra<std::size_t>("7-8,10"), + DiscontinuousSpectra<std::size_t>("1-4,10")}; + + for (auto i = 0u; i < inputStrings.size(); ++i) { + data.setSpectra(inputStrings[i]); + TS_ASSERT(boost::apply_visitor(AreSpectraEqual(), data.spectra(), + anwserSpectra[i])); + } + } + void test_data_is_stored_in_the_ADS() { auto const data = getIndirectFitData(1, 3); SetUpADSWithWorkspace ads("WorkspaceName", data); -- GitLab