/* -*- 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 #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include using namespace ::o3tl; class vector_pool_test : public CppUnit::TestFixture { public: void testPoolBasics() { vector_pool aPool; std::ptrdiff_t nIdx1 = aPool.alloc(); std::ptrdiff_t nIdx2 = aPool.alloc(); std::ptrdiff_t nIdx3 = aPool.alloc(); CPPUNIT_ASSERT_MESSAGE("allocator idx order 1", nIdx1 < nIdx2 ); CPPUNIT_ASSERT_MESSAGE("allocator idx order 2", nIdx2 < nIdx3 ); aPool.free(nIdx2); aPool.free(nIdx3); nIdx2 = aPool.alloc(); nIdx3 = aPool.alloc(); CPPUNIT_ASSERT_MESSAGE("allocator idx order 1 after fragmentation", nIdx1 < nIdx3 ); CPPUNIT_ASSERT_MESSAGE("allocator idx order 2 after fragmentation", nIdx3 < nIdx2 ); } void testPoolValueSemantics() { vector_pool aPool; std::ptrdiff_t nIdx1 = aPool.store(0); CPPUNIT_ASSERT_EQUAL_MESSAGE("allocator value semantics 1", 0, aPool.get(nIdx1) ); std::ptrdiff_t nIdx2 = aPool.store(1); CPPUNIT_ASSERT_EQUAL_MESSAGE("allocator value semantics 2", 1, aPool.get(nIdx2) ); std::ptrdiff_t nIdx3 = aPool.store(2); CPPUNIT_ASSERT_EQUAL_MESSAGE("allocator value semantics 3", 2, aPool.get(nIdx3) ); aPool.free(nIdx2); aPool.free(nIdx3); nIdx2 = aPool.store(1); CPPUNIT_ASSERT_EQUAL_MESSAGE("allocator value semantics 2 after fragmentation", 1, aPool.get(nIdx2) ); nIdx3 = aPool.store(2); CPPUNIT_ASSERT_EQUAL_MESSAGE("allocator value semantics 3 after fragmentation", 2, aPool.get(nIdx3) ); } // Change the following lines only, if you add, remove or rename // member functions of the current class, // because these macros are need by auto register mechanism. CPPUNIT_TEST_SUITE(vector_pool_test); CPPUNIT_TEST(testPoolBasics); CPPUNIT_TEST(testPoolValueSemantics); CPPUNIT_TEST_SUITE_END(); }; CPPUNIT_TEST_SUITE_REGISTRATION(vector_pool_test); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /collabora/cp-4.2'>distro/collabora/cp-4.2 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/ucb/qa
AgeCommit message (Expand)Author
2018-01-16Fix typosAndrea Gelmini
2017-10-23loplugin:includeform: ucbStephan Bergmann
2017-09-14clang-tidy modernize-use-emplace in test..vbahelperNoel Grandin
2017-09-04Translate German comments/debug strings (leftovers in dirs test to uui)Johnny_M
2017-08-17Fix typosAndrea Gelmini
2017-07-31loplugin:oncevarNoel Grandin
2017-03-25Fix typosAndrea Gelmini
2016-11-01Cosmetic: Namespaces, better make use of the 'using-directive'Giuseppe Castagno
2016-10-26const-ness fixesStephan Bergmann
2016-10-26WebDAV: Small cosmetic to unit checks.Giuseppe Castagno
2016-10-12tdf#102499 (6): Cache OPTIONS if not present or if lifetime differentGiuseppe Castagno
2016-10-05tdf#102499 (3): Change caching model for HTTP response status codeGiuseppe Castagno
2016-10-01tdf#101094 (34): Fix test and missing field value in comparision operatorGiuseppe Castagno
2016-09-26tdf#102499 (2): Refactor the WebDAV resource access retryGiuseppe Castagno
2016-09-25tdf#102499 (1): Add WebDAV test to check HTTP reponse status codes retryGiuseppe Castagno
2016-09-07loplugin:constantparam in framework..vbahelperNoel Grandin
2016-08-23Related: tdf#82677, implement a PROPFIND 'propname' request cacheGiuseppe Castagno
2016-07-29tdf#101094 (13) OPTIONS: Options cache removal: LOCK, UNLOCKGiuseppe Castagno
2016-07-29tdf#101094 (10) OPTIONS: Add a simple options cache classGiuseppe Castagno
2016-07-28tdf#101094 (1) OPTIONS: New class to store retrieved OPTIONSGiuseppe Castagno
2016-03-10These tests can just derive from plain CppUnit::TestFixtureStephan Bergmann
2016-01-26Add initial cppunit test to webdav, 'local' only, neon versionGiuseppe Castagno
2016-01-10Fix typosAndrea Gelmini
2015-09-30Fix typosAndrea Gelmini
2015-07-04Fix typosAndrea Gelmini
2015-06-09java:remove unused importsNoel Grandin
2015-06-09more exception handling cleanup in Java unit testsNoel Grandin