mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 05:38:39 +00:00
Fix unit test bugs
This commit is contained in:
parent
33ecc44e1f
commit
35e410f832
|
|
@ -140,8 +140,11 @@ class Integration
|
||||||
$sum1 = 0.0;
|
$sum1 = 0.0;
|
||||||
$sum2 = 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);
|
$sum1 += $func($from + $h * $i + $h / 2.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 1; $i < $n; ++$i) {
|
||||||
$sum2 += $func($from + $h * $i);
|
$sum2 += $func($from + $h * $i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -261,6 +261,8 @@ class Heap
|
||||||
public function getNLargest(int $n) : array
|
public function getNLargest(int $n) : array
|
||||||
{
|
{
|
||||||
$nodes = $this->nodes;
|
$nodes = $this->nodes;
|
||||||
|
\uasort($nodes, $this->compare);
|
||||||
|
|
||||||
return \array_slice(\array_reverse($nodes), 0, $n);
|
return \array_slice(\array_reverse($nodes), 0, $n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,6 +278,8 @@ class Heap
|
||||||
public function getNSmallest(int $n): array
|
public function getNSmallest(int $n): array
|
||||||
{
|
{
|
||||||
$nodes = $this->nodes;
|
$nodes = $this->nodes;
|
||||||
|
\uasort($nodes, $this->compare);
|
||||||
|
|
||||||
return \array_slice($nodes, 0, $n);
|
return \array_slice($nodes, 0, $n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private int $id = 0;
|
protected int $id = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zip or postal.
|
* Zip or postal.
|
||||||
|
|
@ -39,7 +39,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $postal = '';
|
protected string $postal = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of city.
|
* Name of city.
|
||||||
|
|
@ -47,7 +47,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $city = '';
|
protected string $city = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the country.
|
* Name of the country.
|
||||||
|
|
@ -55,7 +55,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $country = '';
|
protected string $country = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Street & district.
|
* Street & district.
|
||||||
|
|
@ -63,7 +63,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $address = '';
|
protected string $address = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address type
|
* Address type
|
||||||
|
|
@ -71,7 +71,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private int $type = AddressType::HOME;
|
protected int $type = AddressType::HOME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State.
|
* State.
|
||||||
|
|
@ -79,7 +79,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private string $state = '';
|
protected string $state = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Geo coordinates.
|
* Geo coordinates.
|
||||||
|
|
@ -87,7 +87,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var float[]
|
* @var float[]
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private array $geo = ['lat' => 0, 'long' => 0];
|
protected array $geo = ['lat' => 0, 'long' => 0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get location id
|
* Get location id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user