1 /****************************************************************************/ 2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo 3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others. 4 // This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v2.0 6 // which accompanies this distribution, and is available at 7 // http://www.eclipse.org/legal/epl-v20.html 8 // SPDX-License-Identifier: EPL-2.0 9 /****************************************************************************/ 10 /// @file FXWorkerThreadTest.cpp 11 /// @author Michael Behrisch 12 /// @date Oct 2010 13 /// @version $Id$ 14 /// 15 // Tests the class FXWorkerThread 16 /****************************************************************************/ 17 18 19 // =========================================================================== 20 // included modules 21 // =========================================================================== 22 #include <config.h> 23 24 #include <gtest/gtest.h> 25 #include <utils/common/StdDefs.h> 26 #include <utils/foxtools/FXWorkerThread.h> 27 28 class TestTask : public FXWorkerThread::Task { 29 public: run(FXWorkerThread *)30 void run(FXWorkerThread* /* context */) { 31 } 32 }; 33 34 // =========================================================================== 35 // test definitions 36 // =========================================================================== 37 /* Test the initialization.*/ TEST(FXWorkerThread,test_init)38TEST(FXWorkerThread, test_init) { 39 FXWorkerThread::Pool g(4); 40 } 41 42 /* Test retrieving all tasks.*/ TEST(FXWorkerThread,test_get_all)43TEST(FXWorkerThread, test_get_all) { 44 FXWorkerThread::Pool g(4); 45 FXWorkerThread::Task* task1 = new TestTask(); 46 FXWorkerThread::Task* task2 = new TestTask(); 47 FXWorkerThread::Task* task3 = new TestTask(); 48 FXWorkerThread::Task* task4 = new TestTask(); 49 g.add(task1); 50 g.add(task2); 51 g.add(task3); 52 g.add(task4); 53 g.waitAll(); 54 } 55 56