Ejemplo n.º 1
0
int main ()
{
	
	testMember ();
	testAssignment();
	testMinEl();
	testIterator();

	BinTree<int> t;

	t.insertBOT(56)
	 .insertBOT(23)
	 .insertBOT(68)
	 .insertBOT(190)
	 .insertBOT(41)
	 .insertBOT(60)
	 .insertBOT(65)
	 .insertBOT(59);


	cerr << "digraph G{" << endl;
	t.dottyPrint (cerr);
	cerr << "}\n";

	prettyPrint<int> (t.rootIter());

	testMakeTree();


	return 0;
}
Ejemplo n.º 2
0
int main() {
	std::cout << "---test costruttori:---" << std::endl;
	testCostructor();
	std::cout << std::endl;
	
	std::cout << "---test di insert e del:---" << std::endl;
	testInsertDel();
	std::cout << std::endl;
	
	std::cout << "---test su vari metodi fondamentali:--- "<< std::endl;
	testValueGetSetOperator();
	std::cout << std::endl;
	
	std::cout << "---test eccezioni:---" << std::endl;
	testEcceptions();
	std::cout << std::endl;
	
	std::cout << "---test degli iteratori:---" << std::endl;
	testIterator();
	std::cout << std::endl;
	
	std::cout << "---test dei const_iterator:---" << std::endl;
	testConstIterator();
	std::cout << std::endl;
	
	std::cout << "---test della funzione gloabale check:---" << std::endl;
	testCheck();
	std::cout << std::endl;
	
	return 0;
}
Ejemplo n.º 3
0
static void testPinchIteratorFromList(CuTest *testCase) {
    for (int64_t test = 0; test < 100; test++) {
        stList *pairwiseAlignments = getRandomPairwiseAlignments();
        st_logInfo("Doing a random pinch iterator from list test %" PRIi64 " with %" PRIi64 " alignments\n", test, stList_length(pairwiseAlignments));
        //Get an iterator
        stPinchIterator *pinchIterator = stPinchIterator_constructFromList(pairwiseAlignments);
        //Now test it
        testIterator(testCase, pinchIterator, pairwiseAlignments);
        //Cleanup
        stPinchIterator_destruct(pinchIterator);
        stList_destruct(pairwiseAlignments);
    }
}
Ejemplo n.º 4
0
static void testPinchIteratorFromFile(CuTest *testCase) {
    for (int64_t test = 0; test < 100; test++) {
        stList *pairwiseAlignments = getRandomPairwiseAlignments();
        st_logInfo("Doing a random pinch iterator from file test %" PRIi64 " with %" PRIi64 " alignments\n", test, stList_length(pairwiseAlignments));
        //Put alignments in a file
        char *tempFile = "tempFileForPinchIteratorTest.cig";
        FILE *fileHandle = fopen(tempFile, "w");
        for (int64_t i = 0; i < stList_length(pairwiseAlignments); i++) {
            cigarWrite(fileHandle, stList_get(pairwiseAlignments, i), 0);
        }
        fclose(fileHandle);
        //Get an iterator
        stPinchIterator *pinchIterator = stPinchIterator_constructFromFile(tempFile);
        //Now test it
        testIterator(testCase, pinchIterator, pairwiseAlignments);
        //Cleanup
        stPinchIterator_destruct(pinchIterator);
        stFile_rmrf(tempFile);
        stList_destruct(pairwiseAlignments);
    }
}
Ejemplo n.º 5
0
int old_main( int args, char **argv ){
  /*
    Useful cull test cases:
    one literal T,F,BTerm
    one AND
    SOR in DNF
    SOR not in DNF
    SAND not in DNF
   */
  //To quiet compiler
  args = 1;
  char ** argv2 = argv;
  argv2 = argv2;

  //Test SymTree

  SymTree * st1 = new SymTree(1);
  st1 = and2(st1,new SymTree(2));
  st1 = or2(st1,3);
  st1 = or2(st1,4);

  SymTree * st2 = new SymTree(10);
  st2 = or2(st2,11);
  st2 = or2(st2,12);
  
  
  st1 = or2(st1,new SymTree(st2));
  cout << "AND and OR tests" << endl;
  st1->printTree();
  
  SymTree *st3;
  st3 = new SymTree(20);
  st3 = and2(st3,21);
  st3 = and2(st3,22);
  st3 = and2(st3,23);

  st3->printTree();
  delete st3;
 
  st1 = and2(st1,st2);

  st2 = 0;

  st1->printTree();
  //Should have been 20^21^22^(1\/2\/3\/4\/10\/11\/12)
  SymTree *tmp;
  cout << "TEST and2\n";
  tmp = and2(1,2);
  tmp->printTree();
  delete tmp;
  tmp = 0;

  cout << "TEST copy";
  SymTree *st1c = new SymTree(st1);
  st1 = or2(st1, and2(30,31) );
  st1c->printTree();
  
  delete st1c;
  st1c = 0;

  st1->printTree();
  
  delete st1;
  st1 = 0;

  cout << "TEST remove duplicate terms from SymNode"<<endl;

  SymNode * root = new SymNode(SAND, -1);
  root->addChild(new SymNode(BTERM, 1));
  noDuplicateNodes(root->children);
  cout <<"when only 1 node is present" <<endl;
  root->printTree(0);

  cout <<"when only 2 nodes are present, same." <<endl;
  root->addChild(new SymNode(BTERM, 1));
  noDuplicateNodes(root->children);
  root->printTree(0);

  cout <<"when 3 nodes are present, same." <<endl;
  root->addChild(new SymNode(BTERM, 1));
  root->addChild(new SymNode(BTERM, 1));
  root->addChild(new SymNode(BTERM, 1));
  noDuplicateNodes(root->children);
  root->printTree(0);
  

  cout <<"when 4 nodes are present, 3 same." <<endl;
  root->addChild(new SymNode(BTERM, 1));
  root->addChild(new SymNode(BTERM, 2));  
  root->addChild(new SymNode(BTERM, 1));
  root->addChild(new SymNode(BTERM, 1));
  noDuplicateNodes(root->children);
  root->printTree(0);

  root->destroyTree();
  root = 0;

  cout << "TEST toDNF "<< endl;

  SymTree *dnfTest = new SymTree(1);
  cout << "simple singleton\nbefore:"<< endl;
  dnfTest->printTree();
  dnfTest->toDNF();
  cout <<"after"<<endl;
  dnfTest->printTree();
  
  testIterator(dnfTest);

  cout << "simple 2-and\nbefore:"<< endl;
  dnfTest = and2( dnfTest,2);
  dnfTest->printTree();
  dnfTest->toDNF();
  cout <<"after"<<endl;
  dnfTest->printTree();
  
  testIterator(dnfTest);

  cout << "simple 3-and\nbefore:"<< endl;
  dnfTest = and2(dnfTest,3);
  dnfTest->printTree();
  dnfTest->toDNF();
  cout <<"after"<<endl;
  dnfTest->printTree();

  cout << "simple 4-and\nbefore:"<< endl;
  dnfTest = and2(dnfTest,4);
  dnfTest->printTree();
  dnfTest->toDNF();
  cout <<"after"<<endl;
  dnfTest->printTree();

  cout << "(5 or (and 1 2 3 4))\nbefore:"<< endl;  
  dnfTest = or2(dnfTest,5);
  dnfTest->printTree();
  dnfTest->toDNF();
  dnfTest->printTree();


  cout << "(or 5 6 (and 1 2 3 4))\nbefore:"<< endl;  
  dnfTest = or2(dnfTest,6);
  dnfTest->printTree();
  dnfTest->toDNF();
  dnfTest->printTree();
  
  cout << "(or 5 6 7 (and 1 2 3 4))\nbefore:"<< endl;  
  dnfTest = or2(dnfTest,7);
  dnfTest->printTree();
  dnfTest->toDNF();
  dnfTest->printTree();
  
  testIterator(dnfTest);

  cout << "(and 8 (or 5 6 ))\nbefore:"<< endl;  
  SymTree *dnfTestPrime = and2( new SymTree(8),or2(5,6));
  dnfTestPrime->printTree();
  dnfTestPrime->toDNF();
  dnfTestPrime->printTree();

  testIterator(dnfTestPrime);

  delete dnfTestPrime;
  dnfTestPrime = 0;

  cout << "(and 8 (or 5 6 7(and 1 2 3 4)))\nbefore:"<< endl;  
  dnfTest = and2(dnfTest,8);
  dnfTest->printTree();
  dnfTest->toDNF();
  dnfTest->printTree();
  

  cout << "(and 8 9 (or 5 6 7(and 1 2 3 4)))\nbefore:"<< endl;  
  //This below is a massive memory leak
  // BK comment: only leak in main (8/7/2007)
  SymTree *dnfTestSecond = and2(1,2)->sand(and2( 3,4))->sor(7)->sor(or2(5,6))->sand(and2(8,9));
  dnfTestSecond->printTree();
  cout << "after" <<endl;
  dnfTestSecond->toDNF();
  dnfTestSecond->printTree();


  cout << "(and 8 8 9 (or 5 6 7(and 1 2 3 4)))\nbefore:"<< endl;  
  dnfTestSecond = and2(dnfTestSecond,8);
  dnfTestSecond->printTree();
  cout << "after" <<endl;
  dnfTestSecond->toDNF();
  dnfTestSecond->printTree();
  
  cout << "\nCULLING Test:\nbefore" << endl;
  dnfTestSecond = or2(dnfTestSecond , and2( and2(13,12),and2(13,12)) );
  dnfTestSecond->printTree();
  dnfTestSecond->cull();
  cout << "after" << endl;
  dnfTestSecond->printTree();

  testIterator(dnfTest);

  delete dnfTest;
  dnfTest = NULL;

  delete dnfTestSecond;
  dnfTestSecond = 0;

  cout << "END TEST"<< endl;;


  // Success Case
  cout << "Success CASE" << endl;
  SymTree * tree = new SymTree();
  SymTree* children = new SymTree(4);
  SymTree* children2 = children->sand(5);
  delete children;
  children = children2;
  SymTree* tree2 = tree->sor(children);
  delete children;
  delete tree;
  tree=tree2;
  //delete children2;
  children = NULL;
  children = new SymTree(6);
  children2 = children->sand(7);
  delete children;
  children = children2;
  tree2 = tree->sor(children);
  delete children;
  delete tree;
  tree = tree2;
  children = new SymTree(6);
  children2 = children->sor(7);
  delete children;
  children = children2;
  tree2 = tree->sand(children);
  delete children;
  delete tree;
  tree = tree2;

  tree->printTree();
  cout << "toDNF" << endl;
  tree->toDNF();
  tree->printTree();
  cout << "cull" << endl;
  tree->cull();
  tree->printTree();
  cout << "END Success CASE" << endl << endl << endl;
  delete tree;



  SymTree *myTree = and2( and2(or2((BTerm)0,1),1),and2((BTerm)0,1));
  myTree->printTree();
		
  myTree->toDNF();
  myTree->printTree();
  myTree->cull();
  myTree->printTree();
  delete myTree;



  // Fail Case
  cout << "FAIL CASE:" << endl;
  SymTree* testCase = new SymTree();
  
  // Valid options (i.e. solutions)
  SymTree* myAnd = new SymTree();
  myAnd = and2((BTerm)0,5);
  testCase = or2(testCase, myAnd);
  myAnd = and2((BTerm)0,15);
  testCase = or2(testCase, myAnd);
  myAnd = and2((BTerm)0,7);
  testCase = or2(testCase, myAnd);
  myAnd = and2((BTerm)0,13);
  testCase = or2(testCase, myAnd);
  myAnd = and2(5,20);
  testCase = or2(testCase, myAnd);
  myAnd = and2(15,20);
  testCase = or2(testCase, myAnd);
  myAnd = and2(7,20);
  testCase = or2(testCase, myAnd);
  myAnd = and2(13,20);
  testCase = or2(testCase, myAnd);
  myAnd = and2(4,5);
  testCase = or2(testCase, myAnd);
  myAnd = and2(4,15);
  testCase = or2(testCase, myAnd);
  myAnd = and2(4,7);
  testCase = or2(testCase, myAnd);
  myAnd = and2(4,13);
  testCase = or2(testCase, myAnd);
  myAnd = and2(5,16);
  testCase = or2(testCase, myAnd);
  myAnd = and2(15,16);
  testCase = or2(testCase, myAnd);
  myAnd = and2(7,16);
  testCase = or2(testCase, myAnd);
  myAnd = and2(13,16);
  testCase = or2(testCase, myAnd);

  // All possible haplotype assignments for Father
//   SymTree* myAnd = new SymTree();
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)7);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)6);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)1);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)0);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)3);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)2);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)1);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)0);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)13);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)12);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)15);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)14);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)13);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)12);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)9);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)8);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)11);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)10);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)9);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)8);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)0,(BTerm)13);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)1,(BTerm)12);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)0,(BTerm)15);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)1,(BTerm)14);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)2,(BTerm)13);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)3,(BTerm)12);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)23);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)22);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)17);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)16);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)19);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)18);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)17);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)16);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)0,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)1,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)0,(BTerm)23);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)1,(BTerm)22);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)2,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)3,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)29);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)28);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)31);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)30);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)29);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)28);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)25);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)24);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)4,(BTerm)27);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)5,(BTerm)26);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)6,(BTerm)25);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)7,(BTerm)24);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)0,(BTerm)29);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)1,(BTerm)28);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)0,(BTerm)31);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)1,(BTerm)30);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)2,(BTerm)29);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)3,(BTerm)28);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)12,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)13,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)12,(BTerm)23);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)13,(BTerm)22);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)14,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)15,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)12,(BTerm)17);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)13,(BTerm)16);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)12,(BTerm)19);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)13,(BTerm)18);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)14,(BTerm)17);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)15,(BTerm)16);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)8,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)9,(BTerm)20);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)8,(BTerm)23);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)9,(BTerm)22);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)10,(BTerm)21);
//   testCase = or2(testCase, myAnd);
//   myAnd = and2((BTerm)11,(BTerm)20);
//   testCase = or2(testCase, myAnd);

  SymTree* testCase2 = new SymTree();
  SymTree* myOr = new SymTree();
  myOr = or2(or2(or2(5,15), 7), 13);
  testCase2 = and2(testCase2, myOr);
  myOr = or2(or2(or2(5,15), 7), 13);
  testCase2 = and2(testCase2, myOr);
  myOr = or2(or2(or2((BTerm) 0,20), 4), 16);
  testCase2 = and2(testCase2, myOr);
  myOr = or2(or2(or2(or2(or2(or2(or2((BTerm) 0, 21), 1), 20), 4), 17), 5), 16);
  testCase2 = and2(testCase2, myOr);
  myOr = or2(or2(or2(or2(or2(or2(or2(4, 15), 5), 14), 6), 13), 7), 12);
  testCase2 = and2(testCase2, myOr);
  myOr = or2(or2(or2(or2(or2(or2(or2(4, 15), 5), 14), 6), 13), 7), 12);
  testCase2 = and2(testCase2, myOr);
  cout << "  first step toDNF and cull" << endl;
  testCase2->toDNF();
  testCase2->cull();

  testCase = and2(testCase, testCase2);

  testCase->printTree();
  printf("BIG ToDNF\n");
  testCase->toDNF();
  printf("BIG Cull\n");
  testCase->cull();
  testCase->printTree();
  cout << "END FAIL CASE" << endl << endl << endl;

  delete testCase;


  return 0;
}
Ejemplo n.º 6
0
int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("SString_Test"));

  {

    /* Set #1 */
    ACE_CString s0 ("hello");
    ACE_CString s1 ("hello");
    ACE_CString s2 ("world");
    ACE_CString s3 ("ll");
    ACE_CString s4 ("ello");
    ACE_CString s5 = s1 + " " + s2;

    char single_character = 'z';
    ACE_CString single_character_string (single_character);

    ACE_CString empty_string;
    ACE_CString zero_size_string (s1.c_str (), 0, 0, 1);

    if (ACE_CString::npos == 0)
      ACE_ERROR((LM_ERROR,"Set #1: npos is incorrect.\n"));

    // Not equal comparisons. Error if they are equal
    if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}

    // Equal comparisons. Error if they are not equal
    if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1 != s0){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}

    // Substring match. Error if they are not equal
    if (s1.strstr (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.strstr (s3) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s3.strstr (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.strstr (s4) != 1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}

    // Substring creation. Error if they are not equal
    if (s1.substring (0) != s1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.substring (1) != s4){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.substring (2, 2) != s3){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.substring (0, 0) != empty_string){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.substring (4, 10).length () != 1){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}

    // Forward search. Error if they are not equal
    if (s1.find (s3) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s3.find (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.find (s3, 2) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s3.find (s1, 1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.find (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.find ('o') != 4){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}

    // Reverse search. Error if they are not equal
    if (s1.rfind ('l') != 3){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}

    // Assignment. Error if they are not equal
    ACE_CString s6;
    s6 = s0;
    if (s6 != s0){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    s6 = s4;
    if (s4 != s6){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
    s6 = s5;
    if (s6 != s5){ACE_ERROR((LM_ERROR,"Set #1:\n"));return 1;}
  }

  {
    /* Set #2 */
    ACE_CString s0 = "hello";
    ACE_CString s1 ("hello", 0, false);
    ACE_CString s2 ("world", 0, false);
    ACE_CString s3 ("ll", 0, false);
    ACE_CString s4 ("ello", 0, false);
    ACE_CString s5 = s1 + " " + s2;

    char single_character = 'z';
    ACE_CString single_character_string (single_character);

    ACE_CString empty_string (0, 0, false);
    ACE_CString zero_size_string (s1.c_str (), 0, 0, false);

    // Not equal comparisons. Error if they are equal
    if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Equal comparisons. Error if they are not equal
    if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1 != s0){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Substring match. Error if they are not equal
    if (s1.strstr (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.strstr (s3) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s3.strstr (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.strstr (s4) != 1){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Substring creation. Error if they are not equal
    if (s1.substring (0) != s1){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.substring (1) != s4){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.substring (2, 2) != s3){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.substring (0, 0) != empty_string){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Forward search. Error if they are not equal
    if (s1.find (s3) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s3.find (s1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.find (s3, 2) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s3.find (s1, 1) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.find (s2) != ACE_CString::npos){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.find ('o') != 4){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Reverse search. Error if they are not equal
    if (s1.rfind ('l') != 3){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Assignment. Error if they are not equal
    ACE_CString s6;
    s6 = s0;
    if (s6 != s0){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    s6 = s4;
    if (s4 != s6){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
    s6 = s5;
    if (s6 != s5){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Clear. Error if they are not equal
    s0.clear();
    if (s0.length() != 0){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}

    // Rep. Error if they are not equal
    ACE_Auto_Basic_Array_Ptr<char> s (s1.rep ());
    if (ACE_OS::strlen (s.get ()) != s1.length ())
      {
        ACE_ERROR((LM_ERROR,"Auto_ptr s:\n"));
      };

    ACE_CString s7 (s.get ());
    if (s1 != s7){ACE_ERROR((LM_ERROR,"Set #2:\n"));return 1;}
  }

  {
    /* Set #3 */
    ACE_NS_WString s0 ("hello");
    ACE_NS_WString s1 ("hello");
    ACE_NS_WString s2 ("world");
    ACE_NS_WString s3 ("ll");
    ACE_NS_WString s4 ("ello");
    ACE_NS_WString s5 = s1 + " " + s2;
    ACE_NS_WString s6 = ("hella"); // Same length as s1, off by one char.

    ACE_WCHAR_T single_character = 'z';
    ACE_NS_WString single_character_string (single_character);

    ACE_NS_WString empty_string;
    ACE_NS_WString zero_size_string (s1.c_str (), 0, 0);

    // Not equal comparisons. Error if they are equal
    if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1 == s6){ACE_ERROR((LM_ERROR,"Set #3: off-by-one failed\n"));return 1;}

    // Equal comparisons. Error if they are not equal
    if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1 != s0){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}

    // Substring match. Error if they are not equal
    if (s1.strstr (s2) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.strstr (s3) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s3.strstr (s1) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.strstr (s4) != 1){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}

    // Substring creation. Error if they are not equal
    if (s1.substring (0) != s1){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.substring (1) != s4){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.substring (2, 2) != s3){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.substring (0, 0) != empty_string){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}

    // Forward search. Error if they are not equal
    if (s1.find (s3) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s3.find (s1) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.find (s3, 2) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s3.find (s1, 1) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.find (s2) != ACE_NS_WString::npos){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.find ('o') != 4){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}

    // Reverse search. Error if they are not equal
    if (s1.rfind ('l') != 3){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}

    // Assignment. Error if they are not equal
    ACE_NS_WString s7;
    s7 = s0;
    if (s7 != s0){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    s7 = s4;
    if (s4 != s7){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
    s7 = s5;
    if (s7 != s5){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}

    // Clear. Error if they are not equal
    s0.clear();
    if (s0.length() != 0){ACE_ERROR((LM_ERROR,"Set #3:\n"));return 1;}
  }

  {
    /* Set #4 */
    ACE_CString s1("dog");
    ACE_CString s2("d");

    if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if (!(s1 > s2)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if (s1 < s2){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}

    ACE_CString s3 ("dog");
    ACE_CString s4 ("dogbert");

    if (s3 == s4){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if (!(s3 < s4)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if (s3 > s4){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}

    ACE_CString s5 ("dogbert",3);
    ACE_CString s6 ("dogbert",5);

    if(s5 == s6){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(!(s5 < s6)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(s5 > s6){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}

    ACE_CString s7 ("dogbert",4);
    ACE_CString s8 ("dogbert",2);

    if(s7 == s8){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(!(s7 > s8)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(s7 < s8){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}

    ACE_CString s9 ("dogbert",3);
    ACE_CString s10 ("dogbert");

    if(s9 == s10){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(!(s9 < s10)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(s9 > s10){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}

    ACE_CString s11 ("dogbert",5);
    ACE_CString s12 ("dog");

    if(s11 == s12){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(!(s11 > s12)){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}
    if(s11 < s12){ACE_ERROR((LM_ERROR,"Set #4:\n"));return 1;}

    s11.fast_clear ();
    if (s11.length () != 0)
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("fast_clear didn't yield 0 length\n")));
  }

  {
    // Set 1 for ACE_SString, which is not tested
    ACE_SString sstr;

    const char *old = sstr.rep ();
    const char *str = "What_a_day_it_has_been";

    sstr.rep (const_cast<char *>(str));

    ACE_SString tmp =
      sstr.substring (2, 300);

    if (tmp.length () == 300)
      ACE_ERROR ((LM_ERROR, "SString substring\n"));

    // Constring an ACE_SString without a character pointer or from an
    // existing ACE_SString causes memory to be allocated that will not
    // be delete (apparently by design).
    ACE_Allocator::instance ()->free (const_cast<char *> (old));
    ACE_Allocator::instance ()->free (const_cast<char *> (tmp.rep ()));
  }

  int err = testConcatenation ();
  err += testIterator ();
  err += testConstIterator ();

  ACE_END_TEST;
  return err;
}