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 4 : class TestTask : public MFXWorkerThread::Task {
32 : public:
33 4 : void run(MFXWorkerThread* /* context */) {
34 4 : }
35 : };
36 :
37 : // ===========================================================================
38 : // test definitions
39 : // ===========================================================================
40 : /* Test the initialization.*/
41 1 : TEST(MFXWorkerThread, test_init) {
42 1 : MFXWorkerThread::Pool g(4);
43 1 : }
44 :
45 : /* Test retrieving all tasks.*/
46 1 : TEST(MFXWorkerThread, test_get_all) {
47 1 : MFXWorkerThread::Pool g(4);
48 1 : MFXWorkerThread::Task* task1 = new TestTask();
49 1 : MFXWorkerThread::Task* task2 = new TestTask();
50 1 : MFXWorkerThread::Task* task3 = new TestTask();
51 1 : MFXWorkerThread::Task* task4 = new TestTask();
52 1 : g.add(task1);
53 1 : g.add(task2);
54 1 : g.add(task3);
55 1 : g.add(task4);
56 1 : g.waitAll();
57 1 : }
|