Version 0.3 :
[scilab.git] / scilab / modules / development_tools / macros / unit_test_run.sci
1 //-----------------------------------------------------------------------------
2 // Pierre MARECHAL
3 // Scilab team
4 // Copyright INRIA
5 // Date : 25/10/2007
6 //
7 // Launch unitary tests
8 //-----------------------------------------------------------------------------
9
10 function unit_test_run(varargin)
11         
12         lhs = argn(1);
13         rhs = argn(2);
14         
15         global test_list;
16         global test_count;
17         global displayed_txt;
18         
19         // options
20         
21         global check_ref;
22         global check_error_output;
23         global create_ref;
24         global launch_mode;
25
26         
27         check_ref          = %T;
28         check_error_output = %T;
29         create_ref         = %F;
30         launch_mode        = "-nw";
31         just_list_tests    = %F;
32         print_help         = %F;
33         
34         test_count         = 0;
35         test_passed_count  = 0;
36         test_failed_count  = 0;
37         test_skipped_count = 0;
38         
39         displayed_txt      = '';
40         details_failed     = '';
41         
42         // =======================================================
43         // Gestion des tests à lancer
44         // =======================================================
45         
46         if (rhs == 0) ..
47                                 | ((rhs == 1) & (varargin(1)==[])) ..
48                                 | (((rhs == 2)|(rhs == 3)) & (varargin(1)==[]) & (varargin(2)==[])) then
49                 
50                 // No input argument
51                 // unit_test_run()
52                 // unit_test_run([])
53                 // => Launch each test of each module
54                 
55                 module_list = getmodules();
56                 for k=1:size(module_list,'*')
57                         unit_test_add_module(module_list(k));
58                 end
59         
60         elseif (rhs == 1) ..
61                                 | ((rhs == 2) & (varargin(2)==[])) ..
62                                 | ((rhs == 3) & (varargin(2)==[])) then
63                 
64                 // One input argument
65                 // unit_test_run(<module_name>)
66                 // unit_test_run([<module_name_1>,<module_name_2>])
67                 
68                 // varargin(1) = [<module_name_1>,<module_name_2>]
69                 
70                 module_mat = varargin(1);
71                 
72                 [nl,nc] = size(module_mat);
73                 
74                 // unit_test_run([<module_name_1>,<module_name_2>])
75                 
76                 for i=1:nl
77                         for j=1:nc
78                                 if( with_module(module_mat(i,j)) ) then
79                                         unit_test_add_module(module_mat(i,j));
80                                 else
81                                         error(sprintf(gettext("%s is not an installed module"),module_mat(i,j)));
82                                 end
83                         end
84                 end
85                 
86         elseif (rhs == 2) | (rhs == 3) then
87                 
88                 // Two input arguments
89                 // unit_test_run(<module_name>,<test_name>)
90                 // unit_test_run(<module_name>,[<test_name_1>,<test_name_2>] )
91                 
92                 // varargin(1) = <module_name> ==> string 1x1
93                 // varargin(2) = <test_name_1> ==> mat nl x nc
94                 
95                 module   = varargin(1);
96                 test_mat = varargin(2);
97                 
98                 if ((or(size(module) <> [1,1])) & (test_mat <> [])) then
99                         example = unit_test_examples();
100                         err     = ["" ; gettext("error : Input argument sizes are not valid") ; "" ; example ];
101                         printf("%s\n",err);
102                         return;
103                 end
104                 
105                 [nl,nc] = size(test_mat);
106                 
107                 for i=1:nl
108                         for j=1:nc
109                                 if( fileinfo(SCI+"/modules/"+module+"/unit_tests/"+test_mat(i,j)+".tst") <> [] ) then
110                                         unit_test_add_onetest(module,test_mat(i,j));
111                                 else
112                                         error(sprintf(gettext("The test ""%s"" is not available from the ""%s"" module"),test_mat(i,j),module));
113                                 end
114                         end
115                 end
116         else
117                 error(gettext('Number of parameters incorrect.'));
118         end
119         
120         // =======================================================
121         // Gestion des options
122         // =======================================================
123         
124         if rhs == 3 then
125                 
126                 option_mat =  varargin(3);
127                 
128                 if grep(option_mat,"no_check_ref") <> [] then
129                         check_ref  = %F;
130                 end
131                 
132                 if grep(option_mat,"no_check_error_output") <> [] then
133                         check_error_output  = %F;
134                 end
135                 
136                 if grep(option_mat,"create_ref") <> [] then
137                         create_ref = %T;
138                         check_ref  = %F;
139                 end
140                 
141                 if grep(option_mat,"mode_nw") <> [] then
142                         launch_mode = "-nw";
143                 end
144                 
145                 if grep(option_mat,"mode_nwni") <> [] then
146                         launch_mode = "-nwni";
147                 end
148                 
149                 if grep(option_mat,"list") <> [] then
150                         just_list_tests    = %T;
151                 end
152                 
153                 if grep(option_mat,"help") <> [] then
154                         print_help         = %T;
155                 end
156         end
157
158         if print_help then
159                 
160                 example = unit_test_examples();
161                 printf("%s\n",example);
162                 return;
163         
164         elseif just_list_tests then
165                 
166                 // =======================================================
167                 // Just list tests
168                 // =======================================================
169                 
170                 for i=1:test_count
171                         printf("   %02d - ",i);
172                         printf("[%s] %s\n",test_list(i,1),test_list(i,2));
173                 end
174                 
175         else
176                 
177                 // =======================================================
178                 // Test launch
179                 // =======================================================
180                 
181                 printf("   TMPDIR = %s\n",TMPDIR);
182                 printf("\n");
183                 
184                 for i=1:test_count
185                         
186                         printf("   %02d/%02d - ",i,test_count);
187                         printf("[%s] %s",test_list(i,1),test_list(i,2));
188                         for j = length(test_list(i,2) + test_list(i,1)):50
189                                 printf(".");
190                         end
191                         
192                         [status_id,status_msg,status_details] = unit_test_run_onetest(test_list(i,1),test_list(i,2));
193                         printf("%s \n",status_msg);
194                         
195                         // Recencement des tests
196                         
197                         if status_id == 0 then
198                                 // passed
199                                 test_passed_count = test_passed_count + 1;
200                         
201                         elseif (status_id > 0) & (status_id < 10) then
202                                 // failed
203                                 test_failed_count = test_failed_count + 1;
204                                 details_failed = [ details_failed ; sprintf("   TEST : [%s] %s",test_list(i,1),test_list(i,2))];
205                                 details_failed = [ details_failed ; sprintf("     %s",status_msg) ];
206                                 details_failed = [ details_failed ; status_details ];
207                                 details_failed = [ details_failed ; "" ];
208                         
209                         elseif (status_id > 10) & (status_id < 20) then
210                                 // skipped
211                                 test_skipped_count = test_skipped_count + 1;
212                         end
213                 end
214                 
215                 // Summary
216                 
217                 test_passed_percent  = test_passed_count  / test_count * 100;
218                 test_skipped_percent = test_skipped_count / test_count * 100;
219                 test_failed_percent  = test_failed_count  / test_count * 100;
220                 
221                 printf("\n");
222                 printf("   ---------------------------------------------------------------------------------------\n");
223                 printf("   Summary\n\n");
224                 printf("   tests                     %4d - 100 %% \n",test_count);
225                 printf("   passed                    %4d - %3d %% \n",test_passed_count ,test_passed_percent);
226                 printf("   failed                    %4d - %3d %% \n",test_failed_count ,test_failed_percent);
227                 printf("   skipped                   %4d - %3d %% \n",test_skipped_count,test_skipped_percent);
228                 printf("   ---------------------------------------------------------------------------------------\n");
229                 
230                 if test_failed_count > 0 then
231                         printf("   Details\n\n");
232                         printf("%s\n",details_failed);
233                         printf("\n");
234                         printf("   ---------------------------------------------------------------------------------------\n");
235                 end
236                 
237         end
238         
239 endfunction
240
241 //-----------------------------------------------------------------------------
242 // Pierre MARECHAL
243 // Scilab team
244 // Copyright INRIA
245 // Date : 28 oct. 2007
246 //
247 // => List all test files in the module <module_mat>
248 // => Add them to the test_mat matrix
249 //-----------------------------------------------------------------------------
250
251 function unit_test_add_module(module_mat)
252         
253         module_test_dir = SCI+"/modules/"+module_mat+"/unit_tests";
254         test_mat        = basename(listfiles(module_test_dir+"/*.tst"));
255         
256         nl = size(test_mat,"*");
257         for i=1:nl
258                 unit_test_add_onetest(module_mat,test_mat(i));
259         end
260         
261 endfunction
262
263 //-----------------------------------------------------------------------------
264 // Pierre MARECHAL
265 // Scilab team
266 // Copyright INRIA
267 // Date : 28 oct. 2007
268 //
269 // => Add the test <test> to the test_mat matrix
270 //-----------------------------------------------------------------------------
271
272 function unit_test_add_onetest(module,test)
273         
274         global test_list;
275         global test_count;
276         
277         test_count = test_count + 1;
278         test_list( test_count , 1 ) = module;
279         test_list( test_count , 2 ) = test;
280         
281 endfunction
282
283 //-----------------------------------------------------------------------------
284 // Pierre MARECHAL
285 // Scilab team
286 // Copyright INRIA
287 // Date : 28 oct. 2007
288 //
289 // => Run one test
290 //-----------------------------------------------------------------------------
291
292 function [status_id,status_msg,status_details] = unit_test_run_onetest(module,test)
293         
294         global check_ref;
295         global create_ref;
296         
297         status_id      = 0 ;
298         status_msg     = "passed" ;
299         status_details = "";
300         
301         [status_id,status_msg,status_details] = unit_test_run_checkerror(module,test);
302         
303         if check_ref | create_ref then
304                 // Check ref or create ref
305                 if status_id == 0 then
306                         [status_id,status_msg,status_details] = unit_test_run_proc_ref(module,test);
307                 end
308         end
309         
310         return;
311         
312 endfunction
313
314 //-----------------------------------------------------------------------------
315 // Pierre MARECHAL
316 // Scilab team
317 // Copyright INRIA
318 // Date : 8 novembre 2007
319 //
320 // => Check the test
321 //-----------------------------------------------------------------------------
322
323 function [status_id,status_msg,status_details] = unit_test_run_checkerror(module,test)
324         
325         status_id      = 0 ;
326         status_msg     = "passed" ;
327         status_details = "";
328         
329         global launch_mode;
330         global check_error_output;
331         
332         // Some definitions
333         
334         tstfile     = pathconvert(SCI+"/modules/"+module+"/unit_tests/"+test+".tst",%f,%f);
335         
336         tmp_tstfile = pathconvert(TMPDIR+"/"+test+"_1.tst",%f,%f);
337         tmp_diafile = pathconvert(TMPDIR+"/"+test+"_1.dia",%f,%f);
338         tmp_resfile = pathconvert(TMPDIR+"/"+test+"_1.res",%f,%f);
339         tmp_errfile = pathconvert(TMPDIR+"/"+test+"_1.err",%f,%f);
340         
341         // Remove the previous tmp files
342         if fileinfo(tmp_tstfile) <> [] then
343                 deletefile(tmp_tstfile)
344         end
345         
346         if fileinfo(tmp_diafile) <> [] then
347                 deletefile(tmp_diafile)
348         end
349         
350         if fileinfo(tmp_resfile) <> [] then
351                 deletefile(tmp_resfile)
352         end
353         
354         if fileinfo(tmp_errfile) <> [] then
355                 deletefile(tmp_errfile)
356         end
357         
358         //Reset standard globals
359         rand('seed',0);
360         rand('uniform');
361         
362         // Get the tst file
363         txt = mgetl(tstfile);
364         
365         // Check if it's an interactive test
366         if grep(txt,"<-- INTERACTIVE TEST -->") <> [] then
367                 status_msg = "skipped : interactive test";
368                 status_id  = 10;
369                 return;
370         end
371         
372         if (grep(txt,"<-- TEST WITH GRAPHIC -->") <> []) & (launch_mode=="-nwni") then
373                 status_msg = "skipped : test with graphic";
374                 status_id  = 11;
375                 return;
376         end
377         
378         // Do some modification in tst file
379         txt = strsubst(txt,'pause,end','bugmes();quit;end');
380         txt = strsubst(txt,'-->','@#>'); //to avoid suppression of input --> with prompts
381         txt = strsubst(txt,'halt();','');
382         
383         // Header : the same for each test
384         
385         head = [        "// <-- HEADER START -->";
386                                 "mode(3);" ;
387                                 "clear;" ;
388                                 "lines(28,72);";
389                                 "lines(0);" ;
390                                 "deff(''[]=bugmes()'',''write(%io(2),''''error on test'''')'');" ;
391                                 "predef(''all'');" ;
392                                 "try";
393                                 "diary(''"+tmp_diafile+"'');";
394                                 "// <-- HEADER END -->"];
395                                 
396         tail = [        "// <-- FOOTER START -->";
397                                 "catch";
398                                 "       errmsg = ""<--""+""Error on the test script file""+""-->""";
399                                 "       printf(""%s"",errmsg)";
400                                 "end";
401                                 "diary(0);";
402                                 "exit;";
403                                 "// <-- FOOTER END -->"]
404         
405         txt = [head;
406                 txt;
407                 tail];
408         
409         // and save it in a temporary file
410         mputl(txt,tmp_tstfile);
411         
412         // Build the command to launch
413         if MSDOS then
414                 unit_test_cmd = "( """+SCI+"\bin\scilex.exe"+""""+" "+launch_mode+" -nb -args -nouserstartup -f """+tmp_tstfile+""" > """+tmp_resfile+""" ) 2> """+tmp_errfile+"""";
415         else
416                 unit_test_cmd = "( "+SCI+"/bin/scilab "+launch_mode+" -nb -args -nouserstartup -f "+tmp_tstfile+" > "+tmp_resfile+" ) 2> "+tmp_errfile;
417         end
418         
419         // Launch the test exec
420         host(unit_test_cmd);
421         
422         // First Check : error output
423         if check_error_output then
424                 tmp_errfile_info = fileinfo(tmp_errfile);
425                 
426                 if ( (tmp_errfile_info <> []) & (tmp_errfile_info(1)<>0) ) then
427                         status_msg = "failed  : error_output not empty"
428                         status_details = sprintf("     Check the following file : \n     - %s",tmp_errfile);
429                         status_id  = 5;
430                         return;
431                 end
432         end
433         
434         //  Do some modification in  dia file
435         dia = mgetl(tmp_diafile);
436         
437         //Check for execution errors
438         if grep(dia,"<--Error on the test scmodules/time/unit_tests/datenum.tstript file-->")<>[] then
439                 status_msg = "failed  : premature end of the test script";
440                 status_details = sprintf("     Check the following file : \n     - %s",tmp_diafile);
441                 status_details = [ status_details ; sprintf("     Or launch the following command : \n     - exec %s;",tstfile) ];
442                 status_id = 3;
443                 return;
444         end
445         
446         // Remove Header and Footer
447         dia = remove_headers(dia);
448         
449         //Check for execution errors
450         
451         if grep(dia,"!--error")<>[] then
452                 status_msg     = "failed  : the string (!--error) has been detected";
453                 status_details = sprintf("     Check the following file : \n     - %s",tmp_diafile);
454                 status_details = [ status_details ; sprintf("     Or launch the following command : \n     - exec %s;",tstfile) ];
455                 status_id  = 1;
456                 return;
457         end
458         
459         if grep(dia,"error on test")<>[] then
460                 status_msg     = "failed  : one or several unit tests failed";
461                 status_details = sprintf("     Check the following file : \n     - %s",tmp_diafile);
462                 status_details = [ status_details ; sprintf("     Or launch the following command : \n     - exec %s;",tstfile) ];
463                 status_id      = 2;
464                 return;
465         end
466         
467         return;
468         
469 endfunction
470
471 //-----------------------------------------------------------------------------
472 // Pierre MARECHAL
473 // Scilab team
474 // Copyright INRIA
475 // Date : 28 oct. 2007
476 //
477 // => Check ref or generate ref
478 //-----------------------------------------------------------------------------
479
480 function [status_id,status_msg,status_details] = unit_test_run_proc_ref(module,test)
481         
482         global create_ref;
483         global check_ref;
484         
485         status_id      = 0 ;
486         status_msg     = "passed" ;
487         status_details = "";
488         
489         // Some definitions
490         
491         tstfile     = pathconvert(SCI+"/modules/"+module+"/unit_tests/"+test+".tst",%f,%f);
492         diafile     = pathconvert(SCI+"/modules/"+module+"/unit_tests/"+test+".dia",%f,%f);
493         reffile     = pathconvert(SCI+"/modules/"+module+"/unit_tests/"+test+".dia.ref",%f,%f);
494         
495         tmp_tstfile = pathconvert(TMPDIR+"/"+test+"_2.tst",%f,%f);
496         tmp_diafile = pathconvert(TMPDIR+"/"+test+"_2.dia",%f,%f);
497         tmp_resfile = pathconvert(TMPDIR+"/"+test+"_2.res",%f,%f);
498         tmp_errfile = pathconvert(TMPDIR+"/"+test+"_2.err",%f,%f);
499         
500         // On test l'existence de la ref si besoin
501         
502         if check_ref then
503                 if fileinfo(reffile) == [] then
504                         status_msg     = "failed  : the ref file doesn''t exist";
505                         status_details = "     Add or create the following file"+reffile+" file";
506                         status_details = sprintf("     Add or create the following file : \n     - %s",reffile);
507                         status_id      = 5;
508                         return;
509                 end
510         end
511         
512         // Remove the previous tmp files
513         if fileinfo(tmp_tstfile) <> [] then
514                 deletefile(tmp_tstfile)
515         end
516         
517         if fileinfo(tmp_diafile) <> [] then
518                 deletefile(tmp_diafile)
519         end
520         
521         if fileinfo(tmp_resfile) <> [] then
522                 deletefile(tmp_resfile)
523         end
524         
525         if fileinfo(tmp_errfile) <> [] then
526                 deletefile(tmp_errfile)
527         end
528         
529         //Reset standard globals
530         rand('seed',0);
531         rand('uniform');
532
533         // Do some modification in  tst file
534         
535         txt = mgetl(tstfile);
536         txt = strsubst(txt,'pause,end','bugmes();quit;end');
537         txt = strsubst(txt,'-->','@#>'); //to avoid suppression of input --> with prompts
538         txt = strsubst(txt,'halt()','');
539         
540         // Header : the same for each test
541         
542         head = [        "// <-- HEADER START -->";
543                                 "mode(3);" ;
544                                 "clear;" ;
545                                 "lines(28,72);";
546                                 "lines(0);" ;
547                                 "deff(''[]=bugmes()'',''write(%io(2),''''error on test'''')'');" ;
548                                 "predef(''all'');" ;
549                                 "tmpdirToPrint = msprintf(''TMPDIR1=''''%s''''\n'',TMPDIR);" ;
550                                 "diary(''"+tmp_diafile+"'');";
551                                 "write(%io(2),tmpdirToPrint);";
552                                 "// <-- HEADER END -->"];
553                                 
554         tail = [        "// <-- FOOTER START -->";
555                                 "diary(0);";
556                                 "exit;";
557                                 "// <-- FOOTER END -->"]
558         
559         txt = [head;
560                 txt;
561                 tail];
562         
563         // and save it in a temporary file
564         mputl(txt,tmp_tstfile);
565         
566         // Delete previous dia file
567         if fileinfo(diafile) <> [] then
568                 deletefile(diafile)
569         end
570         
571         // Build the command to launch
572         if MSDOS then
573                 unit_test_cmd = "( """+SCI+"\bin\scilex.exe"+""""+" "+launch_mode+" -nb -args -nouserstartup -f """+tmp_tstfile+""" > """+tmp_resfile+""" ) 2> """+tmp_errfile+"""";
574         else
575                 unit_test_cmd = "( "+SCI+"/bin/scilab "+launch_mode+" -nb -args -nouserstartup -f "+tmp_tstfile+" > "+tmp_resfile+" ) 2> "+tmp_errfile;
576         end
577         
578         // Launch the test exec
579         host(unit_test_cmd);
580         
581         // First Check : error output
582         if check_error_output then
583                 tmp_errfile_info = fileinfo(tmp_errfile);
584                 
585                 if ( (tmp_errfile_info <> []) & (tmp_errfile_info(1)<>0) ) then
586                         status_msg = "failed  : error_output not empty"
587                         status_details = sprintf("     Check the following file : \n     - %s",tmp_errfile);
588                         status_id  = 5;
589                         return;
590                 end
591         end
592         
593         //  Do some modification in  dia file
594         dia = mgetl(tmp_diafile);
595         
596         // To get TMPDIR line
597         tmpdir1_line = grep(dia,"TMPDIR1");
598         execstr(dia(tmpdir1_line));
599         
600         // Remove Header and Footer
601         dia = remove_headers(dia);
602         
603         //  Do some modification in  dia file
604         dia(grep(dia,"exec("))                     = [];
605         dia(grep(dia,"write(%io(2),tmpdirToPrint"))= [];
606         dia(grep(dia,"TMPDIR1"))                   = [];
607         dia(grep(dia,"diary(0)"))                  = [];
608         
609         dia = strsubst(dia,TMPDIR,'TMPDIR');
610         dia = strsubst(dia,TMPDIR1,'TMPDIR');
611         dia = strsubst(dia,TMPDIR1,'TMPDIR');
612         dia = strsubst(dia,SCI,'SCI');
613         
614         //suppress the prompts
615         dia = strsubst(dia,'-->','');
616         dia = strsubst(dia,'@#>','-->');
617         dia = strsubst(dia,'-1->','');
618         
619         //standardise  number display
620         dia = strsubst(strsubst(strsubst(strsubst(dia,' .','0.'),'E+','D+'),'E-','D-'),'-.','-0.');
621
622         //not to change the ref files
623         dia=strsubst(dia,'bugmes();return','bugmes();quit');
624
625         if create_ref then
626                 
627                 // Delete previous .dia.ref file
628                 if fileinfo(reffile) <> [] then
629                         deletefile(reffile)
630                 end
631                 
632                 mputl(dia,reffile);
633                 
634                 status_msg = "passed : ref created";
635                 status_id  = 20;
636                 
637                 return;
638                 
639         else
640                 
641                 // write down the resulting dia file
642                 mputl(dia,diafile)
643                 
644                 //Check for diff with the .ref file
645                 
646                 [u,ierr] = mopen(reffile,'r');
647                 if ierr== 0 then //ref file exists
648                         
649                         ref=mgetl(u);
650                         mclose(u)
651                         
652                         // suppress blank (diff -nw)
653                         
654                         dia = strsubst(dia,' ','')
655                         ref = strsubst(ref,' ','')
656                         
657                         dia(find(dia=='')) = [];
658                         ref(find(ref=='')) = [];
659                         
660                         dia(find(dia=='')) = [];
661                         ref(find(ref=='')) = [];
662                         
663                         if or(ref<>dia) then
664                                 if MSDOS then
665                                         status_msg     = "failed  : dia and ref are not equal";
666                                         status_details = sprintf("     Compare the following files : \n     - %s\n     - %s",diafile,reffile);
667                                         status_id      = 4;
668                                 else
669                                         status_msg     = "failed  : dia and ref are not equal";
670                                         status_details = sprintf("     Compare the following files : \n     - %s\n     - %s",diafile,reffile);
671                                         status_id      = 4;
672                                 end
673                         end
674                 else
675                         error(sprintf(gettext("The ref file (%s) doesn''t exist"),reffile));
676                 end
677         end
678         
679         return;
680         
681 endfunction
682
683 //-----------------------------------------------------------------------------
684 // Pierre MARECHAL
685 // Scilab team
686 // Copyright INRIA
687 // Date : 8 novembre 2007
688 //
689 // => remove header from the diary txt
690 //
691 //-----------------------------------------------------------------------------
692
693 function dia_out = remove_headers(dia_in)
694         
695         dia_out = dia_in;
696         
697         body_start = grep(dia_out,"// <-- HEADER END -->");
698         
699         if body_start<>[] then
700                 dia_out(1:body_start(1)) = [];
701         end
702         
703         body_end   = grep(dia_out,"// <-- FOOTER START -->");
704         
705         if body_end<>[] then
706                 [dia_nl,dia_nc] = size(dia);
707                 dia_out(body_end(1):dia_nl) = [];
708         end
709         
710         return;
711         
712 endfunction
713
714 //-----------------------------------------------------------------------------
715 // Pierre MARECHAL
716 // Scilab team
717 // Copyright INRIA
718 // Date : 28 oct. 2007
719 //
720 // => Check ref or generate ref
721 //-----------------------------------------------------------------------------
722
723 function example = unit_test_examples()
724         
725         example = [ sprintf("Examples :\n\n") ];
726
727         
728         example = [ example ; sprintf("// Launch all tests\n") ];
729         example = [ example ; sprintf("unit_test_run();\n") ];
730         example = [ example ; sprintf("unit_test_run([]);\n") ];
731         example = [ example ; sprintf("unit_test_run([],[]);\n") ];
732         example = [ example ; "" ];
733         example = [ example ; sprintf("// Test one or several module\n") ];
734         example = [ example ; sprintf("unit_test_run(''core'');\n") ];
735         example = [ example ; sprintf("unit_test_run(''core'',[]);\n") ];
736         example = [ example ; sprintf("unit_test_run([''core'',''string'']);\n") ];
737         example = [ example ; "" ];
738         example = [ example ; sprintf("// Launch one or several test in a specified module\n") ];
739         example = [ example ; sprintf("unit_test_run(''core'',[''trycatch'',''opcode'']);\n") ];
740         example = [ example ; "" ];
741         example = [ example ; sprintf("// With options\n") ];
742         example = [ example ; sprintf("unit_test_run([],[],''no_check_ref'');\n") ];
743         example = [ example ; sprintf("unit_test_run([],[],''no_check_error_output'');\n") ];
744         example = [ example ; sprintf("unit_test_run([],[],''create_ref'');\n") ];
745         example = [ example ; sprintf("unit_test_run([],[],''list'');\n") ];
746         example = [ example ; sprintf("unit_test_run([],[],''help'');\n") ];
747         example = [ example ; sprintf("unit_test_run([],[],[''no_check_ref'',''mode_nw'']);\n") ];
748         example = [ example ; "" ];
749         
750 endfunction