View Javadoc

1   /*
2    * PropDispatch_Test.java
3    *
4    * Created on July 24, 2007, 12:05 PM
5    *
6    * $Id: PropDispatch_Test.java,v 1.1.1.1 2010/04/08 20:38:00 jeremy Exp $
7    */
8   
9   package org.lcsim.recon.tracking.trfbase;
10  
11  import junit.framework.TestCase;
12  import org.lcsim.recon.tracking.trfutil.Assert;
13  
14  /**
15   *
16   * @author Norman Graf
17   */
18  public class PropDispatch_Test extends TestCase
19  {
20      private boolean debug;
21      /** Creates a new instance of PropDispatch_Test */
22      public void testPropDispatch()
23      {
24          String ok_prefix = "PropDispatch test (I): ";
25          String error_prefix = "PropDispatch test (E): ";
26          
27          if(debug) System.out.println( ok_prefix
28                  + "------- Testing component PropDispatch. -------" );
29          
30          //********************************************************************
31          
32          if(debug) System.out.println( ok_prefix + "Test constructor."  );
33          
34          SimplePropTest ptest_prop0 = new SimplePropTest();
35          
36          if(debug) System.out.println( ptest_prop0 );
37          
38          PropDispatch tprop = new PropDispatch();
39          Surface surf = new SurfTest(3.0);
40          String stype = surf.pureType();
41          
42          int stat = tprop.addPropagator(stype,stype,ptest_prop0);
43          Assert.assertTrue( stat == 0 );
44          stat = tprop.addPropagator(stype,stype,ptest_prop0);
45          Assert.assertTrue( stat != 0 );
46          if(debug) System.out.println( "***tprop= \n"+tprop );
47          
48          //********************************************************************
49          
50          if(debug) System.out.println( ok_prefix + "Test propagation."  );
51          Surface tsrf1 = new SurfTest(1.0);
52          VTrack trv1 = new VTrack(  tsrf1.newPureSurface()  );
53          ETrack tre1 = new ETrack(  tsrf1.newPureSurface()  );
54          Surface tsrf2= new SurfTest(2.0);
55          
56          tprop.vecProp(trv1,tsrf2);
57          if(debug) System.out.println(ptest_prop0.get_flag());
58          Assert.assertTrue( ptest_prop0.get_flag() == 1 );
59          tprop.errProp(tre1,tsrf2);
60          Assert.assertTrue( ptest_prop0.get_flag() == 2 );
61          tprop.vecDirProp(trv1,tsrf2,PropDir.NEAREST);
62          Assert.assertTrue( ptest_prop0.get_flag() == 3 );
63          tprop.errDirProp(tre1,tsrf2,PropDir.NEAREST);
64          Assert.assertTrue( ptest_prop0.get_flag() == 4 );
65          
66          //********************************************************************
67          
68          if(debug) System.out.println( ok_prefix
69                  + "------------- All tests passed. -------------" );
70          
71          
72          //********************************************************************        
73      }
74      
75  }