diff options
| author | holli-holzer <holli.holzer@gmail.com> | 2019-09-17 21:14:23 +0200 |
|---|---|---|
| committer | holli-holzer <holli.holzer@gmail.com> | 2019-09-17 21:14:23 +0200 |
| commit | f8f36e82595be65d74b99feef6a2779d36cdc0d3 (patch) | |
| tree | 36549118f34969c1ec59b3733f0d4aeb80454d30 /challenge-026 | |
| parent | 79c26caafa0533b8a500825357fdfdac40100c6e (diff) | |
| download | perlweeklychallenge-club-f8f36e82595be65d74b99feef6a2779d36cdc0d3.tar.gz perlweeklychallenge-club-f8f36e82595be65d74b99feef6a2779d36cdc0d3.tar.bz2 perlweeklychallenge-club-f8f36e82595be65d74b99feef6a2779d36cdc0d3.zip | |
Better wording, added missing "use Test;"
Diffstat (limited to 'challenge-026')
| -rw-r--r-- | challenge-026/markus-holzer/perl6/ch-2.p6 | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/challenge-026/markus-holzer/perl6/ch-2.p6 b/challenge-026/markus-holzer/perl6/ch-2.p6 index 2273b4f199..8c53908732 100644 --- a/challenge-026/markus-holzer/perl6/ch-2.p6 +++ b/challenge-026/markus-holzer/perl6/ch-2.p6 @@ -1,3 +1,5 @@ +use Test; + # Rakus trigonometry functions operate on radians. So we must convert degrees to radians. # That's simple enough using a new postfix operator and high school math. multi sub postfix:<°>( Numeric $degrees ) returns Real { $degrees * π / 180 } @@ -15,11 +17,11 @@ sub mean-angle( *@α ) returns Real ); ρ > 0 - ?? ρ # We always want positive values + ?? ρ # We always want a positive value !! ρ + 2 * π # When it isn't, we add 360° } -ok( mean-angle( 10°, 10°, 10° ) =~= 10°, "The mean of 3 times alpha is alpha" ); +ok( mean-angle( 10°, 10°, 10° ) =~= 10°, "The mean of equal angles is the angle" ); ok( mean-angle( 10°, 20°, 30° ) =~= 20°, "All angles in one quadrant" ); ok( mean-angle( 355°, 5°, 15° ) =~= 5°, "Angles in multiple quadrants" ); ok( mean-angle( 90°, 180°, 270°, 360° ) =~= 270°, "Angle is not negative" ); |
