UnitTest: redesing to avoid #include ".cpp" in Xcode
Each unit test .cpp file is not a separate compilation unit in Xcode project like it is in Visual Studio. Hopefully, Visual Studio test tool still likes this arrangement. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -12,31 +12,25 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace UnitTests
|
||||
{
|
||||
constexpr size_t pool_capacity = 50;
|
||||
|
||||
TEST_CLASS(pool)
|
||||
void pool::test()
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(test)
|
||||
{
|
||||
using worker_t = unique_ptr<int>;
|
||||
using pool_t = stdex::pool<worker_t>;
|
||||
pool_t pool;
|
||||
list<thread> workers;
|
||||
for (auto n = thread::hardware_concurrency(); n--; ) {
|
||||
workers.push_back(thread([](_Inout_ pool_t& pool)
|
||||
{
|
||||
for (size_t n = 10000; n--; ) {
|
||||
worker_t el = pool.pop();
|
||||
if (!el)
|
||||
el.reset(new int(1));
|
||||
pool.push(std::move(el));
|
||||
}
|
||||
}, ref(pool)));
|
||||
}
|
||||
|
||||
for (auto& w : workers)
|
||||
w.join();
|
||||
using worker_t = unique_ptr<int>;
|
||||
using pool_t = stdex::pool<worker_t>;
|
||||
pool_t pool;
|
||||
list<thread> workers;
|
||||
for (auto n = thread::hardware_concurrency(); n--; ) {
|
||||
workers.push_back(thread([](_Inout_ pool_t& pool)
|
||||
{
|
||||
for (size_t n = 10000; n--; ) {
|
||||
worker_t el = pool.pop();
|
||||
if (!el)
|
||||
el.reset(new int(1));
|
||||
pool.push(std::move(el));
|
||||
}
|
||||
}, ref(pool)));
|
||||
}
|
||||
};
|
||||
|
||||
for (auto& w : workers)
|
||||
w.join();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user