/**
  * is $a approximately equal to $b, according to the rules of the
  * ~ operator?
  *
  * NOTES:
  *
  * - you can only use the ~ operator to pin down which major / minor
  *   version to limit to, not the preRelease level
  *
  * @param  VersionNumber|string $a
  *         the LHS of this calculation
  * @param  VersionNumber|string $b
  *         the RHS of this calcuation
  * @param  VersionParser|null $parser
  *         the parser to use if $a or $b are strings
  * @return boolean
  *         TRUE if $a ~= $b
  *         FALSE otherwise
  */
 public static function calculate($a, $b, VersionParser $parser = null)
 {
     $aObj = EnsureVersionNumber::from($a, $parser);
     $bObj = EnsureCompatibleVersionNumber::from($aObj, $b);
     $c = $bObj->getApproximateUpperBoundary();
     return InBetween::calculate($aObj, $bObj, $c);
 }
 /**
  * is $a compatible with $b, according to the rules of the
  * ^ operator?
  *
  * @param  VersionNumber|string $a
  *         the LHS of this calculation
  * @param  VersionNumber|string $b
  *         the RHS of this calculation
  * @param  VersionParser|null $parser
  *         the parser to use if $a or $b are strings
  * @return boolean
  *         TRUE if $a is compatible with $b
  *         FALSE otherwise
  */
 public static function calculate($a, $b, VersionParser $parser = null)
 {
     // make sure $b is something we can work with
     $aObj = EnsureVersionNumber::from($a, $parser);
     $bObj = EnsureCompatibleVersionNumber::from($aObj, $b, $parser);
     // calculate the upper boundary
     $c = $bObj->getCompatibleUpperBoundary();
     // is $a compatible with $b?
     return InBetween::calculate($aObj, $bObj, $c);
 }
 /**
  * @dataProvider provideInBetweenDataset
  *
  * @covers ::calculate
  */
 public function testCanCallStatically($a, $b, $c, $expectedResult)
 {
     // ----------------------------------------------------------------
     // setup your test
     $aVer = ParseSemanticVersion::from($a);
     $bVer = ParseSemanticVersion::from($b);
     $cVer = ParseSemanticVersion::from($c);
     // ----------------------------------------------------------------
     // perform the change
     $actualResult = InBetween::calculate($aVer, $bVer, $cVer);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedResult, $actualResult);
 }