nybbler_test.cc
Go to the documentation of this file.
1 #include "cetlib/nybbler.h"
2 #include <cstdlib>
3 #include <string>
4 
5 using cet::nybbler;
6 
7 void
8 ensure(int which, bool claim)
9 {
10  if (not claim)
11  std::exit(which);
12 }
13 
14 int
16 {
17  {
18  nybbler n1;
19  n1 << "abc";
20  nybbler n2("abc");
21  ensure(1, n1.as_hex() == n2.as_hex());
22  ensure(2, n1.as_char() == n2.as_char());
23  }
24 
25  {
26  std::string s("xyz");
27  nybbler n1(s);
28  nybbler n2(n1.as_hex());
29  ensure(3, n2.as_char() == s);
30  }
31 
32  {
33  std::string s("494A");
34  nybbler n1(s);
35  nybbler n2(n1.as_char());
36  ensure(4, n1.as_char() == "IJ");
37  ensure(5, n2.as_hex() == s);
38  }
39 
40  return 0;
41 }
std::string string
Definition: nybbler.cc:12
void ensure(int which, bool claim)
Definition: nybbler_test.cc:8
string as_char() const
Definition: nybbler.cc:31
int main()
Definition: nybbler_test.cc:15
string as_hex() const
Definition: nybbler.cc:17
static QCString * s
Definition: config.cpp:1042