// $Id: ScaleAtomicExpressionTest.m4,v 1.1 1999/11/15 05:36:20 leavens Exp leavens $

import lib.*;
import lib.atomic_expression.*;

public class ScaleAtomicExpressionTest extends Tester {

    public static void main(String [] argv) {
        System.out.println("");
        System.out.println("Test $RCSfile: ScaleAtomicExpressionTest.m4,v $ of $Date: 1999/11/15 05:36:20 $");
        System.out.println("");

        ScaleAtomicExpression sae = new ScaleAtomicExpression(3.0);
        ToString ts = new ToString();
        AtomicExpression myExp
            = new Expr(new Atom(new Double(4.0)),
                       new Expr(new Atom(new Double(2.0)), new Nil()));
        AtomicExpression bigger
            = new Expr(myExp, new Expr(myExp, new Nil()));
        AtomicExpression [] tests = { 
            new Nil(),
            new Atom(new Double(3.0)),
            myExp,
            bigger
        };
        String [] answers = { 
            "()",
            "9.0",
            "(12.0 . (6.0 . ()))",
            "((12.0 . (6.0 . ())) . ((12.0 . (6.0 . ())) . ()))"
        };
        for (int i = 0; i < tests.length; i++) {
            evalsTo("((AtomicExpression)(tests[i].visit(sae))).visit(ts)", ((AtomicExpression)(tests[i].visit(sae))).visit(ts), answers[i]);
        }

	testReport();
    }

}
