xo-alloc2: tidy for ++ utest coverage
This commit is contained in:
parent
b64940fa0a
commit
8459c883f1
8 changed files with 39 additions and 1 deletions
|
|
@ -159,11 +159,13 @@ namespace xo {
|
|||
* zero @p z.
|
||||
**/
|
||||
virtual value_type sub_alloc(Opaque d, size_type z, bool complete_flag) const = 0;
|
||||
#ifdef OBSOLETE
|
||||
/** Allocate copy of an existing object @p src.
|
||||
* Existing object must be contained in @p d.
|
||||
* NOTE: load bearing for copying garbage collector.
|
||||
**/
|
||||
virtual value_type alloc_copy(Opaque d, value_type src) const = 0;
|
||||
#endif
|
||||
/** reset allocator @p d to empty state. **/
|
||||
virtual void clear(Opaque d) const = 0;
|
||||
/** assign helper for allocator that may require a write barrier
|
||||
|
|
|
|||
|
|
@ -58,7 +58,9 @@ namespace xo {
|
|||
[[noreturn]] value_type alloc(Opaque, typeseq, std::size_t) const override { _fatal(); }
|
||||
[[noreturn]] value_type super_alloc(Opaque, typeseq, std::size_t) const override { _fatal(); }
|
||||
[[noreturn]] value_type sub_alloc(Opaque, std::size_t, bool) const override { _fatal(); }
|
||||
#ifdef OBSOLETE
|
||||
[[noreturn]] value_type alloc_copy(Opaque, value_type) const override { _fatal(); }
|
||||
#endif
|
||||
[[noreturn]] void clear(Opaque) const override { _fatal(); }
|
||||
[[noreturn]] void barrier_assign_aux(Opaque,
|
||||
void *,
|
||||
|
|
|
|||
|
|
@ -75,8 +75,10 @@ namespace xo {
|
|||
bool complete_flag) const override {
|
||||
return I::sub_alloc(_dcast(d), z, complete_flag);
|
||||
}
|
||||
#ifdef OBSOLETE
|
||||
value_type alloc_copy(Opaque d,
|
||||
value_type src) const override { return I::alloc_copy(_dcast(d), src); }
|
||||
#endif
|
||||
void clear(Opaque d) const override { return I::clear(_dcast(d)); }
|
||||
void barrier_assign_aux(Opaque d,
|
||||
void * parent,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ set(UTEST_SRCS
|
|||
# Collector.test.cpp
|
||||
# DX1CollectorIterator.test.cpp
|
||||
Generation.test.cpp
|
||||
VisitReason.test.cpp
|
||||
dp.test.cpp
|
||||
random_allocs.cpp
|
||||
)
|
||||
|
|
|
|||
26
xo-alloc2/utest/VisitReason.test.cpp
Normal file
26
xo-alloc2/utest/VisitReason.test.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/** @file VisitReason.test.cpp
|
||||
*
|
||||
* @author Roland Conybeare, May 2026
|
||||
**/
|
||||
|
||||
#include <xo/alloc2/VisitReason.hpp>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::VisitReason;
|
||||
|
||||
namespace ut {
|
||||
|
||||
TEST_CASE("visitreason-1", "[visitreason]")
|
||||
{
|
||||
REQUIRE(VisitReason::unspecified() == VisitReason::unspecified());
|
||||
|
||||
REQUIRE(VisitReason::unspecified() != VisitReason::forward());
|
||||
REQUIRE(VisitReason::unspecified() != VisitReason::verify());
|
||||
REQUIRE(VisitReason::forward() != VisitReason::verify());
|
||||
}
|
||||
|
||||
} /*namespace ut*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end VisitReason.test.cpp */
|
||||
|
|
@ -607,7 +607,8 @@ namespace xo {
|
|||
|
||||
auto
|
||||
DX1Collector::alloc_copy(value_type src) noexcept -> value_type {
|
||||
return with_facet<AAllocator>::mkobj(this->new_space()).alloc_copy(src);
|
||||
return this->new_space()->alloc_copy(src);
|
||||
//return with_facet<AAllocator>::mkobj(this->new_space()).alloc_copy(src);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ namespace xo {
|
|||
using xo::mm::CollectorTypeRegistry;
|
||||
using xo::mm::AAllocator;
|
||||
using xo::mm::ACollector;
|
||||
using xo::mm::ICollector_Any;
|
||||
using xo::mm::AGCObject;
|
||||
using xo::mm::X1CollectorConfig;
|
||||
using xo::mm::DX1Collector;
|
||||
|
|
@ -59,6 +60,7 @@ namespace xo {
|
|||
REQUIRE(!gc1);
|
||||
REQUIRE(gc1.iface() != nullptr);
|
||||
REQUIRE(gc1.data() == nullptr);
|
||||
REQUIRE(gc1._typeseq() == typeseq::id<ICollector_Any>());
|
||||
}
|
||||
|
||||
TEST_CASE("DX1Collector-1", "[alloc2][gc][DX1Collector]")
|
||||
|
|
|
|||
|
|
@ -179,6 +179,8 @@ namespace xo {
|
|||
obj<AAllocIterator> ix = range.begin();
|
||||
obj<AAllocIterator> end_ix = range.end();
|
||||
|
||||
REQUIRE(ix._typeseq() == typeseq::id<DArenaIterator>());
|
||||
REQUIRE(end_ix._typeseq() == typeseq::id<DArenaIterator>());
|
||||
REQUIRE(ix.iface());
|
||||
REQUIRE(ix.data());
|
||||
REQUIRE(end_ix.iface());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue