Functions
nybbler_test.cc File Reference
#include "cetlib/nybbler.h"
#include <cstdlib>
#include <string>

Go to the source code of this file.

Functions

void ensure (int which, bool claim)
 
int main ()
 

Function Documentation

void ensure ( int  which,
bool  claim 
)

Definition at line 8 of file nybbler_test.cc.

9 {
10  if (not claim)
11  std::exit(which);
12 }
int main ( void  )

Definition at line 15 of file nybbler_test.cc.

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
string as_hex() const
Definition: nybbler.cc:17
static QCString * s
Definition: config.cpp:1042