/**
  * @covers SecurityLib\BaseConverter::convertToBinary
  * @covers SecurityLib\BaseConverter::convertFromBinary
  * @covers SecurityLib\BaseConverter::baseConvert
  * @dataProvider provideConvertToFromBinary
  */
 public function testConvertToAndFromBinary($str, $from)
 {
     return false;
     $result1 = BaseConverter::convertFromBinary($str, $from);
     $result = BaseConverter::convertToBinary($result1, $from);
     $this->assertEquals($str, $result);
 }
예제 #2
0
 /**
  * Subtract two numbers
  *
  * @param string $left  The left argument
  * @param string $right The right argument
  *
  * @return A base-10 string of the difference of the two arguments
  */
 public function subtract($left, $right)
 {
     if (empty($left)) {
         return $right;
     } elseif (empty($right)) {
         return $left;
     } elseif ($right[0] == '-') {
         return $this->add($left, substr($right, 1));
     } elseif ($left[0] == '-') {
         return '-' . $this->add(ltrim($left, '-'), $right);
     }
     $left = $this->normalize($left);
     $right = $this->normalize($right);
     $results = $this->subtractBinary($left, $right);
     $result = BaseConverter::convertFromBinary($results[1], '0123456789');
     return $results[0] . $result;
 }