X7ROOT File Manager
Current Path:
/opt/alt/tests/alt-php84-pecl-leveldb_0.3.0-1.el8/tests
opt
/
alt
/
tests
/
alt-php84-pecl-leveldb_0.3.0-1.el8
/
tests
/
ðŸ“
..
📄
001-basic.phpt
(638 B)
📄
002-db-management.phpt
(313 B)
📄
003-openbasedir.phpt
(670 B)
📄
004-write-batch.phpt
(966 B)
📄
005-iterator.phpt
(1.74 KB)
📄
006-iterator-foreach.phpt
(1.05 KB)
📄
007-db-close.phpt
(567 B)
📄
008-options.phpt
(937 B)
📄
009-comparator.phpt
(1.95 KB)
📄
010-compression.phpt
(578 B)
📄
011-getApproximateSizes.phpt
(859 B)
📄
012-getProperty.phpt
(1011 B)
📄
013-compactRange.phpt
(458 B)
📄
014-iterator-destroy.phpt
(547 B)
📄
015-double-iterator.phpt
(512 B)
📄
016-different-iterators-should-differ.phpt
(826 B)
📄
017-db-getIterator.phpt
(648 B)
📄
018-snapshot.phpt
(1.38 KB)
📄
019-null-comparator.phpt
(547 B)
📄
020-null-snapshot.phpt
(469 B)
📄
leveldb.inc
(152 B)
📄
skipif.inc
(90 B)
Editing: 009-comparator.phpt
--TEST-- leveldb - custom comparator --SKIPIF-- <?php include 'skipif.inc'; ?> --FILE-- <?php $leveldb_path = dirname(__FILE__) . '/leveldb-comparator.test-db'; echo "*** could not use invalid custom comparator ***\n"; try { $db = new LevelDB($leveldb_path, array('comparator' => 'invaid_func')); } catch(LevelDBException $e) { echo $e->getMessage() . "\n"; } echo "*** valid custom comparator ***\n"; $db = new LevelDB($leveldb_path, array('comparator' => 'custom_comparator')); $values = array(3, 1, 4, 6, 2, 5); foreach($values as $v) { $db->set($v, $v); } $it = new LevelDBIterator($db); foreach($it as $v) { echo "$v\n"; } unset($it); unset($db); echo "*** custom comparator can only open with the same comparator again ***\n"; try { $db = new LevelDB($leveldb_path); } catch(LevelDBException $e) { echo $e->getMessage() . "\n"; } $db = new LevelDB($leveldb_path, array('comparator' => 'custom_comparator')); var_dump($db->get(1) == 1); unset($db); echo "*** custom comparator which throw exception ***\n"; $db = new LevelDB($leveldb_path, array('comparator' => array('CustomFunc', 'willException'))); try { $db->set("Hi", "guys"); var_dump($db->get("Hi")); } catch(Exception $e) { echo $e->getMessage() . "\n"; } // reverse DESC function custom_comparator($a, $b) { if ($a == $b) { return 0; } return ($a > $b) ? -1 : 1; } class CustomFunc { public static function willException($a, $b) { throw new Exception("Oops!"); } } ?> ==DONE== --CLEAN-- <?php $leveldb_path = dirname(__FILE__) . '/leveldb-comparator.test-db'; LevelDB::destroy($leveldb_path); ?> --EXPECTF-- *** could not use invalid custom comparator *** Invalid open option: comparator, invaid_func() is not callable *** valid custom comparator *** 6 5 4 3 2 1 *** custom comparator can only open with the same comparator again *** Invalid argument: php_leveldb.custom_comparator%s leveldb.BytewiseComparator bool(true) *** custom comparator which throw exception *** Oops! ==DONE==
Upload File
Create Folder