LCOV - code coverage report
Current view: top level - oox/qa/token - tokenmap-test.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 14 14 100.0 %
Date: 2014-11-03 Functions: 10 11 90.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  */
       9             : 
      10             : #include <cppunit/TestAssert.h>
      11             : #include <cppunit/TestFixture.h>
      12             : #include <cppunit/extensions/HelperMacros.h>
      13             : #include <cppunit/plugin/TestPlugIn.h>
      14             : 
      15             : #include "oox/token/tokenmap.hxx"
      16             : #include "oox/token/tokens.hxx"
      17             : 
      18             : using namespace std;
      19             : using namespace com::sun::star::uno;
      20             : 
      21             : namespace oox {
      22             : 
      23           6 : class TokenmapTest: public CppUnit::TestFixture
      24             : {
      25             : public:
      26             :     void test_roundTrip();
      27             : 
      28           4 :     CPPUNIT_TEST_SUITE(TokenmapTest);
      29             : 
      30           2 :     CPPUNIT_TEST(test_roundTrip);
      31           4 :     CPPUNIT_TEST_SUITE_END();
      32             : 
      33             : private:
      34             :     TokenMap tokenMap;
      35             : };
      36             : 
      37           2 : void TokenmapTest::test_roundTrip()
      38             : {
      39       11636 :     for ( sal_Int32 nToken = 0; nToken < XML_TOKEN_COUNT; ++nToken )
      40             :     {
      41             :         // check that the getIdentifier <-> getToken roundtrip works
      42       11634 :         Sequence< sal_Int8 > rUtf8Name = tokenMap.getUtf8TokenName(nToken);
      43             :         sal_Int32 ret = tokenMap.getTokenFromUTF8(
      44       11634 :             reinterpret_cast< const char * >(rUtf8Name.getConstArray()),
      45       23268 :             rUtf8Name.getLength() );
      46       11634 :         CPPUNIT_ASSERT_EQUAL(ret, nToken);
      47       11634 :     }
      48           2 : }
      49             : 
      50           2 : CPPUNIT_TEST_SUITE_REGISTRATION(TokenmapTest);
      51             : 
      52             : }
      53             : 
      54           8 : CPPUNIT_PLUGIN_IMPLEMENT();

Generated by: LCOV version 1.10