feat: add lab-rv32i-freertos-vector-raii card

This commit is contained in:
user
2026-07-21 19:14:20 +02:00
commit d1094e85f2
64 changed files with 33884 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
#include "freertos/vector_v1.hpp"
void copy_must_not_compile( const freertos::VectorV1 & source )
{
freertos::VectorV1 copy { source };
( void ) copy;
}
+43
View File
@@ -0,0 +1,43 @@
#include <cassert>
#include <type_traits>
#include "freertos/vector_v1.hpp"
static_assert( !std::is_copy_constructible< freertos::VectorV1 >::value );
static_assert( !std::is_copy_assignable< freertos::VectorV1 >::value );
static_assert( std::is_nothrow_move_constructible< freertos::VectorV1 >::value );
static_assert( std::is_nothrow_move_assignable< freertos::VectorV1 >::value );
int main()
{
freertos::VectorV1 source { 4U };
for( size_t index = 0U; index < source.size(); ++index )
{
source[ index ] = static_cast< double >( index + 1U );
}
double * const original = source.data();
freertos::VectorV1 destination { 2U };
double * const replaced = destination.data();
destination = static_cast< freertos::VectorV1 && >( source );
assert( source.empty() );
assert( source.data() == nullptr );
assert( destination.data() == original );
assert( destination.data() != replaced );
assert( destination.size() == 4U );
assert( destination[ 0 ] + destination[ 1 ] +
destination[ 2 ] + destination[ 3 ] == 10.0 );
freertos::VectorV1 final_owner {
static_cast< freertos::VectorV1 && >( destination ) };
assert( destination.empty() );
assert( destination.data() == nullptr );
assert( final_owner.data() == original );
final_owner = static_cast< freertos::VectorV1 && >( final_owner );
assert( final_owner.data() == original );
assert( final_owner.size() == 4U );
return 0;
}