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
e6cc249a
Commit
e6cc249a
authored
11 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
Improved the unittests for castor::Log::Logger().
parent
93866459
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
castor/log/Param.cpp
+2
-3
2 additions, 3 deletions
castor/log/Param.cpp
castor/log/Param.hpp
+1
-1
1 addition, 1 deletion
castor/log/Param.hpp
test/unittest/castor/log/LoggerImplementationTest.cpp
+60
-0
60 additions, 0 deletions
test/unittest/castor/log/LoggerImplementationTest.cpp
with
63 additions
and
4 deletions
castor/log/Param.cpp
+
2
−
3
View file @
e6cc249a
...
...
@@ -151,9 +151,8 @@ castor::log::Param::Param(const std::string &name, const double value)
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
castor
::
log
::
Param
::
Param
(
const
std
::
string
&
name
,
const
castor
::
stager
::
TapeVid
&
value
)
throw
()
:
m_name
(
name
),
m_type
(
LOG_MSG_PARAM_TPVID
),
castor
::
log
::
Param
::
Param
(
const
castor
::
stager
::
TapeVid
&
value
)
throw
()
:
m_name
(
"TPVID"
),
m_type
(
LOG_MSG_PARAM_TPVID
),
m_strValue
(
0
!=
value
.
vid
()
?
value
.
vid
()
:
""
),
m_intValue
(
0
),
m_uint64Value
(
0
),
m_doubleValue
(
0.0
),
m_uuidValue
(
nullCuuid
)
{
}
...
...
This diff is collapsed.
Click to expand it.
castor/log/Param.hpp
+
1
−
1
View file @
e6cc249a
...
...
@@ -98,7 +98,7 @@ public:
/**
* Constructor for Tape VIDS.
*/
Param
(
const
std
::
string
&
name
,
const
castor
::
stager
::
TapeVid
&
value
)
throw
();
Param
(
const
castor
::
stager
::
TapeVid
&
value
)
throw
();
/**
* Constructor for Raw parameters.
...
...
This diff is collapsed.
Click to expand it.
test/unittest/castor/log/LoggerImplementationTest.cpp
+
60
−
0
View file @
e6cc249a
...
...
@@ -27,6 +27,7 @@
#include
<cppunit/extensions/HelperMacros.h>
#include
<memory>
#include
<sys/time.h>
namespace
castor
{
namespace
log
{
...
...
@@ -56,8 +57,67 @@ public:
}
}
void
testLogMsgWithAllParams
()
{
std
::
auto_ptr
<
Logger
>
logger
;
CPPUNIT_ASSERT_NO_THROW_MESSAGE
(
"Constructing logger"
,
logger
.
reset
(
new
LoggerImplementation
(
"unitttests"
)));
const
int
numParams
=
1
;
const
Param
params
[
1
]
=
{
Param
(
"testParam"
,
"valueOfTestParam"
)};
struct
timeval
timeStamp
;
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"gettimeofday()"
,
0
,
gettimeofday
(
&
timeStamp
,
NULL
));
CPPUNIT_ASSERT_NO_THROW_MESSAGE
(
"Calling logMsg() with all parameters"
,
logger
->
logMsg
(
LOG_INFO
,
"Calling logMsg() with all parameters"
,
numParams
,
params
,
timeStamp
));
}
void
testLogMsgWithoutTimeStamp
()
{
std
::
auto_ptr
<
Logger
>
logger
;
CPPUNIT_ASSERT_NO_THROW_MESSAGE
(
"Constructing logger"
,
logger
.
reset
(
new
LoggerImplementation
(
"unitttests"
)));
const
int
numParams
=
1
;
const
Param
params
[
1
]
=
{
Param
(
"testParam"
,
"valueOfTestParam"
)};
CPPUNIT_ASSERT_NO_THROW_MESSAGE
(
"Calling logMsg() without time stamp"
,
logger
->
logMsg
(
LOG_INFO
,
"Calling logMsg() without time stamp"
,
numParams
,
params
));
}
void
testLogMsgWithoutParamsOrTimeStamp
()
{
std
::
auto_ptr
<
Logger
>
logger
;
CPPUNIT_ASSERT_NO_THROW_MESSAGE
(
"Constructing logger"
,
logger
.
reset
(
new
LoggerImplementation
(
"unitttests"
)));
CPPUNIT_ASSERT_NO_THROW_MESSAGE
(
"Calling logMsg() without parameters or time stamp"
,
logger
->
logMsg
(
LOG_INFO
,
"Calling logMsg() without parameters or time stamp"
));
}
CPPUNIT_TEST_SUITE
(
LoggerImplementationTest
);
CPPUNIT_TEST
(
testConstructorTooLongProgramName
);
CPPUNIT_TEST
(
testLogMsgWithAllParams
);
CPPUNIT_TEST
(
testLogMsgWithoutTimeStamp
);
CPPUNIT_TEST
(
testLogMsgWithoutParamsOrTimeStamp
);
CPPUNIT_TEST_SUITE_END
();
};
...
...
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