LUMIERA.clone/tests/vault/gear/work-force-test.cpp

115 lines
2.5 KiB
C++

/*
WorkForce(Test) - verify worker thread service
Copyright (C) Lumiera.org
2023, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *****************************************************/
/** @file work-force-test.cpp
** unit test \ref WorkForce_test
*/
#include "lib/test/run.hpp"
#include "vault/gear/work-force.hpp"
//#include "lib/time/timevalue.hpp"
//#include "lib/format-cout.hpp"
//#include "lib/util.hpp"
//#include <utility>
//#include <chrono>
#include <thread>
using test::Test;
//using std::move;
//using util::isSameObject;
namespace vault{
namespace gear {
namespace test {
using std::this_thread::sleep_for;
using namespace std::chrono_literals;
// using lib::time::FrameRate;
// using lib::time::Offset;
// using lib::time::Time;
/*************************************************************************//**
* @test WorkForce-Service: maintain a pool of active worker threads.
* @see SchedulerUsage_test
*/
class WorkForce_test : public Test
{
virtual void
run (Arg)
{
simpleUsage();
walkingDeadline();
setupLalup();
}
/** @test demonstrate simple worker pool usage
*/
void
simpleUsage()
{
uint check{0};
WorkForce wof{[&]{ ++check; return true; }};
CHECK (0 == check);
wof.activate();
sleep_for(20ms);
CHECK (0 < check);
}
/** @test TODO
*/
void
walkingDeadline()
{
}
/** @test TODO
*/
void
setupLalup()
{
}
};
/** Register this test class... */
LAUNCHER (WorkForce_test, "unit engine");
}}} // namespace vault::mem::test