diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-16 08:50:47 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-19 13:44:13 +0200 |
commit | ff590683f9ac5956d95c519cb54b4ea5634dcb63 (patch) | |
tree | e220364b546a88a09bb5f69796278fb3ab3918ee /tools/qa | |
parent | c72280c1e9a77e0175d8bb2452ee6a535aa8fb99 (diff) |
Revert "tools: test Pair"
This reverts commit 99dbaba70afb91ed3961f9ff627c35bf54d66bef.
Let's land this again once Stephan's comments in
https://gerrit.libreoffice.org/#/c/54189/
have been addressed
Change-Id: I4230e4ce59a46379548bb510e433c68b021e896c
Reviewed-on: https://gerrit.libreoffice.org/54414
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools/qa')
-rw-r--r-- | tools/qa/cppunit/test_pair.cxx | 126 |
1 files changed, 0 insertions, 126 deletions
diff --git a/tools/qa/cppunit/test_pair.cxx b/tools/qa/cppunit/test_pair.cxx deleted file mode 100644 index 31812963f754..000000000000 --- a/tools/qa/cppunit/test_pair.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <sal/types.h> -#include <cppunit/TestFixture.h> -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/plugin/TestPlugIn.h> - -#include <tools/stream.hxx> -#include <tools/Pair.hxx> - -namespace tools -{ -class PairTest : public CppUnit::TestFixture -{ -public: - void testPair() - { - long nExpectedA = 0; - long nExpectedB = 0; - long nActualA = 0; - long nActualB = 0; - - { - Pair aPair; - nActualA = aPair.A(); - nActualB = aPair.B(); - - CPPUNIT_ASSERT_EQUAL(nExpectedA, nActualA); - CPPUNIT_ASSERT_EQUAL(nExpectedB, nActualB); - } - - { - Pair aPair(1, 2); - nExpectedA = 1; - nExpectedB = 2; - nActualA = aPair.A(); - nActualB = aPair.B(); - - CPPUNIT_ASSERT_EQUAL(nExpectedA, nActualA); - CPPUNIT_ASSERT_EQUAL(nExpectedB, nActualB); - } - } - - void testToString() - { - OString sExpectedString("1, 2"); - Pair aPair(1, 2); - CPPUNIT_ASSERT_EQUAL(sExpectedString, aPair.toString()); - } - - void testReadStream() - { - TestPair* pData = new TestPair(1, 2); - SvMemoryStream aMemStm(pData, 8, StreamMode::READ); - - Pair aPair; - ReadPair(aMemStm, aPair); - - sal_Int32 nExpectedA = 1; - sal_Int32 nExpectedB = 2; - sal_Int32 nActualA = aPair.A(); - sal_Int32 nActualB = aPair.B(); - - CPPUNIT_ASSERT_EQUAL(nExpectedA, nActualA); - CPPUNIT_ASSERT_EQUAL(nExpectedB, nActualB); - } - - void testWriteStream() - { - SvMemoryStream aMemStm; - - WritePair(aMemStm, Pair(1, 2)); - - Pair aPair; - aMemStm.Seek(0); // reset to the beginning of the stream - ReadPair(aMemStm, aPair); - - sal_Int32 nExpectedA = 1; - sal_Int32 nExpectedB = 2; - sal_Int32 nActualA = aPair.A(); - sal_Int32 nActualB = aPair.B(); - - CPPUNIT_ASSERT_EQUAL(nExpectedA, nActualA); - CPPUNIT_ASSERT_EQUAL(nExpectedB, nActualB); - } - - CPPUNIT_TEST_SUITE(PairTest); - CPPUNIT_TEST(testPair); - CPPUNIT_TEST(testToString); - CPPUNIT_TEST(testReadStream); - CPPUNIT_TEST(testWriteStream); - CPPUNIT_TEST_SUITE_END(); - -private: - struct TestPair - { - sal_Int32 mnA; - sal_Int32 mnB; - - TestPair(sal_Int32 nA, sal_Int32 nB) - : mnA(nA) - , mnB(nB){}; - }; -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(PairTest); -} // namespace tools - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |