1
0
forked from Alepha/Alepha
Files
Alepha/Memory/ThreadSlab.test/0.cc

50 lines
1.1 KiB
C++

static_assert( __cplusplus > 2020'99 );
#include "../ThreadSlab.h"
#include <Alepha/Testing/test.h>
#include <Alepha/Utility/evaluation_helpers.h>
static auto init= Alepha::Utility::enroll <=[]
{
using namespace Alepha::Testing::literals;
using namespace Alepha::Memory::exports::ThreadSlab_m;
using String= ThreadSlab::String;
"Check slab usage"_test <=[]
{
std::cout << "I see " << Alepha::Memory::detail::ThreadSlab_m::shim::slab().reservation().use_count() << " reservations in a separate test." <<
std::endl;
};
"Can we work with simple `ThreadSlabStrings` without errors?"_test <=[]
{
String s;
std::cerr << "s is empty" << std::endl;
String s2= "Hello World";
std::cerr << "small hello world string." << std::endl;
String s3= s2 + ": and bob";
for( int i= 0; i < 10; ++i )
{
std::cerr << "appended..." << std::endl;
s3= s3 + s3 + s2;
s2= std::move( s3 );
}
std::cout << s3 << std::endl;
};
"Check slab usage"_test <=[]
{
std::cout << "I see " << Alepha::Memory::detail::ThreadSlab_m::shim::slab().reservation().use_count() << " reservations in a separate test." <<
std::endl;
};
};