|
|
|
@@ -163,7 +163,7 @@ echo '[' . ++$action . "] Initialized the record\n";
|
|
|
|
|
// Writing the second record into the databasse
|
|
|
|
|
$database->write($record_ivan);
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
@@ -192,12 +192,12 @@ echo '[' . ++$action . "] Initialized the record\n";
|
|
|
|
|
// Writing the second record into the databasse
|
|
|
|
|
$database->write($record_margarita);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Writed the record into the database\n";
|
|
|
|
|
echo '[' . ++$action . "] Wrote the record into the database\n";
|
|
|
|
|
|
|
|
|
|
// Reading all records from the database
|
|
|
|
|
$records_readed_all = $database->read(amount: 99999);
|
|
|
|
|
$records_read_all = $database->read(amount: 99999);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed all records from the database\n";
|
|
|
|
|
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";
|
|
|
|
@@ -208,18 +208,18 @@ try {
|
|
|
|
|
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 . "] The readed all records checks have been completed\n";
|
|
|
|
|
echo '[' . $action . "] The read all records checks have been completed\n";
|
|
|
|
|
} catch (exception $e) {
|
|
|
|
|
echo '[' . $action . "][WARNING] The readed all records checks have been completed with errors\n";
|
|
|
|
|
echo '[' . $action . "][WARNING] The read all records checks have been completed with errors\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reinitializing the counter of tests
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Reading the first record from the database
|
|
|
|
|
$record_readed_first = $database->read(amount: 1);
|
|
|
|
|
$record_read_first = $database->read(amount: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed the first record from the database\n";
|
|
|
|
|
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";
|
|
|
|
@@ -231,18 +231,18 @@ try {
|
|
|
|
|
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 . "] The readed first record checks have been completed\n";
|
|
|
|
|
echo '[' . $action . "] The read first record checks have been completed\n";
|
|
|
|
|
} catch (exception $e) {
|
|
|
|
|
echo '[' . $action . "][WARNING] The readed first record checks have been completed with errors\n";
|
|
|
|
|
echo '[' . $action . "][WARNING] The read first record checks have been completed with errors\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reinitializing the counter of tests
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Reading the second record from the database
|
|
|
|
|
$record_readed_second = $database->read(amount: 1, offset: 1);
|
|
|
|
|
$record_read_second = $database->read(amount: 1, offset: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed the second record from the database\n";
|
|
|
|
|
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";
|
|
|
|
@@ -256,22 +256,22 @@ try {
|
|
|
|
|
*
|
|
|
|
|
* @see https://www.php.net/manual/en/language.types.float.php#113703
|
|
|
|
|
*/
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_readed_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_readed_second[0]->motivation . '" (' . gettype($record_readed_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_readed_second[0]->reputation . '" (' . gettype($record_readed_second[0]->reputation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_read_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_read_second[0]->motivation . '" (' . gettype($record_read_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_read_second[0]->reputation . '" (' . gettype($record_read_second[0]->reputation) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The readed second record checks have been completed\n";
|
|
|
|
|
echo '[' . $action . "] The read second record checks have been completed\n";
|
|
|
|
|
} catch (exception $e) {
|
|
|
|
|
echo '[' . $action . "][WARNING] The readed second record checks have been completed with errors\n";
|
|
|
|
|
echo '[' . $action . "][WARNING] The read second record checks have been completed with errors\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reinitializing the counter of tests
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Reading the record from the database by filter
|
|
|
|
|
$record_readed_filter = $database->read(filter: fn($record) => $record?->second_name === 'Ivanov', amount: 1);
|
|
|
|
|
$record_read_filter = $database->read(filter: fn($record) => $record?->second_name === 'Ivanov', amount: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed the record from the database by filter\n";
|
|
|
|
|
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";
|
|
|
|
@@ -285,22 +285,22 @@ try {
|
|
|
|
|
*
|
|
|
|
|
* @see https://www.php.net/manual/en/language.types.float.php#113703
|
|
|
|
|
*/
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_readed_filter[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_readed_filter[0]->motivation . '" (' . gettype($record_readed_filter[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_filter[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_readed_filter[0]->reputation . '" (' . gettype($record_readed_filter[0]->reputation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_read_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_read_second[0]->motivation . '" (' . gettype($record_read_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_read_second[0]->reputation . '" (' . gettype($record_read_second[0]->reputation) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The readed record by filter checks have been completed\n";
|
|
|
|
|
echo '[' . $action . "] The read record by filter checks have been completed\n";
|
|
|
|
|
} catch (exception $e) {
|
|
|
|
|
echo '[' . $action . "][WARNING] The readed record by filter checks have been completed with errors\n";
|
|
|
|
|
echo '[' . $action . "][WARNING] The read record by filter checks have been completed with errors\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reinitializing the counter of tests
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Reading the record from the database by filter with amount limit
|
|
|
|
|
$records_readed_filter_amount = $database->read(filter: fn($record) => $record?->age === 24, amount: 1);
|
|
|
|
|
$records_read_filter_amount = $database->read(filter: fn($record) => $record?->age === 24, amount: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed the record from the database by filter with amount limit\n";
|
|
|
|
|
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";
|
|
|
|
@@ -315,22 +315,22 @@ try {
|
|
|
|
|
*
|
|
|
|
|
* @see https://www.php.net/manual/en/language.types.float.php#113703
|
|
|
|
|
*/
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_readed_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_readed_second[0]->motivation . '" (' . gettype($record_readed_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_readed_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_readed_second[0]->reputation . '" (' . gettype($record_readed_second[0]->reputation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_read_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_read_second[0]->motivation . '" (' . gettype($record_read_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_read_second[0]->reputation . '" (' . gettype($record_read_second[0]->reputation) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The readed record by filter with amount limit checks have been completed\n";
|
|
|
|
|
echo '[' . $action . "] The read record by filter with amount limit checks have been completed\n";
|
|
|
|
|
} catch (exception $e) {
|
|
|
|
|
echo '[' . $action . "][WARNING] The readed record by filter with amount limit checks have been completed with errors\n";
|
|
|
|
|
echo '[' . $action . "][WARNING] The read record by filter with amount limit checks have been completed with errors\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reinitializing the counter of tests
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Reading the record from the database by filter with amount limit and offset
|
|
|
|
|
$records_readed_filter_amount_offset = $database->read(filter: fn($record) => $record?->age === 24, amount: 1, offset: 1);
|
|
|
|
|
$records_read_filter_amount_offset = $database->read(filter: fn($record) => $record?->age === 24, amount: 1, offset: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed the record from the database by filter with amount limit and offset\n";
|
|
|
|
|
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";
|
|
|
|
@@ -345,27 +345,27 @@ try {
|
|
|
|
|
*
|
|
|
|
|
* @see https://www.php.net/manual/en/language.types.float.php#113703
|
|
|
|
|
*/
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($records_readed_filter_amount_offset[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $records_readed_filter_amount_offset[0]->motivation . '" (' . gettype($records_readed_filter_amount_offset[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_amount_offset[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $records_readed_filter_amount_offset[0]->reputation . '" (' . gettype($records_readed_filter_amount_offset[0]->reputation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_read_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_read_second[0]->motivation . '" (' . gettype($record_read_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_read_second[0]->reputation . '" (' . gettype($record_read_second[0]->reputation) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The readed record by filter with amount limit and offset checks have been completed\n";
|
|
|
|
|
echo '[' . $action . "] The read record by filter with amount limit and offset checks have been completed\n";
|
|
|
|
|
} catch (exception $e) {
|
|
|
|
|
echo '[' . $action . "][WARNING] The readed record by filter with amount limit and offset checks have been completed with errors\n";
|
|
|
|
|
echo '[' . $action . "][WARNING] The read record by filter with amount limit and offset checks have been completed with errors\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Reinitializing the counter of tests
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Deleting the record in the database by filter
|
|
|
|
|
$records_readed_filter_delete = $database->read(filter: fn($record) => $record?->name === 'Ivan', delete: true, amount: 1);
|
|
|
|
|
$records_read_filter_delete = $database->read(filter: fn($record) => $record?->name === 'Ivan', delete: true, amount: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Deleted the record from the database by filter\n";
|
|
|
|
|
|
|
|
|
|
// Reading records from the database after deleting
|
|
|
|
|
$records_readed_filter_delete_readed = $database->read(amount: 100);
|
|
|
|
|
$records_read_filter_delete_read = $database->read(amount: 100);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed records from the database after deleting the record\n";
|
|
|
|
|
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";
|
|
|
|
@@ -393,14 +393,14 @@ try {
|
|
|
|
|
$test = 0;
|
|
|
|
|
|
|
|
|
|
// Updating the record in the database
|
|
|
|
|
$records_readed_filter_update = $database->read(filter: fn($record) => $record?->name === 'Margarita', update: fn(&$record) => $record->height += 0.5, amount: 1);
|
|
|
|
|
$records_read_filter_update = $database->read(filter: fn($record) => $record?->name === 'Margarita', update: fn(&$record) => $record->height += 0.5, amount: 1);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Updated the record in the database by filter\n";
|
|
|
|
|
|
|
|
|
|
// Reading records from the database after updating
|
|
|
|
|
$records_readed_filter_update_readed = $database->read(amount: 100);
|
|
|
|
|
$records_read_filter_update_read = $database->read(amount: 100);
|
|
|
|
|
|
|
|
|
|
echo '[' . ++$action . "] Readed records from the database after updating the record\n";
|
|
|
|
|
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";
|
|
|
|
@@ -416,8 +416,8 @@ try {
|
|
|
|
|
*
|
|
|
|
|
* @see https://www.php.net/manual/en/language.types.float.php#113703
|
|
|
|
|
*/
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($records_readed_filter_update[0]->motivation, 2) === round(163, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "163" (double). Actual: "' . $records_readed_filter_update[0]->motivation . '" (' . gettype($records_readed_filter_update[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($records_readed_filter_update[0]->reputation === (int) 9223372036854775807 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "9223372036854775807" (integer). Actual: "' . $records_readed_filter_update[0]->reputation . '" (' . gettype($records_readed_filter_update[0]->reputation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . (round($record_read_second[0]->motivation, 2) === round(2.2250738585072E-308, 2) ? 'SUCCESS' : 'FAIL') . ']["motivation"] Expected: "2.2250738585072E-308" (double). Actual: "' . $record_read_second[0]->motivation . '" (' . gettype($record_read_second[0]->motivation) . ")\n";
|
|
|
|
|
echo '[' . $action . '][' . ++$test . '][' . ($record_read_second[0]->reputation === (int) -9223372036854775808 ? 'SUCCESS' : 'FAIL') . ']["reputation"] Expected: "-9223372036854775808" (integer). Actual: "' . $record_read_second[0]->reputation . '" (' . gettype($record_read_second[0]->reputation) . ")\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo '[' . $action . "] The updated record by filter checks have been completed\n";
|
|
|
|
|