1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <sal/config.h>
12 #include <cppunit/TestFixture.h>
13 #include <cppunit/TestAssert.h>
14 #include <cppunit/extensions/HelperMacros.h>
16 #include <rtl/ustrbuf.hxx>
17 #include <rtl/ustring.hxx>
21 class Test
: public CppUnit::TestFixture
{
25 OUString
s1("123456789012345");
27 CPPUNIT_ASSERT_EQUAL(s1
, b1
.toString());
28 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b1
.getCapacity());
31 CPPUNIT_ASSERT_EQUAL(s2
, b1
.toString());
32 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b1
.getCapacity());
33 OUString
s3("1234567890123456");
35 CPPUNIT_ASSERT_EQUAL(s3
, b1
.toString());
36 CPPUNIT_ASSERT_EQUAL(sal_Int32(32), b1
.getCapacity());
38 b2
= "123456789012345";
39 CPPUNIT_ASSERT_EQUAL(s1
, b2
.toString());
40 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b2
.getCapacity());
42 CPPUNIT_ASSERT_EQUAL(s2
, b2
.toString());
43 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b2
.getCapacity());
44 b2
= "1234567890123456";
45 CPPUNIT_ASSERT_EQUAL(s3
, b2
.toString());
46 CPPUNIT_ASSERT_EQUAL(sal_Int32(32), b2
.getCapacity());
48 b3
= u
"123456789012345";
49 CPPUNIT_ASSERT_EQUAL(s1
, b3
.toString());
50 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b3
.getCapacity());
52 CPPUNIT_ASSERT_EQUAL(s2
, b3
.toString());
53 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b3
.getCapacity());
54 b3
= u
"1234567890123456";
55 CPPUNIT_ASSERT_EQUAL(s3
, b3
.toString());
56 CPPUNIT_ASSERT_EQUAL(sal_Int32(32), b3
.getCapacity());
58 b4
= OUStringLiteral("1") + "23456789012345";
59 CPPUNIT_ASSERT_EQUAL(s1
, b4
.toString());
60 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b4
.getCapacity());
61 b4
= OUStringLiteral("a") + "bc";
62 CPPUNIT_ASSERT_EQUAL(s2
, b4
.toString());
63 CPPUNIT_ASSERT_EQUAL(sal_Int32(16), b4
.getCapacity());
64 b4
= OUStringLiteral("1") + "234567890123456";
65 CPPUNIT_ASSERT_EQUAL(s3
, b4
.toString());
66 CPPUNIT_ASSERT_EQUAL(sal_Int32(32), b4
.getCapacity());
69 CPPUNIT_TEST_SUITE(Test
);
71 CPPUNIT_TEST_SUITE_END();
76 CPPUNIT_TEST_SUITE_REGISTRATION(Test
);
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */