Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : : *
5 : : * The contents of this file are subject to the Mozilla Public License Version
6 : : * 1.1 (the "License"); you may not use this file except in compliance with
7 : : * the License or as specified alternatively below. You may obtain a copy of
8 : : * the License at http://www.mozilla.org/MPL/
9 : : *
10 : : * Software distributed under the License is distributed on an "AS IS" basis,
11 : : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : : * for the specific language governing rights and limitations under the
13 : : * License.
14 : : *
15 : : * Major Contributor(s):
16 : : * Copyright (C) 2011 Red Hat, Inc., Stephan Bergmann <sbergman@redhat.com>
17 : : * (initial developer)
18 : : *
19 : : * All Rights Reserved.
20 : : *
21 : : * For minor contributions see the git repository.
22 : : *
23 : : * Alternatively, the contents of this file may be used under the terms of
24 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : : * instead of those above.
28 : : */
29 : :
30 : : #include <sal/types.h>
31 : : #include <cppunit/TestFixture.h>
32 : : #include <cppunit/TestAssert.h>
33 : : #include <cppunit/extensions/HelperMacros.h>
34 : : #include "rtl/ustrbuf.hxx"
35 : :
36 : : namespace test { namespace oustringbuffer {
37 : :
38 [ - + ]: 15 : class AppendChar: public CppUnit::TestFixture {
39 : : private:
40 : : void testAppendChar();
41 : :
42 [ + - ][ + - ]: 10 : CPPUNIT_TEST_SUITE(AppendChar);
[ + - ][ + - ]
[ # # ]
43 [ + - ][ + - ]: 5 : CPPUNIT_TEST(testAppendChar);
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
44 [ + - ][ + - ]: 10 : CPPUNIT_TEST_SUITE_END();
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
45 : : };
46 : :
47 : 5 : void AppendChar::testAppendChar() {
48 : : // Check that append('a') does not unexpectedly pick
49 : : // append(sal_Int32 i, sal_Int16 radix = 10):
50 : 5 : rtl::OUStringBuffer s;
51 [ + - ]: 5 : s.append('a');
52 [ + - ][ + - ]: 5 : CPPUNIT_ASSERT_EQUAL(sal_Int32(1), s.getLength());
[ + - ][ + - ]
[ + - ]
53 [ + - ][ + - ]: 5 : CPPUNIT_ASSERT_EQUAL(sal_Unicode('a'), s[0]);
[ + - ][ + - ]
[ + - ]
54 : 5 : }
55 : :
56 : : } }
57 : :
58 [ + - ][ + - ]: 15 : CPPUNIT_TEST_SUITE_REGISTRATION(test::oustringbuffer::AppendChar);
59 : :
60 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|