diff --git a/lib/Fun.pm b/lib/Fun.pm index 53a7bd34c4..67cf094d03 100644 --- a/lib/Fun.pm +++ b/lib/Fun.pm @@ -201,8 +201,8 @@ my $FUNCTION_REFERENCE = "Fun"; my %fields = ( tstart => -1, # (tstart,$tstop) constitutes the domain - tstop => 1, - steps => 50, + tstop => 1, + steps => 50, color => 'blue', x_rule => \&identity, y_rule => \&identity, diff --git a/lib/Hermite.pm b/lib/Hermite.pm index 19c8442215..b429793446 100644 --- a/lib/Hermite.pm +++ b/lib/Hermite.pm @@ -233,7 +233,7 @@ sub internal_critical_points { } sub internal_inflection_points { - my ($x0, $l, $lp,, $x1, $r, $rp, $rh_roots, $rf_function) = @_; + my ($x0, $l, $lp, $x1, $r, $rp, $rh_roots, $rf_function) = @_; #data for one segment of the hermite spline # coefficients for the approximating polynomial diff --git a/lib/Label.pm b/lib/Label.pm index 52f9b77071..bc58b2d8ba 100644 --- a/lib/Label.pm +++ b/lib/Label.pm @@ -42,6 +42,9 @@ This module defines labels for the graph objects (WWPlot). package Label; use strict; +use warnings; + +use GD; #use Exporter; #use DynaLoader; diff --git a/lib/Plots/Axes.pm b/lib/Plots/Axes.pm index 8c7b08efcd..6c20059543 100644 --- a/lib/Plots/Axes.pm +++ b/lib/Plots/Axes.pm @@ -190,6 +190,9 @@ be visible after the fill, otherwise the fill will cover the axis. Default: 0 package Plots::Axes; +use strict; +use warnings; + sub new { my $class = shift; my $self = { @@ -214,9 +217,9 @@ sub new { sub axis_defaults { my ($self, $axis) = @_; return ( - visible => 1, + visible => 1, min => -5, - max => 5, + max => 5, label => $axis eq 'y' ? '\(y\)' : '\(x\)', location => $axis eq 'y' ? 'center' : 'middle', position => 0, @@ -329,4 +332,4 @@ sub bounds { return $self->{xaxis}{min}, $self->{yaxis}{min}, $self->{xaxis}{max}, $self->{yaxis}{max}; } -1; \ No newline at end of file +1; diff --git a/lib/Plots/Data.pm b/lib/Plots/Data.pm index b0a4580dc2..cd153d14a4 100644 --- a/lib/Plots/Data.pm +++ b/lib/Plots/Data.pm @@ -107,6 +107,9 @@ to add / change the styles. package Plots::Data; +use strict; +use warnings; + sub new { my $class = shift; my $self = { @@ -168,7 +171,7 @@ sub set_function { sub_x => sub { return $_[0]; }, sub_y => sub { return $_[0]; }, min => -5, - max => 5, + max => 5, @_ }; $self->style(steps => $self->{function}{steps}) if $self->{funciton}{steps}; diff --git a/lib/Plots/GD.pm b/lib/Plots/GD.pm index 00caae375a..a3da9498aa 100644 --- a/lib/Plots/GD.pm +++ b/lib/Plots/GD.pm @@ -23,6 +23,11 @@ See L for more details. package Plots::GD; +use GD; + +use strict; +use warnings; + sub new { my ($class, $pgplot) = @_; my $self = { @@ -382,4 +387,4 @@ sub draw { return $pgplot->ext eq 'gif' ? $self->im->gif : $self->im->png; } -1; \ No newline at end of file +1; diff --git a/lib/Plots/Plot.pm b/lib/Plots/Plot.pm index 7fadd75789..43dbb1f345 100644 --- a/lib/Plots/Plot.pm +++ b/lib/Plots/Plot.pm @@ -23,17 +23,20 @@ See L for more details. package Plots::Plot; +use strict; +use warnings; + use Plots::Axes; use Plots::Data; -use Plots::GD; use Plots::Tikz; +use Plots::GD; sub new { my ($class, $pg, @opts) = @_; - my $size = $main::envir{onTheFlyImageSize} || 500; + my $size = $pg->{envir}{onTheFlyImageSize} || 500; my $self = { - pg => $pg, + pg => $pg, imageName => {}, type => 'Tikz', ext => 'svg', @@ -158,7 +161,7 @@ sub image_type { # Tikz needs to use pdf for hardcopy generation. sub ext { my $self = shift; - return 'pdf' if ($self->{type} eq 'Tikz' && $main::displayMode eq 'TeX'); + return 'pdf' if ($self->{type} eq 'Tikz' && $self->{pg}{displayMode} eq 'TeX'); return $self->{ext}; } @@ -166,7 +169,7 @@ sub ext { # Set $plot->{tikzDebug} to 1 to just generate the tikzCode, and not create a graph. sub tikz_code { my $self = shift; - return ($self->{tikzCode} && $main::displayMode =~ /HTML/) ? '
' . $self->{tikzCode} . '
' : ''; + return ($self->{tikzCode} && $self->{pg}{displayMode} =~ /HTML/) ? '
' . $self->{tikzCode} . '
' : ''; } # Add functions to the graph. diff --git a/lib/Plots/Tikz.pm b/lib/Plots/Tikz.pm index b639485828..8e08125226 100644 --- a/lib/Plots/Tikz.pm +++ b/lib/Plots/Tikz.pm @@ -21,9 +21,11 @@ See L for more details. =cut - package Plots::Tikz; +use strict; +use warnings; + sub new { my ($class, $pgplot) = @_; my $image = new LaTeXImage; diff --git a/lib/Regression.pm b/lib/Regression.pm index 7b3e272720..3cceeccddd 100644 --- a/lib/Regression.pm +++ b/lib/Regression.pm @@ -431,9 +431,9 @@ if (DEBUGGING) { my $reg = Statistics::Regression->new(3, "sample regression", [ "const", "someX", "someY" ]); $reg->include(2.0, [ 1.0, 3.0, -1.0 ]); - $reg->include(1.0, [ 1.0, 5.0, 2.0 ]); - $reg->include(20.0, [ 1.0, 31.0, 0.0 ]); - $reg->include(15.0, [ 1.0, 11.0, 2.0 ]); + $reg->include(1.0, [ 1.0, 5.0, 2.0 ]); + $reg->include(20.0, [ 1.0, 31.0, 0.0 ]); + $reg->include(15.0, [ 1.0, 11.0, 2.0 ]); # $reg->print(); or: my $coefs= $reg->theta(); print @coefs; print $reg->rsq; # my $coefs= $reg->theta(); print $coeff[0]; diff --git a/lib/Units.pm b/lib/Units.pm index 5fb6c479a3..bcd099ad19 100644 --- a/lib/Units.pm +++ b/lib/Units.pm @@ -327,9 +327,9 @@ our %known_units = ( s => -2 }, uN => { # micronewton - factor => 1E-6, - m => 1, - kg => 1, + factor => 1E-6, + m => 1, + kg => 1, s => -2, aliases => [ 'microN', "\x{00B5}N" ] }, @@ -346,16 +346,16 @@ our %known_units = ( s => -2 }, lb => { # pound - factor => 4.4482216152605, - m => 1, - kg => 1, + factor => 4.4482216152605, + m => 1, + kg => 1, s => -2, aliases => [ 'pound', 'pounds', 'lbs' ] }, ton => { - factor => 8900, - m => 1, - kg => 1, + factor => 8900, + m => 1, + kg => 1, s => -2, aliases => ['tons'] }, @@ -480,69 +480,69 @@ our %known_units = ( # PRESSURE Pa => { # pascal - factor => 1, + factor => 1, m => -1, - kg => 1, + kg => 1, s => -2 }, kPa => { # kilopascal factor => 1000, m => -1, - kg => 1, + kg => 1, s => -2 }, MPa => { # megapascal factor => 1E6, m => -1, - kg => 1, + kg => 1, s => -2 }, GPa => { # gigapascal factor => 1E9, m => -1, - kg => 1, + kg => 1, s => -2 }, atm => { # atmosphere factor => 1.01E5, m => -1, - kg => 1, + kg => 1, s => -2 }, bar => { factor => 100000, m => -1, - kg => 1, + kg => 1, s => -2 }, mbar => { # millibar factor => 100, m => -1, - kg => 1, + kg => 1, s => -2 }, Torr => { factor => 133.322, m => -1, - kg => 1, + kg => 1, s => -2 }, mmHg => { factor => 133.322, m => -1, - kg => 1, + kg => 1, s => -2 }, cmH2O => { # centimeters of water factor => 98.0638, m => -1, - kg => 1, + kg => 1, s => -2 }, psi => { # pounds per square inch factor => 6895, m => -1, - kg => 1, + kg => 1, s => -2 }, @@ -569,85 +569,85 @@ our %known_units = ( s => 1, }, V => { # volt (also J/C) - factor => 1, - kg => 1, - m => 2, + factor => 1, + kg => 1, + m => 2, amp => -1, s => -3, }, mV => { # millivolt factor => 0.001, - kg => 1, - m => 2, + kg => 1, + m => 2, amp => -1, s => -3, }, kV => { # killivolt factor => 1000, - kg => 1, - m => 2, + kg => 1, + m => 2, amp => -1, s => -3, }, MV => { # megavolt factor => 1E6, - kg => 1, - m => 2, + kg => 1, + m => 2, amp => -1, s => -3, }, F => { # farad (also C/V) - factor => 1, - amp => 2, - s => 4, + factor => 1, + amp => 2, + s => 4, kg => -1, m => -2, }, mF => { # millifarad factor => 0.001, - amp => 2, - s => 4, + amp => 2, + s => 4, kg => -1, m => -2, }, uF => { # microfarad - factor => 1E-6, - amp => 2, - s => 4, + factor => 1E-6, + amp => 2, + s => 4, kg => -1, m => -2, aliases => [ "\x{00B5}F", "\x{338C}" ] }, ohm => { # V/amp - factor => 1, - kg => 1, - m => 2, + factor => 1, + kg => 1, + m => 2, amp => -2, s => -3, aliases => ["\x{2126}"] }, kohm => { # kiloohm - factor => 1000, - kg => 1, - m => 2, + factor => 1000, + kg => 1, + m => 2, amp => -2, s => -3, aliases => [ "k\x{2126}", "\x{33C0}" ] }, Mohm => { # megaohm - factor => 1E6, - kg => 1, - m => 2, + factor => 1E6, + kg => 1, + m => 2, amp => -2, s => -3, aliases => [ "M\x{2126}", "\x{33C1}" ] }, S => { # siemens (1/ohm) - factor => 1, + factor => 1, kg => -1, m => -2, - amp => 2, - s => 3, + amp => 2, + s => 3, }, mA => { # milliampere factor => 0.001, @@ -656,47 +656,47 @@ our %known_units = ( # MAGNETIC UNITS T => { # tesla (also kg / A s^2 or N s / C m) - factor => 1, - kg => 1, + factor => 1, + kg => 1, amp => -1, s => -2, }, mT => { # millitesla factor => 0.001, - kg => 1, + kg => 1, amp => -1, s => -2, }, G => { # gauss factor => 1E-4, - kg => 1, + kg => 1, amp => -1, s => -2, }, Wb => { # weber (also T m^2) - factor => 1, - kg => 1, - m => 2, + factor => 1, + kg => 1, + m => 2, amp => -1, s => -2, }, H => { # henry (also V s/amp) - factor => 1, - kg => 1, - m => 2, + factor => 1, + kg => 1, + m => 2, amp => -2, s => -2, }, # LUMINOSITY lm => { # lumen (luminous flux) - factor => 1, - cd => 1, + factor => 1, + cd => 1, rad => -2, }, lx => { # lux (illuminance) - factor => 1, - cd => 1, + factor => 1, + cd => 1, rad => -2, m => -2, }, @@ -722,23 +722,23 @@ our %known_units = ( # RADIATION Sv => { # sievert, dose equivalent radiation (http://xkcd.com/radiation) - factor => 1, - m => 2, + factor => 1, + m => 2, s => -2, }, mSv => { # millisievert (http://blog.xkcd.com/2011/03/19/radiation-chart) factor => 0.001, - m => 2, + m => 2, s => -2, }, uSv => { # microsievert (http://blog.xkcd.com/2011/04/26/radiation-chart-update) - factor => 0.000001, - m => 2, + factor => 0.000001, + m => 2, s => -2, aliases => ["\x{00B5}Sv"] }, Bq => { # becquerel, radioactivity (https://en.wikipedia.org/wiki/Becquerel) - factor => 1, + factor => 1, s => -1, }, @@ -756,8 +756,8 @@ our %known_units = ( mol => 1, }, kat => { # katal (catalytic activity) - factor => 1, - mol => 1, + factor => 1, + mol => 1, s => -1, }, diff --git a/lib/Value/AnswerChecker.pm b/lib/Value/AnswerChecker.pm index 85ed004fb8..f3082bf382 100644 --- a/lib/Value/AnswerChecker.pm +++ b/lib/Value/AnswerChecker.pm @@ -1156,7 +1156,7 @@ sub ANS_MATRIX { $def = $self->context->lists->get('Matrix'); $open = $self->{open} || $def->{open}; $close = $self->{close} || $def->{close}; - return $self->ans_matrix($extend, $name, $self->length, 1, $size, $open, $close, '',, '', %options) + return $self->ans_matrix($extend, $name, $self->length, 1, $size, $open, $close, '', '', %options) if ($self->{ColumnVector}); $def = $self->context->lists->get('Vector'); $open = $self->{open} || $def->{open}; diff --git a/lib/VectorField.pm b/lib/VectorField.pm index 369fd313c0..6d071229ce 100644 --- a/lib/VectorField.pm +++ b/lib/VectorField.pm @@ -159,11 +159,11 @@ my $VECTORFIELD_REFERENCE = "VectorField"; my %fields = ( xmin => -4, - xmax => 4, + xmax => 4, ymin => -4, - ymax => 4, - x_steps => 10, - y_steps => 10, + ymax => 4, + x_steps => 10, + y_steps => 10, arrow_color => 'blue', arrow_weight => 1, #line thickness dot_color => 'red', diff --git a/lib/WWPlot.pm b/lib/WWPlot.pm index 1b73e350e4..de23817563 100644 --- a/lib/WWPlot.pm +++ b/lib/WWPlot.pm @@ -169,6 +169,9 @@ These functions translate from real world to pixel coordinates. package WWPlot; use strict; +use warnings; + +use GD; #use Exporter; #use DynaLoader; @@ -189,9 +192,9 @@ my $last_image_number = 0; #class variable. Keeps track of how many images h my %fields = ( # initialization only!!! xmin => -1, - xmax => 1, + xmax => 1, ymin => -1, - ymax => 1, + ymax => 1, imageName => undef, position => undef, #used internally in the draw routine lineTo ); diff --git a/macros/graph/LiveGraphicsParametricSurface3D.pl b/macros/graph/LiveGraphicsParametricSurface3D.pl index e93b54b8e6..69569ea1f1 100644 --- a/macros/graph/LiveGraphicsParametricSurface3D.pl +++ b/macros/graph/LiveGraphicsParametricSurface3D.pl @@ -176,12 +176,12 @@ sub ParametricSurface3D { uvar => 'u', vvar => 'v', umin => -3, - umax => 3, + umax => 3, vmin => -3, - vmax => 3, - usamples => 20, - vsamples => 20, - axesframed => 1, + vmax => 3, + usamples => 20, + vsamples => 20, + axesframed => 1, xaxislabel => 'x', yaxislabel => 'y', zaxislabel => 'z', diff --git a/macros/graph/LiveGraphicsRectangularPlot3D.pl b/macros/graph/LiveGraphicsRectangularPlot3D.pl index bb9e40cb77..285bbd5f0e 100644 --- a/macros/graph/LiveGraphicsRectangularPlot3D.pl +++ b/macros/graph/LiveGraphicsRectangularPlot3D.pl @@ -243,12 +243,12 @@ sub RectangularPlot3DRectangularDomain { xvar => 'x', yvar => 'y', xmin => -3, - xmax => 3, + xmax => 3, ymin => -3, - ymax => 3, - xsamples => 20, - ysamples => 20, - axesframed => 1, + ymax => 3, + xsamples => 20, + ysamples => 20, + axesframed => 1, xaxislabel => 'x', yaxislabel => 'y', zaxislabel => 'z', diff --git a/macros/graph/LiveGraphicsVectorField2D.pl b/macros/graph/LiveGraphicsVectorField2D.pl index 41c91313d3..0a57d5e416 100644 --- a/macros/graph/LiveGraphicsVectorField2D.pl +++ b/macros/graph/LiveGraphicsVectorField2D.pl @@ -148,12 +148,12 @@ sub VectorField2D { xvar => 'x', yvar => 'y', xmin => -3, - xmax => 3, + xmax => 3, ymin => -3, - ymax => 3, - xsamples => 20, - ysamples => 20, - axesframed => 1, + ymax => 3, + xsamples => 20, + ysamples => 20, + axesframed => 1, xaxislabel => 'x', yaxislabel => 'y', vectorcolor => 'RGBColor[0.0,0.0,1.0]', diff --git a/macros/graph/LiveGraphicsVectorField3D.pl b/macros/graph/LiveGraphicsVectorField3D.pl index 22b35a0402..5d393243e3 100644 --- a/macros/graph/LiveGraphicsVectorField3D.pl +++ b/macros/graph/LiveGraphicsVectorField3D.pl @@ -177,15 +177,15 @@ sub VectorField3D { yvar => 'y', zvar => 'z', xmin => -3, - xmax => 3, + xmax => 3, ymin => -3, - ymax => 3, + ymax => 3, zmin => -3, - zmax => 3, - xsamples => 20, - ysamples => 20, - zsamples => 20, - axesframed => 1, + zmax => 3, + xsamples => 20, + ysamples => 20, + zsamples => 20, + axesframed => 1, xaxislabel => 'x', yaxislabel => 'y', zaxislabel => 'z', diff --git a/macros/graph/VectorField2D.pl b/macros/graph/VectorField2D.pl index 58121bda40..e0223a62ab 100644 --- a/macros/graph/VectorField2D.pl +++ b/macros/graph/VectorField2D.pl @@ -93,11 +93,11 @@ sub VectorField2D { xvar => 'x', yvar => 'y', xmin => -5, - xmax => 5, + xmax => 5, ymin => -5, - ymax => 5, - xsamples => 10, - ysamples => 10, + ymax => 5, + xsamples => 10, + ysamples => 10, vectorcolor => 'blue', vectorscale => 0.25, vectorthickness => 2, diff --git a/macros/graph/plots.pl b/macros/graph/plots.pl index 0ff73f2787..38acb49ab5 100644 --- a/macros/graph/plots.pl +++ b/macros/graph/plots.pl @@ -410,4 +410,4 @@ BEGIN sub _plots_init { } -sub Plot { Plots::Plot->new($main::PG,@_); } \ No newline at end of file +sub Plot { Plots::Plot->new($main::PG, @_); } diff --git a/macros/math/LinearProgramming.pl b/macros/math/LinearProgramming.pl index f2664d4480..5b783d0560 100644 --- a/macros/math/LinearProgramming.pl +++ b/macros/math/LinearProgramming.pl @@ -156,7 +156,7 @@ sub lp_pivot_element { } else { # Test to see if this is an improvement if ($fracmode ? ($m[$prow][$ncols]->scalar()) / ($m[$prow][$pcol]->scalar()) > - ($m[$j][$ncols]->scalar() / $m[$j][$pcol]->scalar()) + ($m[$j][$ncols]->scalar() / $m[$j][$pcol]->scalar()) : ($m[$prow][$ncols] / $m[$prow][$pcol] > $m[$j][$ncols] / $m[$j][$pcol])) { $prow = $j; diff --git a/macros/math/PGnauStats.pl b/macros/math/PGnauStats.pl index bad2828673..6762dd59c2 100644 --- a/macros/math/PGnauStats.pl +++ b/macros/math/PGnauStats.pl @@ -452,7 +452,7 @@ sub SpecialData { sub PercentStemAndLeaf { my (@dat) = @_; - my ($i, $j, $s1, $s2, $all, $low, $max, $num, $row, $cols, $high, @list, $sort, $var1, $var2,, $tex_table, + my ($i, $j, $s1, $s2, $all, $low, $max, $num, $row, $cols, $high, @list, $sort, $var1, $var2, $tex_table, $html_table); while (isstring($dat[0]) == 1) { diff --git a/macros/math/customizeLaTeX.pl b/macros/math/customizeLaTeX.pl index d89d45fcfd..93201497ea 100644 --- a/macros/math/customizeLaTeX.pl +++ b/macros/math/customizeLaTeX.pl @@ -36,7 +36,7 @@ sub implies { sub vectorstyle { my $v = shift; return "\\vec{$v}" - #return "$v"; + #return "$v"; } sub polynomials_of_degree_up_to_degree_over_ring_in_variable { @@ -121,10 +121,10 @@ sub quaternions { return "Q_8" - # Alternatives + # Alternatives - # return "H_8" - # return "Q" + # return "H_8" + # return "Q" } 1; diff --git a/macros/math/draggableSubsets.pl b/macros/math/draggableSubsets.pl index fc6eaa3a16..2eeeaa1fc0 100644 --- a/macros/math/draggableSubsets.pl +++ b/macros/math/draggableSubsets.pl @@ -359,8 +359,7 @@ sub cmp_preprocess { $ans->{preview_latex_string} = join( ',', map { - "\\{\\text{" - . join(',', map { $self->{shuffledSet}[$_] } grep { $_ >= 0 } @{ $_->{data} }) . "}\\}" + "\\{\\text{" . join(',', map { $self->{shuffledSet}[$_] } grep { $_ >= 0 } @{ $_->{data} }) . "}\\}" } @{ $ans->{student_value}{data} } ); } diff --git a/t/macros/math_objects_more.t b/t/macros/math_objects_more.t index 67f43863f2..5b2fccbf7e 100644 --- a/t/macros/math_objects_more.t +++ b/t/macros/math_objects_more.t @@ -25,7 +25,7 @@ is($f->class, 'Formula', 'math objects: check that the class is Formula'); is($f->type, 'Number', 'math objects: check that the type is Number'); # check answer evaluators -is(check_score($f->eval(x => 2), '4'), 1, 'math objects: eval x^2 at x=2'); +is(check_score($f->eval(x => 2), '4'), 1, 'math objects: eval x^2 at x=2'); is(check_score($f->eval(x => -3), '9'), 1, 'math objects: eval x^2 at x=-3'); is(check_score($g->eval(x => 'pi/6'), '1/2'), 1, 'math objects: eval sin(x) at x=pi/6'); diff --git a/t/macros/numerical_methods.t b/t/macros/numerical_methods.t index e0e36f4f43..b5a00a2a31 100644 --- a/t/macros/numerical_methods.t +++ b/t/macros/numerical_methods.t @@ -36,7 +36,7 @@ subtest 'horner' => sub { is &$h1(1.5), 1, 'h1(1.5)=1'; # 1-1*(1.5)+2*(1.5)*(0.5)= 1 ok my $h2 = horner([ -1, 1, 2, 5 ], [ 2, 0, -2, 1 ]); # 2+0(x+1)-2(x+1)(x-1)+(x+1)(x-1)(x-2) - is &$h2(0), 6, 'h2(0)=6'; # 2-2(1)(-1)+(1)(-1)(-2) = 6 + is &$h2(0), 6, 'h2(0)=6'; # 2-2(1)(-1)+(1)(-1)(-2) = 6 is &$h2(3), -6, 'h2(3)=-6'; # 2-2(4)(2)+(4)(2)(1) = -6 like dies { horner([ 0, 1, 2 ], [ -1, 0, 2, 3 ]); }, @@ -65,8 +65,8 @@ subtest 'hermite' => sub { subtest 'hermite spline' => sub { ok my $h = hermite_spline([ 0, 1, 3 ], [ 3, 1, -5 ], [ 1, -2, 0 ]); - is &$h(0), 3, 'h(0)=3'; - is &$h(1), 1, 'h(1)=1'; + is &$h(0), 3, 'h(0)=3'; + is &$h(1), 1, 'h(1)=1'; is &$h(3), -5, 'h(3)=-5'; is &$h(0.5), 19 / 8, 'h(1/2)=19/8'; is &$h(2), -2.5, 'h(2)=-2.5'; diff --git a/t/macros/pgaux.t b/t/macros/pgaux.t index 399de39e67..f6977ea347 100644 --- a/t/macros/pgaux.t +++ b/t/macros/pgaux.t @@ -21,18 +21,18 @@ is(step(0), 0, "step: step(0)=0"); # test floor function -is(floor(0.5), 0, "floor: positive non-integer"); +is(floor(0.5), 0, "floor: positive non-integer"); is(floor(-0.5), -1, "floor: negative non-integer"); -is(floor(1), 1, "floor: positive integer"); -is(floor(0), 0, "floor: floor(0)=0"); +is(floor(1), 1, "floor: positive integer"); +is(floor(0), 0, "floor: floor(0)=0"); is(floor(-1), -1, "floor: negative integer"); # test ceiling function -is(ceil(0.5), 1, "ceil: positive non-integer"); -is(ceil(-0.5), 0, "ceil: negative non-integer"); -is(ceil(1), 1, "ceil: positive integer"); -is(ceil(0), 0, "ceil: floor(0)=0"); +is(ceil(0.5), 1, "ceil: positive non-integer"); +is(ceil(-0.5), 0, "ceil: negative non-integer"); +is(ceil(1), 1, "ceil: positive integer"); +is(ceil(0), 0, "ceil: floor(0)=0"); is(ceil(-1), -1, "ceil: negative integer"); # max/min functions @@ -44,18 +44,18 @@ is(min(0.1, -2.3, 1.345, 2.71712, -1000.1), -1000.1, "min: set of decimals"); # round function -is(round(0.95), 1, "round: fractional part > 0.5"); -is(round(0.45), 0, "round: fractional part < 0.5"); -is(round(0.5), 1, "round: fractional part = 0.5"); +is(round(0.95), 1, "round: fractional part > 0.5"); +is(round(0.45), 0, "round: fractional part < 0.5"); +is(round(0.5), 1, "round: fractional part = 0.5"); is(round(-0.95), -1, "round: fractional part > 0.5 and negative"); -is(round(-0.45), 0, "round: fractional part < 0.5 and negative"); +is(round(-0.45), 0, "round: fractional part < 0.5 and negative"); is(round(-0.5), -1, "round: fractional part = 0.5 and negative"); # Round function which takes a second number, the number of digits to round to -is(Round(1.793, 2), 1.79, "Round to 2 digits: test 1"); -is(Round(1.797, 2), 1.80, "Round to 2 digits: test 2"); -is(Round(1.795, 2), 1.80, "Round to 2 digits: test 3"); +is(Round(1.793, 2), 1.79, "Round to 2 digits: test 1"); +is(Round(1.797, 2), 1.80, "Round to 2 digits: test 2"); +is(Round(1.795, 2), 1.80, "Round to 2 digits: test 3"); is(Round(-1.793, 2), -1.79, "Round to 2 digits: test 1"); is(Round(-1.797, 2), -1.80, "Round to 2 digits: test 2"); is(Round(-1.795, 2), -1.80, "Round to 2 digits: test 3"); diff --git a/t/macros/tableau.t b/t/macros/tableau.t index d7638df8d4..cdcf9de15b 100644 --- a/t/macros/tableau.t +++ b/t/macros/tableau.t @@ -92,13 +92,13 @@ my $steve_profit = 4500; # need error checking to make sure that tableau->new checks # that inputs are matrices my $ra_matrix = [ - [ -$bill_money_commitment, -$bill_time_commitment, -1, 0, 1, 0, 0, -$bill_profit ], - [ -$steve_money_commitment, -$steve_time_commitment, 0, -1, 0, 1, 0, -$steve_profit ], + [ -$bill_money_commitment, -$bill_time_commitment, -1, 0, 1, 0, 0, -$bill_profit ], + [ -$steve_money_commitment, -$steve_time_commitment, 0, -1, 0, 1, 0, -$steve_profit ], [ -$money_total, -$time_total, -1, -1, 0, 0, 1, 0 ] ]; my $a = Value::Matrix->new([ [ -$bill_money_commitment, -$bill_time_commitment, -1, 0 ], - [ -$steve_money_commitment, -$steve_time_commitment, 0, -1 ] + [ -$steve_money_commitment, -$steve_time_commitment, 0, -1 ] ]); my $b = Value::Vector->new([ -$bill_profit, -$steve_profit ]); # need vertical vector my $c = Value::Vector->new([ $money_total, $time_total, 1, 1 ]); diff --git a/t/units/basic_parser.t b/t/units/basic_parser.t index f5cebc4aea..6598c29814 100644 --- a/t/units/basic_parser.t +++ b/t/units/basic_parser.t @@ -60,17 +60,17 @@ subtest 'Check attributes' => sub { data => [1], units => 'J', units_ref => { - kg => 1, - m => 2, + kg => 1, + m => 2, s => -2, - factor => 1, - amp => 0, - cd => 0, - mol => 0, - rad => 0, - degC => 0, - degF => 0, - K => 0, + factor => 1, + amp => 0, + cd => 0, + mol => 0, + rad => 0, + degC => 0, + degF => 0, + K => 0, }, isValue => T(), context => check_isa 'Parser::Context'