This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add tests for mX?PUSH[inup] macros.
[perl5.git] / ext / XS / APItest / t / push.t
1 BEGIN {
2     chdir 't' if -d 't';
3     @INC = '../lib';
4     push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
5     require Config; import Config;
6     if ($Config{'extensions'} !~ /\bXS\/APItest\b/) {
7         print "1..0 # Skip: XS::APItest was not built\n";
8         exit 0;
9     }
10 }
11
12 use Test::More tests => 9;
13
14 BEGIN { use_ok('XS::APItest') };
15
16 #########################
17
18 my @mpushp = mpushp();
19 my @mpushn = mpushn();
20 my @mpushi = mpushi();
21 my @mpushu = mpushu();
22 ok(eq_array(\@mpushp, [qw(one two three)]), 'mPUSHp()');
23 ok(eq_array(\@mpushn, [0.5, -0.25, 0.125]), 'mPUSHn()');
24 ok(eq_array(\@mpushi, [-1, 2, -3]),         'mPUSHi()');
25 ok(eq_array(\@mpushu, [1, 2, 3]),           'mPUSHu()');
26
27 my @mxpushp = mxpushp();
28 my @mxpushn = mxpushn();
29 my @mxpushi = mxpushi();
30 my @mxpushu = mxpushu();
31 ok(eq_array(\@mxpushp, [qw(one two three)]), 'mXPUSHp()');
32 ok(eq_array(\@mxpushn, [0.5, -0.25, 0.125]), 'mXPUSHn()');
33 ok(eq_array(\@mxpushi, [-1, 2, -3]),         'mXPUSHi()');
34 ok(eq_array(\@mxpushu, [1, 2, 3]),           'mXPUSHu()');