Fixes cvc5/cvc5-projects#380
CVC5_API_CHECK_NOT_NULL;
CVC5_API_CHECK(isDatatype()) << "Not a datatype sort.";
//////// all checks before this line
- return d_type->getNumChildren() - 1;
+ return d_type->isParametricDatatype() ? d_type->getNumChildren() - 1 : 0;
////////
CVC5_API_TRY_CATCH_END;
}
CVC5ApiException);
}
+TEST_F(TestApiBlackSolver, getDatatypeArity)
+{
+ DatatypeConstructorDecl ctor1 = d_solver.mkDatatypeConstructorDecl("_x21");
+ DatatypeConstructorDecl ctor2 = d_solver.mkDatatypeConstructorDecl("_x31");
+ Sort s3 = d_solver.declareDatatype(std::string("_x17"), {ctor1, ctor2});
+ ASSERT_EQ(s3.getDatatypeArity(), 0);
+}
} // namespace test
} // namespace cvc5