VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.9/util/c-compress-test.pl@ 100906

Last change on this file since 100906 was 100487, checked in by vboxsync, 17 months ago

openssl-3.0.9: Applied and adjusted our OpenSSL changes we made to 3.0.7. bugref:10484

File size: 1.0 KB
Line 
1#! /usr/bin/env perl
2#
3# TEST c-compress-pl with a number of examples and what should happen to them
4
5use strict;
6use warnings;
7
8use File::Basename;
9
10my @pairs =
11 (
12 [ <<'_____'
13/* A hell of a program */
14#def\
15ine foo/* bar */ 3
16#define bar /* haha "A /* comment */ that should /* remain" */
17#define haha /* hoho */ "A /* comment */ that should /* remain" */
18
19int main() {
20 int x;
21 /* one lonely comment */
22}
23_____
24 , <<'_____'
25#define foo 3
26#define bar that should
27#define haha "A /* comment */ that should /* remain" */
28int main() {
29int x;
30}
31_____
32 ]
33 );
34
35my $here = dirname $0;
36my $c_compress = "$here/lang-compress.pl";
37
38use FileHandle;
39use IPC::Open2;
40use Text::Diff;
41foreach (@pairs) {
42 my $source = $_->[0];
43 my $expected = $_->[1];
44 my $pid = open2(\*Reader, \*Writer, "perl $c_compress 'C'");
45 print Writer $source;
46 close Writer;
47
48 local $/ = undef; # slurp
49 my $got = <Reader>;
50
51 if ($got ne $expected) {
52 print "MISMATCH:\n", diff \$expected, \$got;
53 }
54}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette