#!/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 => 78;
my $schema = XML::Compile::Schema->new( <<__SCHEMA__ );
__SCHEMA__
ok(defined $schema);
###
### int
###
test_rw($schema, test1 => '0', 0);
test_rw($schema, test1 => '3', 3);
###
### Boolean
###
test_rw($schema, test2 => '0', 0);
test_rw($schema, test2 => 'false', 0
, 'false', 'false');
test_rw($schema, test2 => '1', 1);
test_rw($schema, test2 => 'true', 1
, 'true', 'true');
###
### Float
###
test_rw($schema, test3 => '0', 0);
test_rw($schema, test3 => '9', 9);
my $error = reader_error($schema, test3 => '');
is($error, "Value `' is not a float");
$error = writer_error($schema, test3 => 'aap');
is($error, "Value `aap' is not a float");
$error = writer_error($schema, test3 => '');
is($error, "Value `' is not a float");
###
test_rw($schema, test4 => 'A bc D', [ qw/A bc D/ ]);