File: stringstest.cc

package info (click to toggle)
babel 0.10.2-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 43,932 kB
  • ctags: 29,707
  • sloc: java: 74,695; ansic: 73,142; cpp: 40,649; sh: 18,411; f90: 10,062; fortran: 6,727; python: 6,406; makefile: 3,866; xml: 118; perl: 48
file content (44 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

#include <string>
using namespace std;
#include "Strings.hh"
#include "synch.hh"



#define MYASSERT( AAA ) \
  tracker.startPart(++part_no);\
  tracker.writeComment(#AAA); \
  if ( AAA ) result = synch::ResultType_PASS; \
  else result = synch::ResultType_FAIL;  \
  tracker.endPart(part_no, result);


int main() { 
  synch::ResultType result = synch::ResultType_PASS;
  int part_no = 0;
  Strings::Cstring obj = Strings::Cstring::_create();
  synch::RegOut tracker = synch::RegOut::_create();
  tracker.setExpectations(-1);
  
  { 
    string in = "Three";
    string out;
    string inout = "Three";
 
    MYASSERT( obj.returnback(true) == "Three" );
    MYASSERT( obj.returnback(false) == "" );
    MYASSERT( obj.passin( in ) == true );
    MYASSERT( obj.passout(true, out ) == true && out == "Three" );
    MYASSERT( obj.passout(false, out ) == false && out == "" );
    MYASSERT( obj.passinout( inout ) == true && inout == "threes" );
    MYASSERT( obj.passeverywhere( in, out, inout ) == "Three" &&
	      out == "Three" && inout == "Three" );
    MYASSERT( obj.mixedarguments( "Test", 'z', "Test", 'z') );
    MYASSERT( !obj.mixedarguments( "Not", 'A', "Equal", 'a') );
    
  }

  tracker.close();
  return 0;
}