From c99d6b5040542a7172f413a90bc175324f8ad13f Mon Sep 17 00:00:00 2001
From: Nick Draper <nick.draper@stfc.ac.uk>
Date: Mon, 12 Nov 2007 11:23:55 +0000
Subject: [PATCH] re #60 corrected bug in the what section of tests. Changed
 solutions to link to the dll version of the C++ runtime

---
 Code/Mantid/Algorithms/Algorithms.vcproj      |  2 +-
 Code/Mantid/DataHandling/DataHandling.vcproj  |  2 +-
 Code/Mantid/DataObjects/DataObjects.vcproj    |  2 +-
 Code/Mantid/Kernel/Kernel.vcproj              |  2 +-
 Code/Mantid/Kernel/inc/Exception.h            |  5 +++-
 Code/Mantid/Kernel/src/Exception.cpp          | 28 +++++++++----------
 Code/Mantid/Kernel/test/ConfigSvcTest.h       |  4 ++-
 Code/Mantid/Kernel/test/MantidTest.properties |  2 +-
 Code/Mantid/Kernel/test/runTests.bat          | 12 +++++++-
 9 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/Code/Mantid/Algorithms/Algorithms.vcproj b/Code/Mantid/Algorithms/Algorithms.vcproj
index d5153ccfcf4..c9da4694064 100644
--- a/Code/Mantid/Algorithms/Algorithms.vcproj
+++ b/Code/Mantid/Algorithms/Algorithms.vcproj
@@ -41,7 +41,7 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="../../Third_Party/include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				DebugInformationFormat="3"
 			/>
 			<Tool
diff --git a/Code/Mantid/DataHandling/DataHandling.vcproj b/Code/Mantid/DataHandling/DataHandling.vcproj
index fc5fbcb5e48..56099538789 100644
--- a/Code/Mantid/DataHandling/DataHandling.vcproj
+++ b/Code/Mantid/DataHandling/DataHandling.vcproj
@@ -41,7 +41,7 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="../../Third_Party/include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				DebugInformationFormat="3"
 			/>
 			<Tool
diff --git a/Code/Mantid/DataObjects/DataObjects.vcproj b/Code/Mantid/DataObjects/DataObjects.vcproj
index c756c6d30a4..22aefc79dcd 100644
--- a/Code/Mantid/DataObjects/DataObjects.vcproj
+++ b/Code/Mantid/DataObjects/DataObjects.vcproj
@@ -41,7 +41,7 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="../../Third_Party/include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				DebugInformationFormat="3"
 			/>
 			<Tool
diff --git a/Code/Mantid/Kernel/Kernel.vcproj b/Code/Mantid/Kernel/Kernel.vcproj
index fb4cb66be5b..7cbedf0cee9 100644
--- a/Code/Mantid/Kernel/Kernel.vcproj
+++ b/Code/Mantid/Kernel/Kernel.vcproj
@@ -41,7 +41,7 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="inc;../../Third_Party/include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
-				RuntimeLibrary="1"
+				RuntimeLibrary="3"
 				DebugInformationFormat="3"
 			/>
 			<Tool
