pdlib/tests/vector_length.phpt
Matias De lellis 526fb725ce Add native vector_lenght() function which calculates the euclidean distance 80%
faster. See https://github.com/matiasdelellis/pdlib/pull/2.

Increase the version to 1.0.2 since this is a required function for our
application and we must control it.

Add more compilation info in php-info(), and print a final message with the
build options when configure.

Fix that when dlib is not installed, the configuration returns that it cannot
find pkgconfig. See https://github.com/matiasdelellis/facerecognition/issues/261

Also implement the test on travis. See for example:
(https://travis-ci.com/github/matiasdelellis/pdlib/builds/161854044)
2020-07-07 19:11:56 -03:00

20 lines
488 B
PHP

--TEST--
Basic tests for dlib_vector_length
--SKIPIF--
<?php if (!extension_loaded("pdlib")) print "skip"; ?>
--FILE--
<?php
$vectorAL = [0.0, 0.0];
$vectorAR = [0.0, 1.0];
var_dump(dlib_vector_length($vectorAL, $vectorAR));
$vectorBL = [0.0, 0.0, -1.0];
$vectorBR = [0.0, 0.0, 1.0];
var_dump(dlib_vector_length($vectorBL, $vectorBR));
$vectorCL = [0.0, 2.5, 1.0];
$vectorCR = [0.0, 1.0, 1.0];
var_dump(dlib_vector_length($vectorCL, $vectorCR));
?>
--EXPECT--
float(1)
float(2)
float(1.5)