#include "TestHeader.hpp"
#include <Core/SharedArray.hpp>


TEST_CASE("Shared Array Basics", "[shared_array]")
{
  test_allocator _Allocator;
  allocator_interface* Allocator = &_Allocator;

  shared_array<int> Arr{};
  Arr.Allocator = Allocator;

  REQUIRE( Arr.Num() == 0 );

  SECTION("Reserve")
  {
    Reserve(Arr, 10);
    REQUIRE( Arr.Num() == 0 );
    REQUIRE( Arr.Capacity() >= 10 );
    REQUIRE( Arr.Ptr() != nullptr );
  }

  SECTION("PushBack")
  {
    Expand(Arr) = 42;
    REQUIRE( Arr.Num() == 1 );
    REQUIRE( Arr[0] == 42 );
  }
}

TEST_CASE("Shared Array Reserve", "[shared_array]")