| 1 | /*************************************************************************** |
| 2 | copyright : (C) 2009 by Lukas Lalinsky |
| 3 | email : [email protected] |
| 4 | ***************************************************************************/ |
| 5 | |
| 6 | /*************************************************************************** |
| 7 | * This library is free software; you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU Lesser General Public License version * |
| 9 | * 2.1 as published by the Free Software Foundation. * |
| 10 | * * |
| 11 | * This library is distributed in the hope that it will be useful, but * |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 | * Lesser General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU Lesser General Public * |
| 17 | * License along with this library; if not, write to the Free Software * |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * |
| 19 | * 02110-1301 USA * |
| 20 | * * |
| 21 | * Alternatively, this file is available under the Mozilla Public * |
| 22 | * License Version 1.1. You may obtain a copy of the License at * |
| 23 | * http://www.mozilla.org/MPL/ * |
| 24 | ***************************************************************************/ |
| 25 | |
| 26 | #include "tbytevector.h" |
| 27 | #include "tbytevectorlist.h" |
| 28 | #include <cppunit/extensions/HelperMacros.h> |
| 29 | |
| 30 | using namespace std; |
| 31 | using namespace TagLib; |
| 32 | |
| 33 | class TestByteVectorList : public CppUnit::TestFixture |
| 34 | { |
| 35 | CPPUNIT_TEST_SUITE(TestByteVectorList); |
| 36 | CPPUNIT_TEST(testSplitSingleChar); |
| 37 | CPPUNIT_TEST(testSplitSingleChar_2); |
| 38 | CPPUNIT_TEST_SUITE_END(); |
| 39 | |
| 40 | public: |
| 41 | |
| 42 | void testSplitSingleChar() |
| 43 | { |
| 44 | ByteVector v("a b"); |
| 45 | |
| 46 | ByteVectorList l = ByteVectorList::split(v, " "); |
| 47 | CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(2), l.size()); |
| 48 | CPPUNIT_ASSERT_EQUAL(ByteVector("a"), l[0]); |
| 49 | CPPUNIT_ASSERT_EQUAL(ByteVector("b"), l[1]); |
| 50 | } |
| 51 | |
| 52 | void testSplitSingleChar_2() |
| 53 | { |
| 54 | ByteVector v("a"); |
| 55 | |
| 56 | ByteVectorList l = ByteVectorList::split(v, " "); |
| 57 | CPPUNIT_ASSERT_EQUAL(static_cast<unsigned int>(1), l.size()); |
| 58 | CPPUNIT_ASSERT_EQUAL(ByteVector("a"), l[0]); |
| 59 | } |
| 60 | |
| 61 | }; |
| 62 | |
| 63 | CPPUNIT_TEST_SUITE_REGISTRATION(TestByteVectorList); |