diff --git a/Code/Mantid/Kernel/inc/Exception.h b/Code/Mantid/Kernel/inc/Exception.h
index 7777dec5a54..939a0741d36 100644
--- a/Code/Mantid/Kernel/inc/Exception.h
+++ b/Code/Mantid/Kernel/inc/Exception.h
@@ -79,6 +79,7 @@ class DLLExport FileError : public std::runtime_error
 {
  private:
   const std::string fileName;
+  std::string outMessage;
 
  public:
   FileError(const std::string&,const std::string&);
@@ -91,7 +92,7 @@ class DLLExport FileError : public std::runtime_error
 
 /// Marks code as not implemented yet.
 class DLLExport NotImplementedError : public std::logic_error
-{
+{ 
  public:
   NotImplementedError(const std::string&);
   NotImplementedError(const NotImplementedError& A);
@@ -106,6 +107,7 @@ class DLLExport NotFoundError : public std::runtime_error
 {
  private:
   const std::string objectName;
+  std::string outMessage;
 
  public:
   NotFoundError(const std::string&,const std::string&);
@@ -121,6 +123,7 @@ class DLLExport ExistsError : public std::runtime_error
 {
  private:
   const std::string objectName;
+  std::string outMessage;
 
  public:
   ExistsError(const std::string&,const std::string&);
diff --git a/Code/Mantid/Kernel/src/Exception.cpp b/Code/Mantid/Kernel/src/Exception.cpp
index 5d3ec8584c8..3cc16141a98 100644
--- a/Code/Mantid/Kernel/src/Exception.cpp
+++ b/Code/Mantid/Kernel/src/Exception.cpp
@@ -19,7 +19,9 @@ namespace Exception
 */
 FileError::FileError(const std::string& Desc,const std::string& FName) :
 std::runtime_error(Desc),fileName(FName)
-{}
+{
+	outMessage = std::string(std::runtime_error::what()) + " in " + fileName;
+}
  
 /// Copy constructor
 FileError::FileError(const FileError& A) :
@@ -31,9 +33,7 @@ FileError::FileError(const FileError& A) :
 */
 const char* FileError::what() const throw()
 {
-  std::stringstream cx;
-  cx<<std::runtime_error::what()<<" in "<<fileName;
-  return cx.str().c_str();
+	return outMessage.c_str();
 }
 
 //-------------------------
@@ -56,9 +56,7 @@ NotImplementedError::NotImplementedError(const NotImplementedError& A) :
 */
 const char* NotImplementedError::what() const throw()
 {
-  std::stringstream cx;
-  cx<<std::logic_error::what();
-  return cx.str().c_str();
+  return std::logic_error::what();
 }
 
 //-------------------------
@@ -70,7 +68,9 @@ const char* NotImplementedError::what() const throw()
 */
 NotFoundError::NotFoundError(const std::string& Desc,const std::string& ObjectName) :
 std::runtime_error(Desc),objectName(ObjectName)
-{}
+{ 
+	outMessage = std::string(std::runtime_error::what()) + " search object " + objectName;
+}
  
 /// Copy constructor
 NotFoundError::NotFoundError(const NotFoundError& A) :
@@ -82,9 +82,7 @@ NotFoundError::NotFoundError(const NotFoundError& A) :
 */
 const char* NotFoundError::what() const throw()
 {
-  std::stringstream cx;
-  cx<<std::runtime_error::what()<<" search object "<<objectName;;
-  return cx.str().c_str();
+	return outMessage.c_str();
 }
 
 //-------------------------
@@ -96,7 +94,9 @@ const char* NotFoundError::what() const throw()
 */
 ExistsError::ExistsError(const std::string& Desc,const std::string& ObjectName) :
 std::runtime_error(Desc),objectName(ObjectName)
-{}
+{
+	outMessage = std::string(std::runtime_error::what()) + " search object " + objectName;
+}
  
 /// Copy constructor
 ExistsError::ExistsError(const ExistsError& A) :
@@ -108,9 +108,7 @@ ExistsError::ExistsError(const ExistsError& A) :
 */
 const char* ExistsError::what() const throw()
 {
-  std::stringstream cx;
-  cx<<std::runtime_error::what()<<" search object "<<objectName;;
-  return cx.str().c_str();
+	return outMessage.c_str();
 }
 
 } // namespace Exception
diff --git a/Code/Mantid/Kernel/test/ConfigSvcTest.h b/Code/Mantid/Kernel/test/ConfigSvcTest.h
index 4491f015269..91e65c0645e 100644
--- a/Code/Mantid/Kernel/test/ConfigSvcTest.h
+++ b/Code/Mantid/Kernel/test/ConfigSvcTest.h
@@ -6,6 +6,7 @@
 #include "../inc/ConfigSvc.h"
 #include "../inc/Logger.h"
 #include <string>
+#include <iostream>
 
 using namespace Mantid::Kernel;
 
@@ -39,7 +40,7 @@ public:
 	  TS_ASSERT(log1.is(Logger::PRIO_ERROR)); //error
 	  TS_ASSERT(log1.is(Logger::PRIO_CRITICAL)); //critical
 	  TS_ASSERT(log1.is(Logger::PRIO_FATAL)); //fatal
-	  
+
   }
 
   void TestSystemValues()
@@ -68,6 +69,7 @@ public:
 	  int retVal = configSvc->getValue("mantid.legs",value);
 	  double dblValue;
 	  retVal = configSvc->getValue("mantid.legs",dblValue);
+ std::cerr << std::endl << "mantid.legs=" << dblValue << std::endl;
 
 	  TS_ASSERT_EQUALS(value, 6);
 	  TS_ASSERT_EQUALS(dblValue, 6.0);
diff --git a/Code/Mantid/Kernel/test/MantidTest.properties b/Code/Mantid/Kernel/test/MantidTest.properties
index 400867a5324..9b8d826db23 100644
--- a/Code/Mantid/Kernel/test/MantidTest.properties
+++ b/Code/Mantid/Kernel/test/MantidTest.properties
@@ -7,4 +7,4 @@ logging.loggers.root.channel = fileChannel
 logging.channels.fileChannel.class = FileChannel
 logging.channels.fileChannel.path = sample.log
 logging.channels.fileChannel.formatter.class = PatternFormatter
-logging.channels.fileChannel.formatter.pattern = %s: {%p} %t
+logging.channels.fileChannel.formatter.pattern = %Y-%m-%d %H:%M:%S,%i [%I] %p %s - %t
diff --git a/Code/Mantid/Kernel/test/runTests.bat b/Code/Mantid/Kernel/test/runTests.bat
index be53c526a2d..33cc5f4e027 100644
--- a/Code/Mantid/Kernel/test/runTests.bat
+++ b/Code/Mantid/Kernel/test/runTests.bat
@@ -8,10 +8,20 @@ REM
 REM Author: Nick Draper, 19/10/07
 REM
 echo "Generating the source from the test header files..."
+IF "%1" == "" GOTO BUILD_ALL ELSE GOTO BUILD_ONE
+:BUILD_ONE 
+ECHO Building only %1
+python ..\..\..\Third_Party\src\cxxtest\cxxtestgen.py --error-printer -o runner.cpp %1
+GOTO COMPILE
+
+:BUILD_ALL 
+ECHO Building all .h files
 python ..\..\..\Third_Party\src\cxxtest\cxxtestgen.py --error-printer -o runner.cpp *.h
+GOTO COMPILE
 
+:COMPILE
 echo "Compiling the test executable..."
-cl runner.cpp /I "..\..\..\Third_Party\include" /I "..\.." /EHsc /MTd /W3 /nologo /c /ZI /TP 
+cl runner.cpp /I "..\..\..\Third_Party\include" /I "..\.." /EHsc /MDd /W3 /nologo /c /ZI /TP 
 
 link /OUT:"runner.exe" /NOLOGO /LIBPATH:"../../Debug" /LIBPATH:"../../../Third_Party/lib/win32" /DEBUG /PDB:".\runner.pdb" kernel.lib runner.obj
 
-- 
GitLab