cout << failed << " tests FAILED out of " << numTests << endl;
printf("%d tests FAILED out of %d\n", failed, numTests);
int doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0){    if (i_URL && i_relativePortion)    {        return makeAbsTest(i_URL, i_relativePortion, nsnull);    }    // Run standard tests. These tests are based on the ones described in     // rfc2396 with the exception of the handling of ?y which is wrong as    // notified by on of the RFC authors.    /* Section C.1.  Normal Examples      g:h        = <URL:g:h>      g          = <URL:http://a/b/c/g>      ./g        = <URL:http://a/b/c/g>      g/         = <URL:http://a/b/c/g/>      /g         = <URL:http://a/g>      //g        = <URL:http://g>      ?y         = <URL:http://a/b/c/d;p?y>      g?y        = <URL:http://a/b/c/g?y>      g?y/./x    = <URL:http://a/b/c/g?y/./x>      #s         = <URL:http://a/b/c/d;p?q#s>      g#s        = <URL:http://a/b/c/g#s>      g#s/./x    = <URL:http://a/b/c/g#s/./x>      g?y#s      = <URL:http://a/b/c/g?y#s>      ;x         = <URL:http://a/b/c/;x>      g;x        = <URL:http://a/b/c/g;x>      g;x?y#s    = <URL:http://a/b/c/g;x?y#s>      .          = <URL:http://a/b/c/>      ./         = <URL:http://a/b/c/>      ..         = <URL:http://a/b/>      ../        = <URL:http://a/b/>      ../g       = <URL:http://a/b/g>      ../..      = <URL:http://a/>      ../../     = <URL:http://a/>      ../../g    = <URL:http://a/g>    */    struct test {        const char* baseURL;        const char* relativeURL;        const char* expectedResult;    };    test tests[] = {        // Tests from rfc2396, section C.1 with the exception of the        // handling of ?y        { "http://a/b/c/d;p?q#f",     "g:h",         "g:h" },        { "http://a/b/c/d;p?q#f",     "g",           "http://a/b/c/g" },        { "http://a/b/c/d;p?q#f",     "./g",         "http://a/b/c/g" },        { "http://a/b/c/d;p?q#f",     "g/",          "http://a/b/c/g/" },        { "http://a/b/c/d;p?q#f",     "/g",          "http://a/g" },        { "http://a/b/c/d;p?q#f",     "//g",         "http://g" },        { "http://a/b/c/d;p?q#f",     "?y",          "http://a/b/c/d;p?y" },        { "http://a/b/c/d;p?q#f",     "g?y",         "http://a/b/c/g?y" },        { "http://a/b/c/d;p?q#f",     "g?y/./x",     "http://a/b/c/g?y/./x" },        { "http://a/b/c/d;p?q#f",     "#s",          "http://a/b/c/d;p?q#s" },        { "http://a/b/c/d;p?q#f",     "g#s",         "http://a/b/c/g#s" },        { "http://a/b/c/d;p?q#f",     "g#s/./x",     "http://a/b/c/g#s/./x" },        { "http://a/b/c/d;p?q#f",     "g?y#s",       "http://a/b/c/g?y#s" },        { "http://a/b/c/d;p?q#f",     ";x",          "http://a/b/c/;x" },        { "http://a/b/c/d;p?q#f",     "g;x",         "http://a/b/c/g;x" },        { "http://a/b/c/d;p?q#f",     "g;x?y#s",     "http://a/b/c/g;x?y#s" },        { "http://a/b/c/d;p?q#f",     ".",           "http://a/b/c/" },        { "http://a/b/c/d;p?q#f",     "./",          "http://a/b/c/" },        { "http://a/b/c/d;p?q#f",     "..",          "http://a/b/" },        { "http://a/b/c/d;p?q#f",     "../",         "http://a/b/" },        { "http://a/b/c/d;p?q#f",     "../g",        "http://a/b/g" },        { "http://a/b/c/d;p?q#f",     "../..",       "http://a/" },        { "http://a/b/c/d;p?q#f",     "../../",      "http://a/" },        { "http://a/b/c/d;p?q#f",     "../../g",     "http://a/g" },        // Our additional tests...        { "http://a/b/c/d;p?q#f",     "#my::anchor", "http://a/b/c/d;p?q#my::anchor" },        { "http://a/b/c/d;p?q#f",     "get?baseRef=viewcert.jpg", "http://a/b/c/get?baseRef=viewcert.jpg" },        // Make sure relative query's work right even if the query        // string contains absolute urls or other junk.        { "http://a/b/c/d;p?q#f",     "?http://foo",        "http://a/b/c/d;p?http://foo" },        { "http://a/b/c/d;p?q#f",     "g?http://foo",       "http://a/b/c/g?http://foo" },        {"http://a/b/c/d;p?q#f",      "g/h?http://foo",     "http://a/b/c/g/h?http://foo" },        { "http://a/b/c/d;p?q#f",     "g/h/../H?http://foo","http://a/b/c/g/H?http://foo" },        { "http://a/b/c/d;p?q#f",     "g/h/../H?http://foo?baz", "http://a/b/c/g/H?http://foo?baz" },        { "http://a/b/c/d;p?q#f",     "g/h/../H?http://foo;baz", "http://a/b/c/g/H?http://foo;baz" },        { "http://a/b/c/d;p?q#f",     "g/h/../H?http://foo#bar", "http://a/b/c/g/H?http://foo#bar" },        { "http://a/b/c/d;p?q#f",     "g/h/../H;baz?http://foo", "http://a/b/c/g/H;baz?http://foo" },        { "http://a/b/c/d;p?q#f",     "g/h/../H;baz?http://foo#bar", "http://a/b/c/g/H;baz?http://foo#bar" },        { "http://a/b/c/d;p?q#f",     "g/h/../H;baz?C:\\temp", "http://a/b/c/g/H;baz?C:\\temp" },        { "http://a/b/c/d;p?q#f",     "", "http://a/b/c/d;p?q" },        { "http://a/b/c/d;p?q#f",     "#", "http://a/b/c/d;p?q#" },        { "http://a/b/c;p/d;p?q#f",   "../g;p" , "http://a/b/g;p" },    };    const int numTests = sizeof(tests) / sizeof(tests[0]);    int failed = 0;    nsresult rv;    for (int i = 0 ; i<numTests ; ++i)    {        rv = makeAbsTest(tests[i].baseURL, tests[i].relativeURL,                         tests[i].expectedResult);        if (NS_FAILED(rv))            failed++;    }    if (failed>0) {        cout << failed << " tests FAILED out of " << numTests << endl;        return NS_ERROR_FAILURE;    } else {        cout << "All " << numTests << " tests PASSED." << endl;        return NS_OK;    }}