Skip to content
Go to file
Cannot retrieve contributors at this time
36 lines (20 sloc) 789 Bytes
use v6;
use Test;
plan 8;
# L<S32::Numeric/Numeric/"Numeric provides some constants">
=begin pod
Basic tests for builtin Num::pi and Num::tau
=end pod
# See also: L<""> :)
my $PI = 3.141592e0;
is-approx(EVAL("pi"), $PI, "pi imported by default");
throws-like "3 + pi()", X::Undeclared, "pi() is not a sub";
is-approx(EVAL("3 + pi"), $PI+3, "3+pi, as a bareword");
is-approx(EVAL("pi + 3"), $PI+3, "pi+3, as a bareword");
is-approx(π, $PI, "unicode π as a bareword");
# Tau, see also: L<"">
is(EVAL("tau"), EVAL("2 * pi"), "pi = tau / 2");
throws-like "3 + tau()", X::Undeclared, "tau() is not a sub";
is-approx(τ, 2*$PI, "unicode τ as a bareword");
# vim: expandtab shiftwidth=4
You can’t perform that action at this time.