Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others. 4 : // This program and the accompanying materials are made available under the 5 : // terms of the Eclipse Public License 2.0 which is available at 6 : // https://www.eclipse.org/legal/epl-2.0/ 7 : // This Source Code may also be made available under the following Secondary 8 : // Licenses when the conditions for such availability set forth in the Eclipse 9 : // Public License 2.0 are satisfied: GNU General Public License, version 2 10 : // or later which is available at 11 : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html 12 : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later 13 : /****************************************************************************/ 14 : /// @file MFXWorkerThreadTest.cpp 15 : /// @author Michael Behrisch 16 : /// @date Oct 2010 17 : /// 18 : // Tests the class MFXWorkerThread 19 : /****************************************************************************/ 20 : 21 : 22 : // =========================================================================== 23 : // included modules 24 : // =========================================================================== 25 : #include <config.h> 26 : 27 : #include <gtest/gtest.h> 28 : #include <utils/common/StdDefs.h> 29 : #include <utils/foxtools/MFXWorkerThread.h> 30 : 31 8 : class TestTask : public MFXWorkerThread::Task { 32 : public: 33 8 : void run(MFXWorkerThread* /* context */) { 34 8 : } 35 : }; 36 : 37 : // =========================================================================== 38 : // test definitions 39 : // =========================================================================== 40 : /* Test the initialization.*/ 41 2 : TEST(MFXWorkerThread, test_init) { 42 2 : MFXWorkerThread::Pool g(4); 43 2 : } 44 : 45 : /* Test retrieving all tasks.*/ 46 2 : TEST(MFXWorkerThread, test_get_all) { 47 2 : MFXWorkerThread::Pool g(4); 48 2 : MFXWorkerThread::Task* task1 = new TestTask(); 49 2 : MFXWorkerThread::Task* task2 = new TestTask(); 50 2 : MFXWorkerThread::Task* task3 = new TestTask(); 51 2 : MFXWorkerThread::Task* task4 = new TestTask(); 52 2 : g.add(task1); 53 2 : g.add(task2); 54 2 : g.add(task3); 55 2 : g.add(task4); 56 2 : g.waitAll(); 57 2 : }