using namespace std;

/////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE("variant_array_view::ctor", "[variant_array_view]")
{
   SECTION("empty")
   {
        variant_array_view a;
        CHECK(a.is_valid() == false);

        variant_array_view b(a);
        CHECK(b.is_valid() == false);

        variant var;
        variant_array_view c = var.create_array_view();

        CHECK(c.is_valid() == false);
        CHECK(c.is_dynamic() == false);
        CHECK(c.get_rank_type(0).is_valid() == false);
        CHECK(c.get_rank() == 0);
        CHECK(c.get_type().is_valid() == false);
        CHECK(c.get_size() == 0);
        CHECK(c.get_size(0) == 0);
        CHECK(c.get_size(0, 0) == 0);
        CHECK(c.get_size_variadic({}) == 0);

        CHECK(c.set_size(0) == false);
        CHECK(c.set_size(0, 0) == false);
        CHECK(c.set_size(0, 0, 0) == false);
        CHECK(c.set_size_variadic(0, {}) == false);
            policy::prop::bind_as_ptr
        )
        ;
}

/////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE("property - class - get/set - bind_as_ptr - array", "[property]")
{
    property_member_policy obj;
    type prop_type = type::get(obj);
    property array_prop = prop_type.get_property("array");

    REQUIRE(array_prop.is_array() == true);
    variant array_obj = array_prop.get_value(obj); // the array is returned by pointer
    variant_array_view vec_array = array_obj.create_array_view();
    REQUIRE(vec_array.is_valid() == true);
    REQUIRE(array_obj.is_type<std::vector<int>*>() == true);
    REQUIRE(array_obj.get_value<std::vector<int>*>() == &obj._array);
}

/////////////////////////////////////////////////////////////////////////////////////////

TEST_CASE("property - class - get/set - bind_as_ptr - raw_array", "[property]")
{
    property_member_policy obj;
    type prop_type = type::get(obj);

    property array_prop = prop_type.get_property("raw_array");
    REQUIRE(array_prop.is_array() == true);
    variant array_obj = array_prop.get_value(obj); // the array is returned by pointer