Fix unit test bugs

This commit is contained in:
Dennis Eichhorn 2019-10-10 22:30:58 +02:00
parent 33ecc44e1f
commit 35e410f832
3 changed files with 16 additions and 9 deletions

View File

@ -140,8 +140,11 @@ class Integration
$sum1 = 0.0;
$sum2 = 0.0;
for ($i = 1; $i < $n; ++$i) {
for ($i = 0; $i < $n; ++$i) {
$sum1 += $func($from + $h * $i + $h / 2.0);
}
for ($i = 1; $i < $n; ++$i) {
$sum2 += $func($from + $h * $i);
}

View File

@ -261,6 +261,8 @@ class Heap
public function getNLargest(int $n) : array
{
$nodes = $this->nodes;
\uasort($nodes, $this->compare);
return \array_slice(\array_reverse($nodes), 0, $n);
}
@ -276,6 +278,8 @@ class Heap
public function getNSmallest(int $n): array
{
$nodes = $this->nodes;
\uasort($nodes, $this->compare);
return \array_slice($nodes, 0, $n);
}

View File

@ -31,7 +31,7 @@ class Location implements \JsonSerializable, \Serializable
* @var int
* @since 1.0.0
*/
private int $id = 0;
protected int $id = 0;
/**
* Zip or postal.
@ -39,7 +39,7 @@ class Location implements \JsonSerializable, \Serializable
* @var string
* @since 1.0.0
*/
private string $postal = '';
protected string $postal = '';
/**
* Name of city.
@ -47,7 +47,7 @@ class Location implements \JsonSerializable, \Serializable
* @var string
* @since 1.0.0
*/
private string $city = '';
protected string $city = '';
/**
* Name of the country.
@ -55,7 +55,7 @@ class Location implements \JsonSerializable, \Serializable
* @var string
* @since 1.0.0
*/
private string $country = '';
protected string $country = '';
/**
* Street & district.
@ -63,7 +63,7 @@ class Location implements \JsonSerializable, \Serializable
* @var string
* @since 1.0.0
*/
private string $address = '';
protected string $address = '';
/**
* Address type
@ -71,7 +71,7 @@ class Location implements \JsonSerializable, \Serializable
* @var int
* @since 1.0.0
*/
private int $type = AddressType::HOME;
protected int $type = AddressType::HOME;
/**
* State.
@ -79,7 +79,7 @@ class Location implements \JsonSerializable, \Serializable
* @var string
* @since 1.0.0
*/
private string $state = '';
protected string $state = '';
/**
* Geo coordinates.
@ -87,7 +87,7 @@ class Location implements \JsonSerializable, \Serializable
* @var float[]
* @since 1.0.0
*/
private array $geo = ['lat' => 0, 'long' => 0];
protected array $geo = ['lat' => 0, 'long' => 0];
/**
* Get location id