Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Seitosh
Seitosh
Commits
0c05383f
Commit
0c05383f
authored
Jul 11, 2016
by
thomas.forbriger
Browse files
libdatrwxx [WP]: test formatting of error messages
parent
6ba3a85c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libs/libdatrwxx/tests/libdatrwxxtests.cc
View file @
0c05383f
...
...
@@ -42,6 +42,7 @@
#include
<fstream>
#include
<string>
#include
<tfxx/commandline.h>
#include
<datrwxx/debug.h>
#include
<datrwxx/error.h>
#include
<datrwxx/util.h>
#include
<datrwxx/types.h>
...
...
@@ -429,8 +430,9 @@ int main(int iargc, char* argv[])
if
(
opt
.
testerror
)
{
cout
<<
"Test format modifiers"
<<
endl
;
cout
<<
"====================="
<<
endl
;
cout
<<
"Test error reports (formatting of messages)"
<<
endl
;
cout
<<
"==========================================="
<<
endl
;
cout
<<
endl
;
if
(
opt
.
nerrortest
==
0
)
{
cout
<<
"available tests:"
<<
endl
;
...
...
@@ -444,29 +446,46 @@ int main(int iargc, char* argv[])
{
cout
<<
"report assert"
<<
endl
;
cout
<<
"-------------"
<<
endl
;
DATRW_report_assert
(
false
,
"message"
);
cout
<<
"warning"
<<
endl
;
cout
<<
"-------"
<<
endl
;
DATRW_warning
(
"main"
,
"message"
);
DATRW_report_assert
(
false
,
"This message is produced after testing"
" a condition to report
\n
"
"that the test fails."
);
cout
<<
"
\n
warning"
<<
endl
;
cout
<<
"-------"
<<
endl
;
DATRW_warning
(
"main"
,
"This is a warning message from a specific"
" function in the library.
\n
"
"The macro takes a multiline message output too."
);
}
else
if
(
opt
.
nerrortest
==
2
)
{
cout
<<
"direct abort"
<<
endl
;
cout
<<
"------------"
<<
endl
;
DATRW_abort
(
"abort program intentionally"
);
DATRW_abort
(
"Abort program intentionally.
\n
"
"A multi-line message my be passed too in this case.
\n
"
"Pass one of the non-specified values for the error
\n
"
"test to see the output for DATRW_illegal."
);
}
else
if
((
opt
.
nerrortest
==
3
)
||
(
opt
.
nerrortest
==
4
))
{
cout
<<
"fatal/non-fatal assert"
<<
endl
;
cout
<<
"----------------------"
<<
endl
;
DATRW_nonfatal_assert
(
opt
.
nerrortest
==
3
,
false
,
"fatal/non-fatal assert"
);
DATRW_nonfatal_assert
(
opt
.
nerrortest
==
3
,
(
opt
.
nerrortest
<=
1
)
||
(
opt
.
nerrortest
>=
6
),
"This is a test of a fatal/non-fatal assert.
\n
"
"The error is made non-fatal, if the option"
"opt.nerrortest equals 3.
\n
"
"Currently "
<<
DATRW_value
(
opt
.
nerrortest
));
}
else
if
(
opt
.
nerrortest
==
5
)
{
cout
<<
"standard assertion"
<<
endl
;
cout
<<
"------------------"
<<
endl
;
DATRW_assert
(
false
,
"faild assertion"
);
DATRW_assert
(
false
,
"This type of error is emitted,"
" if an assertion is failed.
\n
"
"Several lines of explanation can be provided"
" to the user.
\n
"
"This can include the output of variables like "
<<
DATRW_value
(
opt
.
nerrortest
));
}
else
{
...
...
Write
Preview
Supports
Markdown
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