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 2495, Wed Oct 23 21:28:25 2013 UTC revision 2496, Tue Oct 29 05:29:46 2013 UTC
# Line 8  Line 8 
8      structure X =ExamplesN      structure X =ExamplesN
9  structure XS =ExamplesS  structure XS =ExamplesS
10    
     structure equal=equal  
11      in      in
12    
13    
14    val x=[1]
15    
16    
17    val line="\n ------------------ "
18    
19    fun test(e)= let val n=N.normalize(e)
20  fun isEinEqual(E.EIN{params, index, body},body2)=equal.isEqual(body,body2)  in (print line;print(P.printerE(e)); print "=>";print( P.printerE(n)); print line;n)
21        end
   
   
   
 fun test(e)=   (print"------------------ " ; P.printerE(e);  
 let val n=N.normalize(e) in (P.printerE(n);n) end )  
22    
23    
24  fun create(b)= E.EIN{params=[], index=[], body=b}  fun create(b)= E.EIN{params=[], index=[], body=b}
25    
26    fun tester(e)=  List.map (fn(e1)=>test(create e1)) e
   
   
 fun tester(e)=  List.map (fn(e1)=>  
 let val norm=test(create e1) in (print" \n ------------------------";norm )end)    e  
   
 fun tester2(e)=  List.map (fn(e1)=>  
 let val norm=test(e1) in (print" \n ------------------------"; norm)   end )    e  
   
   
   
   
 fun testerEqual(e)=  
     List.map (fn(e1,e2)=>  
         let val einexp=(create e1)  
         val line="\n ------------------ "  
         val linep=(print line; P.printerE einexp)  
         val norm=N.normalize(einexp)  
         val seq=isEinEqual(norm,e2)  
         in (if(seq>0) then print "FAIL \n" else print "PASS \n")  
         end) e  
   
27    
28    
29    
# Line 58  Line 33 
33      let      let
34      val base=[]      val base=[]
35    
36      val r3=[X.R3b,X.R3c,X.R3d]      val r1=[X.probe1,X.probe2,X.probe3,X.probe4,X.probe5,X.probe6,X.probe7]
37      val r1=[X.R1,X.R1b,X.R1c,X.R1d,X.R1e]      val r2=[X.probe8,X.probe9,X.probe10,X.probe11,X.probe12,X.probe13]
38      val r2=[X.R2,X.R2b,X.R2c,X.R2d,X.R2e,X.R2f]      val r3=[X.sum1,X.sum2,X.sum3,X.sum4,X.sum5,X.sum6]
39      val r4=[X.R4,X.R4b,X.R4c,X.R4d,X.R4e,X.R4f,X.R4g, X.R4h]      val r4=[X.sum7,X.sum8,X.sum9,X.sum10,X.sum11,X.sum12,X.sum13,X.sum14]
40      val r5=[X.R5,X.R5b]      val r5=[X.sum15,X.sum16,X.sum17,X.sum18,X.sum19,X.sum20,X.sum21,X.sum22,X.sum23]
41      val r6=[X.R6,X.R6b,X.R6c,X.R6d,X.R6e]      val r6=[X.sum24,X.sum25,X.sum26,X.sum27,X.sum28]
42      val r7=[X.R7,X.R7b,X.R7c,X.R7d,X.R7e]      val r7=[X.prod1,X.prod2,X.prod3,X.prod4,X.prod5]
43      val r8=[X.R8,X.R8b,X.R8c,X.R8d,X.R8e]      val r8=[X.prod6,X.prod7,X.prod8,X.prod9,X.prod10]
44      val r9=[X.R9,X.R9b,X.R9c,X.R9d]      val r9=[X.apply1,X.apply2,X.apply3,X.apply4,X.apply5,X.apply6]
45        val r10=[X.apply7,X.apply8,X.apply9,X.apply10,X.apply11,X.apply12]
46      (*val r10=[X.R10, X.R10a,X.R10b, X.R10c,X.R10d, X.R10e, X.R10f,X.R10g,X.R10h,X.R10i]*)      val r11=[X.apply13,X.apply14,X.apply15,X.apply16,X.apply17,X.apply18]
47        val r12=[X.applysum1,X.applysum2,X.applysum3,X.applysum4,X.applysum5,X.applysum6,X.applysum7]
     val r10 =[X.R10f, X.R10h]  
     val r11=[X.R11,X.R11b, X.R11c, X.R11d, X.R11e]  
     val r12=[X.R12,X.R12b, X.R12c, X.R12d,X.R12e,X.R12f, X.R12g, X.R12h,X.R12i,X.R12j, X.R12k, X.R12l,X.R12m,X.R12n, X.R12o, X.R12p,X.R12q, X.R12r]  
     val r13=[X.R13, X.R13b, X.R13c]  
     val r14=[X.R14, X.R14b, X.R14c]  
     val s1=[XS.dotGrad, XS.dotCross,XS.crossGrad,XS.curlCurl]  
     val s2=[XS.S6, XS.S7, XS.S8, XS.S9]  
    val s3=[XS.S10, XS.S11, XS.S12]  
48    
49      val r=   if(set=1) then tester r1      val r=   if(set=1) then tester r1
50          else if(set=2) then tester r2          else if(set=2) then tester r2
# Line 91  Line 58 
58          else if(set=10) then tester r10          else if(set=10) then tester r10
59          else if(set=11) then tester r11          else if(set=11) then tester r11
60          else if(set=12) then tester r12          else if(set=12) then tester r12
         else if(set=13) then tester r13  
         else if(set=14) then tester r14  
         else if(set=21) then tester2 s1  
         else if(set=22) then tester2 s2  
         else if(set=23) then tester2 s3  
61          else  base          else  base
62      in      in
63          r          r
64      end      end
65    
66    
67    val r1=List.map run x
 (*Test Nnormalize, against should be answer*)  
 fun runEqual (set)=  
      let  
         val base=[]  
         val r3=[X.R3]  
         val r=if(set=3) then r3  
             else base  
   
     in  
       testerEqual r  
     end  
   
   
 (*Run test on normalzie*)  
 val r1=List.map run [10]  
   
 (*val r3=runEqual 0*)  
   
   
   
68    
69    
70    

Legend:
Removed from v.2495  
changed lines
  Added in v.2496

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