Assert against inconsistent numbers of arguments

This commit is contained in:
Patrick Lühne 2020-02-04 02:55:56 +01:00
parent 88274e4396
commit 09e16edbe4
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 6 additions and 0 deletions

View File

@ -225,6 +225,9 @@ impl Function
{
pub fn new(declaration: &std::rc::Rc<FunctionDeclaration>, arguments: Vec<Box<Term>>) -> Self
{
assert_eq!(declaration.arity, arguments.len(),
"function has a different number of arguments then declared");
Self
{
declaration: std::rc::Rc::clone(declaration),
@ -377,6 +380,9 @@ impl Predicate
{
pub fn new(declaration: &std::rc::Rc<PredicateDeclaration>, arguments: Vec<Box<Term>>) -> Self
{
assert_eq!(declaration.arity, arguments.len(),
"predicate has a different number of arguments then declared");
Self
{
declaration: std::rc::Rc::clone(declaration),