LCOV - code coverage report
Current view: top level - libreoffice/tools/qa/cppunit - test_inetmime.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 14 100.0 %
Date: 2012-12-27 Functions: 10 10 100.0 %
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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sal/types.h>
      21             : #include "cppunit/TestAssert.h"
      22             : #include "cppunit/TestFixture.h"
      23             : #include "cppunit/extensions/HelperMacros.h"
      24             : #include "cppunit/plugin/TestPlugIn.h"
      25             : 
      26             : #include <tools/inetmime.hxx>
      27             : 
      28             : namespace
      29             : {
      30             : 
      31           3 :     class Test: public CppUnit::TestFixture
      32             :     {
      33             :         bool testDecode(char const * input, char const * expected);
      34             :     public:
      35             :         void test_decodeHeaderFieldBody();
      36             : 
      37           2 :         CPPUNIT_TEST_SUITE(Test);
      38           1 :         CPPUNIT_TEST(test_decodeHeaderFieldBody);
      39           2 :         CPPUNIT_TEST_SUITE_END();
      40             :     };
      41             : 
      42           3 :     bool Test::testDecode(char const * input, char const * expected)
      43             :     {
      44             :         rtl::OUString result = INetMIME::decodeHeaderFieldBody(
      45           3 :             INetMIME::HEADER_FIELD_TEXT, input);
      46           3 :         return result.equalsAscii(expected);
      47             :     }
      48             : 
      49           1 :     void Test::test_decodeHeaderFieldBody()
      50             :     {
      51           1 :         CPPUNIT_ASSERT(testDecode("=?iso-8859-1?B?QQ==?=", "A"));
      52           1 :         CPPUNIT_ASSERT(testDecode("=?iso-8859-1?B?QUI=?=", "AB"));
      53           1 :         CPPUNIT_ASSERT(testDecode("=?iso-8859-1?B?QUJD?=", "ABC"));
      54           1 :     }
      55             : 
      56           1 :     CPPUNIT_TEST_SUITE_REGISTRATION(Test);
      57           3 : }
      58             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10