BEGIN {
  if (exists $ENV{PERL_INSTALL_ROOT}) {
    warn "\nIgnoring \$ENV{PERL_INSTALL_ROOT} in $0\n";
    delete $ENV{PERL_INSTALL_ROOT};
  }
};
use File::Spec;
use lib (File::Spec->catdir(File::Spec->updir(),'blib','lib'), File::Spec->catdir(File::Spec->curdir(),'blib','lib'));
use strict;
use diagnostics;

print "1..6\n";

use Inline C => Config =>
    FORCE_BUILD => 1,
    DIRECTORY => '_Inline_test',
    USING => 'ParseRegExp';

use Inline C => <<'EOC';

void foo1(void) {
     printf("Hello from foo1\n");
}

int foo2(void) {
    return 42;
}

SV * foo3(void) {
     return newSVnv(42.0);
}

void foo4() {
     printf("Hello from foo4\n");
}

int foo5() {
    return 42;
}

SV * foo6() {
     return newSVnv(42.0);
}

EOC

eval {foo1();};
if($@) {
  warn "\$\@: $@";
  print "not ok 1\n";
}
else { print "ok 1\n"}

if(42 == foo2()) {print "ok 2\n"}
else {print "not ok 2\n"}

if(42 == foo3()) {print "ok 3\n"}
else {print "not ok 3\n"}

eval {foo4();};
if($@) {
  warn "\$\@: $@";
  print "not ok 4\n";
}
else { print "ok 4\n"}

if(42 == foo5()) {print "ok 5\n"}
else {print "not ok 5\n"}

if(42 == foo6()) {print "ok 6\n"}
else {print "not ok 6\n"}