ArrayMac > Function display > TEST_rm_2015_APL_Competition_R2

     ∇ r←TEST_rm_2015_APL_Competition_R2;ckFnExists;unless;aOk;aEq;on;chkFeature;ckObExists;chkFeatureLine;tfuuN;tfuu;urlV;fileN;scrpN;nsV;scrpTN;scrpNT;fileV;scrpT99;actV;errStr;nameF;fooF;tFooF;ckF
[1]   ⍝∇ 20150701/20150720 ra⌈ --()-- test "rm_2015_APL_Competition_R2"                                                                                                                                
[2]    test_start                                                                                                                                                                                      
[3]    r←0                                                                                                                                                                                             
[4]    unless←{(~⍵)/⍺}                                                                                                                                                                                 
[5]    aOk←#.Assert                                                                                                                                                                                    
[6]    aEq←#.AssertEq                                                                                                                                                                                  
[7]    on←{⍺ ⍵}                                                                                                                                                                                        
[8]    ⍝⍝--------                                                                                                                                                                                      
[9]    ckObExists←{(⍵ omrepl'missing "⍵"')AssertEq ⍺ on ⍬⍴⎕NC ⍵}                                                                                                                                       
[10]   ckFnExists←3∘ckObExists                                                                                                                                                                         
[11]   chkFeature←{⍺←0 ⋄ ('Requirement:',⍵)aEq 1 ⍺}                                                                                                                                                    
[12]   chkFeatureLine←{⍺←0 ⋄ ⍺ chkFeature'⍝⍝--'{(1+(⍬⍴⍴⍺)+⍬⍴where ⍺⍷⍵)↓⍵}(1 atpars 2⌷[1]qSI'')FNline ⍵}                                                                                               
[13]   ⍝⍝--                                                                                                                                                                                            
[14]   →XIT{⍺}r←1 ⍝⍝ test obsolete                                                                                                                                                                     
[15]                                                                                                                                                                                                   
[16]   tfuuN←'rm_2015_APL_Competition_R2'                                                                                                                                                              
[17]   :If 0                                                                                                                                                                                           
[18]       :If ~ckFnExists{⍵}tfuuN                                                                                                                                                                     
[19]           ⎕←APLPmtMFS tfuuN                                                                                                                                                                       
[20]           →XIT                                                                                                                                                                                    
[21]       :EndIf                                                                                                                                                                                      
[22]       tfuu←⍎tfuuN                                                                                                                                                                                 
[23]   :EndIf                                                                                                                                                                                          
[24]   ⍝⍝--                                                                                                                                                                                            
[25]   urlV←'http://www.dyalogaplcompetition.com/'                                                                                                                                                     
[26]                                                                                                                                                                                                   
[27]   fileN←'H:\ArrayMax\APL2015 Contest\2015 APL Problem Solving Competition Phase II Problems.pdf'                                                                                                  
[28]   →fail unless aOk qNExists fileN                                                                                                                                                                 
[29]   →fail unless 1 chkFeature'Get documentation on Phase II problems'                                                                                                                               
[30]   ⍝⍝.                                                                                                                                                                                             
[31]   :For nsV :In 'APL2015base.Problems' 'APL2015.Problems'                                                                                                                                          
[32]       :If ~9 ckObExists nsV                                                                                                                                                                       
[33]           ⎕←0 APLPmt nsV omrepl' ''⍵''⎕ns '''' '                                                                                                                                                  
[34]           ⎕←0 APLPmt ThisFN''                                                                                                                                                                     
[35]           →XIT                                                                                                                                                                                    
[36]       :EndIf                                                                                                                                                                                      
[37]   :EndFor                                                                                                                                                                                         
[38]   →fail unless 1 chkFeature'Put up a #.Problems. namespace'                                                                                                                                       
[39]   →fail unless 1 chkFeature'Put up a #.Problems999. namespace'                                                                                                                                    
[40]                                                                                                                                                                                                   
[41]   ⍝.                                                                                                                                                                                              
[42]   scrpN←'H:\ArrayMax\APL2015 Contest\Contest2015.dyalog'                                                                                                                                          
[43]   scrpTN←scrpN,'-t'                                                                                                                                                                               
[44]   scrpNT←'H:\ArrayMax\APL2015 Contest\Contest2015⍵.dyalog'                                                                                                                                        
[45]   →fail unless aEq scrpN on''omrepl scrpNT                                                                                                                                                        
[46]                                                                                                                                                                                                   
[47]   :If ~aOk qNExists scrpTN                                                                                                                                                                        
[48]       ⎕←APLPmt'qNcopy'on scrpN scrpTN                                                                                                                                                             
[49]       →fail                                                                                                                                                                                       
[50]   :EndIf                                                                                                                                                                                          
[51]   →fail unless 1 chkFeature'build script template'                                                                                                                                                
[52]   ⍝.                                                                                                                                                                                              
[53]   :If ~aEq{qTCLF qTCNL TEXTREPL(qTCNL qTCLF)qTCNL TEXTREPL ⍵}('UTF-8'DOSCHARS scrpN)('fill'to'UTF-8'DOSCHARS scrpTN)                                                                             
[54]       ⎕←APLPmt'toUTF8 qNqED fromUTF_8'scrpTN                                                                                                                                                      
[55]       ⎕←0 APLPmt ThisFN''                                                                                                                                                                         
[56]       →fail                                                                                                                                                                                       
[57]   :EndIf                                                                                                                                                                                          
[58]                                                                                                                                                                                                   
[59]   :If ~'Unexpected stubs found'aEq{(0⌿⍵)⍵}ETC(qTCNL qTCLF)qTCNL TEXTREPL'Stub' 'scan'to'UTF-8'DOSCHARS scrpTN                                                                                     
[60]       ⎕←APLPmt'toUTF8 qNqED fromUTF_8'scrpTN                                                                                                                                                      
[61]       ⎕←0 APLPmt ThisFN''                                                                                                                                                                         
[62]       →fail                                                                                                                                                                                       
[63]   :EndIf                                                                                                                                                                                          
[64]                                                                                                                                                                                                   
[65]   ⎕←APLPmt'toUTF8 qNqED fromUTF_8'scrpTN                                                                                                                                                          
[66]                                                                                                                                                                                                   
[67]   →fail unless 1 chkFeature'change scrpN template to catch functions'                                                                                                                             
[68]   ⍝⍝.                                                                                                                                                                                             
[69]                                                                                                                                                                                                   
[70]   fileN←'.0000'omrepl scrpNT                                                                                                                                                                      
[71]   →fail unless aEq fileN on'path'to'0000'new'APLContSubm2015'                                                                                                                                     
[72]   :If 0                                                                                                                                                                                           
[73]   :OrIf ~'Missing .0000 file'aOk qNExists fileN                                                                                                                                                   
[74]   :OrIf ~aEq('UTF-8'DOSCHARS fileN)on'fill'to'UTF-8'DOSCHARS scrpTN                                                                                                                               
[75]       ⎕←APLPmt'fileN←'fileN                                                                                                                                                                       
[76]       ⎕←APLPmt'scrpTN←'scrpTN                                                                                                                                                                     
[77]       ⎕←0 APLPmt'qNset∘fileN toUTF8 ''fill''to''UTF-8''DOSCHARS scrpTN'                                                                                                                           
[78]       →fail                                                                                                                                                                                       
[79]   :EndIf                                                                                                                                                                                          
[80]   :If ~'Missing 0000 template'aEq 1 on qNExists{⍵}fileV←'.0000'omrepl scrpNT,'-t'                                                                                                                 
[81]       ⎕←APLPmt'fileV←'fileV                                                                                                                                                                       
[82]       ⎕←APLPmt'qNcopy'on scrpTN fileV                                                                                                                                                             
[83]       →fail                                                                                                                                                                                       
[84]   :EndIf                                                                                                                                                                                          
[85]                  
[86]   scrpT99←'.0000'omrepl scrpNT,'-t'                                                                                                                                                               
[87]   ⎕←APLPmt'scrpT99←'scrpT99                                                                                                                                                                       
[88]   ⎕←APLPmt'toUTF8 qNqED fromUTF_8'scrpT99                                                                                                                                                         
[89]                                                                                                                                                                                                   
[90]   errStr←'???'                                                                                                                                                                                    
[91]   :If ~'Errors in calculating file'aEq 0 on errStr xIsIn{⍵}actV←'fill'to'UTF-8'DOSCHARS scrpT99                                                                                                   
[92]       ⎕←'------'                                                                                                                                                                                  
[93]       ⎕←errStr'scan'to actV                                                                                                                                                                       
[94]       ⎕←'======'                                                                                                                                                                                  
[95]       →fail                                                                                                                                                                                       
[96]   :EndIf                                                                                                                                                                                          
[97]   :If 0                                                                                                                                                                                           
[98]   :OrIf ~'Missing .0001 file'aOk qNExists{⍵}fileN←'.0001'omrepl scrpNT                                                                                                                            
[99]   :OrIf ~'file not matching fill of template'aEq('UTF-8'DOSCHARS fileN)on'fill'to'UTF-8'DOSCHARS scrpT99                                                                                          
[100]      ⎕←APLPmt'fileN←'fileN                                                                                                                                                                       
[101]      ⎕←APLPmt'scrpT99←'scrpT99                                                                                                                                                                   
[102]      ⎕←0 APLPmt'{}qED ''UTF-8'' DOSCHARS fileN'                                                                                                                                                  
[103]      ⎕←0 APLPmt'qNset∘fileN toUTF8 ''fill''to''UTF-8''DOSCHARS scrpT99'                                                                                                                          
[104]      ⎕←0 APLPmt ThisFN''                                                                                                                                                                         
[105]      →XIT                                                                                                                                                                                        
[106]  :EndIf                                                                                                                                                                                          
[107]  →fail unless 1 chkFeature'create null entry from minimal stubs'                                                                                                                                 
[108]  ⍝.                                                                                                                                                                                              
[109]                                                                                                                                                                                                  
[110]  →fail unless aEq'tFooF'on FNdef PUlines ∆∆tFooF-1 ⋄ :If 0                                                                                                                                       
[111]      r←ckF tFooF fooF;nameF;tfuu;tfuuN                                                                                                                                                           
[112]      r←0                                                                                                                                                                                         
[113]      nameF←'APL2015.Problems.⍵',fooF                                                                                                                                                             
[114]      →0 unless ckFnExists''omrepl nameF                                                                                                                                                          
[115]      :If ~ckFnExists'TEST_'omrepl nameF                                                                                                                                                          
[116]          ⎕←'MyFile qoSave TESTFNnew',quote''omrepl nameF                                                                                                                                         
[117]          →0                                                                                                                                                                                      
[118]      :EndIf                                                                                                                                                                                      
[119]      →0 unless aOk qoExists MyFile on''omrepl nameF                                                                                                                                              
[120]      →0 unless aOk qoExists MyFile on'TEST_'omrepl nameF                                                                                                                                         
[121]      tfuu←⍎tfuuN←''omrepl nameF                                                                                                                                                                  
[122]      →0 unless⍎'TEST_'omrepl nameF                                                                                                                                                               
[123]      :If ~ckF chkFeature'tFooF.implement ',fooF                                                                                                                                                  
[124]          ⎕←APLPmtMFS'TEST_'omrepl nameF                                                                                                                                                          
[125]          →0                                                                                                                                                                                      
[126]      :EndIf                                                                                                                                                                                      
[127]      r←1                                                                                                                                                                                         
[128] ∆∆tFooF:                                                                                                                                                                                         
[129]  :EndIf                                                                                                                                                                                          
[130]  →fail unless 1 tFooF'fibRabbits'                                                                                                                                                                
[131]  →fail unless 1 tFooF'RNAtoProtein'                                                                                                                                                              
[132]  →fail unless 1 tFooF'htmlTable'                                                                                                                                                                 
[133]  →fail unless 1 tFooF'longestSubsequences'                                                                                                                                                       
[134]  →fail unless 1 tFooF'searchOrder'                                                                                                                                                               
[135]  →fail unless 1 tFooF'shift2048'                                                                                                                                                                 
[136]  →fail unless 1 tFooF'board2048'                                                                                                                                                                 
[137]  →fail unless 1 tFooF'findLocs'                                                                                                                                                                  
[138]  →fail unless 1 tFooF'infermRNA'                                                                                                                                                                 
[139]  →fail unless 1 tFooF'arrangeStars'                                                                                                                                                              
[140]                                                                                                                                                                                                  
[141]  →fail unless 0 tFooF'KenKen'                                                                                                                                                                    
[142]  →fail unless 0 tFooF'reversalDistance'                                                                                                                                                          
[143]  →fail unless 0 tFooF'checkNurikabe'                                                                                                                                                             
[144]                                                                                                                                                                                                  
[145]  →fail unless 0 tFooF'htmlList'                                                                                                                                                                  
[146]  →fail unless 0 tFooF'maxRepeats'                                                                                                                                                                
[147]  ⍝.                                                                                                                                                                                              
[148]  →fail unless 0 chkFeature'build from template; (toUTF8''fill''to DOSCHARS scrptN)qNset ()'                                                                                                      
[149]  →fail unless 0 chkFeature'Get a null entry uploaded'                                                                                                                                            
[150]  →fail unless 0 chkFeature'Get a single solution entry uploaded'                                                                                                                                 
[151]  →fail unless 0 chkFeature'Get all solutions uploaded'                                                                                                                                           
[152]  ⍝⍝--                                                                                                                                                                                            
[153]  :If ~0 chkFeature tfuuN omrepl'implement "⍵"'                                                                                                                                                   
[154]      ⎕←APLPmtMFS'TEST_',tfuuN                                                                                                                                                                    
[155]      →XIT                                                                                                                                                                                        
[156]  :EndIf                                                                                                                                                                                          
[157]  r←1                                                                                                                                                                                             
[158]  →XIT                                                                                                                                                                                            
[159] fail:                                                                                                                                                                                            
[160]  ⎕←APLPmtMFS ThisFN''                                                                                                                                                                            
[161] XIT: ⍝⍝-------                                                                                                                                                                                   
[162]  test_complete                                                                                                                                                                                   
     ∇                                                                                                                                                                                                 

Page served at: Wed, 08 Apr 2020 05:41:44 AST.