#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vi:ts=4:et
# $Date: 2003/08/18 14:27:14 $
# $Revision: 1.3 $
# =====================================================
"""Test script for young.py"""

import young

def _test1():
    # calculate tableaux based on the partition

    p = (2,1,1)
    y = young.young(p)
    print y
    print "len       : %d"%len(y)
    print "size      : %d"%y.size()

    return

def _test2():
    # calculate tableaux based on the number

    number = 4
    y = young.young(number)
    # test of __repr__ in Young class
    for tbl in y:
        print tbl

    y.report()
    print "factorial of %d : %d"%(number, young.factorial(number))

def _test3():
    # use arbitrary argument lists
    # test for iterator module

    y = young.young(5,1,1)
    print y

    print "take(4)"
    y.take(4)
    print "drop(10)"
    y.drop(10)
    print "last(3)"
    y.last(3)

def _test_up_operation():
    # up operation of diagram

    print "\n===up operation==="

    y = young.young(1,1)
    print "original diagram"
    print y.get_partition()
    for i in range(3):
        y.up()
        print "upped diagram"
        print y.get_partition()

def _test_down_operation():
    # down operation of diagram

    print "\n===down operation==="

    y = young.young((2,1,1))
    print "original diagram"
    print y.get_partition()
    for i in range(4):
        y.down()
        print "downed diagram"
        print y.get_partition()


if __name__ == '__main__':
    _test1()
    _test2()
    _test3()
    _test_up_operation()
    _test_down_operation()


