# 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: TupleDefListForm.bunit,v 1.4 2011/09/30 01:43:32 schellj Exp $ require './TupleListForm.PL'; model('TupleDef')->delete_all; model('TupleDef')->create_from_hash({ 'x1#EXIST1' => [ { label => 'L1', type => 'Integer', }, ], }); my($exists_id) = req(qw(Model.TupleDef tuple_def_id)); my($integer_id) = req(qw(Model.TupleSlotTypeList TupleSlotType.tuple_slot_type_id)); [ empty_case({ 'TupleDef.label' => undef, 'TupleDef.moniker' => undef, map(( "TupleSlotDef.tuple_slot_num_$_" => model('TupleSlotDefList')->EMPTY_KEY_VALUE), 0 .. class()->ROW_INCREMENT - 1), }), simple_case($exists_id, { 'TupleDef.label' => 'EXIST1', 'TupleDef.moniker' => 'x1', 'TupleSlotDef.label_0' => 'L1', 'TupleSlotDef.tuple_slot_type_id_0' => $integer_id, 'TupleSlotDef.tuple_slot_num_0' => 1, 'TupleSlotDef.is_required_0' => 0, map(( "TupleSlotDef.tuple_slot_num_$_" => model('TupleSlotDefList')->EMPTY_KEY_VALUE), 1 .. 1 + class()->ROW_INCREMENT - 1), }), [{ 'TupleDef.label' => 'TD1', 'TupleDef.moniker' => 'td1', 'TupleSlotDef.label_0' => 'L1', 'TupleSlotDef.tuple_slot_type_id_0' => $integer_id, 'TupleSlotDef.is_required_0' => 0, 'TupleSlotDef.label_1' => 'L2', 'TupleSlotDef.tuple_slot_type_id_1' => $integer_id, 'TupleSlotDef.is_required_1' => 1, empty_row_count => 2, }] => [{ # 'Model.TupleDef' => { # label => 'td1', # moniker => 'TD1', # }, 'Model.TupleSlotDef' => { label => 'L2', tuple_slot_num => 2, is_required => 1, }, }], simple_case({ 'TupleDef.label' => 'TD2', 'TupleDef.moniker' => 'td2', 'TupleSlotDef.label_0' => 'L1', 'TupleSlotDef.tuple_slot_type_id_0' => $integer_id, 'TupleSlotDef.is_required_0' => 0, 'TupleSlotDef.label_1' => 'L1', 'TupleSlotDef.tuple_slot_type_id_1' => $integer_id, 'TupleSlotDef.is_required_1' => 1, empty_row_count => 2, }, { 'TupleSlotDef.label_1' => 'EXISTS', }), simple_case({ 'TupleDef.label' => 'TD2', 'TupleDef.moniker' => 'td2', 'TupleSlotDef.label_0' => 'L1', 'TupleSlotDef.tuple_slot_type_id_0' => $integer_id, 'TupleSlotDef.is_required_0' => 0, 'TupleSlotDef.label_1' => 'l2', 'TupleSlotDef.tuple_slot_type_id_1' => $integer_id, 'TupleSlotDef.is_required_1' => 1, empty_row_count => 2, }, { 'TupleSlotDef.label_1' => 'SYNTAX_ERROR', }), error_case({ 'TupleDef.label' => 'TD2', 'TupleDef.moniker' => 'td2', empty_row_count => 0, }, { 'TupleSlotDef.label_0' => 'NOT_FOUND', }), ];