#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vi:ts=4:et
# $Date: 2003/08/10 02:08:44 $
# $Revision: 1.1 $
# =====================================================
"""Test script for combination.py"""

import young

def _test():
    # test

    # factorial
    print "factorial"
    print "factorial(5):",young.factorial(5)
    print "factorial(5,3):",young.factorial(5,3)

    # permutation
    print
    print "permutation"
    seq = tuple('abc')
    print "permutation of", seq
    for a in young.permutation(seq):
        print a

    # use arbitrary argument lists
    print "permutation of", range(3)
    print young.permutation(range(3))       # use arbitrary argument lists

    # combination
    print
    print "combination"
    seq = tuple('math')
    print "out of", seq
    print "take 2 element"
    for a in young.combination(seq, 2):
        print a

    print "combination of (5,2):",
    print young.combination(5,2)

    # Catalan number
    print
    print "Catalan number"
    for i in range(1, 6):
        print "catalan(%d) :"%i,
        print young.catalan(i)

    return


if __name__ == '__main__':
    _test()
