Salome HOME
Merge from V6_main (04/10/2012)
[modules/kernel.git] / src / Utils / Test / UtilsTest.cxx
index 0ee9fb081d1d0a2d9b50a558ed3d6382e887a49b..de2a9b78d57d8a95a06a1f34786688cb9d18bb45 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// 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
+// 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
-//  version 2.1 of the License.
+// 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
+// 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
-//  Lesser General Public License for more details.
+// 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
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// 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/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 #include "UtilsTest.hxx"
 
 #include <iostream>
 #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"
 
@@ -50,12 +54,12 @@ UtilsTest::setUp()
   // --- trace on file
   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();
 
@@ -110,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);
     }
 }