3 require_once('test/Obj/test.phh');
4 require_once('web/Obj/brisk.phh');
6 $arr = array(array('v1' => '', 'v2' => '', 'exp' => 0),
8 array('v1' => '1.2.3', 'v2' => '1.2.3', 'exp' => 0),
10 array('v1' => '1.2.3', 'v2' => '1.2', 'exp' => 0),
11 array('v1' => '1.2.3', 'v2' => '1', 'exp' => 0),
13 array('v1' => '1.2', 'v2' => '1.2.3', 'exp' => 0),
14 array('v1' => '1', 'v2' => '1.2.3', 'exp' => 0),
16 array('v1' => '1', 'v2' => '2', 'exp' => -1),
17 array('v1' => '2', 'v2' => '1', 'exp' => 1),
19 array('v1' => '0.1', 'v2' => '0.2', 'exp' => -1),
20 array('v1' => '0.2', 'v2' => '0.1', 'exp' => 1),
22 array('v1' => '0.0.1', 'v2' => '0.0.2', 'exp' => -1),
23 array('v1' => '0.0.2', 'v2' => '0.0.1', 'exp' => 1),
25 array('v1' => '0.0.2', 'v2' => '0.0.1', 'exp' => 1),
29 foreach($arr as $el) {
30 $ret = versions_cmp($el['v1'], $el['v2']);
31 printf("V1: [%s]\nV2: [%s]\nRet: [%+d]\n", $el['v1'], $el['v2'], $ret);
32 if ($ret != $el['exp']) {
33 printf("\nExp: [%+d] Ret and Exp differ!\n\n", $el['exp']);