Salome HOME
Merge from V6_main (04/10/2012)
[modules/kernel.git] / src / Utils / Test / UtilsTest.cxx
index 8c983138222442b859f7d5238dec3dad9d0c4389..de2a9b78d57d8a95a06a1f34786688cb9d18bb45 100644 (file)
@@ -1,21 +1,23 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-// 
+//
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either 
+// License as published by the Free Software Foundation; either
 // version 2.1 of the License.
-// 
-// This library is distributed in the hope that it will be useful 
-// but WITHOUT ANY WARRANTY; without even the implied warranty of 
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Lesser General Public License for more details.
 //
-// You should have received a copy of the GNU Lesser General Public  
-// License along with this library; if not, write to the Free Software 
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "UtilsTest.hxx"
 #include <string>
 #include <cstdlib>
 #include "Utils_SALOME_Exception.hxx"
+#include "Basics_Utils.hxx"
 #include "utilities.h"
 
-using namespace std;
+#ifdef WIN32
+#define setenv Kernel_Utils::setenv
+#endif 
 
 #define TRACEFILE "/tmp/traceUnitTest.log"
 
@@ -47,14 +52,14 @@ UtilsTest::setUp()
   bp1->deleteInstance(bp1);
 
   // --- trace on file
-  char *theFileName = TRACEFILE;
+  const char *theFileName = TRACEFILE;
 
-  string s = "file:";
+  std::string s = "file:";
   s += theFileName;
   CPPUNIT_ASSERT(! setenv("SALOME_trace",s.c_str(),1)); // 1: overwrite
 
-  ofstream traceFile;
-  traceFile.open(theFileName, ios::out | ios::app);
+  std::ofstream traceFile;
+  traceFile.open(theFileName, std::ios::out | std::ios::app);
   CPPUNIT_ASSERT(traceFile); // file created empty, then closed
   traceFile.close();
 
@@ -109,8 +114,8 @@ UtilsTest::testSALOME_ExceptionMessage()
     }
   catch (const SALOME_Exception &ex)
     {
-      string expectedMessage = EXAMPLE_EXCEPTION_MESSAGE;
-      string actualMessage = ex.what();
-      CPPUNIT_ASSERT(actualMessage.find(expectedMessage) != string::npos);
+      std::string expectedMessage = EXAMPLE_EXCEPTION_MESSAGE;
+      std::string actualMessage = ex.what();
+      CPPUNIT_ASSERT(actualMessage.find(expectedMessage) != std::string::npos);
     }
 }