xo-umbrella2/xo-alloc2/utest/Generation.test.cpp
Roland Conybeare 6a82040d48 git subrepo clone git@github.com:Rconybea/xo-alloc2.git xo-alloc2
subrepo:
  subdir:   "xo-alloc2"
  merged:   "4039c29f"
upstream:
  origin:   "git@github.com:Rconybea/xo-alloc2.git"
  branch:   "main"
  commit:   "4039c29f"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:01:14 -04:00

45 lines
1.2 KiB
C++

/** @file Generation.test.cpp
*
* @author Roland Conybeare, May 2026
**/
#include <xo/testutil/Utest.hpp>
#include "Generation.hpp"
#include <catch2/catch.hpp>
namespace xo {
using xo::mm::Generation;
using xo::mm::c_max_generation;
namespace ut {
TEST_CASE("Generation-1", "[Generation]")
{
auto log = Utest::ut_scope();
REQUIRE(Generation::nursery() == 0);
REQUIRE(Generation::g0() == 0);
REQUIRE(Generation::g1() == 1);
REQUIRE(Generation::sentinel() == c_max_generation);
REQUIRE(Generation::g0().is_sentinel() == false);
REQUIRE(Generation::g1().is_sentinel() == false);
REQUIRE(Generation::sentinel().is_sentinel());
REQUIRE(Generation::g0() != Generation::sentinel());
REQUIRE(Generation::g1() != Generation::sentinel());
REQUIRE(!(Generation::g0() > Generation::g1()));
REQUIRE(Generation::g1() > Generation::g0());
auto g = Generation::g0();
++g;
REQUIRE(g == Generation::g1());
++g;
REQUIRE(g > Generation::g1());
}
} /*namespace ut*/
} /*namespace xo*/
/* end Generation.test.cpp */