sizes() public static method

--------------------------------------------------
public static sizes ( $maxSize )
コード例 #1
0
ファイル: Quick.php プロジェクト: steos/php-quickcheck
 public static function check($n, Gen $prop, array $opts = [])
 {
     $maxSize = @$opts['max_size'] ?: 200;
     $seed = @$opts['seed'] ?: intval(1000 * microtime(true));
     $rng = new Random($seed);
     $sizes = Gen::sizes($maxSize);
     for ($i = 0, $sizes->rewind(); $i < $n; ++$i, $sizes->next()) {
         $size = $sizes->current();
         $resultMapRose = $prop->call($rng, $size);
         $resultMap = $resultMapRose->getRoot();
         $result = $resultMap['result'];
         $args = $resultMap['args'];
         if (!$result || $result instanceof \Exception) {
             if (@$opts['echo']) {
                 echo 'F', PHP_EOL;
             }
             return self::failure($prop, $resultMapRose, $i, $size, $seed);
         }
         if (@$opts['echo']) {
             echo '.';
         }
         // TODO: trial reporting
     }
     return self::complete($prop, $n, $seed);
 }