Mercurial > forge
changeset 2457:955ba5740a7f octave-forge
Embedded combinatorics tests in the code, as the checking code doesn't look in seperate files
author | adb014 |
---|---|
date | Sun, 10 Sep 2006 22:25:49 +0000 |
parents | 2b9d35e719d7 |
children | 180f668996de |
files | main/combinatorics/src/partcnt main/combinatorics/src/partint main/combinatorics/src/partition.cc |
diffstat | 3 files changed, 22 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/main/combinatorics/src/partcnt Sun Sep 10 22:17:06 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -## Copyright (C) 2006 Torsten Finke <fi@igh-essen.com> -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -# $Revision$ -# $Date$ -# $RCSfile$ - -%!assert(partcnt(1), 1); -%!assert(partcnt(17), 297); -%!fail("partcnt()", "partcnt"); -%!fail("partcnt(1,2)", "partcnt"); -%!fail("partcnt('xyz')", "partcnt"); -%!demo -%! p = partcnt([1, 5; 17 -5])
--- a/main/combinatorics/src/partint Sun Sep 10 22:17:06 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -## Copyright (C) 2006 Torsten Finke <fi@igh-essen.com> -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -# $Revision$ -# $Date$ -# $RCSfile$ - -%!assert(partint(1), 1); -%!assert(all(partint(n=17) * [1:n]' == n) - 1, 0); -%!fail("partint()", "partint"); -%!fail("partint(1,2)", "partint"); -%!fail("partint('xyz')", "partint"); -%!demo -%! p = partint(4)
--- a/main/combinatorics/src/partition.cc Sun Sep 10 22:17:06 2006 +0000 +++ b/main/combinatorics/src/partition.cc Sun Sep 10 22:25:49 2006 +0000 @@ -116,6 +116,18 @@ return r; } +/* + +%!assert(partcnt(1), 1); +%!assert(partcnt(17), 297); +%!fail("partcnt()", "partcnt"); +%!fail("partcnt(1,2)", "partcnt"); +%!fail("partcnt('xyz')", "partcnt"); +%!demo +%! p = partcnt([1, 5; 17 -5]) + +*/ + DEFUN_DLD (partint, args, , "-*- texinfo -*-\n\ @deftypefn{Loadable Function} {@var{p} =} partint(@var{n})\n\ @@ -205,7 +217,17 @@ return r; } +/* +%!assert(partint(1), 1); +%!assert(all(partint(n=17) * [1:n]' == n) - 1, 0); +%!fail("partint()", "partint"); +%!fail("partint(1,2)", "partint"); +%!fail("partint('xyz')", "partint"); +%!demo +%! p = partint(4) + +*/ /* ;;; Local Variables: ***