forked from Alepha/Alepha
Dangit! Forgot the test.
This commit is contained in:
45
Atomic/Dropbox.test/0.cc
Normal file
45
Atomic/Dropbox.test/0.cc
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
static_assert( __cplusplus > 2023'00 );
|
||||||
|
|
||||||
|
#include "../Dropbox.h"
|
||||||
|
|
||||||
|
#include <Alepha/Testing/TableTest.h>
|
||||||
|
#include <Alepha/Testing/test.h>
|
||||||
|
|
||||||
|
#include <Alepha/Utility/enroll.h>
|
||||||
|
#include <Alepha/Utility/evaluate.h>
|
||||||
|
|
||||||
|
static auto init= Alepha::Utility::enroll <=[]
|
||||||
|
{
|
||||||
|
using namespace Alepha::Testing::exports;
|
||||||
|
using namespace Alepha::Testing::literals;
|
||||||
|
using namespace Alepha::Utility::exports::evaluate_m;
|
||||||
|
|
||||||
|
const std::string tooLong= "Supercalifragalisticexpialidocious and "
|
||||||
|
"Antidisestablishmentarianism";
|
||||||
|
|
||||||
|
"Does weight computation make sense for strings?"_test <=TableTest
|
||||||
|
<
|
||||||
|
[]( const std::string &init, const std::size_t sz )
|
||||||
|
{
|
||||||
|
std::string s= init;
|
||||||
|
if( sz ) s.reserve( sz );
|
||||||
|
return Alepha::Atomic::Dropbox_m::computeWeight( s );
|
||||||
|
}
|
||||||
|
>
|
||||||
|
::Cases
|
||||||
|
{
|
||||||
|
{ "Empty string, SSO", { "", 0 }, sizeof( std::string ) },
|
||||||
|
{ "Empty string, no SSO", { "", 1000 }, sizeof( std::string ) + 1000 },
|
||||||
|
|
||||||
|
{ "'Hello', SSO", { "Hello", 0 }, sizeof( std::string ) },
|
||||||
|
{ "'Hello', no SSO", { "Hello", 1000 }, sizeof( std::string ) + 1000 },
|
||||||
|
|
||||||
|
|
||||||
|
// This pair of cases are extremely sensitive to SSO implementation.
|
||||||
|
// If the SSO supports at least 16 bytes (including Null), then these pass.
|
||||||
|
{ "Hex digits, except for F, SSO", { "0123456789ABCDE", 0 }, sizeof( std::string ) },
|
||||||
|
{ "Hex digits, except for F, SSO", { "0123456789ABCDE", 1000 }, sizeof( std::string ) + 1000 },
|
||||||
|
|
||||||
|
{ "Too long", { tooLong, 0 }, sizeof( std::string ) + tooLong.capacity() },
|
||||||
|
};
|
||||||
|
};
|
1
Atomic/Dropbox.test/CMakeLists.txt
Normal file
1
Atomic/Dropbox.test/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
unit_test( 0 )
|
Reference in New Issue
Block a user