diff --git a/cpp/include/resolvo_dependency_provider.h b/cpp/include/resolvo_dependency_provider.h index 5f56c9c..8cd9258 100644 --- a/cpp/include/resolvo_dependency_provider.h +++ b/cpp/include/resolvo_dependency_provider.h @@ -18,6 +18,8 @@ using cbindgen_private::VersionSetId; * An interface that implements ecosystem specific logic. */ struct DependencyProvider { + virtual ~DependencyProvider() = default; + /** * Returns a user-friendly string representation of the specified solvable. * diff --git a/cpp/tests/solve.cpp b/cpp/tests/solve.cpp index 92dad7f..ffb8c66 100644 --- a/cpp/tests/solve.cpp +++ b/cpp/tests/solve.cpp @@ -167,6 +167,11 @@ SCENARIO("Solve") { /// Construct a database with packages a, b, and c. PackageDatabase db; + // Check that PackageDatabase correctly implements the DependencyProvider interface + static_assert(std::has_virtual_destructor_v); + static_assert(std::is_polymorphic_v); + static_assert(std::is_base_of_v); + auto a_1 = db.alloc_candidate("a", 1, {{db.alloc_requirement("b", 1, 4)}, {}}); auto a_2 = db.alloc_candidate("a", 2, {{db.alloc_requirement("b", 1, 4)}, {}}); auto a_3 = db.alloc_candidate("a", 3, {{db.alloc_requirement("b", 4, 7)}, {}});