Debian Codegraph @

test/sort.t

raw
1 #!/usr/bin/env perl
2 # =============================================================================
3 #
4 # This file is part of BibTool.
5 # It is distributed under the GNU General Public License.
6 # See the file COPYING for details.
7 #
8 # (c) 2011-2020 Gerd Neugebauer
9 #
10 # Net: [email protected]
11 #
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2, or (at your option)
15 # any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #
26 #*=============================================================================
27
28 =head1 NAME
29
30 sort.t - Test suite for BibTool sort.
31
32 =head1 SYNOPSIS
33
34 sort.t
35
36 =head1 DESCRIPTION
37
38 This module contains some test cases. Running this module as program
39 will run all test cases and print a summary for each. Optionally files
40 *.out and *.err are left if the expected result does not match the
41 actual result.
42
43 =head1 OPTIONS
44
45 none
46
47 =head1 AUTHOR
48
49 Gerd Neugebauer
50
51 =cut
52
53 use strict;
54 use BUnit;use warnings;
55
56
57
58 #------------------------------------------------------------------------------
59 BUnit::run(name => '_s_1',
60 args => '-s bib/xampl_s.bib',
61 expected_out => <<EOF,
62 \@STRING{acm = "The OX Association for Computing Machinery" }
63 \@STRING{stoc = " Symposium on the Theory of Computing" }
64 \@STRING{stoc-key= "OX" }
65
66 \@Article{ article-crossref,
67 title = ""
68 }
69
70 \@Article{ article-full,
71 title = ""
72 }
73
74 \@Article{ article-minimal,
75 title = ""
76 }
77
78 \@Book{ book-crossref,
79 title = ""
80 }
81
82 \@Book{ book-full,
83 title = ""
84 }
85
86 \@Book{ book-minimal,
87 title = ""
88 }
89
90 \@Booklet{ booklet-full,
91 title = ""
92 }
93
94 \@Booklet{ booklet-minimal,
95 title = ""
96 }
97
98 \@InBook{ inbook-crossref,
99 title = ""
100 }
101
102 \@InBook{ inbook-full,
103 title = ""
104 }
105
106 \@InBook{ inbook-minimal,
107 title = ""
108 }
109
110 \@InCollection{ incollection-crossref,
111 title = ""
112 }
113
114 \@InCollection{ incollection-full,
115 title = ""
116 }
117
118 \@InCollection{ incollection-minimal,
119 title = ""
120 }
121
122 \@InProceedings{ inproceedings-crossref,
123 title = ""
124 }
125
126 \@InProceedings{ inproceedings-full,
127 title = ""
128 }
129
130 \@InProceedings{ inproceedings-minimal,
131 title = ""
132 }
133
134 \@Manual{ manual-full,
135 title = ""
136 }
137
138 \@Manual{ manual-minimal,
139 title = ""
140 }
141
142 \@MastersThesis{ mastersthesis-full,
143 title = ""
144 }
145
146 \@MastersThesis{ mastersthesis-minimal,
147 title = ""
148 }
149
150 \@Misc{ misc-full,
151 title = ""
152 }
153
154 \@Misc{ misc-minimal,
155 title = ""
156 }
157
158 \@PhDThesis{ phdthesis-full,
159 title = ""
160 }
161
162 \@PhDThesis{ phdthesis-minimal,
163 title = ""
164 }
165
166 \@Proceedings{ proceedings-full,
167 title = ""
168 }
169
170 \@Proceedings{ proceedings-minimal,
171 title = ""
172 }
173
174 \@Misc{ random-note-crossref,
175 title = ""
176 }
177
178 \@TechReport{ techreport-full,
179 title = ""
180 }
181
182 \@TechReport{ techreport-minimal,
183 title = ""
184 }
185
186 \@Unpublished{ unpublished-full,
187 title = ""
188 }
189
190 \@Unpublished{ unpublished-minimal,
191 title = ""
192 }
193
194 \@Book{ whole-collection,
195 title = ""
196 }
197
198 \@Article{ whole-journal,
199 title = ""
200 }
201
202 \@Proceedings{ whole-proceedings,
203 title = ""
204 }
205
206 \@Book{ whole-set,
207 title = ""
208 }
209 EOF
210 expected_err => '' );
211
212
213 #------------------------------------------------------------------------------
214 BUnit::run(name => 'sort_1',
215 args => '--sort=on bib/xampl_s.bib',
216 expected_out => <<EOF,
217 \@STRING{acm = "The OX Association for Computing Machinery" }
218 \@STRING{stoc = " Symposium on the Theory of Computing" }
219 \@STRING{stoc-key= "OX" }
220
221 \@Article{ article-crossref,
222 title = ""
223 }
224
225 \@Article{ article-full,
226 title = ""
227 }
228
229 \@Article{ article-minimal,
230 title = ""
231 }
232
233 \@Book{ book-crossref,
234 title = ""
235 }
236
237 \@Book{ book-full,
238 title = ""
239 }
240
241 \@Book{ book-minimal,
242 title = ""
243 }
244
245 \@Booklet{ booklet-full,
246 title = ""
247 }
248
249 \@Booklet{ booklet-minimal,
250 title = ""
251 }
252
253 \@InBook{ inbook-crossref,
254 title = ""
255 }
256
257 \@InBook{ inbook-full,
258 title = ""
259 }
260
261 \@InBook{ inbook-minimal,
262 title = ""
263 }
264
265 \@InCollection{ incollection-crossref,
266 title = ""
267 }
268
269 \@InCollection{ incollection-full,
270 title = ""
271 }
272
273 \@InCollection{ incollection-minimal,
274 title = ""
275 }
276
277 \@InProceedings{ inproceedings-crossref,
278 title = ""
279 }
280
281 \@InProceedings{ inproceedings-full,
282 title = ""
283 }
284
285 \@InProceedings{ inproceedings-minimal,
286 title = ""
287 }
288
289 \@Manual{ manual-full,
290 title = ""
291 }
292
293 \@Manual{ manual-minimal,
294 title = ""
295 }
296
297 \@MastersThesis{ mastersthesis-full,
298 title = ""
299 }
300
301 \@MastersThesis{ mastersthesis-minimal,
302 title = ""
303 }
304
305 \@Misc{ misc-full,
306 title = ""
307 }
308
309 \@Misc{ misc-minimal,
310 title = ""
311 }
312
313 \@PhDThesis{ phdthesis-full,
314 title = ""
315 }
316
317 \@PhDThesis{ phdthesis-minimal,
318 title = ""
319 }
320
321 \@Proceedings{ proceedings-full,
322 title = ""
323 }
324
325 \@Proceedings{ proceedings-minimal,
326 title = ""
327 }
328
329 \@Misc{ random-note-crossref,
330 title = ""
331 }
332
333 \@TechReport{ techreport-full,
334 title = ""
335 }
336
337 \@TechReport{ techreport-minimal,
338 title = ""
339 }
340
341 \@Unpublished{ unpublished-full,
342 title = ""
343 }
344
345 \@Unpublished{ unpublished-minimal,
346 title = ""
347 }
348
349 \@Book{ whole-collection,
350 title = ""
351 }
352
353 \@Article{ whole-journal,
354 title = ""
355 }
356
357 \@Proceedings{ whole-proceedings,
358 title = ""
359 }
360
361 \@Book{ whole-set,
362 title = ""
363 }
364 EOF
365 expected_err => '' );
366
367 #------------------------------------------------------------------------------
368 BUnit::run(name => '_S_1',
369 args => '-S bib/xampl_s.bib',
370 expected_out => <<EOF,
371 \@STRING{acm = "The OX Association for Computing Machinery" }
372 \@STRING{stoc = " Symposium on the Theory of Computing" }
373 \@STRING{stoc-key= "OX" }
374
375 \@Book{ whole-set,
376 title = ""
377 }
378
379 \@Proceedings{ whole-proceedings,
380 title = ""
381 }
382
383 \@Article{ whole-journal,
384 title = ""
385 }
386
387 \@Book{ whole-collection,
388 title = ""
389 }
390
391 \@Unpublished{ unpublished-minimal,
392 title = ""
393 }
394
395 \@Unpublished{ unpublished-full,
396 title = ""
397 }
398
399 \@TechReport{ techreport-minimal,
400 title = ""
401 }
402
403 \@TechReport{ techreport-full,
404 title = ""
405 }
406
407 \@Misc{ random-note-crossref,
408 title = ""
409 }
410
411 \@Proceedings{ proceedings-minimal,
412 title = ""
413 }
414
415 \@Proceedings{ proceedings-full,
416 title = ""
417 }
418
419 \@PhDThesis{ phdthesis-minimal,
420 title = ""
421 }
422
423 \@PhDThesis{ phdthesis-full,
424 title = ""
425 }
426
427 \@Misc{ misc-minimal,
428 title = ""
429 }
430
431 \@Misc{ misc-full,
432 title = ""
433 }
434
435 \@MastersThesis{ mastersthesis-minimal,
436 title = ""
437 }
438
439 \@MastersThesis{ mastersthesis-full,
440 title = ""
441 }
442
443 \@Manual{ manual-minimal,
444 title = ""
445 }
446
447 \@Manual{ manual-full,
448 title = ""
449 }
450
451 \@InProceedings{ inproceedings-minimal,
452 title = ""
453 }
454
455 \@InProceedings{ inproceedings-full,
456 title = ""
457 }
458
459 \@InProceedings{ inproceedings-crossref,
460 title = ""
461 }
462
463 \@InCollection{ incollection-minimal,
464 title = ""
465 }
466
467 \@InCollection{ incollection-full,
468 title = ""
469 }
470
471 \@InCollection{ incollection-crossref,
472 title = ""
473 }
474
475 \@InBook{ inbook-minimal,
476 title = ""
477 }
478
479 \@InBook{ inbook-full,
480 title = ""
481 }
482
483 \@InBook{ inbook-crossref,
484 title = ""
485 }
486
487 \@Booklet{ booklet-minimal,
488 title = ""
489 }
490
491 \@Booklet{ booklet-full,
492 title = ""
493 }
494
495 \@Book{ book-minimal,
496 title = ""
497 }
498
499 \@Book{ book-full,
500 title = ""
501 }
502
503 \@Book{ book-crossref,
504 title = ""
505 }
506
507 \@Article{ article-minimal,
508 title = ""
509 }
510
511 \@Article{ article-full,
512 title = ""
513 }
514
515 \@Article{ article-crossref,
516 title = ""
517 }
518 EOF
519 expected_err => '' );
520
521
522 #------------------------------------------------------------------------------
523 BUnit::run(name => 'sort_reverse_1',
524 args => '--sort=on --sort.reverse=on bib/xampl_s.bib',
525 expected_out => <<EOF,
526 \@STRING{acm = "The OX Association for Computing Machinery" }
527 \@STRING{stoc = " Symposium on the Theory of Computing" }
528 \@STRING{stoc-key= "OX" }
529
530 \@Book{ whole-set,
531 title = ""
532 }
533
534 \@Proceedings{ whole-proceedings,
535 title = ""
536 }
537
538 \@Article{ whole-journal,
539 title = ""
540 }
541
542 \@Book{ whole-collection,
543 title = ""
544 }
545
546 \@Unpublished{ unpublished-minimal,
547 title = ""
548 }
549
550 \@Unpublished{ unpublished-full,
551 title = ""
552 }
553
554 \@TechReport{ techreport-minimal,
555 title = ""
556 }
557
558 \@TechReport{ techreport-full,
559 title = ""
560 }
561
562 \@Misc{ random-note-crossref,
563 title = ""
564 }
565
566 \@Proceedings{ proceedings-minimal,
567 title = ""
568 }
569
570 \@Proceedings{ proceedings-full,
571 title = ""
572 }
573
574 \@PhDThesis{ phdthesis-minimal,
575 title = ""
576 }
577
578 \@PhDThesis{ phdthesis-full,
579 title = ""
580 }
581
582 \@Misc{ misc-minimal,
583 title = ""
584 }
585
586 \@Misc{ misc-full,
587 title = ""
588 }
589
590 \@MastersThesis{ mastersthesis-minimal,
591 title = ""
592 }
593
594 \@MastersThesis{ mastersthesis-full,
595 title = ""
596 }
597
598 \@Manual{ manual-minimal,
599 title = ""
600 }
601
602 \@Manual{ manual-full,
603 title = ""
604 }
605
606 \@InProceedings{ inproceedings-minimal,
607 title = ""
608 }
609
610 \@InProceedings{ inproceedings-full,
611 title = ""
612 }
613
614 \@InProceedings{ inproceedings-crossref,
615 title = ""
616 }
617
618 \@InCollection{ incollection-minimal,
619 title = ""
620 }
621
622 \@InCollection{ incollection-full,
623 title = ""
624 }
625
626 \@InCollection{ incollection-crossref,
627 title = ""
628 }
629
630 \@InBook{ inbook-minimal,
631 title = ""
632 }
633
634 \@InBook{ inbook-full,
635 title = ""
636 }
637
638 \@InBook{ inbook-crossref,
639 title = ""
640 }
641
642 \@Booklet{ booklet-minimal,
643 title = ""
644 }
645
646 \@Booklet{ booklet-full,
647 title = ""
648 }
649
650 \@Book{ book-minimal,
651 title = ""
652 }
653
654 \@Book{ book-full,
655 title = ""
656 }
657
658 \@Book{ book-crossref,
659 title = ""
660 }
661
662 \@Article{ article-minimal,
663 title = ""
664 }
665
666 \@Article{ article-full,
667 title = ""
668 }
669
670 \@Article{ article-crossref,
671 title = ""
672 }
673 EOF
674 expected_err => '' );
675
676 #------------------------------------------------------------------------------
677 BUnit::run(name => 'sort_reverse_2',
678 args => '--sort=on --sort.reverse=off bib/xampl_s.bib',
679 expected_out => <<EOF,
680 \@STRING{acm = "The OX Association for Computing Machinery" }
681 \@STRING{stoc = " Symposium on the Theory of Computing" }
682 \@STRING{stoc-key= "OX" }
683
684 \@Article{ article-crossref,
685 title = ""
686 }
687
688 \@Article{ article-full,
689 title = ""
690 }
691
692 \@Article{ article-minimal,
693 title = ""
694 }
695
696 \@Book{ book-crossref,
697 title = ""
698 }
699
700 \@Book{ book-full,
701 title = ""
702 }
703
704 \@Book{ book-minimal,
705 title = ""
706 }
707
708 \@Booklet{ booklet-full,
709 title = ""
710 }
711
712 \@Booklet{ booklet-minimal,
713 title = ""
714 }
715
716 \@InBook{ inbook-crossref,
717 title = ""
718 }
719
720 \@InBook{ inbook-full,
721 title = ""
722 }
723
724 \@InBook{ inbook-minimal,
725 title = ""
726 }
727
728 \@InCollection{ incollection-crossref,
729 title = ""
730 }
731
732 \@InCollection{ incollection-full,
733 title = ""
734 }
735
736 \@InCollection{ incollection-minimal,
737 title = ""
738 }
739
740 \@InProceedings{ inproceedings-crossref,
741 title = ""
742 }
743
744 \@InProceedings{ inproceedings-full,
745 title = ""
746 }
747
748 \@InProceedings{ inproceedings-minimal,
749 title = ""
750 }
751
752 \@Manual{ manual-full,
753 title = ""
754 }
755
756 \@Manual{ manual-minimal,
757 title = ""
758 }
759
760 \@MastersThesis{ mastersthesis-full,
761 title = ""
762 }
763
764 \@MastersThesis{ mastersthesis-minimal,
765 title = ""
766 }
767
768 \@Misc{ misc-full,
769 title = ""
770 }
771
772 \@Misc{ misc-minimal,
773 title = ""
774 }
775
776 \@PhDThesis{ phdthesis-full,
777 title = ""
778 }
779
780 \@PhDThesis{ phdthesis-minimal,
781 title = ""
782 }
783
784 \@Proceedings{ proceedings-full,
785 title = ""
786 }
787
788 \@Proceedings{ proceedings-minimal,
789 title = ""
790 }
791
792 \@Misc{ random-note-crossref,
793 title = ""
794 }
795
796 \@TechReport{ techreport-full,
797 title = ""
798 }
799
800 \@TechReport{ techreport-minimal,
801 title = ""
802 }
803
804 \@Unpublished{ unpublished-full,
805 title = ""
806 }
807
808 \@Unpublished{ unpublished-minimal,
809 title = ""
810 }
811
812 \@Book{ whole-collection,
813 title = ""
814 }
815
816 \@Article{ whole-journal,
817 title = ""
818 }
819
820 \@Proceedings{ whole-proceedings,
821 title = ""
822 }
823
824 \@Book{ whole-set,
825 title = ""
826 }
827 EOF
828 expected_err => '' );
829
830 1;
831 #------------------------------------------------------------------------------
832 # Local Variables:
833 # mode: perl
834 # End: