Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.core
Commits
3fb55685
Commit
3fb55685
authored
Feb 07, 2017
by
André Anjos
💬
Browse files
Make test local (case 2) and closes
#6
parent
6d558ab4
Pipeline
#6962
failed with stages
in 6 minutes and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/core/test.cpp
View file @
3fb55685
...
...
@@ -250,39 +250,55 @@ BOB_TRY
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
""
,
kwlist
))
return
0
;
//local streams to test C++ use cases
//necessary because of issue #6
//bottom line: cannot reliably test streams which are declared (as globals)
//inside libbob_core.so as there are no guarantees this module and that
//library will share the same pointers to std::cout and std::cerr.
//libbob_core.so may be loaded from another module and, because of python's
//insular loading system, this and the other module may not share the same
//pointers to those streams.
boost
::
iostreams
::
stream
<
bob
::
core
::
AutoOutputDevice
>
debug
(
"stdout"
);
boost
::
iostreams
::
stream
<
bob
::
core
::
AutoOutputDevice
>
info
(
"stdout"
);
boost
::
iostreams
::
stream
<
bob
::
core
::
AutoOutputDevice
>
warn
(
"stderr"
);
boost
::
iostreams
::
stream
<
bob
::
core
::
AutoOutputDevice
>
error
(
"stderr"
);
_ostream_redirect
out
(
std
::
cout
);
_ostream_redirect
err
(
std
::
cerr
);
bob
::
core
::
log_level
(
bob
::
core
::
DEBUG
);
bob
::
core
::
debug
<<
"This is a debug message"
<<
std
::
endl
;
bob
::
core
::
info
<<
"This is an info message"
<<
std
::
endl
;
bob
::
core
::
warn
<<
"This is a warning message"
<<
std
::
endl
;
bob
::
core
::
error
<<
"This is an error message"
<<
std
::
endl
;
//equivalent to:
bob::core::log_level(bob::core::DEBUG);
debug
<<
"This is a debug message"
<<
std
::
endl
;
info
<<
"This is an info message"
<<
std
::
endl
;
warn
<<
"This is a warning message"
<<
std
::
endl
;
error
<<
"This is an error message"
<<
std
::
endl
;
_test
(
out
.
str
(),
"This is a debug message
\n
This is an info message
\n
"
,
"debug"
);
_test
(
err
.
str
(),
"This is a warning message
\n
This is an error message
\n
"
,
"debug"
);
//equivalent to: bob::core::log_level(bob::core::ERROR);
out
.
str
(
""
);
err
.
str
(
""
);
bob
::
core
::
log_level
(
bob
::
core
::
ERROR
);
bob
::
core
::
debug
<<
"This is a debug message"
<<
std
::
endl
;
bob
::
core
::
info
<<
"This is an info message"
<<
std
::
endl
;
bob
::
core
::
warn
<<
"This is a warning message"
<<
std
::
endl
;
bob
::
core
::
error
<<
"This is an error message"
<<
std
::
endl
;
debug
->
reset
(
"null"
);
info
->
reset
(
"null"
);
warn
->
reset
(
"null"
);
debug
<<
"This is a debug message"
<<
std
::
endl
;
info
<<
"This is an info message"
<<
std
::
endl
;
warn
<<
"This is a warning message"
<<
std
::
endl
;
error
<<
"This is an error message"
<<
std
::
endl
;
_test
(
out
.
str
(),
""
,
"error"
);
_test
(
err
.
str
(),
"This is an error message
\n
"
,
"error"
);
//equivalent to: bob::core::log_level(bob::core::DISABLE);
out
.
str
(
""
);
err
.
str
(
""
);
bob
::
core
::
log_level
(
bob
::
core
::
DISABLE
);
bob
::
core
::
debug
<<
"This is a debug message"
<<
std
::
endl
;
bob
::
core
::
info
<<
"This is an info message"
<<
std
::
endl
;
bob
::
core
::
warn
<<
"This is a warning message"
<<
std
::
endl
;
bob
::
core
::
error
<<
"This is an error message"
<<
std
::
endl
;
error
->
reset
(
"null"
);
debug
<<
"This is a debug message"
<<
std
::
endl
;
info
<<
"This is an info message"
<<
std
::
endl
;
warn
<<
"This is a warning message"
<<
std
::
endl
;
error
<<
"This is an error message"
<<
std
::
endl
;
_test
(
out
.
str
(),
""
,
"disable"
);
_test
(
err
.
str
(),
""
,
"disable"
);
bob
::
core
::
log_level
(
bob
::
core
::
DEBUG
);
Py_RETURN_NONE
;
BOB_CATCH_FUNCTION
(
"_test_output_disable"
,
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment