java-tests: minor changes preparing tryMatch
authorwneuper
Tue, 14 Jun 2005 17:26:39 +0200
changeset 23925895e82fac98
parent 2391 59a60ef2a2c8
child 2393 9c8703317ad6
java-tests: minor changes preparing tryMatch
src/java-tests/isac/bridge/TestBridgeSpecify.java
src/java-tests/isac/functest/problems/TestProblemHierarchy.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/java-tests/isac/bridge/TestBridgeSpecify.java	Tue Jun 14 17:26:39 2005 +0200
     1.3 @@ -0,0 +1,103 @@
     1.4 +/*
     1.5 + * @author Walther Neuper, member of the ISAC-team, 
     1.6 + * Copyright (c) 2005 by Walther Neuper
     1.7 + * created Jun 10, 2005 10:44:45 AM
     1.8 + * Institute for Softwaretechnology, Graz University of Technology, Austria.
     1.9 + * 
    1.10 + * Use is subject to PGPL license terms.
    1.11 + */
    1.12 +package isac.bridge;
    1.13 +
    1.14 +import isac.kestore.KEStoreServices;
    1.15 +import isac.util.CalcChangedEvent;
    1.16 +import isac.util.Formalization;
    1.17 +import isac.util.formulae.CalcFormula;
    1.18 +import isac.util.formulae.CalcHead;
    1.19 +import isac.util.formulae.CalcHeadCompoundID;
    1.20 +import isac.util.formulae.Position;
    1.21 +import isac.util.interfaces.ICalcIterator;
    1.22 +import isac.util.interfaces.IToCalc;
    1.23 +import isac.util.interfaces.IToUser;
    1.24 +import isac.util.parser.FormalizationDigest;
    1.25 +import isac.util.tactics.Tactic;
    1.26 +
    1.27 +import java.io.File;
    1.28 +import java.io.FileInputStream;
    1.29 +import java.io.IOException;
    1.30 +import java.io.ObjectInputStream;
    1.31 +import java.util.Vector;
    1.32 +
    1.33 +import junit.framework.TestCase;
    1.34 +
    1.35 +/**
    1.36 + * tests kernel in the specify-phase
    1.37 + * 
    1.38 + * @author Walther Neuper
    1.39 + * @version 1.0
    1.40 + */
    1.41 +public class TestBridgeSpecify extends TestCase {
    1.42 +
    1.43 +    /**
    1.44 +     * test match and refine with x^^^2 + 4*x + 5 = 2
    1.45 +     * sml/systest/FE-interface.sml --- tryMatchProblem, tryRefineProblem ---
    1.46 +     */
    1.47 +    public void testMatchRefine() throws Exception {
    1.48 +        System.out
    1.49 +                .println("---BEGIN isac.bridge.TestBridgeSpecify#testMatchRefine");
    1.50 +
    1.51 +        //load the file of the example,
    1.52 +        //see TestKEStoreServices#testLoadContentMinisubpbl
    1.53 +        KEStoreServices ks = new KEStoreServices("isac/xmldata");
    1.54 +        Vector vec = ks.loadContent("exp", "exp_IsacCore_Tests_1d.xml");
    1.55 +        //parse out the Formalization
    1.56 +        //see TestFormalizationDigest#testParseExplMini
    1.57 +        String xmlstr = (String) vec.firstElement();
    1.58 +        FormalizationDigest fd = new FormalizationDigest();
    1.59 +        Formalization fmz = fd.parseFormalization((String) xmlstr);
    1.60 +        System.out.println(".end step_a-----");
    1.61 +        //end step_a ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.62 +
    1.63 +        //start the calculation
    1.64 +        MathEngine.init("localhost");
    1.65 +        MathEngine me = MathEngine.getMathEngine();
    1.66 +
    1.67 +        IToCalc ct = me.startCalculation(fmz);
    1.68 +
    1.69 +        IToUser user = new MockIToUser();
    1.70 +        ct.addDataChangeListener(user);
    1.71 +        CalcChangedEvent cce = null;
    1.72 +        System.out.println(".end step_b-----");
    1.73 +        //end step_b
    1.74 +        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.75 +
    1.76 +        //fill the CalcHead with Descriptions: tac = Model_Problem ...
    1.77 +        Tactic tac = ct.fetchProposedTactic();
    1.78 +        ct.setNextTactic(tac);
    1.79 +        //tac = Add_Given "equality (x ^^^ 2 + 4 * x + 5 = 2)"
    1.80 +        tac = ct.fetchProposedTactic();
    1.81 +        ct.setNextTactic(tac);
    1.82 +        //end step_c
    1.83 +        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.84 +
    1.85 +        //trymatch ... go into the problem-hierarchy
    1.86 +        //TOOODO GOON.WN050610
    1.87 +        CalcHead ch = new CalcHead();
    1.88 +        CalcHeadCompoundID id = new CalcHeadCompoundID();
    1.89 +        id.addString("univariate");
    1.90 +        id.addString("equation");
    1.91 +        //        ct.tryMatch(ch, id);//nullPointerExn !!!!!!!!!!!!!!!!!!!
    1.92 +        System.out.println(".d: id = " + id.toSMLString());
    1.93 +
    1.94 +        //WN050610 es hier NICHT um das CalcHead: 
    1.95 +        //CalcHead im ct NICHT geaendert durch tryMatch !!!
    1.96 +        //aber dass Model in pbl-hierarchie soll genaus aussehen !
    1.97 +        ICalcIterator ci = ct.getActiveFormula();
    1.98 +        ch = (CalcHead) ci.getFormula();
    1.99 +        System.out.println(".d: CalcHead = " + ch.toSMLString());
   1.100 +        //end step_d
   1.101 +        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1.102 +
   1.103 +        System.out
   1.104 +                .println("---END isac.bridge.TestBridgeSpecify#testMatchRefine");
   1.105 +    }
   1.106 +}
   1.107 \ No newline at end of file
     2.1 --- a/src/java-tests/isac/functest/problems/TestProblemHierarchy.java	Tue Jun 14 17:22:50 2005 +0200
     2.2 +++ b/src/java-tests/isac/functest/problems/TestProblemHierarchy.java	Tue Jun 14 17:26:39 2005 +0200
     2.3 @@ -8,10 +8,9 @@
     2.4  
     2.5  import junit.framework.TestCase;
     2.6  
     2.7 -
     2.8  /**
     2.9   * @author jloinig
    2.10 - *
    2.11 + *  
    2.12   */
    2.13  public class TestProblemHierarchy extends TestCase {
    2.14  
    2.15 @@ -21,8 +20,12 @@
    2.16       * uses a WEB-Browser to gain an overview of \sisac s problem hierarchy, for
    2.17       * instance, see p.\pageref{3D-math}.
    2.18       * 
    2.19 -     * @todo implement
    2.20 +     * TOOODO implement
    2.21 +     * 
    2.22       * @author JL
    2.23 +     * @see isac.gui.browser.TestProblemBrowserPanel (WN050610 this link may be
    2.24 +     *      moved into future testcases which will be 'deeper' in technical
    2.25 +     *      details)
    2.26       * @version $Revision$
    2.27       */
    2.28      public void testOverviewOfProblems() {