Skip to content

Commit

Permalink
Fix build errors due to using initialization lists.
Browse files Browse the repository at this point in the history
Refs #7772
  • Loading branch information
arturbekasov committed Aug 22, 2013
1 parent 5d9ae99 commit 3030d1c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ namespace DataHandling
{
/// Initialise the properties

std::vector<std::string> fileExts = {".xml", ".map"};
std::vector<std::string> fileExts(2);
fileExts[0] = ".xml";
fileExts[1] = ".map";

declareProperty(new FileProperty("InputFile", "", FileProperty::Load, fileExts),
"The XML or Map file with full path.");

Expand Down Expand Up @@ -871,7 +874,7 @@ namespace DataHandling
LoadGroupMapFile::LoadGroupMapFile(const std::string& fileName, Kernel::Logger& log)
: m_fileName(fileName), m_log(log), m_lastLineRead(0)
{
m_file.open(m_fileName, std::ifstream::in);
m_file.open(m_fileName.c_str(), std::ifstream::in);

if(!m_file)
throw Exception::FileError("Couldn't open file for reading", fileName);
Expand Down
42 changes: 36 additions & 6 deletions Code/Mantid/Framework/Kernel/test/StringsTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,35 @@ class StringsTest : public CxxTest::TestSuite
{
std::vector<int> result;
TS_ASSERT_THROWS_NOTHING(result = parseRange("3,1,4,0,2,5"));
std::vector<int> expected = {3,1,4,0,2,5};
std::vector<int> expected(6);
expected[0] = 3;
expected[1] = 1;
expected[2] = 4;
expected[3] = 0;
expected[4] = 2;
expected[5] = 5;
TS_ASSERT_EQUALS(result, expected);
}

void test_parseRange_defaultRanges()
{
std::vector<int> result;
TS_ASSERT_THROWS_NOTHING(result = parseRange(" 1, 2 - 5, 6 ,7,8, 9,10-12"));
std::vector<int> expected = {1,2,3,4,5,6,7,8,9,10,11,12};

std::vector<int> expected;
expected.reserve(12);
for(int i = 1; i <= 12; i++)
expected.push_back(i);

TS_ASSERT_EQUALS(result, expected);
}

void test_parseRange_emptyElements()
{
std::vector<int> expected = {1,2,3};
std::vector<int> expected(3);
expected[0] = 1;
expected[1] = 2;
expected[2] = 3;

std::vector<int> result1;
TS_ASSERT_THROWS_NOTHING(result1 = parseRange(",1,2,3"));
Expand All @@ -325,23 +339,39 @@ class StringsTest : public CxxTest::TestSuite
{
std::vector<int> result;
TS_ASSERT_THROWS_NOTHING(result = parseRange(" 52 53 54 55 56 57 58 192", " "));
std::vector<int> expected = {52,53,54,55,56,57,58,192};

std::vector<int> expected;
expected.reserve(8);
for(int i = 52; i <= 58; i++)
expected.push_back(i);
expected.push_back(192);

TS_ASSERT_EQUALS(result, expected);
}

void test_parseRange_mapStyleRanges()
{
std::vector<int> result;
TS_ASSERT_THROWS_NOTHING(result = parseRange(" 1- 3 4 5 - 7 8 -10 ", " "));
std::vector<int> expected = {1,2,3,4,5,6,7,8,9,10};

std::vector<int> expected;
expected.reserve(10);
for(int i = 1; i <= 10; i++)
expected.push_back(i);

TS_ASSERT_EQUALS(result, expected);
}

void test_parseRange_customRangeSep()
{
std::vector<int> result;
TS_ASSERT_THROWS_NOTHING(result = parseRange("1-2,3:5,6-7,8:10", ",","-:"));
std::vector<int> expected = {1,2,3,4,5,6,7,8,9,10};

std::vector<int> expected;
expected.reserve(10);
for(int i = 1; i <= 10; i++)
expected.push_back(i);

TS_ASSERT_EQUALS(result, expected);
}

Expand Down

0 comments on commit 3030d1c

Please sign in to comment.