Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
messagefacility
messagefacility
test
Utilities
Simple_t.cc
Go to the documentation of this file.
1
#include "cetlib_except/exception.h"
2
3
#include <cassert>
4
#include <iomanip>
5
#include <iostream>
6
#include <string>
7
8
int
9
main
()
10
{
11
cet::exception
e
(
"BadJuju"
);
12
13
char
array
[] =
"blue"
;
14
char
* ptr =
array
;
15
16
e <<
"arghargharghargharghargh "
<< 3 <<
' '
<< 1.5 <<
std::endl
17
<<
std::string
(
" boo"
) <<
' '
<< array <<
' '
<< ptr;
18
19
std::string
expected
=
"---- BadJuju BEGIN\n"
20
" arghargharghargharghargh 3 1.5\n boo blue blue\n"
21
"---- BadJuju END\n"
;
22
23
std::string
result
(e.explain_self());
24
assert(
result
== expected);
25
26
// Check to see that the following items compile; their modification
27
// of the output is tested elsewhere.
28
e <<
std::setprecision
(3);
29
e << std::scientific;
30
31
cet::exception
e2(
"RealBadStuff"
,
"A"
);
32
e2 <<
"B"
;
33
std::string
res2(
"---- RealBadStuff BEGIN\n A B\n---- RealBadStuff END\n"
);
34
assert(e2.explain_self() == res2);
35
36
cet::exception
e3(
"RealBadStuff"
,
"A "
);
37
e3 <<
"B"
;
38
std::string
res3(
"---- RealBadStuff BEGIN\n A B\n---- RealBadStuff END\n"
);
39
assert(e3.explain_self() == res3);
40
}
result
static QCString result
Definition:
fortranscanner.cpp:56614
expected
const char expected[]
Definition:
Exception_t.cc:22
string
std::string string
Definition:
nybbler.cc:12
setprecision
Q_EXPORT QTSManip setprecision(int p)
Definition:
qtextstream.h:343
e
const double e
Definition:
gUpMuFluxGen.cxx:165
gar::dump::array
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition:
DumpUtils.h:228
main
int main()
Definition:
Simple_t.cc:9
fhicl::exception
cet::coded_exception< error, detail::translate > exception
Definition:
exception.h:33
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11