Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/einTest/testNormalize.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/einTest/testNormalize.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2436, Sat Sep 21 15:57:18 2013 UTC revision 2437, Mon Sep 23 22:28:42 2013 UTC
# Line 8  Line 8 
8     structure ExN =ExamplesN     structure ExN =ExamplesN
9      in      in
10    
 (* Change current to true if you want to test normalize.sml*)  
11    
 val current=false;  
12    
13    fun test(e)=   (print"------------------ " ; P.printerE(e); print("     =>  ");  P.printerE(N.normalize(e));print" \n ------------------------")
14    
 fun test(e)=  print("")  
          (*   else (print" \n " ;print(P.printerE(e)); print("     =>  "); print(P.printerE(N.normalize(e)));print" \n ")  
 *)  
15    
16  fun create(b)= test(E.EIN{params=[], index=[], body=b})  fun create(b)= E.EIN{params=[], index=[], body=b}
17    
18    
19  (*-----Test more complicated terms in Normalize Function:normalize.sml---------------*)  (*-----Test more complicated terms in Normalize Function:normalize.sml---------------*)
 (*  
 val id= List.map test [ExN.dotGrad, ExN.dotCross,ExN.crossGrad,ExN.curlCurl]  
 val partials=List.map test [ ExN.S6, ExN.S7]  
 val epsSub=List.map test [ExN.S8,ExN.S9, ExN.S10,ExN.S11, ExN.S12]  
20    
21    fun run set=
22         let
23            val base=[]
24    
 (* --------Test Rewrite Rule in Normalize function: normalize.sml--------*)  
25    
26  val rules1= List.map create [ExN.R1,ExN.R2,ExN.R3, ExN.R4,ExN.R5,ExN.R7, ExN.R8, ExN.R9]          val r1= List.map create [ExN.R1,ExN.R2,ExN.R3, ExN.R4,ExN.R5,ExN.R7, ExN.R8, ExN.R9]
27  (*Test R5 change eps to delts*)  (*Test R5 change eps to delts*)
28  val rule10= List.map create [ExN.R10, ExN.R10b,ExN.R10c,ExN.R10d, ExN.R10e, ExN.R10f]          val r2= List.map create [ExN.R10, ExN.R10b,ExN.R10c,ExN.R10d, ExN.R10e, ExN.R10f]
29  val eps= List.map test[ExN.S9,ExN.S10,ExN.S11,ExN.S12]                  (*dels*)
30  val dels=List.map create [ExN.R11, ExN.R11b, ExN.R11c, ExN.R11d, ExN.R11e, ExN.R11f, ExN.R11g, ExN.R11h, ExN.R11i, ExN.R11j, ExN.R11k ,ExN.R11l, ExN.R11m, ExN.R11n, ExN.R11o ,ExN.R11p, ExN.R11q, ExN.R11r]          val r3=List.map create [ExN.R11, ExN.R11b, ExN.R11c, ExN.R11d, ExN.R11e, ExN.R11f, ExN.R11g, ExN.R11h, ExN.R11i, ExN.R11j, ExN.R11k ,ExN.R11l, ExN.R11m, ExN.R11n, ExN.R11o ,ExN.R11p, ExN.R11q, ExN.R11r]
31  val rules3=List.map create [ExN.sR12,ExN.sR13,ExN.sR14, ExN.sR14b, ExN.sR14c]          val r4=List.map create [ExN.sR12,ExN.sR13,ExN.sR14, ExN.sR14b, ExN.sR14c]
32  *)  
33            val s1=  [ExN.dotGrad, ExN.dotCross,ExN.crossGrad,ExN.curlCurl]
34            val s2=[ ExN.S6, ExN.S7]
35            val s3=[ExN.S8,ExN.S9, ExN.S10,ExN.S11, ExN.S12]
36    
37        in
38            if(set=0) then List.map test base
39            else if(set=1) then List.map test r1
40            else if(set=2) then List.map test r2
41            else if(set=3) then List.map test r3
42            else if(set=4) then List.map test r4
43    
44            else if(set=5) then List.map test s1
45            else if(set=6) then List.map test s2
46            else if(set=7) then List.map test s3
47            else List.map test base
48        end
49    
50    val r=run 0
51    
52    
53    
 (*not written R6*)  
54    
55    
56    

Legend:
Removed from v.2436  
changed lines
  Added in v.2437

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0