Commit | Line | Data |
760ac839 |
1 | BEGIN { |
2 | chdir 't' if -d 't/lib'; |
3 | @INC = '../lib' if -d 'lib'; |
4 | require Config; import Config; |
bbad3607 |
5 | if (-d 'lib' and $Config{'extensions'} !~ /\bOS2(::|\/)REXX\b/) { |
760ac839 |
6 | print "1..0\n"; |
7 | exit 0; |
8 | } |
9 | } |
10 | |
11 | use OS2::REXX; |
12 | |
13 | print "1..9\n"; |
14 | |
15 | REXX_call { |
16 | OS2::REXX::_set("X" => sqrt(2)) and print "ok 1\n"; |
17 | $x = OS2::REXX::_fetch("X") and print "ok 2\n"; |
18 | if (abs($x - sqrt(2)) < 5e-15) { |
19 | print "ok 3\n"; |
20 | } else { print "not ok 3\n# sqrt(2) = @{[sqrt(2)]} != `$x'\n" } |
21 | OS2::REXX::_set("Y" => sqrt(3)) and print "ok 4\n"; |
22 | $i = 0; |
23 | $n = 4; |
24 | while (($name, $value) = OS2::REXX::_next("")) { |
25 | $i++; $n++; |
26 | if ($i <= 2 and $name eq "Y" ) { |
27 | if ($value eq sqrt(3)) { |
28 | print "ok $n\n"; |
29 | } else { |
30 | print "not ok $n\n# `$name' => `$value'\n" ; |
31 | } |
32 | } elsif ($i <= 2 and $name eq "X") { |
33 | print "ok $n\n" if $value eq sqrt(2); |
34 | } else { print "not ok 7\n# name `$name', value `$value'\n" } |
35 | } |
36 | print "ok 7\n" if $i == 2; |
37 | OS2::REXX::_drop("X") and print "ok 8\n"; |
38 | $x = OS2::REXX::_fetch("X") or print "ok 9\n"; |
39 | }; |