# Copyright (c) 2006 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: TupleSlotType.bunit,v 1.9 2012/01/10 00:18:47 moeller Exp $ PropertyModel(); req()->set_realm_and_user(qw(demo demo)); my($tsa) = class('Type.TupleSlotArray'); [ create_from_hash => [ [{TST1 => { type_class => 'Integer', choices => undef, default_value => 3, }}] => [{ choices => $tsa->new([]), default_value => 3, }], ], validate_slot => [ x => [undef, 'INTEGER'], 1 => [1, undef], [''] => [undef, undef], ], create_from_hash => [ [{TST2 => { type_class => 'Integer', choices => [1, 2], }}] => [{ choices => $tsa->new([1, 2]), }], ], validate_slot => [ 1 => [1, undef], 3 => [undef, 'NOT_FOUND'], ], create_from_hash => [ [{TST3 => { type_class => 'Date', choices => "9/1/2006$;10/1/2006", }}] => [{ choices => $tsa->new(['2453980 79199', '2454010 79199']), }], ], validate_slot => [ '9/1/2006' => ['2453980 79199', undef], '9/2/2006' => [undef, 'NOT_FOUND'], '9/2' => [undef, 'DATE'], ], create_from_hash => [ [{TST4 => { type_class => 'String', choices => "A$;b$;c", }}] => [{ choices => $tsa->new(['A', 'b', 'c',]), }], ], validate_slot => [ 'a' => ['A', undef], 'A' => ['A', undef], 'B' => ['b', undef], 'x' => [undef, 'NOT_FOUND'], ], create_from_hash => [ [{Tst4 => { choices => [qw(1 x)], }}] => DB_CONSTRAINT(), [{Tst5 => { type_class => 'Integer', choices => [qw(1 x)], }}] => DB_CONSTRAINT(), [{Tst6 => { type_class => 'Integer', default_value => 'x', }}] => DB_CONSTRAINT(), [{Tst7 => { type_class => 'Integer', choices => [1, 2], default_value => '3', }}] => DB_CONSTRAINT(), ], ];