Ejemplo n.º 1
0
    $fail = false;
} catch (\Exception $e) {
}
if ($fail) {
    echo "Failure!\n";
} else {
    echo "Success...\n";
}
echo "Instantiate and Pass (Data) with Custom Restrictions -> ";
$success = true;
$testPriorityQueueRestrictions = $testRestrictions = $testStack = null;
try {
    $testStack = new Types\Stack();
    $testRestrictions = new Types\Restrictions(array(Type::TYPED_OBJECT), array('Falcraft\\Data\\Types\\Stack'));
    $testPriorityQueueRestrictions = new Types\PriorityQueue(array(), $testRestrictions, array('strict' => true));
    $testPriorityQueueRestrictions->push($testStack);
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success!\n";
} else {
    echo "Failure...\n";
}
echo "Priority Queue Operations -- \n\n";
echo "    Population -> ";
$success = true;
try {
    $testPriorityQueue->push(new Types\Priority('towel', 7), new Types\Priority('gas mask', 50), new Types\Priority('cooler', 2));
} catch (\Exception $e) {
    $success = false;