Perl TESTING for gcc compiler option related

commandline session

$cat testgcc.pl
#!/usr/bin/perl -w

use Test::More tests => 2 ;

my $result;

system "gcc unsigned.c";
$result = `./a.out`;
#print $result;
ok ($result lt 0);


system "gcc -funsigned-char unsigned.c";
$result = `./a.out`;
#print $result;
ok ($result gt 0);

$cat unsigned.c
#include

int main(void)
{
  char c = -10;
  printf("%d",c);
  return 0;
}
$perl testgcc.pl
1..2
ok 1
ok 2
$

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s