You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
within() considers the range boundaries to be NOT within. Under the covers, Test2::Tools::Compare->within() indirectly calls Test2::Compare::Float->verify(), which compares with < and >, rather than <= and >=.
Is this intended? In any case, please document the behavior.
Demonstration:
use Test2::V0;
is(55, within(54,1), 'on upper edge');
is(53, within(54,1), 'on lower edge');
is(55, within(54,2), 'wholly within range');
is(53, within(54,2), 'wholly within range');
is(55, within(54,1.0001), 'barely within range (workaround)');
is(53, within(54,1.0001), 'barely within range (workaround)');
done_testing();
# prove -v within.t
not ok 1 - on upper edge
# Failed test 'on upper edge'
# at within.t line 2.
# +-----+----+----------+-----+
# | GOT | OP | CHECK | LNs |
# +-----+----+----------+-----+
# | 55 | == | 54 +/- 1 | 2 |
# +-----+----+----------+-----+
not ok 2 - on lower edge
ok 3 - wholly within range
ok 4 - wholly within range
ok 5 - barely within range (workaround)
# Failed test 'on lower edge'
# at within.t line 3.
# +-----+----+----------+-----+
# | GOT | OP | CHECK | LNs |
# +-----+----+----------+-----+
# | 53 | == | 54 +/- 1 | 3 |
# +-----+----+----------+-----+
ok 6 - barely within range (workaround)
The text was updated successfully, but these errors were encountered:
within()
considers the range boundaries to be NOT within. Under the covers,Test2::Tools::Compare->within()
indirectly callsTest2::Compare::Float->verify()
, which compares with<
and>
, rather than<=
and>=
.Is this intended? In any case, please document the behavior.
Demonstration:
The text was updated successfully, but these errors were encountered: