# Copyright (c) 2006-2007 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: Random.bunit,v 1.10 2009/12/22 22:45:52 moeller Exp $ my($prev) = {}; [ { object => class(), compute_return => sub { my($case, $actual) = @_; die("duplicate") if $prev->{$actual->[0]}++; return [length($actual->[0])]; }, } => [ bytes => [ 4 => 4, 4 => 4, 4 => 4, 4 => 4, 4 => 4, 1 => 1, [] => Bivio::DieCode->DIE, '' => Bivio::DieCode->DIE, ], hex_digits => [ 1 => 1, 2 => 2, 3 => 3, [] => Bivio::DieCode->DIE, ], password => [ [] => 16, [] => 16, [] => 16, [] => 16, [] => 16, ], ], class() => [ string => [ [1, ['a']] => 'a', [1, [qw(a b)]] => qr/^[ab]$/s, [2, ['a']] => 'aa', [14, [0..9]] => qr/^[0123456789]{14}$/s, ], { method => 'integer', check_return => sub { my($case, $actual) = @_; my($ceiling) = $case->get('params')->[0]; my($floor) = $case->get('params')->[1]; $ceiling = class('Type.Integer')->get_max unless defined($ceiling); $floor = 0 unless defined($floor); return $actual->[0] >= $floor && $actual->[0] < $ceiling ? 1 : 0; }, } => [ [1, 0] => [], [2, 1] => [], 1 => [], 2 => [], 3 => [], 0 => DIE(), -1 => DIE(), [2, 2] => DIE(), [2, -1] => DIE(), [undef] => [], ], ], ];