#ifndef POKEMONSCRIPTTESTER_TESTENVIRONMENT_HPP #define POKEMONSCRIPTTESTER_TESTENVIRONMENT_HPP struct TestEnvironment { size_t TotalRequirements = 0; size_t FailedRequirements = 0; template void AddGarbage(T* data) { _garbage.Append(GarbageObject(data)); } void CollectGarbage() { for (auto& o : _garbage) { o.Destructor(o.Ptr); } _garbage.Clear(); } private: struct GarbageObject { void* Ptr; std::function Destructor; template GarbageObject(T* ptr) { Ptr = ptr; Destructor = [](void* v) { delete static_cast(v); }; } }; ArbUt::List _garbage; }; #endif // POKEMONSCRIPTTESTER_TESTENVIRONMENT_HPP