Skip to content

Commit

Permalink
Refs #8028 - Pin down debug error with unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterParker committed Sep 26, 2013
1 parent 0ed1dec commit 928873f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Code/Mantid/Framework/Kernel/src/Strings.cpp
Expand Up @@ -1163,6 +1163,8 @@ namespace Mantid
#endif
template MANTID_KERNEL_DLL std::string toString(const std::string value);

template MANTID_KERNEL_DLL std::string toString(const std::vector<int> &value);

// this block should generate the vector ones as well
template MANTID_KERNEL_DLL std::string toString(const std::set<int> &value);
template MANTID_KERNEL_DLL std::string toString(const std::set<int16_t> &value);
Expand Down
16 changes: 16 additions & 0 deletions Code/Mantid/Framework/Kernel/test/StringsTest.h
Expand Up @@ -3,6 +3,7 @@

#include <cxxtest/TestSuite.h>
#include <Poco/Path.h>
#include <fstream>

#include "MantidKernel/Strings.h"
#include <string>
Expand Down Expand Up @@ -424,6 +425,21 @@ class StringsTest : public CxxTest::TestSuite
e.what(), std::string("Range boundaries are reversed: 5-1"));
}

void test_toString_vector_of_ints()
{
std::vector<int> sortedInts;
sortedInts.push_back(1);
sortedInts.push_back(2);
sortedInts.push_back(3);
sortedInts.push_back(5);
sortedInts.push_back(6);
sortedInts.push_back(8);

auto result = toString(sortedInts);

TS_ASSERT_EQUALS(std::string("1-3,5-6,8"), result);
}

};

#endif //MANTID_SUPPORTTEST_H_

0 comments on commit 928873f

Please sign in to comment.