add some assertions

This commit is contained in:
Maximilian Keßler 2023-11-04 19:34:16 +01:00
parent a1862661e8
commit 05ab338cf2
Signed by: max
GPG key ID: BCC5A619923C0BA5
2 changed files with 6 additions and 0 deletions

View file

@ -23,6 +23,8 @@
*/
#include <stdexcept>
#include <cassert>
// Anonymous name spaces may be used to show the reader
// that a function will only be used in the current file.
namespace

View file

@ -40,6 +40,7 @@
*/
#include <vector>
#include <cassert>
/**
* Namespaces can be used in order to make sure different modules,
* possibly implemented by different people don't have classes/functions/...
@ -238,18 +239,21 @@ Node & Graph::node(NodeId const id)
inline
NodeId Graph::matched_neighbor(NodeId const id) const
{
assert(id <= num_nodes());
return _nodes[id].matched_neighbor;
}
inline
NodeId Graph::ear_or_root_neighbor(const ED::NodeId id) const
{
assert(id <= num_nodes());
return _nodes[id].ear_or_root_neighbor;
}
inline
NodeId Graph::root_of_ear_component(const ED::NodeId id) const
{
assert(id <= num_nodes());
return _nodes[id].root_of_ear_component;
}