libreoffice-online/test/UtilTests.cpp
Ashod Nakashian 52f2600cf9 wsd: test: embue all tests with a name and unify logs
Now the remaining tests that didn't have a name
get one and the logs are unified between old-
and new-style tests. Mostly.

This makes sure that all logs and assertions
properly log the test name and make test
failures easier to debug and fix.

Change-Id: Id159ffacc81642a6ec594c5143498408adab67cf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-02-17 18:52:48 -05:00

41 lines
1.2 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <config.h>
#include <test/lokassert.hpp>
#include <Util.hpp>
/// Util unit-tests.
class UtilTests : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE(UtilTests);
CPPUNIT_TEST(testStringifyHexLine);
CPPUNIT_TEST_SUITE_END();
void testStringifyHexLine();
};
void UtilTests::testStringifyHexLine()
{
constexpr auto testname = __func__;
std::string test("hello here\ntest");
std::string result1("68 65 6C 6C 6F 20 68 65 72 65 0A 74 65 73 74"
" "
"| hello here.test ");
std::string result2("68 65 72 65 0A 74 | here.t");
LOK_ASSERT_EQUAL(result1, Util::stringifyHexLine(test, 0));
LOK_ASSERT_EQUAL(result2, Util::stringifyHexLine(test, 6, 6));
}
CPPUNIT_TEST_SUITE_REGISTRATION(UtilTests);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */