Files
predis/tests/Predis/Command/Utils/VectorUtilityTest.php
T
Vladyslav Vildanov 30e48f566e feat(commands): Add support for VectorSet commands (#1550)
* feat(commands): Add support for VectorSet commands

* Codestyle fixes

* Fixed test

* Added logging for test purposes

* Marked tests as relay incompatible

* Missing incompatible tests

* Updated CHANGELOG to reflect experimental nature of feature

* Marked properties as nullable

* Changed static variables to constants

* Codestyle fixe

* Revert changes

* Update CHANGELOG.md

---------

Co-authored-by: Till Krüss <tillkruss@users.noreply.github.com>
2025-06-05 09:28:31 +03:00

42 lines
879 B
PHP

<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2025 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Utils;
use Predis\Command\Redis\Utils\VectorUtility;
use PredisTestCase;
class VectorUtilityTest extends PredisTestCase
{
/**
* @return void
*/
public function testToBlob()
{
$this->assertSame(
pack('f*', 0.1, 0.2, 0.3),
VectorUtility::toBlob([0.1, 0.2, 0.3])
);
}
/**
* @return void
*/
public function testToArray()
{
$this->assertSame(
unpack('f*', VectorUtility::toBlob([0.1, 0.2, 0.3])),
VectorUtility::toArray(VectorUtility::toBlob([0.1, 0.2, 0.3]))
);
}
}