/* vim:set ts=2 sw=2 et cindent: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla.
*
* The Initial Developer of the Original Code is IBM Corporation.
* Portions created by IBM Corporation are Copyright (C) 2003
* IBM Corporation. All Rights Reserved.
*
* Contributor(s):
* Darin Fisher <darin@meer.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include <stdio.h>
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
{
}
{
if (!r)
return r;
}
{
if (!r)
return r;
}
{
if (n != kNotFound)
printf("n=%d\n", n);
return n == kNotFound;
}
{
if (!r)
return r;
}
{
if (i == 2)
return PR_TRUE;
printf("i=%d\n", i);
return PR_FALSE;
}
{
PRInt32 i;
if (i != kNotFound)
{
printf("unexpected result searching from offset=3, i=%d\n", i);
return PR_FALSE;
}
if (i != 20)
{
printf("unexpected result searching from offset=-1, i=%d\n", i);
return PR_FALSE;
}
if (i != 10)
{
printf("unexpected result searching from offset=13, i=%d\n", i);
return PR_FALSE;
}
if (i != 20)
{
printf("unexpected result searching from offset=22, i=%d\n", i);
return PR_FALSE;
}
return PR_TRUE;
}
{
if (i == 5)
return PR_TRUE;
printf("i=%d\n", i);
return PR_FALSE;
}
{
if (i == 24)
return PR_TRUE;
printf("i=%d\n", i);
return PR_FALSE;
}
{
if (i != 1)
{
printf("i=%d\n", i);
return PR_FALSE;
}
return PR_TRUE;
}
{
s.BeginReading(begin);
s.EndReading(end);
if (!r)
printf("d=%zu\n", d);
return r;
}
{
if (!r)
printf("d=%zu\n", d);
return r;
}
{
if (!r)
return r;
}
{
if (!r)
{
return PR_FALSE;
}
s.Assign("foobar");
if (!r)
{
return PR_FALSE;
}
s.Assign("foofoofoo");
if (!r)
{
return PR_FALSE;
}
s.Assign("foofoofoo");
if (!r)
{
return PR_FALSE;
}
return PR_TRUE;
}
{
// here, oldVal is empty. we are testing that this function
// does not hang. see bug 235355.
// we expect that newAcctName will be unchanged.
return PR_FALSE;
return PR_TRUE;
}
{
s.StripWhitespace();
if (!r)
return r;
}
{
nsCString s;
if (r)
printf("[r=%d]\n", r);
return !r;
}
{
return PR_FALSE;
return PR_FALSE;
s.Assign("foopy doopy doo");
return PR_FALSE;
return PR_TRUE;
}
{
NS_LITERAL_CSTRING(",") +
barRef);
return PR_TRUE;
return PR_FALSE;
}
{
return PR_TRUE;
return PR_FALSE;
}
#if 0
{
// THIS DOES NOT COMPILE
const nsACString& r = a + b;
return PR_TRUE;
}
#endif
{
nsXPIDLCString a, b;
a = b;
if (a != b)
return PR_FALSE;
a.Adopt(0);
if (a != b)
return PR_FALSE;
a.Append("foopy");
a.Assign(b);
if (a != b)
return PR_FALSE;
a.Insert("", 0);
a.Assign(b);
if (a != b)
return PR_FALSE;
return PR_FALSE;
b = a;
if (strcmp(a, b) != 0)
return PR_FALSE;
a.Adopt(0);
a.BeginReading(begin);
a.EndReading(end);
if (strcmp(r, "") != 0)
return PR_FALSE;
a.Adopt(0);
if (a != (const char*) 0)
return PR_FALSE;
/*
PRInt32 index = a.FindCharInSet("xyz");
if (index != kNotFound)
return PR_FALSE;
*/
return PR_TRUE;
}
{
nsCString a;
a.AssignLiteral("");
a.AppendLiteral("");
nsCString b;
b.SetCapacity(0);
return PR_TRUE;
}
{
return PR_FALSE;
return PR_TRUE;
}
{
// this tests that |super| starts with |sub|,
if (!r)
return PR_FALSE;
// and verifies that |sub| does not start with |super|.
if (r)
return PR_FALSE;
return PR_TRUE;
}
{
return PR_FALSE;
}
return PR_FALSE;
}
return PR_FALSE;
}
return PR_FALSE;
}
return PR_FALSE;
}
return PR_TRUE;
}
{
if (index != 5)
return PR_FALSE;
if (index != 0)
return PR_FALSE;
return PR_FALSE;
return PR_TRUE;
}
{
if (index != 5)
return PR_FALSE;
if (index != 0)
return PR_FALSE;
return PR_FALSE;
if (index != 3)
return PR_FALSE;
if (index != 12)
return PR_FALSE;
if (index != 11)
return PR_FALSE;
if (index != 1)
return PR_FALSE;
if (index != 0)
return PR_FALSE;
return PR_FALSE;
if (index != 7)
return PR_FALSE;
return PR_TRUE;
}
//----
static const struct Test
{
const char* name;
}
tests[] =
{
{ "test_assign", test_assign },
{ "test_assign_c", test_assign_c },
{ "test1", test1 },
{ "test2", test2 },
{ "test_find", test_find },
{ "test_rfind", test_rfind },
{ "test_rfind_2", test_rfind_2 },
{ "test_rfind_3", test_rfind_3 },
{ "test_rfind_4", test_rfind_4 },
{ "test_distance", test_distance },
{ "test_length", test_length },
{ "test_trim", test_trim },
{ "test_replace_substr", test_replace_substr },
{ "test_replace_substr_2", test_replace_substr_2 },
{ "test_strip_ws", test_strip_ws },
{ "test_equals_ic", test_equals_ic },
{ "test_fixed_string", test_fixed_string },
{ "test_concat", test_concat },
{ "test_concat_2", test_concat_2 },
{ "test_xpidl_string", test_xpidl_string },
{ "test_empty_assign", test_empty_assign },
{ "test_set_length", test_set_length },
{ "test_substring", test_substring },
{ "test_appendint64", test_appendint64 },
{ "test_findcharinset", test_findcharinset },
{ "test_rfindcharinset", test_rfindcharinset },
};
//----
{
if (argc > 1)
while (count--)
{
{
}
}
return 0;
}