Implement dlib_vector_length to calculate the euclidean distance of the vectors
It not use the 'length' native versions of dlib, due I have to convert the array to the vector, which will take the same time, and then I will use the native method.
This commit is contained in:
14
tests/vector_length.phpt
Normal file
14
tests/vector_length.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Basic tests for dlib_vector_length
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("pdlib")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(dlib_vector_length([0.0, 0.0], [1.0, 0.0]));
|
||||
var_dump(dlib_vector_length([0.0, 0.0, -1.0], [0.0, 0.0, 1.0]));
|
||||
var_dump(dlib_vector_length([0.0, 2.5, 1.0], [0.0, 1.0, 1.0]));
|
||||
?>
|
||||
--EXPECT--
|
||||
float(1)
|
||||
float(2)
|
||||
float(1.5)
|
||||
10
tests/version.phpt
Normal file
10
tests/version.phpt
Normal file
@@ -0,0 +1,10 @@
|
||||
--TEST--
|
||||
Just test php extension version
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("pdlib")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(phpversion('pdlib'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(5) "1.0.2"
|
||||
Reference in New Issue
Block a user