AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.80
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/share/perl5/Test/Deep/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /usr/local/share/perl5/Test/Deep/Number.pm
use strict;
use warnings;

package Test::Deep::Number;

use Test::Deep::Cmp;

use Scalar::Util;

sub init
{
  my $self = shift;

  $self->{val} = shift(@_) + 0;
  $self->{tolerance} = shift;
}

sub descend
{
  my $self = shift;
  my $got = shift;
  $self->data->{got_string} = $got;
  {
    no warnings 'numeric';
    $got += 0;
  }

  $self->data->{got} = $got;
  if (defined(my $tolerance = $self->{tolerance}))
  {
    return abs($got - $self->{val}) <= $tolerance;
  }
  else
  {
    return $got == $self->{val};
  }
}

sub diag_message
{
  my $self = shift;

  my $where = shift;

  return "Comparing $where as a number";
}

sub renderGot
{
  my $self = shift;
  my $val = shift;

  my $got_string = $self->data->{got_string};
  if ("$val" ne "$got_string")
  {
    $got_string = $self->SUPER::renderGot($got_string);
    return "$val ($got_string)"
  }
  else
  {
    return $val;
  }
}
sub renderExp
{
  my $self = shift;

  my $exp = $self->{val};

  if (defined(my $tolerance = $self->{tolerance}))
  {
    return "$exp +/- $tolerance";
  }
  else
  {
    return $exp;
  }
}

1;

Anon7 - 2022
AnonSec Team