#!/usr/bin/perl
use warnings;
use strict;
use lib 'lib','t';
use TestTools;
use XML::Compile::Schema;
use XML::Compile::Tester;
use Test::More tests => 22;
my $TestNS2 = "http://second-ns";
my $schema = XML::Compile::Schema->new( <<__SCHEMA__ );
__SCHEMA__
ok(defined $schema);
#
# element as reference to an element
#
my %r1_a = (a1_a => 10, e1_a => 11, e1_b => 12);
test_rw($schema, "{$TestNS2}test4" => <<__XML, {test1 => \%r1_a});
11
12
__XML
#
# element groups
#
my %r2_a = (e2_a => 20, g2_a => 22, g2_b => 23, e2_b => 21);
test_rw($schema, test2 => <<__XML, \%r2_a);
20
22
23
21
__XML
#
# ref to choice
#
my %r3_a = (gr_g3 => [ {g3_a => 30}, {g3_a => 31}, {g3_b => 32}, {g3_a => 33} ]);
test_rw($schema, test3 => <<__XML, \%r3_a);
30
31
32
33
__XML