|
|
|
@@ -3,7 +3,6 @@
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
use mirzaev\baza\database,
|
|
|
|
|
mirzaev\baza\core,
|
|
|
|
|
mirzaev\baza\record,
|
|
|
|
|
mirzaev\baza\column,
|
|
|
|
|
mirzaev\baza\enumerations\encoding,
|
|
|
|
@@ -36,9 +35,6 @@ require($autoload);
|
|
|
|
|
// Initializing path to the database file
|
|
|
|
|
$file = __DIR__ . DIRECTORY_SEPARATOR . 'temporary' . DIRECTORY_SEPARATOR . 'database.baza';
|
|
|
|
|
|
|
|
|
|
// Initilized architecture runtime constant
|
|
|
|
|
define('ARCHITECTURE', core::architecture());
|
|
|
|
|
|
|
|
|
|
echo "Started testing\n\n\n";
|
|
|
|
|
|
|
|
|
|
// Initializing the counter of actions
|
|
|
|
@@ -57,9 +53,10 @@ if (!file_exists($file) || unlink($file)) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Initializing the test database
|
|
|
|
|
/* $database = new database() */
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
$database = (new database())
|
|
|
|
|
$database = new database();
|
|
|
|
|
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
$database
|
|
|
|
|
->encoding(encoding::utf8)
|
|
|
|
|
->columns(
|
|
|
|
|
new column('name', type::string, ['length' => 32]),
|
|
|
|
@@ -74,7 +71,7 @@ if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
)
|
|
|
|
|
->connect($file);
|
|
|
|
|
} else {
|
|
|
|
|
$database = (new database())
|
|
|
|
|
$database
|
|
|
|
|
->encoding(encoding::utf8)
|
|
|
|
|
->columns(
|
|
|
|
|
new column('name', type::string, ['length' => 32]),
|
|
|
|
@@ -89,7 +86,7 @@ if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . "] Initialized the database\n";
|
|
|
|
|
|
|
|
|
|
// Initializing the record
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
$record = $database->record(
|
|
|
|
|
'Arsen',
|
|
|
|
|
'Mirzaev',
|
|
|
|
@@ -119,7 +116,7 @@ echo '[' . ++$action . '][' . ++$test . '][' . ($record->name === 'Arsen' ? 'SUC
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record->second_name === 'Mirzaev' ? 'SUCCESS' : 'FAIL') . "][\"second_name\"] Expected: \"Mirzaev\" (string). Actual: \"$record->second_name\" (" . gettype($record->second_name) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record->age === 24 ? 'SUCCESS' : 'FAIL') . "][\"age\"] Expected: \"24\" (integer). Actual: \"$record->age\" (" . gettype($record->age) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record->height === 165.5 ? 'SUCCESS' : 'FAIL') . "][\"height\"] Expected: \"165.5\" (double). Actual: \"$record->height\" (" . gettype($record->height) . ")\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record->neuron_count === 91000000000 ? 'SUCCESS' : 'FAIL') . "][\"neuron_count\"] Expected: \"91000000000\" (integer). Actual: \"$record->neuron_count\" (" . gettype($record->neuron_count) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record->motivation === 1.7976931348623E+238 ? 'SUCCESS' : 'FAIL') . "][\"motivation\"] Expected: \"1.7976931348623E+238\" (double). Actual: \"$record->motivation\" (" . gettype($record->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record->reputation === 7355608 ? 'SUCCESS' : 'FAIL') . "][\"reputation\"] Expected: \"7355608\" (integer). Actual: \"$record->reputation\" (" . gettype($record->reputation) . ")\n";
|
|
|
|
@@ -134,10 +131,10 @@ $test = 0;
|
|
|
|
|
// Writing the record into the database
|
|
|
|
|
$database->write($record);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Writed the record into the database\n";
|
|
|
|
|
echo '[' . ++$action . "] Wrote the record into the database\n";
|
|
|
|
|
|
|
|
|
|
// Initializing the second record
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
$record_ivan = $database->record(
|
|
|
|
|
'Ivan',
|
|
|
|
|
'Ivanov',
|
|
|
|
@@ -166,7 +163,7 @@ $database->write($record_ivan);
|
|
|
|
|
echo '[' . ++$action . "] Wrote the record into the database\n";
|
|
|
|
|
|
|
|
|
|
// Initializing the second record
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
$record_margarita = $database->record(
|
|
|
|
|
'Margarita',
|
|
|
|
|
'Esenina',
|
|
|
|
@@ -200,12 +197,12 @@ $records_read_all = $database->read(amount: 99999);
|
|
|
|
|
echo '[' . ++$action . "] Read all records from the database\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_readed_all) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_readed_all) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_all) === 3 ? 'SUCCESS' : 'FAIL') . '][amount of readed records] Expected: 3 records. Actual: ' . count($records_readed_all) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_readed_all[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($records_readed_all[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_all[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $records_readed_all[0]::class . "\"\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_all[0]->neuron_count === 91000000000 ? 'SUCCESS' : 'FAIL') . ']["neuron_count"] Expected: "91000000000" (integer). Actual: "' . $records_readed_all[0]->neuron_count . '" (' . gettype($records_readed_all[0]->neuron_count) . ")\n";
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_read_all) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_read_all) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_all) === 3 ? 'SUCCESS' : 'FAIL') . '][amount of read records] Expected: 3 records. Actual: ' . count($records_read_all) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_read_all[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($records_read_all[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_all[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $records_read_all[0]::class . "\"\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_all[0]->neuron_count === 91000000000 ? 'SUCCESS' : 'FAIL') . ']["neuron_count"] Expected: "91000000000" (integer). Actual: "' . $records_read_all[0]->neuron_count . '" (' . gettype($records_read_all[0]->neuron_count) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The read all records checks have been completed\n";
|
|
|
|
@@ -222,13 +219,13 @@ $record_read_first = $database->read(amount: 1);
|
|
|
|
|
echo '[' . ++$action . "] Read the first record from the database\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($record_readed_first) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($record_readed_first) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($record_readed_first) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of readed records] Expected: 1 records. Actual: ' . count($record_readed_first) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($record_readed_first[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($record_readed_first[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_first[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $record_readed_first[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_first[0]->second_name === 'Mirzaev' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Mirzaev" (string). Actual: "' . $record_readed_first[0]->second_name . '" (' . gettype($record_readed_first[0]->second_name) . ")\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_first[0]->neuron_count === 91000000000 ? 'SUCCESS' : 'FAIL') . ']["neuron_count"] Expected: "91000000000" (integer). Actual: "' . $record_readed_first[0]->neuron_count . '" (' . gettype($record_readed_first[0]->neuron_count) . ")\n";
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($record_read_first) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($record_read_first) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($record_read_first) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of read records] Expected: 1 records. Actual: ' . count($record_read_first) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($record_read_first[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($record_read_first[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_first[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $record_read_first[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_first[0]->second_name === 'Mirzaev' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Mirzaev" (string). Actual: "' . $record_read_first[0]->second_name . '" (' . gettype($record_read_first[0]->second_name) . ")\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_first[0]->neuron_count === 91000000000 ? 'SUCCESS' : 'FAIL') . ']["neuron_count"] Expected: "91000000000" (integer). Actual: "' . $record_read_first[0]->neuron_count . '" (' . gettype($record_read_first[0]->neuron_count) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The read first record checks have been completed\n";
|
|
|
|
@@ -245,12 +242,12 @@ $record_read_second = $database->read(amount: 1, offset: 1);
|
|
|
|
|
echo '[' . ++$action . "] Read the second record from the database\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($record_readed_second) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($record_readed_second) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($record_readed_second) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of readed records] Expected: 1 records. Actual: ' . count($record_readed_second) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($record_readed_second[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($record_readed_second[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_second[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $record_readed_second[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_second[0]->second_name === 'Ivanov' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Ivanov" (string). Actual: "' . $record_readed_second[0]->second_name . '" (' . gettype($record_readed_second[0]->second_name) . ")\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($record_read_second) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($record_read_second) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($record_read_second) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of read records] Expected: 1 records. Actual: ' . count($record_read_second) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($record_read_second[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($record_read_second[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $record_read_second[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0]->second_name === 'Ivanov' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Ivanov" (string). Actual: "' . $record_read_second[0]->second_name . '" (' . gettype($record_read_second[0]->second_name) . ")\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
/**
|
|
|
|
|
* Due to IEEE 754 double precision format double equality is problematic
|
|
|
|
|
*
|
|
|
|
@@ -274,12 +271,12 @@ $record_read_filter = $database->read(filter: fn($record) => $record?->second_na
|
|
|
|
|
echo '[' . ++$action . "] Read the record from the database by filter\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($record_readed_filter) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($record_readed_filter) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($record_readed_filter) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of readed records] Expected: 1 records. Actual: ' . count($record_readed_filter) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($record_readed_filter[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($record_readed_filter[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_filter[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $record_readed_filter[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_filter[0]->second_name === 'Ivanov' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Ivanov" (string). Actual: "' . $record_readed_filter[0]->second_name . '" (' . gettype($record_readed_filter[0]->second_name) . ")\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($record_read_filter) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($record_read_filter) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($record_read_filter) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of read records] Expected: 1 records. Actual: ' . count($record_read_filter) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($record_read_filter[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($record_read_filter[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_filter[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $record_read_filter[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_filter[0]->second_name === 'Ivanov' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Ivanov" (string). Actual: "' . $record_read_filter[0]->second_name . '" (' . gettype($record_read_filter[0]->second_name) . ")\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
/**
|
|
|
|
|
* Due to IEEE 754 double precision format double equality is problematic
|
|
|
|
|
*
|
|
|
|
@@ -303,13 +300,13 @@ $records_read_filter_amount = $database->read(filter: fn($record) => $record?->a
|
|
|
|
|
echo '[' . ++$action . "] Read the record from the database by filter with amount limit\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_readed_filter_amount) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_readed_filter_amount) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_filter_amount) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of readed records] Expected: 1 records. Actual: ' . count($records_readed_filter_amount) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_readed_filter_amount[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($records_readed_filter_amount[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $records_readed_filter_amount[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount[0]->age === 24 ? 'SUCCESS' : 'FAIL') . ']["age"] Expected: "24" (integer). Actual: "' . $records_readed_filter_amount[0]->age . '" (' . gettype($records_readed_filter_amount[0]->age) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount[0]->second_name === 'Mirzaev' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Mirzaev" (string). Actual: "' . $records_readed_filter_amount[0]->second_name . '" (' . gettype($records_readed_filter_amount[0]->second_name) . ")\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_read_filter_amount) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_read_filter_amount) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_filter_amount) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of read records] Expected: 1 records. Actual: ' . count($records_read_filter_amount) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_read_filter_amount[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($records_read_filter_amount[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_amount[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $records_read_filter_amount[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_amount[0]->age === 24 ? 'SUCCESS' : 'FAIL') . ']["age"] Expected: "24" (integer). Actual: "' . $records_read_filter_amount[0]->age . '" (' . gettype($records_read_filter_amount[0]->age) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_amount[0]->second_name === 'Mirzaev' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Mirzaev" (string). Actual: "' . $records_read_filter_amount[0]->second_name . '" (' . gettype($records_read_filter_amount[0]->second_name) . ")\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
/**
|
|
|
|
|
* Due to IEEE 754 double precision format double equality is problematic
|
|
|
|
|
*
|
|
|
|
@@ -333,13 +330,13 @@ $records_read_filter_amount_offset = $database->read(filter: fn($record) => $rec
|
|
|
|
|
echo '[' . ++$action . "] Read the record from the database by filter with amount limit and offset\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_readed_filter_amount_offset) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_readed_filter_amount_offset) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_filter_amount_offset) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of readed records] Expected: 1 records. Actual: ' . count($records_readed_filter_amount_offset) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_readed_filter_amount_offset[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($records_readed_filter_amount_offset[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount_offset[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $records_readed_filter_amount_offset[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount_offset[0]->age === 24 ? 'SUCCESS' : 'FAIL') . ']["age"] Expected: "24" (integer). Actual: "' . $records_readed_filter_amount_offset[0]->age . '" (' . gettype($records_readed_filter_amount_offset[0]->age) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount_offset[0]->second_name === 'Ivanov' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Ivanov" (string). Actual: "' . $records_readed_filter_amount_offset[0]->second_name . '" (' . gettype($records_readed_filter_amount_offset[0]->second_name) . ")\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_read_filter_amount_offset) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_read_filter_amount_offset) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_filter_amount_offset) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of read records] Expected: 1 records. Actual: ' . count($records_read_filter_amount_offset) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_read_filter_amount_offset[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($records_read_filter_amount_offset[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_amount_offset[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $records_read_filter_amount_offset[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_amount_offset[0]->age === 24 ? 'SUCCESS' : 'FAIL') . ']["age"] Expected: "24" (integer). Actual: "' . $records_read_filter_amount_offset[0]->age . '" (' . gettype($records_read_filter_amount_offset[0]->age) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_amount_offset[0]->second_name === 'Ivanov' ? 'SUCCESS' : 'FAIL') . ']["second_name"] Expected: "Ivanov" (string). Actual: "' . $records_read_filter_amount_offset[0]->second_name . '" (' . gettype($records_read_filter_amount_offset[0]->second_name) . ")\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
/**
|
|
|
|
|
* Due to IEEE 754 double precision format double equality is problematic
|
|
|
|
|
*
|
|
|
|
@@ -368,20 +365,20 @@ $records_read_filter_delete_read = $database->read(amount: 100);
|
|
|
|
|
echo '[' . ++$action . "] Read records from the database after deleting the record\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_readed_filter_delete) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_readed_filter_delete) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_filter_delete) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of deleted records] Expected: 1 records. Actual: ' . count($records_readed_filter_delete) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_readed_filter_delete[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($records_readed_filter_delete[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_delete[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $records_readed_filter_delete[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_delete[0]->name === 'Ivan' ? 'SUCCESS' : 'FAIL') . ']["name"] Expected: "Ivan" (string). Actual: "' . $records_readed_filter_delete[0]->second_name . '" (' . gettype($records_readed_filter_delete[0]->second_name) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_filter_delete_readed) === 2 ? 'SUCCESS' : 'FAIL') . '][amount of readed records after deleting] Expected: 2 records. Actual: ' . count($records_readed_filter_delete_readed) . " records\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_read_filter_delete) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_read_filter_delete) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_filter_delete) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of deleted records] Expected: 1 records. Actual: ' . count($records_read_filter_delete) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_read_filter_delete[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($records_read_filter_delete[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_delete[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $records_read_filter_delete[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_delete[0]->name === 'Ivan' ? 'SUCCESS' : 'FAIL') . ']["name"] Expected: "Ivan" (string). Actual: "' . $records_read_filter_delete[0]->second_name . '" (' . gettype($records_read_filter_delete[0]->second_name) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_filter_delete_read) === 2 ? 'SUCCESS' : 'FAIL') . '][amount of read records after deleting] Expected: 2 records. Actual: ' . count($records_read_filter_delete_read) . " records\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
/**
|
|
|
|
|
* Due to IEEE 754 double precision format double equality is problematic
|
|
|
|
|
*
|
|
|
|
|
* @see https://www.php.net/manual/en/language.types.float.php#113703
|
|
|
|
|
*/
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($records_readed_filter_delete_readed[1]->motivation, 2) === round(163, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "163" (double). Actual: "' . $records_readed_filter_delete_readed[1]->motivation . '" (' . gettype($records_readed_filter_delete_readed[1]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_delete_readed[1]->reputation === (int) 9223372036854775807 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "9223372036854775807" (integer). Actual: "' . $records_readed_filter_delete_readed[1]->reputation . '" (' . gettype($records_readed_filter_delete_readed[1]->reputation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($records_read_filter_delete_read[1]->motivation, 2) === round(163, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "163" (double). Actual: "' . $records_read_filter_delete_read[1]->motivation . '" (' . gettype($records_read_filter_delete_read[1]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_delete_read[1]->reputation === (int) 9223372036854775807 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "9223372036854775807" (integer). Actual: "' . $records_read_filter_delete_read[1]->reputation . '" (' . gettype($records_read_filter_delete_read[1]->reputation) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The deleted record by filter checks have been completed\n";
|
|
|
|
@@ -403,14 +400,14 @@ $records_read_filter_update_read = $database->read(amount: 100);
|
|
|
|
|
echo '[' . ++$action . "] Read records from the database after updating the record\n";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_readed_filter_update) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_readed_filter_update) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_filter_update) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of updated records] Expected: 1 records. Actual: ' . count($records_readed_filter_update) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_readed_filter_update[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of readed values] Expected: "object". Actual: "' . gettype($records_readed_filter_update[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_update[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of readed object values] Expected: "' . record::class . '". Actual: "' . $records_readed_filter_update[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_update[0]->height === 165.5 ? 'SUCCESS' : 'FAIL') . ']["height"] Expected: "165.5" (double). Actual: "' . $records_readed_filter_update[0]->height . '" (' . gettype($records_readed_filter_update[0]->height) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_readed_filter_update_readed) === 2 ? 'SUCCESS' : 'FAIL') . '][amount of readed records after updating] Expected: 2 records. Actual: ' . count($records_readed_filter_update_readed) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_update_readed[1]->height === $records_readed_filter_update[0]->height ? 'SUCCESS' : 'FAIL') . "] Height from `update` process response matched height from the `read` preocess response\n";
|
|
|
|
|
if (ARCHITECTURE === architecture::x86_64) {
|
|
|
|
|
echo '[' . ++$action . '][' . ++$test . '][' . (gettype($records_read_filter_update) === 'array' ? 'SUCCESS' : 'FAIL') . '][type of returned value] Expected: "array". Actual: "' . gettype($records_read_filter_update) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_filter_update) === 1 ? 'SUCCESS' : 'FAIL') . '][amount of updated records] Expected: 1 records. Actual: ' . count($records_read_filter_update) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (gettype($records_read_filter_update[0]) === 'object' ? 'SUCCESS' : 'FAIL') . '][type of read values] Expected: "object". Actual: "' . gettype($records_read_filter_update[0]) . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_update[0] instanceof record ? 'SUCCESS' : 'FAIL') . '][class of read object values] Expected: "' . record::class . '". Actual: "' . $records_read_filter_update[0]::class . "\"\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_update[0]->height === 165.5 ? 'SUCCESS' : 'FAIL') . ']["height"] Expected: "165.5" (double). Actual: "' . $records_read_filter_update[0]->height . '" (' . gettype($records_read_filter_update[0]->height) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (count($records_read_filter_update_read) === 2 ? 'SUCCESS' : 'FAIL') . '][amount of read records after updating] Expected: 2 records. Actual: ' . count($records_read_filter_update_read) . " records\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_read_filter_update_read[1]->height === $records_read_filter_update[0]->height ? 'SUCCESS' : 'FAIL') . "] Height from `update` process response matched height from the `read` preocess response\n";
|
|
|
|
|
if ($database::$architecture === architecture::x86_64) {
|
|
|
|
|
/**
|
|
|
|
|
* Due to IEEE 754 double precision format double equality is problematic
|
|
|
|
|
*
|
|
|
|
|