Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
d1d2de7a
Commit
d1d2de7a
authored
11 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Ported LoggerImplementationTest.cpp from CPPUNIT to gtest.
parent
cc9ed7ea
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
castor/log/LoggerImplementationTest.cpp
+90
-0
90 additions, 0 deletions
castor/log/LoggerImplementationTest.cpp
test/CMakeLists.txt
+1
-0
1 addition, 0 deletions
test/CMakeLists.txt
with
91 additions
and
0 deletions
castor/log/LoggerImplementationTest.cpp
0 → 100644
+
90
−
0
View file @
d1d2de7a
/******************************************************************************
* castor/log/LoggerImplementationTest.hpp
*
* This file is part of the Castor project.
* See http://castor.web.cern.ch/castor
*
* Copyright (C) 2003 CERN
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*
*
* @author Steven.Murray@cern.ch
*****************************************************************************/
#include
"castor/log/LoggerImplementation.hpp"
#include
<gtest/gtest.h>
#include
<memory>
#include
<sys/time.h>
namespace
unitTests
{
class
castor_log_LoggerImplementationTest
:
public
::
testing
::
Test
{
protected:
virtual
void
SetUp
()
{
}
virtual
void
TearDown
()
{
}
};
// class LoggerImplementationTest
TEST_F
(
castor_log_LoggerImplementationTest
,
testLogMsgWithAllParams
)
{
using
namespace
castor
::
log
;
std
::
auto_ptr
<
Logger
>
logger
;
ASSERT_NO_THROW
(
logger
.
reset
(
new
LoggerImplementation
(
"unitttests"
)));
const
int
numParams
=
1
;
const
Param
params
[
1
]
=
{
Param
(
"testParam"
,
"valueOfTestParam"
)};
struct
timeval
timeStamp
;
ASSERT_EQ
(
0
,
gettimeofday
(
&
timeStamp
,
NULL
));
ASSERT_NO_THROW
(
logger
->
logMsg
(
LOG_INFO
,
"Calling logMsg() with all parameters"
,
numParams
,
params
,
timeStamp
));
}
TEST_F
(
castor_log_LoggerImplementationTest
,
testLogMsgWithoutTimeStamp
)
{
using
namespace
castor
::
log
;
std
::
auto_ptr
<
Logger
>
logger
;
ASSERT_NO_THROW
(
logger
.
reset
(
new
LoggerImplementation
(
"unitttests"
)));
const
int
numParams
=
1
;
const
Param
params
[
1
]
=
{
Param
(
"testParam"
,
"valueOfTestParam"
)};
ASSERT_NO_THROW
(
logger
->
logMsg
(
LOG_INFO
,
"Calling logMsg() without time stamp"
,
numParams
,
params
));
}
TEST_F
(
castor_log_LoggerImplementationTest
,
testLogMsgWithoutParamsOrTimeStamp
)
{
using
namespace
castor
::
log
;
std
::
auto_ptr
<
Logger
>
logger
;
ASSERT_NO_THROW
(
logger
.
reset
(
new
LoggerImplementation
(
"unitttests"
)));
ASSERT_NO_THROW
(
logger
->
logMsg
(
LOG_INFO
,
"Calling logMsg() without parameters or time stamp"
));
}
}
// namespace unitTests
This diff is collapsed.
Click to expand it.
test/CMakeLists.txt
+
1
−
0
View file @
d1d2de7a
...
...
@@ -27,6 +27,7 @@ cmake_minimum_required (VERSION 2.6)
add_executable
(
castorUnitTests
castorUnitTests.cpp
../castor/exception/ExceptionTest.cpp
../castor/log/LoggerImplementationTest.cpp
../castor/server/DaemonTest.cpp
../castor/tape/tapeserver/SCSI/DeviceTest.cpp
../castor/tape/tapeserver/SCSI/StructuresTest.cpp
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment