#!/usr/bin/perl use warnings; use strict; use lib 'lib','t'; use TestTools; use XML::Compile::Schema; use XML::Compile::Tester; use Math::BigFloat; use Test::More tests => 113; my $schema = XML::Compile::Schema->new( <<__SCHEMA__ ); __SCHEMA__ ok(defined $schema); set_compile_defaults elements_qualified => 'NONE'; ### ### 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); test_rw($schema, test3 => 'INF', Math::BigFloat->binf); test_rw($schema, test3 => '-INF', Math::BigFloat->binf('-')); test_rw($schema, test3 => 'NaN', Math::BigFloat->bnan); my $error = error_r($schema, test3 => ''); is($error, "illegal value `' for type {http://www.w3.org/2001/XMLSchema}float"); $error = error_w($schema, test3 => 'aap'); is($error, "illegal value `aap' for type {http://www.w3.org/2001/XMLSchema}float"); $error = error_w($schema, test3 => ''); is($error, "illegal value `' for type {http://www.w3.org/2001/XMLSchema}float"); ### test_rw($schema, test4 => 'A bc D', [ qw/A bc D/ ]); ### ### Integers ### test_rw($schema, test5 => '432000', Math::BigInt->new(432000)); ### ### Base64Binary ### test_rw($schema, test6 => 'SGVsbG8sIFdvcmxkIQ==', 'Hello, World!');