Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/unittest/src/utils/foxtools/MFXWorkerThreadTest.cpp
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 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
class TestTask : public MFXWorkerThread::Task {
32
public:
33
void run(MFXWorkerThread* /* context */) {
34
}
35
};
36
37
// ===========================================================================
38
// test definitions
39
// ===========================================================================
40
/* Test the initialization.*/
41
TEST(MFXWorkerThread, test_init) {
42
MFXWorkerThread::Pool g(4);
43
}
44
45
/* Test retrieving all tasks.*/
46
TEST(MFXWorkerThread, test_get_all) {
47
MFXWorkerThread::Pool g(4);
48
MFXWorkerThread::Task* task1 = new TestTask();
49
MFXWorkerThread::Task* task2 = new TestTask();
50
MFXWorkerThread::Task* task3 = new TestTask();
51
MFXWorkerThread::Task* task4 = new TestTask();
52
g.add(task1);
53
g.add(task2);
54
g.add(task3);
55
g.add(task4);
56
g.waitAll();
57
}
58
59