tests reorganization :
[scilab.git] / scilab / modules / core / tests / unit_tests / display.dia.ref
1  
2 // Copyright INRIA
3  
4  
5  
6 format('v',10)
7  
8 //display of numbers
9  
10 x=2.6533333
11  x  =
12  
13     2.6533333  
14  
15 x=[2.6533333 -0.0002]
16  x  =
17  
18     2.6533333  - 0.0002  
19  
20 x'
21  ans  =
22  
23     2.6533333  
24   - 0.0002     
25  
26 x=[]
27  x  =
28  
29      []
30  
31  
32 //display of polynomials
33  
34 z=poly(0,'z')
35  z  =
36  
37     z   
38  
39 num=[ (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)*...
40      z-0.0243497
41       (((((1)*z-2.6533333)*z+2.6887936)*z-1.2916784)*z+0.2911572)*...
42      z-0.0243497
43      (((1)*z )*z )*z+1
44      0]
45  num  =
46  
47                                        2            3            4      
48   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
49                5                                                        
50             + z                                                         
51                                                                         
52                                        2            3            4      
53   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
54                5                                                        
55             + z                                                         
56                                                                         
57          3                                                              
58     1 + z                                                               
59                                                                         
60     0                                                                   
61  
62 den = [ ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
63 ((((1)*z-1.536926)*z+0.8067352)*z-0.1682810)*z+0.0113508
64 ((1)*z )*z
65 1]
66  den  =
67  
68                                       2           3   4  
69     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
70                                                          
71                                       2           3   4  
72     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
73                                                          
74      2                                                   
75     z                                                    
76                                                          
77     1                                                    
78  
79 num',den'
80  ans  =
81  
82  
83          column 1
84  
85                                        2            3            4      
86   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
87                5                                                        
88             + z                                                         
89  
90          column 2
91  
92                                        2            3            4      
93   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
94                5                                                        
95             + z                                                         
96  
97          column 3 to 4
98  
99          3       
100     1 + z     0  
101  ans  =
102  
103  
104          column 1
105  
106                                       2           3   4  
107     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
108  
109          column 2 to 4
110  
111                                       2           3   4     2        
112     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z     z     1   
113  
114 [num;den]
115  ans  =
116  
117                                        2            3            4      
118   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
119                5                                                        
120             + z                                                         
121                                                                         
122                                        2            3            4      
123   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
124                5                                                        
125             + z                                                         
126                                                                         
127          3                                                              
128     1 + z                                                               
129                                                                         
130     0                                                                   
131                                                                         
132                                       2           3   4                 
133     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z                  
134                                                                         
135                                       2           3   4                 
136     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z                  
137                                                                         
138      2                                                                  
139     z                                                                   
140                                                                         
141     1                                                                   
142  
143 [num den]
144  ans  =
145  
146  
147          column 1
148  
149                                        2            3            4      
150   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
151                5                                                        
152             + z                                                         
153                                                                         
154                                        2            3            4      
155   - 0.0243497 + 0.2911572z - 1.2916784z + 2.6887936z - 2.6533333z       
156                5                                                        
157             + z                                                         
158                                                                         
159          3                                                              
160     1 + z                                                               
161                                                                         
162     0                                                                   
163  
164          column 2
165  
166                                       2           3   4  
167     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
168                                                          
169                                       2           3   4  
170     0.0113508 - 0.168281z + 0.8067352z - 1.536926z + z   
171                                                          
172      2                                                   
173     z                                                    
174                                                          
175     1                                                    
176  
177 //display of polynomials
178  
179 z=poly(0,'z')
180  z  =
181  
182     z   
183  
184 n=1+z;d=n*n;n1=[n d];d1=[d d*d];n1=[n1 n1];d1=[d1 d1];
185  
186 n2=[n n*n;n*n n**4];d2=[n*n n**4;n n*n];den=d2(1,:);num=n2(2,:);
187  
188 p=poly(rand(5,1),'z');q=poly(rand(6,1),'z');
189  
190 p1=[p,0.1+2.35*z-5.05*z**3];q1=[q,2.56+0.03*z-10.01*z*z+z**5];
191  
192 d3=[1+z**10 z**15];
193  
194 //display of rationals
195  
196 r=num./den
197  r  =
198  
199     1     1   
200     -     -   
201     1     1   
202  
203 r'
204  ans  =
205  
206     1   
207     -   
208     1   
209         
210     1   
211     -   
212     1   
213  
214 tlist('r',d,n)
215  ans  =
216  
217               2  
218     1 + 2z + z   
219     ----------   
220       1 + z      
221  
222 tlist('r',n,d)
223  ans  =
224  
225       1 + z      
226     ---------    
227               2  
228     1 + 2z + z   
229  
230 tlist('r',d2,n2)
231  ans  =
232  
233               2               2    3   4  
234     1 + 2z + z     1 + 4z + 6z + 4z + z   
235     ----------     --------------------   
236                                   2       
237       1 + z             1 + 2z + z        
238                                           
239                                   2       
240       1 + z             1 + 2z + z        
241     ---------      --------------------   
242               2               2    3   4  
243     1 + 2z + z     1 + 4z + 6z + 4z + z   
244  
245 tlist('r',n2,d2)
246  ans  =
247  
248                                   2       
249       1 + z             1 + 2z + z        
250     ---------      --------------------   
251               2               2    3   4  
252     1 + 2z + z     1 + 4z + 6z + 4z + z   
253                                           
254               2               2    3   4  
255     1 + 2z + z     1 + 4z + 6z + 4z + z   
256     ----------     --------------------   
257                                   2       
258       1 + z             1 + 2z + z        
259  
260 tlist('r',den,num)
261  ans  =
262  
263               2               2    3   4  
264     1 + 2z + z     1 + 4z + 6z + 4z + z   
265     ----------     --------------------   
266               2               2    3   4  
267     1 + 2z + z     1 + 4z + 6z + 4z + z   
268  
269 tlist('r',num,den)
270  ans  =
271  
272               2               2    3   4  
273     1 + 2z + z     1 + 4z + 6z + 4z + z   
274     ----------     --------------------   
275               2               2    3   4  
276     1 + 2z + z     1 + 4z + 6z + 4z + z   
277  
278 tlist('r',p1,q1)
279  ans  =
280  
281  
282          column 1
283  
284                                        2            3            4      
285   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
286           5                                                             
287        + z                                                              
288     ------------------------------------------------------------------  
289                                        2            3            4      
290     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
291                    5   6                                                
292        - 3.6713072z + z                                                 
293  
294          column 2
295  
296                           3     
297        0.1 + 2.35z - 5.05z      
298     -------------------------   
299                          2   5  
300     2.56 + 0.03z - 10.01z + z   
301  
302 tlist('r',q1,p1)
303  ans  =
304  
305  
306          column 1
307  
308                                        2            3            4      
309     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
310                    5   6                                                
311        - 3.6713072z + z                                                 
312     ------------------------------------------------------------------  
313                                        2            3            4      
314   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
315           5                                                             
316        + z                                                              
317  
318          column 2
319  
320                          2   5  
321     2.56 + 0.03z - 10.01z + z   
322     -------------------------   
323                           3     
324        0.1 + 2.35z - 5.05z      
325  
326 tlist('r',p,q)
327  ans  =
328  
329                                        2            3            4      
330   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
331           5                                                             
332        + z                                                              
333     ------------------------------------------------------------------  
334                                        2            3            4      
335     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
336                    5   6                                                
337        - 3.6713072z + z                                                 
338  
339 tlist('r',q,p)
340  ans  =
341  
342                                        2            3            4      
343     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
344                    5   6                                                
345        - 3.6713072z + z                                                 
346     ------------------------------------------------------------------  
347                                        2            3            4      
348   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
349           5                                                             
350        + z                                                              
351  
352 tlist('r',p,z)
353  ans  =
354  
355                                        2            3            4      
356   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
357           5                                                             
358        + z                                                              
359     ------------------------------------------------------------------  
360                                     z                                   
361  
362 tlist('r',z,p)
363  ans  =
364  
365                                     z                                   
366     -----------------------------------------------------------------   
367                                        2            3            4      
368   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
369           5                                                             
370        + z                                                              
371  
372 tlist('r',d1,n1)
373  ans  =
374  
375  
376          column 1 to 3
377  
378               2               2    3   4              2  
379     1 + 2z + z     1 + 4z + 6z + 4z + z     1 + 2z + z   
380     ----------     --------------------     ----------   
381                                   2                      
382       1 + z             1 + 2z + z            1 + z      
383  
384          column 4
385  
386                2    3   4  
387     1 + 4z + 6z + 4z + z   
388     --------------------   
389                    2       
390          1 + 2z + z        
391  
392 tlist('r',n1,d1)
393  ans  =
394  
395  
396          column 1 to 3
397  
398                                   2                      
399       1 + z             1 + 2z + z            1 + z      
400     ---------      --------------------     ---------    
401               2               2    3   4              2  
402     1 + 2z + z     1 + 4z + 6z + 4z + z     1 + 2z + z   
403  
404          column 4
405  
406                    2       
407          1 + 2z + z        
408     --------------------   
409                2    3   4  
410     1 + 4z + 6z + 4z + z   
411  
412 //display of strings
413  
414 digits='abcdefghijklmnopqrstuvwxyz'
415  digits  =
416  
417  abcdefghijklmnopqrstuvwxyz   
418  
419 numbers='1234567890'
420  numbers  =
421  
422  1234567890   
423  
424 majuscules='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
425  majuscules  =
426  
427  ABCDEFGHIJKLMNOPQRSTUVWXYZ   
428  
429 symbols=',./;''[] \ =-!\$%^&*()_+~:""[]| @'
430  symbols  =
431  
432  ,./;'[] \ =-!\$%^&*()_+~:"[]| @   
433  
434 [numbers;digits]
435  ans  =
436  
437 !1234567890                  !
438 !                            !
439 !abcdefghijklmnopqrstuvwxyz  !
440  
441 [numbers digits;digits numbers]
442  ans  =
443  
444 !1234567890                  abcdefghijklmnopqrstuvwxyz  !
445 !                                                        !
446 !abcdefghijklmnopqrstuvwxyz  1234567890                  !
447  
448 [numbers digits+digits+digits]
449  ans  =
450  
451  
452          column 1
453  
454 !1234567890  !
455  
456          column 2
457  
458 !abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
459 !     stuvwxyz                                                         !
460  
461 ans';
462  
463 [ans ans]
464  ans  =
465  
466  
467          column 1
468  
469 !1234567890                                                            !
470 !                                                                      !
471 !abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
472 !     stuvwxyz                                                         !
473  
474          column 2
475  
476 !1234567890                                                            !
477 !                                                                      !
478 !abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr!
479 !     stuvwxyz                                                         !
480  
481 ''
482  ans  =
483  
484     
485  
486  
487 // display of list
488  
489 list()
490  ans  =
491  
492      ()
493  
494 list(1,2,3)
495  ans  =
496  
497  
498        ans(1)
499  
500     1.  
501  
502        ans(2)
503  
504     2.  
505  
506        ans(3)
507  
508     3.  
509  
510 list(list(1,list()),2)
511  ans  =
512  
513  
514        ans(1)
515  
516  
517         ans(1)(1)
518  
519     1.  
520  
521         ans(1)(2)
522  
523      ()
524  
525        ans(2)
526  
527     2.  
528  
529 list(tlist('r',q,p),1.23)
530  ans  =
531  
532  
533        ans(1)
534  
535                                        2            3            4      
536     0.0123314 - 0.2684985z + 1.5393672z - 4.0114366z + 5.4004179z       
537                    5   6                                                
538        - 3.6713072z + z                                                 
539     ------------------------------------------------------------------  
540                                        2            3            4      
541   - 0.0000078 + 0.0351988z - 0.3720034z + 1.3432153z - 1.9632981z       
542           5                                                             
543        + z                                                              
544  
545        ans(2)
546  
547     1.23  
548  
549 // overloading of display
550  
551 1:$
552  ans  =
553  
554  
555  1:1:$   
556  
557 list(1,1:$)
558  ans  =
559  
560  
561        ans(1)
562  
563     1.  
564  
565        ans(2)
566  
567  
568  1:1:$   
569  
570 list(list(1:$))
571  ans  =
572  
573  
574        ans(1)
575  
576  
577         ans(1)(1)
578  
579  
580  1:1:$   
581  
582 list(list(1,$),list())
583  ans  =
584  
585  
586        ans(1)
587  
588  
589         ans(1)(1)
590  
591     1.  
592  
593         ans(1)(2)
594  
595     $   
596  
597        ans(2)
598  
599      ()
600  
601 // Tlist overloaded display
602  
603 TL=tlist('x',1,2)
604  TL  =
605  
606  
607        TL(1)
608  
609  x   
610  
611        TL(2)
612  
613     1.  
614  
615        TL(3)
616  
617     2.  
618  
619 deff('%x_p(x)','disp(x(3),x(2),''Mydisplay'')')
620  
621 TL
622  TL  =
623  
624  
625  Mydisplay   
626  
627     1.  
628  
629     2.  
630  
631 list(TL)
632  ans  =
633  
634  
635        ans(1)
636  
637  
638  Mydisplay   
639  
640     1.  
641  
642     2.  
643  
644 list(list(TL))
645  ans  =
646  
647  
648        ans(1)
649  
650  
651         ans(1)(1)
652  
653  
654  Mydisplay   
655  
656     1.  
657  
658     2.  
659  
660 TL=tlist('x',1:$,2)
661  TL  =
662  
663  
664  Mydisplay   
665  
666  
667  1:1:$   
668  
669     2.  
670  
671 list(TL)
672  ans  =
673  
674  
675        ans(1)
676  
677  
678  Mydisplay   
679  
680  
681  1:1:$   
682  
683     2.  
684  
685 list(list(TL))
686  ans  =
687  
688  
689        ans(1)
690  
691  
692         ans(1)(1)
693  
694  
695  Mydisplay   
696  
697  
698  1:1:$   
699  
700     2.  
701  
702 TL(2)=TL
703  TL  =
704  
705  
706  Mydisplay   
707  
708  
709  Mydisplay   
710  
711  
712  1:1:$   
713  
714     2.  
715  
716     2.  
717