xref: /openbsd-src/gnu/usr.bin/perl/os2/OS2/OS2-REXX/t/rx_emxrv.t (revision b39c515898423c8d899e35282f4b395f7cad3298)
1*b39c5158SmillertBEGIN {
2*b39c5158Smillert    chdir 't' if -d 't/lib';
3*b39c5158Smillert    @INC = '../lib' if -d 'lib';
4*b39c5158Smillert    require Config; import Config;
5*b39c5158Smillert    if (-d 'lib' and $Config{'extensions'} !~ /\bOS2(::|\/)REXX\b/) {
6*b39c5158Smillert	print "1..0\n";
7*b39c5158Smillert	exit 0;
8*b39c5158Smillert    }
9*b39c5158Smillert}
10*b39c5158Smillert
11*b39c5158Smillertprint "1..20\n";
12*b39c5158Smillert
13*b39c5158Smillertrequire OS2::DLL;
14*b39c5158Smillertprint "ok 1\n";
15*b39c5158Smillert$emx_dll = OS2::DLL->load('emx');
16*b39c5158Smillertprint "ok 2\n";
17*b39c5158Smillert$emx_version = $emx_dll->emx_revision();
18*b39c5158Smillertprint "ok 3\n";
19*b39c5158Smillert$emx_version >= 40 or print "not ";	# We cannot work with old EMXs
20*b39c5158Smillertprint "ok 4\n";
21*b39c5158Smillert
22*b39c5158Smillert$reason = '';
23*b39c5158Smillert$emx_version >= 99 and $reason = ' # skipped: version of EMX 100 or more';	# Be safe
24*b39c5158Smillertprint "ok 5$reason\n";
25*b39c5158Smillert
26*b39c5158Smillert$emx_fullname = OS2::DLLname 0x202, $emx_dll->{Handle};	# Handle ==> fullname
27*b39c5158Smillertprint "ok 6\n";
28*b39c5158Smillert$emx_dll1 = OS2::DLL->module($emx_fullname);
29*b39c5158Smillertprint "ok 7\n";
30*b39c5158Smillert$emx_dll->{Handle} == $emx_dll1->{Handle} or print "not ";
31*b39c5158Smillertprint "ok 8\n";
32*b39c5158Smillert
33*b39c5158Smillert$emx_version1 = $emx_dll1->emx_revision();
34*b39c5158Smillertprint "ok 9\n";
35*b39c5158Smillert$emx_version1 eq $emx_version or print "not ";
36*b39c5158Smillertprint "ok 10\n";
37*b39c5158Smillert
38*b39c5158Smillert$emx_revision = $emx_dll->wrapper_REXX('emx_revision');
39*b39c5158Smillertprint "ok 11\n";
40*b39c5158Smillert$emx_version2 = $emx_revision->();
41*b39c5158Smillertprint "ok 12\n";
42*b39c5158Smillert$emx_version2 eq $emx_version or print "not ";
43*b39c5158Smillertprint "ok 13\n";
44*b39c5158Smillert
45*b39c5158Smillert$emx_revision1 = $emx_dll1->wrapper_REXX('#128');
46*b39c5158Smillertprint "ok 14\n";
47*b39c5158Smillert$emx_version3 = $emx_revision1->();
48*b39c5158Smillertprint "ok 15\n";
49*b39c5158Smillert$emx_version3 eq $emx_version or print "not ";
50*b39c5158Smillertprint "ok 16\n";
51*b39c5158Smillert
52*b39c5158Smillert($emx_fullname1 = $emx_fullname) =~ s,/,\\,g;
53*b39c5158Smillert$emx_dll2 = OS2::DLL->new($emx_fullname1);
54*b39c5158Smillertprint "ok 17\n";
55*b39c5158Smillert$emx_dll->{Handle} == $emx_dll2->{Handle} or print "not ";
56*b39c5158Smillertprint "ok 18\n";
57*b39c5158Smillert
58*b39c5158Smillert$emx_version4 = $emx_dll2->emx_revision();
59*b39c5158Smillertprint "ok 19\n";
60*b39c5158Smillert$emx_version4 eq $emx_version or print "not ";
61*b39c5158Smillertprint "ok 20\n";
62