rtiss_soap4r 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/wsdl2ruby.rb +139 -0
- data/bin/xsd2ruby.rb +91 -0
- data/lib/soap/attachment.rb +109 -0
- data/lib/soap/attrproxy.rb +35 -0
- data/lib/soap/baseData.rb +1095 -0
- data/lib/soap/element.rb +278 -0
- data/lib/soap/encodingstyle/aspDotNetHandler.rb +208 -0
- data/lib/soap/encodingstyle/handler.rb +121 -0
- data/lib/soap/encodingstyle/literalHandler.rb +196 -0
- data/lib/soap/encodingstyle/soapHandler.rb +560 -0
- data/lib/soap/filter/filterchain.rb +52 -0
- data/lib/soap/filter/handler.rb +32 -0
- data/lib/soap/filter/streamhandler.rb +30 -0
- data/lib/soap/filter.rb +14 -0
- data/lib/soap/generator.rb +299 -0
- data/lib/soap/header/handler.rb +62 -0
- data/lib/soap/header/handlerset.rb +71 -0
- data/lib/soap/header/mappinghandler.rb +48 -0
- data/lib/soap/header/simplehandler.rb +45 -0
- data/lib/soap/httpconfigloader.rb +140 -0
- data/lib/soap/mapping/encodedregistry.rb +539 -0
- data/lib/soap/mapping/factory.rb +389 -0
- data/lib/soap/mapping/literalregistry.rb +392 -0
- data/lib/soap/mapping/mapping.rb +577 -0
- data/lib/soap/mapping/registry.rb +296 -0
- data/lib/soap/mapping/rubytypeFactory.rb +446 -0
- data/lib/soap/mapping/schemadefinition.rb +171 -0
- data/lib/soap/mapping/typeMap.rb +107 -0
- data/lib/soap/mapping/wsdlencodedregistry.rb +212 -0
- data/lib/soap/mapping/wsdlliteralregistry.rb +249 -0
- data/lib/soap/mapping.rb +13 -0
- data/lib/soap/marshal.rb +60 -0
- data/lib/soap/mimemessage.rb +243 -0
- data/lib/soap/nestedexception.rb +43 -0
- data/lib/soap/netHttpClient.rb +242 -0
- data/lib/soap/ns.rb +39 -0
- data/lib/soap/parser.rb +253 -0
- data/lib/soap/processor.rb +67 -0
- data/lib/soap/property.rb +340 -0
- data/lib/soap/proxy.rb +15 -0
- data/lib/soap/rpc/cgistub.rb +248 -0
- data/lib/soap/rpc/driver.rb +222 -0
- data/lib/soap/rpc/element.rb +375 -0
- data/lib/soap/rpc/httpserver.rb +143 -0
- data/lib/soap/rpc/methodDef.rb +69 -0
- data/lib/soap/rpc/proxy.rb +573 -0
- data/lib/soap/rpc/router.rb +663 -0
- data/lib/soap/rpc/rpc.rb +26 -0
- data/lib/soap/rpc/soaplet.rb +201 -0
- data/lib/soap/rpc/standaloneServer.rb +44 -0
- data/lib/soap/soap.rb +154 -0
- data/lib/soap/streamHandler.rb +306 -0
- data/lib/soap/version.rb +9 -0
- data/lib/soap/wsdlDriver.rb +165 -0
- data/lib/wsdl/binding.rb +66 -0
- data/lib/wsdl/data.rb +65 -0
- data/lib/wsdl/definitions.rb +237 -0
- data/lib/wsdl/documentation.rb +33 -0
- data/lib/wsdl/import.rb +81 -0
- data/lib/wsdl/importer.rb +39 -0
- data/lib/wsdl/info.rb +51 -0
- data/lib/wsdl/message.rb +55 -0
- data/lib/wsdl/operation.rb +152 -0
- data/lib/wsdl/operationBinding.rb +241 -0
- data/lib/wsdl/param.rb +94 -0
- data/lib/wsdl/parser.rb +165 -0
- data/lib/wsdl/part.rb +53 -0
- data/lib/wsdl/port.rb +67 -0
- data/lib/wsdl/portType.rb +76 -0
- data/lib/wsdl/service.rb +62 -0
- data/lib/wsdl/soap/address.rb +41 -0
- data/lib/wsdl/soap/binding.rb +50 -0
- data/lib/wsdl/soap/body.rb +59 -0
- data/lib/wsdl/soap/cgiStubCreator.rb +93 -0
- data/lib/wsdl/soap/classDefCreator.rb +434 -0
- data/lib/wsdl/soap/classDefCreatorSupport.rb +241 -0
- data/lib/wsdl/soap/classNameCreator.rb +55 -0
- data/lib/wsdl/soap/clientSkeltonCreator.rb +107 -0
- data/lib/wsdl/soap/complexType.rb +174 -0
- data/lib/wsdl/soap/data.rb +43 -0
- data/lib/wsdl/soap/definitions.rb +201 -0
- data/lib/wsdl/soap/driverCreator.rb +121 -0
- data/lib/wsdl/soap/element.rb +34 -0
- data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +74 -0
- data/lib/wsdl/soap/fault.rb +57 -0
- data/lib/wsdl/soap/header.rb +87 -0
- data/lib/wsdl/soap/headerfault.rb +57 -0
- data/lib/wsdl/soap/literalMappingRegistryCreator.rb +116 -0
- data/lib/wsdl/soap/mappingRegistryCreator.rb +59 -0
- data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +377 -0
- data/lib/wsdl/soap/methodDefCreator.rb +200 -0
- data/lib/wsdl/soap/operation.rb +113 -0
- data/lib/wsdl/soap/servantSkeltonCreator.rb +92 -0
- data/lib/wsdl/soap/servletStubCreator.rb +105 -0
- data/lib/wsdl/soap/standaloneServerStubCreator.rb +101 -0
- data/lib/wsdl/soap/wsdl2ruby.rb +226 -0
- data/lib/wsdl/types.rb +45 -0
- data/lib/wsdl/wsdl.rb +25 -0
- data/lib/wsdl/xmlSchema/all.rb +25 -0
- data/lib/wsdl/xmlSchema/annotation.rb +35 -0
- data/lib/wsdl/xmlSchema/any.rb +62 -0
- data/lib/wsdl/xmlSchema/anyAttribute.rb +49 -0
- data/lib/wsdl/xmlSchema/attribute.rb +105 -0
- data/lib/wsdl/xmlSchema/attributeGroup.rb +69 -0
- data/lib/wsdl/xmlSchema/choice.rb +59 -0
- data/lib/wsdl/xmlSchema/complexContent.rb +98 -0
- data/lib/wsdl/xmlSchema/complexExtension.rb +120 -0
- data/lib/wsdl/xmlSchema/complexRestriction.rb +105 -0
- data/lib/wsdl/xmlSchema/complexType.rb +194 -0
- data/lib/wsdl/xmlSchema/content.rb +96 -0
- data/lib/wsdl/xmlSchema/data.rb +117 -0
- data/lib/wsdl/xmlSchema/element.rb +154 -0
- data/lib/wsdl/xmlSchema/enumeration.rb +37 -0
- data/lib/wsdl/xmlSchema/fractiondigits.rb +38 -0
- data/lib/wsdl/xmlSchema/group.rb +101 -0
- data/lib/wsdl/xmlSchema/import.rb +54 -0
- data/lib/wsdl/xmlSchema/importHandler.rb +46 -0
- data/lib/wsdl/xmlSchema/importer.rb +103 -0
- data/lib/wsdl/xmlSchema/include.rb +49 -0
- data/lib/wsdl/xmlSchema/length.rb +38 -0
- data/lib/wsdl/xmlSchema/list.rb +49 -0
- data/lib/wsdl/xmlSchema/maxexclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/maxinclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/maxlength.rb +38 -0
- data/lib/wsdl/xmlSchema/minexclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/mininclusive.rb +38 -0
- data/lib/wsdl/xmlSchema/minlength.rb +38 -0
- data/lib/wsdl/xmlSchema/parser.rb +168 -0
- data/lib/wsdl/xmlSchema/pattern.rb +37 -0
- data/lib/wsdl/xmlSchema/ref.rb +34 -0
- data/lib/wsdl/xmlSchema/schema.rb +179 -0
- data/lib/wsdl/xmlSchema/sequence.rb +55 -0
- data/lib/wsdl/xmlSchema/simpleContent.rb +70 -0
- data/lib/wsdl/xmlSchema/simpleExtension.rb +63 -0
- data/lib/wsdl/xmlSchema/simpleRestriction.rb +133 -0
- data/lib/wsdl/xmlSchema/simpleType.rb +88 -0
- data/lib/wsdl/xmlSchema/totaldigits.rb +38 -0
- data/lib/wsdl/xmlSchema/union.rb +36 -0
- data/lib/wsdl/xmlSchema/unique.rb +35 -0
- data/lib/wsdl/xmlSchema/whitespace.rb +38 -0
- data/lib/wsdl/xmlSchema/xsd2ruby.rb +176 -0
- data/lib/xsd/charset.rb +190 -0
- data/lib/xsd/codegen/classdef.rb +209 -0
- data/lib/xsd/codegen/commentdef.rb +35 -0
- data/lib/xsd/codegen/gensupport.rb +277 -0
- data/lib/xsd/codegen/methoddef.rb +71 -0
- data/lib/xsd/codegen/moduledef.rb +209 -0
- data/lib/xsd/codegen.rb +13 -0
- data/lib/xsd/datatypes.rb +1466 -0
- data/lib/xsd/datatypes1999.rb +21 -0
- data/lib/xsd/iconvcharset.rb +34 -0
- data/lib/xsd/mapping.rb +69 -0
- data/lib/xsd/namedelements.rb +133 -0
- data/lib/xsd/ns.rb +183 -0
- data/lib/xsd/qname.rb +80 -0
- data/lib/xsd/xmlparser/libxmlparser.rb +116 -0
- data/lib/xsd/xmlparser/parser.rb +101 -0
- data/lib/xsd/xmlparser/rexmlparser.rb +59 -0
- data/lib/xsd/xmlparser/xmlparser.rb +51 -0
- data/lib/xsd/xmlparser/xmlscanner.rb +150 -0
- data/lib/xsd/xmlparser.rb +77 -0
- data/test/16runner.rb +69 -0
- data/test/helper.rb +7 -0
- data/test/interopR2/README.txt +2 -0
- data/test/interopR2/SOAPBuildersInterop_R2.wsdl +461 -0
- data/test/interopR2/SOAPBuildersInterop_R2GrB.wsdl +19 -0
- data/test/interopR2/base.rb +289 -0
- data/test/interopR2/client.NetRemoting.rb +18 -0
- data/test/interopR2/client.rb +1235 -0
- data/test/interopR2/client4S4C.rb +16 -0
- data/test/interopR2/client4S4C2.rb +15 -0
- data/test/interopR2/clientASP.NET.rb +18 -0
- data/test/interopR2/clientApacheAxis.rb +17 -0
- data/test/interopR2/clientApacheSOAP.rb +18 -0
- data/test/interopR2/clientBEAWebLogic.rb +18 -0
- data/test/interopR2/clientBase.rb +1968 -0
- data/test/interopR2/clientCapeConnect.rb +19 -0
- data/test/interopR2/clientDelphi.rb +20 -0
- data/test/interopR2/clientEasySoap.rb +15 -0
- data/test/interopR2/clientFrontier.rb +26 -0
- data/test/interopR2/clientGLUE.rb +33 -0
- data/test/interopR2/clientHP.rb +14 -0
- data/test/interopR2/clientJAX-RPC.rb +20 -0
- data/test/interopR2/clientJSOAP.rb +15 -0
- data/test/interopR2/clientKafkaXSLT.rb +16 -0
- data/test/interopR2/clientMSSOAPToolkit2.0.rb +18 -0
- data/test/interopR2/clientMSSOAPToolkit3.0.rb +18 -0
- data/test/interopR2/clientNuSOAP.rb +20 -0
- data/test/interopR2/clientNuWave.rb +16 -0
- data/test/interopR2/clientOpenLink.rb +16 -0
- data/test/interopR2/clientOracle.rb +16 -0
- data/test/interopR2/clientPEAR.rb +19 -0
- data/test/interopR2/clientPhalanx.rb +19 -0
- data/test/interopR2/clientSIMACE.rb +19 -0
- data/test/interopR2/clientSOAP4R.rb +19 -0
- data/test/interopR2/clientSOAP__Lite.rb +15 -0
- data/test/interopR2/clientSQLData.rb +19 -0
- data/test/interopR2/clientSilverStream.rb +18 -0
- data/test/interopR2/clientSpray2001.rb +18 -0
- data/test/interopR2/clientSun.rb +20 -0
- data/test/interopR2/clientVWOpentalkSoap.rb +20 -0
- data/test/interopR2/clientWASP.rb +20 -0
- data/test/interopR2/clientWASPC.rb +19 -0
- data/test/interopR2/clientWebMethods.rb +16 -0
- data/test/interopR2/clientWhiteMesa.rb +29 -0
- data/test/interopR2/clientWingfoot.rb +16 -0
- data/test/interopR2/clientXMLBus.rb +20 -0
- data/test/interopR2/clientXMLRPC-EPI.rb +18 -0
- data/test/interopR2/clientXSOAP.rb +15 -0
- data/test/interopR2/clientZSI.rb +20 -0
- data/test/interopR2/clienteSOAP.rb +19 -0
- data/test/interopR2/clientgSOAP.rb +19 -0
- data/test/interopR2/clientkSOAP.rb +18 -0
- data/test/interopR2/iSimonReg.rb +113 -0
- data/test/interopR2/interopResultBase.rb +115 -0
- data/test/interopR2/interopService.rb +248 -0
- data/test/interopR2/rwikiInteropService.rb +106 -0
- data/test/interopR2/server.cgi +271 -0
- data/test/interopR2/server.rb +276 -0
- data/test/interopR2/simonReg.rb +124 -0
- data/test/interopR2/test.sh +49 -0
- data/test/interopR4/client.rb +113 -0
- data/test/runner.rb +8 -0
- data/test/sm11/classDef.rb +157 -0
- data/test/sm11/client.rb +543 -0
- data/test/sm11/driver.rb +184 -0
- data/test/sm11/servant.rb +1068 -0
- data/test/sm11/server.rb +26 -0
- data/test/soap/asp.net/hello.wsdl +96 -0
- data/test/soap/asp.net/test_aspdotnet.rb +124 -0
- data/test/soap/auth/htdigest +2 -0
- data/test/soap/auth/htpasswd +2 -0
- data/test/soap/auth/test_basic.rb +118 -0
- data/test/soap/auth/test_digest.rb +119 -0
- data/test/soap/calc/calc.rb +18 -0
- data/test/soap/calc/calc2.rb +30 -0
- data/test/soap/calc/server.cgi +16 -0
- data/test/soap/calc/server.rb +18 -0
- data/test/soap/calc/server2.rb +21 -0
- data/test/soap/calc/test_calc.rb +53 -0
- data/test/soap/calc/test_calc2.rb +57 -0
- data/test/soap/calc/test_calc_cgi.rb +72 -0
- data/test/soap/case/test_mapping.rb +58 -0
- data/test/soap/fault/test_customfault.rb +61 -0
- data/test/soap/fault/test_fault.rb +47 -0
- data/test/soap/fault/test_soaparray.rb +36 -0
- data/test/soap/filter/test_filter.rb +147 -0
- data/test/soap/header/server.cgi +121 -0
- data/test/soap/header/test_authheader.rb +241 -0
- data/test/soap/header/test_authheader_cgi.rb +122 -0
- data/test/soap/header/test_simplehandler.rb +117 -0
- data/test/soap/helloworld/hw_s.rb +17 -0
- data/test/soap/helloworld/test_helloworld.rb +45 -0
- data/test/soap/htpasswd +2 -0
- data/test/soap/literalArrayMapping/amazonEc.rb +4779 -0
- data/test/soap/literalArrayMapping/amazonEcDriver.rb +173 -0
- data/test/soap/literalArrayMapping/amazonresponse.xml +100 -0
- data/test/soap/literalArrayMapping/test_definedarray.rb +35 -0
- data/test/soap/marshal/marshaltestlib.rb +498 -0
- data/test/soap/marshal/test_digraph.rb +57 -0
- data/test/soap/marshal/test_marshal.rb +28 -0
- data/test/soap/marshal/test_struct.rb +48 -0
- data/test/soap/ssl/README +1 -0
- data/test/soap/ssl/ca.cert +23 -0
- data/test/soap/ssl/client.cert +19 -0
- data/test/soap/ssl/client.key +15 -0
- data/test/soap/ssl/server.cert +19 -0
- data/test/soap/ssl/server.key +15 -0
- data/test/soap/ssl/sslsvr.rb +59 -0
- data/test/soap/ssl/subca.cert +21 -0
- data/test/soap/ssl/test_ssl.rb +236 -0
- data/test/soap/struct/test_struct.rb +71 -0
- data/test/soap/styleuse/client.rb +21 -0
- data/test/soap/styleuse/server.rb +87 -0
- data/test/soap/swa/test_file.rb +76 -0
- data/test/soap/test_basetype.rb +1091 -0
- data/test/soap/test_cookie.rb +113 -0
- data/test/soap/test_custom_ns.rb +106 -0
- data/test/soap/test_custommap.rb +111 -0
- data/test/soap/test_empty.rb +106 -0
- data/test/soap/test_envelopenamespace.rb +86 -0
- data/test/soap/test_extraattr.rb +55 -0
- data/test/soap/test_generator.rb +32 -0
- data/test/soap/test_httpconfigloader.rb +72 -0
- data/test/soap/test_mapping.rb +132 -0
- data/test/soap/test_nestedexception.rb +71 -0
- data/test/soap/test_nil.rb +71 -0
- data/test/soap/test_no_indent.rb +89 -0
- data/test/soap/test_property.rb +429 -0
- data/test/soap/test_response_as_xml.rb +118 -0
- data/test/soap/test_soapelement.rb +139 -0
- data/test/soap/test_streamhandler.rb +271 -0
- data/test/soap/test_styleuse.rb +327 -0
- data/test/soap/wsdlDriver/README.txt +2 -0
- data/test/soap/wsdlDriver/calc.wsdl +126 -0
- data/test/soap/wsdlDriver/document.wsdl +54 -0
- data/test/soap/wsdlDriver/echo_version.rb +30 -0
- data/test/soap/wsdlDriver/simpletype.wsdl +63 -0
- data/test/soap/wsdlDriver/test_calc.rb +72 -0
- data/test/soap/wsdlDriver/test_document.rb +72 -0
- data/test/soap/wsdlDriver/test_simpletype.rb +82 -0
- data/test/testutil.rb +55 -0
- data/test/wsdl/abstract/abstract.wsdl +176 -0
- data/test/wsdl/abstract/test_abstract.rb +160 -0
- data/test/wsdl/anonymous/expectedClassDef.rb +129 -0
- data/test/wsdl/anonymous/expectedDriver.rb +60 -0
- data/test/wsdl/anonymous/expectedMappingRegistry.rb +177 -0
- data/test/wsdl/anonymous/lp.wsdl +147 -0
- data/test/wsdl/anonymous/test_anonymous.rb +131 -0
- data/test/wsdl/any/any.wsdl +114 -0
- data/test/wsdl/any/expectedDriver.rb +69 -0
- data/test/wsdl/any/expectedEcho.rb +58 -0
- data/test/wsdl/any/expectedMappingRegistry.rb +64 -0
- data/test/wsdl/any/expectedService.rb +70 -0
- data/test/wsdl/any/test_any.rb +194 -0
- data/test/wsdl/axisArray/axisArray.wsdl +87 -0
- data/test/wsdl/axisArray/test_axisarray.rb +125 -0
- data/test/wsdl/choice/choice.wsdl +167 -0
- data/test/wsdl/choice/test_choice.rb +311 -0
- data/test/wsdl/complexcontent/complexContent.wsdl +83 -0
- data/test/wsdl/complexcontent/test_echo.rb +91 -0
- data/test/wsdl/datetime/DatetimeService.rb +45 -0
- data/test/wsdl/datetime/datetime.rb +0 -0
- data/test/wsdl/datetime/datetime.wsdl +45 -0
- data/test/wsdl/datetime/datetimeServant.rb +23 -0
- data/test/wsdl/datetime/test_datetime.rb +88 -0
- data/test/wsdl/document/array/double.wsdl +161 -0
- data/test/wsdl/document/array/test_array.rb +202 -0
- data/test/wsdl/document/document.wsdl +76 -0
- data/test/wsdl/document/number.wsdl +54 -0
- data/test/wsdl/document/ping_nosoapaction.wsdl +66 -0
- data/test/wsdl/document/test_nosoapaction.rb +103 -0
- data/test/wsdl/document/test_number.rb +93 -0
- data/test/wsdl/document/test_rpc.rb +356 -0
- data/test/wsdl/emptycomplextype.wsdl +31 -0
- data/test/wsdl/fault/fault.wsdl +79 -0
- data/test/wsdl/fault/multifault.wsdl +96 -0
- data/test/wsdl/fault/test_fault.rb +120 -0
- data/test/wsdl/fault/test_multifault.rb +135 -0
- data/test/wsdl/group/expectedClassdef.rb +59 -0
- data/test/wsdl/group/expectedDriver.rb +52 -0
- data/test/wsdl/group/expectedMappingRegistry.rb +68 -0
- data/test/wsdl/group/group.wsdl +88 -0
- data/test/wsdl/group/test_rpc.rb +146 -0
- data/test/wsdl/list/list.wsdl +93 -0
- data/test/wsdl/list/test_list.rb +125 -0
- data/test/wsdl/map/map.wsdl +92 -0
- data/test/wsdl/map/map.xml +43 -0
- data/test/wsdl/map/test_map.rb +100 -0
- data/test/wsdl/marshal/person.wsdl +21 -0
- data/test/wsdl/marshal/person_org.rb +24 -0
- data/test/wsdl/marshal/test_wsdlmarshal.rb +76 -0
- data/test/wsdl/multiplefault.wsdl +75 -0
- data/test/wsdl/oneway/oneway.wsdl +36 -0
- data/test/wsdl/oneway/test_oneway.rb +109 -0
- data/test/wsdl/overload/expectedClient.rb +38 -0
- data/test/wsdl/overload/expectedDriver.rb +62 -0
- data/test/wsdl/overload/expectedServant.rb +36 -0
- data/test/wsdl/overload/overload.wsdl +70 -0
- data/test/wsdl/overload/test_overload.rb +132 -0
- data/test/wsdl/qualified/lp.wsdl +47 -0
- data/test/wsdl/qualified/lp.xsd +26 -0
- data/test/wsdl/qualified/np.wsdl +51 -0
- data/test/wsdl/qualified/test_qualified.rb +138 -0
- data/test/wsdl/qualified/test_unqualified.rb +139 -0
- data/test/wsdl/raa/RAAService.rb +126 -0
- data/test/wsdl/raa/README.txt +8 -0
- data/test/wsdl/raa/expectedClassDef.rb +101 -0
- data/test/wsdl/raa/expectedDriver.rb +97 -0
- data/test/wsdl/raa/expectedMappingRegistry.rb +122 -0
- data/test/wsdl/raa/raa.wsdl +264 -0
- data/test/wsdl/raa/test_raa.rb +127 -0
- data/test/wsdl/ref/expectedDriver.rb +52 -0
- data/test/wsdl/ref/expectedProduct.rb +244 -0
- data/test/wsdl/ref/product.wsdl +147 -0
- data/test/wsdl/ref/test_ref.rb +269 -0
- data/test/wsdl/rpc/rpc.wsdl +109 -0
- data/test/wsdl/rpc/test-rpc-lit.wsdl +371 -0
- data/test/wsdl/rpc/test_rpc.rb +177 -0
- data/test/wsdl/rpc/test_rpc_lit.rb +471 -0
- data/test/wsdl/simplecontent/simplecontent.wsdl +84 -0
- data/test/wsdl/simplecontent/test_simplecontent.rb +103 -0
- data/test/wsdl/simpletype/rpc/expectedClient.rb +35 -0
- data/test/wsdl/simpletype/rpc/expectedDriver.rb +59 -0
- data/test/wsdl/simpletype/rpc/expectedEchoVersion.rb +37 -0
- data/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +58 -0
- data/test/wsdl/simpletype/rpc/expectedServant.rb +33 -0
- data/test/wsdl/simpletype/rpc/expectedService.rb +56 -0
- data/test/wsdl/simpletype/rpc/rpc.wsdl +98 -0
- data/test/wsdl/simpletype/rpc/test_rpc.rb +53 -0
- data/test/wsdl/simpletype/simpletype.wsdl +114 -0
- data/test/wsdl/simpletype/test_simpletype.rb +93 -0
- data/test/wsdl/soap/soapbodyparts.wsdl +103 -0
- data/test/wsdl/soap/test_soapbodyparts.rb +80 -0
- data/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb +22 -0
- data/test/wsdl/soap/wsdl2ruby/expectedClient.rb +35 -0
- data/test/wsdl/soap/wsdl2ruby/expectedDriver.rb +59 -0
- data/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +37 -0
- data/test/wsdl/soap/wsdl2ruby/expectedServant.rb +33 -0
- data/test/wsdl/soap/wsdl2ruby/expectedService.cgi +49 -0
- data/test/wsdl/soap/wsdl2ruby/expectedService.rb +56 -0
- data/test/wsdl/soap/wsdl2ruby/rpc.wsdl +80 -0
- data/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb +38 -0
- data/test/wsdl/soap/wsdl2ruby/section/section.xsd +31 -0
- data/test/wsdl/soap/wsdl2ruby/section/test_section.rb +54 -0
- data/test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl +64 -0
- data/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +84 -0
- data/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb +103 -0
- data/test/wsdl/soaptype/soaptype.wsdl +61 -0
- data/test/wsdl/soaptype/test_soaptype.rb +179 -0
- data/test/wsdl/test_emptycomplextype.rb +22 -0
- data/test/wsdl/test_fault.rb +51 -0
- data/test/wsdl/test_multiplefault.rb +42 -0
- data/test/xsd/codegen/test_classdef.rb +245 -0
- data/test/xsd/noencoding.xml +4 -0
- data/test/xsd/test_noencoding.rb +33 -0
- data/test/xsd/test_ns.rb +42 -0
- data/test/xsd/test_xmlschemaparser.rb +23 -0
- data/test/xsd/test_xsd.rb +1639 -0
- data/test/xsd/xmllang.xml +43 -0
- data/test/xsd/xmlschema.xml +12 -0
- data/test/xsd/xsd2ruby/expected_mysample.rb +66 -0
- data/test/xsd/xsd2ruby/expected_mysample_mapper.rb +12 -0
- data/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +52 -0
- data/test/xsd/xsd2ruby/section.xsd +49 -0
- data/test/xsd/xsd2ruby/test_xsd2ruby.rb +91 -0
- metadata +489 -0
@@ -0,0 +1,1639 @@
|
|
1
|
+
# encoding: ASCII-8BIT
|
2
|
+
require 'helper'
|
3
|
+
require 'xsd/datatypes'
|
4
|
+
|
5
|
+
|
6
|
+
module XSD
|
7
|
+
|
8
|
+
|
9
|
+
class TestXSD < Test::Unit::TestCase
|
10
|
+
NegativeZero = (-1.0 / (1.0 / 0.0))
|
11
|
+
|
12
|
+
def setup
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_parsed_result(klass, str)
|
19
|
+
o = klass.new(str)
|
20
|
+
assert_equal(str, o.to_s)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_NSDBase
|
24
|
+
o = XSD::NSDBase.new
|
25
|
+
assert_equal(nil, o.type)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_XSDBase
|
29
|
+
o = XSD::XSDAnySimpleType.new
|
30
|
+
assert_equal(nil, o.data)
|
31
|
+
assert_equal(true, o.is_nil)
|
32
|
+
assert_equal('', o.to_s)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_XSDNil
|
36
|
+
o = XSD::XSDNil.new
|
37
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
38
|
+
assert_equal(XSD::NilLiteral, o.type.name)
|
39
|
+
assert_equal(nil, o.data)
|
40
|
+
assert_equal(true, o.is_nil)
|
41
|
+
|
42
|
+
o = XSD::XSDNil.new(nil)
|
43
|
+
assert_equal(true, o.is_nil)
|
44
|
+
assert_equal(nil, o.data)
|
45
|
+
assert_equal("", o.to_s)
|
46
|
+
o = XSD::XSDNil.new('var')
|
47
|
+
assert_equal(false, o.is_nil)
|
48
|
+
assert_equal('var', o.data)
|
49
|
+
assert_equal('var', o.to_s)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_XSDString_UTF8
|
53
|
+
o = XSD::XSDString.new
|
54
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
55
|
+
assert_equal(XSD::StringLiteral, o.type.name)
|
56
|
+
assert_equal(nil, o.data)
|
57
|
+
assert_equal(true, o.is_nil)
|
58
|
+
|
59
|
+
str = "abc"
|
60
|
+
assert_equal(str, XSD::XSDString.new(str).data)
|
61
|
+
assert_equal(str, XSD::XSDString.new(str).to_s)
|
62
|
+
back = XSD::XSDString.strict_ces_validation
|
63
|
+
XSD::XSDString.strict_ces_validation = true
|
64
|
+
begin
|
65
|
+
assert_raises(XSD::ValueSpaceError) do
|
66
|
+
XSD::XSDString.new("\0")
|
67
|
+
end
|
68
|
+
assert_raises(XSD::ValueSpaceError) do
|
69
|
+
p XSD::XSDString.new("\xC0\xC0").to_s
|
70
|
+
end
|
71
|
+
ensure
|
72
|
+
XSD::XSDString.strict_ces_validation = back
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_XSDString_NONE
|
77
|
+
XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" }
|
78
|
+
begin
|
79
|
+
o = XSD::XSDString.new
|
80
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
81
|
+
assert_equal(XSD::StringLiteral, o.type.name)
|
82
|
+
assert_equal(nil, o.data)
|
83
|
+
assert_equal(true, o.is_nil)
|
84
|
+
|
85
|
+
str = "abc"
|
86
|
+
assert_equal(str, XSD::XSDString.new(str).data)
|
87
|
+
assert_equal(str, XSD::XSDString.new(str).to_s)
|
88
|
+
back = XSD::XSDString.strict_ces_validation
|
89
|
+
XSD::XSDString.strict_ces_validation = true
|
90
|
+
begin
|
91
|
+
assert_raises(XSD::ValueSpaceError) do
|
92
|
+
XSD::XSDString.new("\0")
|
93
|
+
end
|
94
|
+
assert_raises(XSD::ValueSpaceError) do
|
95
|
+
XSD::XSDString.new("\xC0\xC0").to_s
|
96
|
+
end
|
97
|
+
ensure
|
98
|
+
XSD::XSDString.strict_ces_validation = back
|
99
|
+
end
|
100
|
+
ensure
|
101
|
+
XSD::Charset.module_eval { @internal_encoding = @encoding_backup }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_XSDNormalizedString
|
106
|
+
XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" }
|
107
|
+
begin
|
108
|
+
o = XSD::XSDNormalizedString.new
|
109
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
110
|
+
assert_equal(XSD::NormalizedStringLiteral, o.type.name)
|
111
|
+
assert_equal(nil, o.data)
|
112
|
+
assert_equal(true, o.is_nil)
|
113
|
+
|
114
|
+
str = "abc"
|
115
|
+
assert_equal(str, XSD::XSDNormalizedString.new(str).data)
|
116
|
+
assert_equal(str, XSD::XSDNormalizedString.new(str).to_s)
|
117
|
+
back = XSD::XSDString.strict_ces_validation
|
118
|
+
XSD::XSDString.strict_ces_validation = true
|
119
|
+
begin
|
120
|
+
assert_raises(XSD::ValueSpaceError) do
|
121
|
+
XSD::XSDNormalizedString.new("\0")
|
122
|
+
end
|
123
|
+
assert_raises(XSD::ValueSpaceError) do
|
124
|
+
XSD::XSDNormalizedString.new("\xC0\xC0").to_s
|
125
|
+
end
|
126
|
+
assert_raises(XSD::ValueSpaceError) do
|
127
|
+
XSD::XSDNormalizedString.new("a\tb").to_s
|
128
|
+
end
|
129
|
+
assert_raises(XSD::ValueSpaceError) do
|
130
|
+
XSD::XSDNormalizedString.new("a\r").to_s
|
131
|
+
end
|
132
|
+
assert_raises(XSD::ValueSpaceError) do
|
133
|
+
XSD::XSDNormalizedString.new("\nb").to_s
|
134
|
+
end
|
135
|
+
ensure
|
136
|
+
XSD::XSDString.strict_ces_validation = back
|
137
|
+
end
|
138
|
+
ensure
|
139
|
+
XSD::Charset.module_eval { @internal_encoding = @encoding_backup }
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_XSDToken
|
144
|
+
XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" }
|
145
|
+
begin
|
146
|
+
o = XSD::XSDToken.new
|
147
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
148
|
+
assert_equal(XSD::TokenLiteral, o.type.name)
|
149
|
+
assert_equal(nil, o.data)
|
150
|
+
assert_equal(true, o.is_nil)
|
151
|
+
|
152
|
+
str = "abc"
|
153
|
+
assert_equal(str, XSD::XSDToken.new(str).data)
|
154
|
+
assert_equal(str, XSD::XSDToken.new(str).to_s)
|
155
|
+
back = XSD::XSDString.strict_ces_validation
|
156
|
+
XSD::XSDString.strict_ces_validation = true
|
157
|
+
begin
|
158
|
+
assert_raises(XSD::ValueSpaceError) do
|
159
|
+
XSD::XSDToken.new("\0")
|
160
|
+
end
|
161
|
+
assert_raises(XSD::ValueSpaceError) do
|
162
|
+
XSD::XSDToken.new("\xC0\xC0").to_s
|
163
|
+
end
|
164
|
+
assert_raises(XSD::ValueSpaceError) do
|
165
|
+
XSD::XSDToken.new("a\tb").to_s
|
166
|
+
end
|
167
|
+
assert_raises(XSD::ValueSpaceError) do
|
168
|
+
XSD::XSDToken.new("a\r").to_s
|
169
|
+
end
|
170
|
+
assert_raises(XSD::ValueSpaceError) do
|
171
|
+
XSD::XSDToken.new("\nb").to_s
|
172
|
+
end
|
173
|
+
assert_raises(XSD::ValueSpaceError) do
|
174
|
+
XSD::XSDToken.new(" a").to_s
|
175
|
+
end
|
176
|
+
assert_raises(XSD::ValueSpaceError) do
|
177
|
+
XSD::XSDToken.new("b ").to_s
|
178
|
+
end
|
179
|
+
assert_raises(XSD::ValueSpaceError) do
|
180
|
+
XSD::XSDToken.new("a b").to_s
|
181
|
+
end
|
182
|
+
assert_equal("a b", XSD::XSDToken.new("a b").data)
|
183
|
+
ensure
|
184
|
+
XSD::XSDString.strict_ces_validation = back
|
185
|
+
end
|
186
|
+
ensure
|
187
|
+
XSD::Charset.module_eval { @internal_encoding = @encoding_backup }
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_XSDLanguage
|
192
|
+
o = XSD::XSDLanguage.new
|
193
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
194
|
+
assert_equal(XSD::LanguageLiteral, o.type.name)
|
195
|
+
assert_equal(nil, o.data)
|
196
|
+
assert_equal(true, o.is_nil)
|
197
|
+
|
198
|
+
str = "ja"
|
199
|
+
assert_equal(str, XSD::XSDLanguage.new(str).data)
|
200
|
+
assert_equal(str, XSD::XSDLanguage.new(str).to_s)
|
201
|
+
str = "ja-jp"
|
202
|
+
assert_equal(str, XSD::XSDLanguage.new(str).data)
|
203
|
+
assert_equal(str, XSD::XSDLanguage.new(str).to_s)
|
204
|
+
assert_raises(XSD::ValueSpaceError) do
|
205
|
+
XSD::XSDLanguage.new("ja-jp-")
|
206
|
+
end
|
207
|
+
assert_raises(XSD::ValueSpaceError) do
|
208
|
+
XSD::XSDLanguage.new("-ja-")
|
209
|
+
end
|
210
|
+
assert_raises(XSD::ValueSpaceError) do
|
211
|
+
XSD::XSDLanguage.new("ja-")
|
212
|
+
end
|
213
|
+
assert_raises(XSD::ValueSpaceError) do
|
214
|
+
XSD::XSDLanguage.new("a1-01")
|
215
|
+
end
|
216
|
+
assert_equal("aA-01", XSD::XSDLanguage.new("aA-01").to_s)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_XSDBoolean
|
220
|
+
o = XSD::XSDBoolean.new
|
221
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
222
|
+
assert_equal(XSD::BooleanLiteral, o.type.name)
|
223
|
+
assert_equal(nil, o.data)
|
224
|
+
assert_equal(true, o.is_nil)
|
225
|
+
|
226
|
+
targets = [
|
227
|
+
["true", true],
|
228
|
+
["1", true],
|
229
|
+
["false", false],
|
230
|
+
["0", false],
|
231
|
+
]
|
232
|
+
targets.each do |data, expected|
|
233
|
+
assert_equal(expected, XSD::XSDBoolean.new(data).data)
|
234
|
+
assert_equal(expected.to_s, XSD::XSDBoolean.new(data).to_s)
|
235
|
+
end
|
236
|
+
|
237
|
+
assert_raises(XSD::ValueSpaceError) do
|
238
|
+
XSD::XSDBoolean.new("nil").to_s
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
def test_XSDDecimal
|
243
|
+
o = XSD::XSDDecimal.new
|
244
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
245
|
+
assert_equal(XSD::DecimalLiteral, o.type.name)
|
246
|
+
assert_equal(nil, o.data)
|
247
|
+
assert_equal(true, o.is_nil)
|
248
|
+
|
249
|
+
targets = [
|
250
|
+
0,
|
251
|
+
1000000000,
|
252
|
+
-9999999999,
|
253
|
+
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
|
254
|
+
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
|
255
|
+
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
|
256
|
+
]
|
257
|
+
targets.each do |dec|
|
258
|
+
assert_equal(dec.to_s, XSD::XSDDecimal.new(dec).data)
|
259
|
+
end
|
260
|
+
|
261
|
+
targets = [
|
262
|
+
"0",
|
263
|
+
"0.00000001",
|
264
|
+
"1000000000",
|
265
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
266
|
+
"-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123.45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
|
267
|
+
]
|
268
|
+
targets.each do |str|
|
269
|
+
assert_equal(str, XSD::XSDDecimal.new(str).to_s)
|
270
|
+
end
|
271
|
+
|
272
|
+
targets = [
|
273
|
+
["-0", "0"],
|
274
|
+
["+0", "0"],
|
275
|
+
["0.0", "0"],
|
276
|
+
["-0.0", "0"],
|
277
|
+
["+0.0", "0"],
|
278
|
+
["0.", "0"],
|
279
|
+
[".0", "0"],
|
280
|
+
[
|
281
|
+
"+0.12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
282
|
+
"0.1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
|
283
|
+
],
|
284
|
+
[
|
285
|
+
".0000012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
286
|
+
"0.000001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
|
287
|
+
],
|
288
|
+
[
|
289
|
+
"-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.",
|
290
|
+
"-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
291
|
+
],
|
292
|
+
]
|
293
|
+
targets.each do |data, expected|
|
294
|
+
assert_equal(expected, XSD::XSDDecimal.new(data).to_s)
|
295
|
+
end
|
296
|
+
|
297
|
+
targets = [
|
298
|
+
"0.000000000000a",
|
299
|
+
"00a.0000000000001",
|
300
|
+
"+-5",
|
301
|
+
]
|
302
|
+
targets.each do |d|
|
303
|
+
assert_raises(XSD::ValueSpaceError) do
|
304
|
+
XSD::XSDDecimal.new(d)
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
def test_XSDFloat
|
310
|
+
o = XSD::XSDFloat.new
|
311
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
312
|
+
assert_equal(XSD::FloatLiteral, o.type.name)
|
313
|
+
assert_equal(nil, o.data)
|
314
|
+
assert_equal(true, o.is_nil)
|
315
|
+
|
316
|
+
targets = [
|
317
|
+
3.14159265358979,
|
318
|
+
12.34e36,
|
319
|
+
1.402e-45,
|
320
|
+
-1.402e-45,
|
321
|
+
]
|
322
|
+
targets.each do |f|
|
323
|
+
assert_equal(f, XSD::XSDFloat.new(f).data)
|
324
|
+
end
|
325
|
+
|
326
|
+
targets = [
|
327
|
+
"+3.141592654",
|
328
|
+
"+1.234e+37",
|
329
|
+
"+1.402e-45",
|
330
|
+
"-1.402e-45",
|
331
|
+
]
|
332
|
+
targets.each do |f|
|
333
|
+
assert_equal(f, XSD::XSDFloat.new(f).to_s)
|
334
|
+
end
|
335
|
+
|
336
|
+
targets = [
|
337
|
+
[3, "+3"], # should be 3.0?
|
338
|
+
[-2, "-2"], # ditto
|
339
|
+
[3.14159265358979, "+3.141592654"],
|
340
|
+
[12.34e36, "+1.234e+37"],
|
341
|
+
[1.402e-45, "+1.402e-45"],
|
342
|
+
[-1.402e-45, "-1.402e-45"],
|
343
|
+
["1.402e", "+1.402"],
|
344
|
+
["12.34E36", "+1.234e+37"],
|
345
|
+
["1.402E-45", "+1.402e-45"],
|
346
|
+
["-1.402E-45", "-1.402e-45"],
|
347
|
+
["1.402E", "+1.402"],
|
348
|
+
]
|
349
|
+
targets.each do |f, str|
|
350
|
+
assert_equal(str, XSD::XSDFloat.new(f).to_s)
|
351
|
+
end
|
352
|
+
|
353
|
+
assert_equal("+0", XSD::XSDFloat.new(+0.0).to_s)
|
354
|
+
assert_equal("-0", XSD::XSDFloat.new(NegativeZero).to_s)
|
355
|
+
assert(XSD::XSDFloat.new(0.0/0.0).data.nan?)
|
356
|
+
assert_equal("INF", XSD::XSDFloat.new(1.0/0.0).to_s)
|
357
|
+
assert_equal(1, XSD::XSDFloat.new(1.0/0.0).data.infinite?)
|
358
|
+
assert_equal("-INF", XSD::XSDFloat.new(-1.0/0.0).to_s)
|
359
|
+
assert_equal(-1, XSD::XSDFloat.new(-1.0/0.0).data.infinite?)
|
360
|
+
|
361
|
+
targets = [
|
362
|
+
"0.000000000000a",
|
363
|
+
"00a.0000000000001",
|
364
|
+
"+-5",
|
365
|
+
"5_0",
|
366
|
+
]
|
367
|
+
targets.each do |d|
|
368
|
+
assert_raises(XSD::ValueSpaceError) do
|
369
|
+
XSD::XSDFloat.new(d)
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
374
|
+
def test_XSDDouble
|
375
|
+
o = XSD::XSDDouble.new
|
376
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
377
|
+
assert_equal(XSD::DoubleLiteral, o.type.name)
|
378
|
+
assert_equal(nil, o.data)
|
379
|
+
assert_equal(true, o.is_nil)
|
380
|
+
|
381
|
+
targets = [
|
382
|
+
3.14159265358979,
|
383
|
+
12.34e36,
|
384
|
+
1.402e-45,
|
385
|
+
-1.402e-45,
|
386
|
+
]
|
387
|
+
targets.each do |f|
|
388
|
+
assert_equal(f, XSD::XSDDouble.new(f).data)
|
389
|
+
end
|
390
|
+
|
391
|
+
targets = [
|
392
|
+
"+3.14159265358979",
|
393
|
+
"+1.234e+37",
|
394
|
+
"+1.402e-45",
|
395
|
+
"-1.402e-45",
|
396
|
+
]
|
397
|
+
targets.each do |f|
|
398
|
+
assert_equal(f, XSD::XSDDouble.new(f).to_s)
|
399
|
+
end
|
400
|
+
|
401
|
+
targets = [
|
402
|
+
[3, "+3"], # should be 3.0?
|
403
|
+
[-2, "-2"], # ditto.
|
404
|
+
[3.14159265358979, "+3.14159265358979"],
|
405
|
+
[12.34e36, "+1.234e+37"],
|
406
|
+
[1.402e-45, "+1.402e-45"],
|
407
|
+
[-1.402e-45, "-1.402e-45"],
|
408
|
+
["1.402e", "+1.402"],
|
409
|
+
["12.34E36", "+1.234e+37"],
|
410
|
+
["1.402E-45", "+1.402e-45"],
|
411
|
+
["-1.402E-45", "-1.402e-45"],
|
412
|
+
["1.402E", "+1.402"],
|
413
|
+
]
|
414
|
+
targets.each do |f, str|
|
415
|
+
assert_equal(str, XSD::XSDDouble.new(f).to_s)
|
416
|
+
end
|
417
|
+
|
418
|
+
assert_equal("+0", XSD::XSDFloat.new(+0.0).to_s)
|
419
|
+
assert_equal("-0", XSD::XSDFloat.new(NegativeZero).to_s)
|
420
|
+
assert_equal("NaN", XSD::XSDDouble.new(0.0/0.0).to_s)
|
421
|
+
assert(XSD::XSDDouble.new(0.0/0.0).data.nan?)
|
422
|
+
assert_equal("INF", XSD::XSDDouble.new(1.0/0.0).to_s)
|
423
|
+
assert_equal(1, XSD::XSDDouble.new(1.0/0.0).data.infinite?)
|
424
|
+
assert_equal("-INF", XSD::XSDDouble.new(-1.0/0.0).to_s)
|
425
|
+
assert_equal(-1, XSD::XSDDouble.new(-1.0/0.0).data.infinite?)
|
426
|
+
|
427
|
+
targets = [
|
428
|
+
"0.000000000000a",
|
429
|
+
"00a.0000000000001",
|
430
|
+
"+-5",
|
431
|
+
]
|
432
|
+
targets.each do |d|
|
433
|
+
assert_raises(XSD::ValueSpaceError) do
|
434
|
+
XSD::XSDDouble.new(d)
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
def test_XSDDuration
|
440
|
+
o = XSD::XSDDuration.new
|
441
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
442
|
+
assert_equal(XSD::DurationLiteral, o.type.name)
|
443
|
+
assert_equal(nil, o.data)
|
444
|
+
assert_equal(true, o.is_nil)
|
445
|
+
|
446
|
+
targets = [
|
447
|
+
"P1Y2M3DT4H5M6S",
|
448
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S",
|
449
|
+
"PT3456H7890M1234.5678S",
|
450
|
+
"P1234Y5678M9012D",
|
451
|
+
"-P1234Y5678M9012DT3456H7890M1234.5678S",
|
452
|
+
"P5678M9012DT3456H7890M1234.5678S",
|
453
|
+
"-P1234Y9012DT3456H7890M1234.5678S",
|
454
|
+
"+P1234Y5678MT3456H7890M1234.5678S",
|
455
|
+
"P1234Y5678M9012DT7890M1234.5678S",
|
456
|
+
"-P1234Y5678M9012DT3456H1234.5678S",
|
457
|
+
"+P1234Y5678M9012DT3456H7890M",
|
458
|
+
"P123400000000000Y",
|
459
|
+
"-P567800000000000M",
|
460
|
+
"+P901200000000000D",
|
461
|
+
"PT345600000000000H",
|
462
|
+
"-PT789000000000000M",
|
463
|
+
"+PT123400000000000.000000000005678S",
|
464
|
+
"P1234YT1234.5678S",
|
465
|
+
"-P5678MT7890M",
|
466
|
+
"+P9012DT3456H",
|
467
|
+
"PT5S",
|
468
|
+
]
|
469
|
+
targets.each do |str|
|
470
|
+
assert_parsed_result(XSD::XSDDuration, str)
|
471
|
+
end
|
472
|
+
|
473
|
+
targets = [
|
474
|
+
["P0Y0M0DT0H0M0S",
|
475
|
+
"P0D"],
|
476
|
+
["-P0DT0S",
|
477
|
+
"-P0D"],
|
478
|
+
["P01234Y5678M9012DT3456H7890M1234.5678S",
|
479
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S"],
|
480
|
+
["P1234Y005678M9012DT3456H7890M1234.5678S",
|
481
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S"],
|
482
|
+
["P1234Y5678M0009012DT3456H7890M1234.5678S",
|
483
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S"],
|
484
|
+
["P1234Y5678M9012DT00003456H7890M1234.5678S",
|
485
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S"],
|
486
|
+
["P1234Y5678M9012DT3456H000007890M1234.5678S",
|
487
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S"],
|
488
|
+
["P1234Y5678M9012DT3456H7890M0000001234.5678S",
|
489
|
+
"P1234Y5678M9012DT3456H7890M1234.5678S"],
|
490
|
+
]
|
491
|
+
targets.each do |data, expected|
|
492
|
+
assert_equal(expected, XSD::XSDDuration.new(data).to_s)
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
def test_XSDDateTime
|
497
|
+
o = XSD::XSDDateTime.new
|
498
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
499
|
+
assert_equal(XSD::DateTimeLiteral, o.type.name)
|
500
|
+
assert_equal(nil, o.data)
|
501
|
+
assert_equal(true, o.is_nil)
|
502
|
+
|
503
|
+
targets = [
|
504
|
+
"2002-05-18T16:52:20Z",
|
505
|
+
"0001-01-01T00:00:00Z",
|
506
|
+
"9999-12-31T23:59:59Z",
|
507
|
+
"19999-12-31T23:59:59Z",
|
508
|
+
"2002-12-31T23:59:59.999Z",
|
509
|
+
"2002-12-31T23:59:59.001Z",
|
510
|
+
"2002-12-31T23:59:59.99999999999999999999Z",
|
511
|
+
"2002-12-31T23:59:59.00000000000000000001Z",
|
512
|
+
"2002-12-31T23:59:59+09:00",
|
513
|
+
"2002-12-31T23:59:59+00:01",
|
514
|
+
"2002-12-31T23:59:59-00:01",
|
515
|
+
"2002-12-31T23:59:59-23:59",
|
516
|
+
"2002-12-31T23:59:59.00000000000000000001+13:30",
|
517
|
+
"2002-12-31T23:59:59.5137Z",
|
518
|
+
"2002-12-31T23:59:59.51375Z", # 411/800
|
519
|
+
"2002-12-31T23:59:59.51375+12:34",
|
520
|
+
"-2002-05-18T16:52:20Z",
|
521
|
+
"-4713-01-01T12:00:00Z",
|
522
|
+
"-2002-12-31T23:59:59+00:01",
|
523
|
+
"-0001-12-31T23:59:59.00000000000000000001+13:30",
|
524
|
+
]
|
525
|
+
targets.each do |str|
|
526
|
+
assert_parsed_result(XSD::XSDDateTime, str)
|
527
|
+
end
|
528
|
+
|
529
|
+
targets = [
|
530
|
+
["2002-12-31T23:59:59.00",
|
531
|
+
"2002-12-31T23:59:59Z"],
|
532
|
+
["2002-12-31T23:59:59+00:00",
|
533
|
+
"2002-12-31T23:59:59Z"],
|
534
|
+
["2002-12-31T23:59:59-00:00",
|
535
|
+
"2002-12-31T23:59:59Z"],
|
536
|
+
["-2002-12-31T23:59:59.00",
|
537
|
+
"-2002-12-31T23:59:59Z"],
|
538
|
+
["-2002-12-31T23:59:59+00:00",
|
539
|
+
"-2002-12-31T23:59:59Z"],
|
540
|
+
["-2002-12-31T23:59:59-00:00",
|
541
|
+
"-2002-12-31T23:59:59Z"],
|
542
|
+
]
|
543
|
+
targets.each do |data, expected|
|
544
|
+
assert_equal(expected, XSD::XSDDateTime.new(data).to_s)
|
545
|
+
d = DateTime.parse(data)
|
546
|
+
d >>= 12 if d.year < 0 # XSDDateTime.year(-1) == DateTime.year(0)
|
547
|
+
assert_equal(expected, XSD::XSDDateTime.new(d).to_s)
|
548
|
+
end
|
549
|
+
|
550
|
+
targets = [
|
551
|
+
"0000-05-18T16:52:20Z",
|
552
|
+
"05-18T16:52:20Z",
|
553
|
+
"2002-05T16:52:20Z",
|
554
|
+
"2002-05-18T16:52Z",
|
555
|
+
"",
|
556
|
+
]
|
557
|
+
targets.each do |d|
|
558
|
+
assert_raises(XSD::ValueSpaceError, d.to_s) do
|
559
|
+
XSD::XSDDateTime.new(d)
|
560
|
+
end
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
564
|
+
def test_XSDTime
|
565
|
+
o = XSD::XSDTime.new
|
566
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
567
|
+
assert_equal(XSD::TimeLiteral, o.type.name)
|
568
|
+
assert_equal(nil, o.data)
|
569
|
+
assert_equal(true, o.is_nil)
|
570
|
+
|
571
|
+
targets = [
|
572
|
+
"16:52:20Z",
|
573
|
+
"00:00:00Z",
|
574
|
+
"23:59:59Z",
|
575
|
+
"23:59:59.999Z",
|
576
|
+
"23:59:59.001Z",
|
577
|
+
"23:59:59.99999999999999999999Z",
|
578
|
+
"23:59:59.00000000000000000001Z",
|
579
|
+
"23:59:59+09:00",
|
580
|
+
"23:59:59+00:01",
|
581
|
+
"23:59:59-00:01",
|
582
|
+
"23:59:59-23:59",
|
583
|
+
"23:59:59.00000000000000000001+13:30",
|
584
|
+
"23:59:59.51345Z",
|
585
|
+
"23:59:59.51345+12:34",
|
586
|
+
"23:59:59+00:01",
|
587
|
+
]
|
588
|
+
targets.each do |str|
|
589
|
+
assert_parsed_result(XSD::XSDTime, str)
|
590
|
+
end
|
591
|
+
|
592
|
+
targets = [
|
593
|
+
["23:59:59.00",
|
594
|
+
"23:59:59Z"],
|
595
|
+
["23:59:59+00:00",
|
596
|
+
"23:59:59Z"],
|
597
|
+
["23:59:59-00:00",
|
598
|
+
"23:59:59Z"],
|
599
|
+
]
|
600
|
+
targets.each do |data, expected|
|
601
|
+
assert_equal(expected, XSD::XSDTime.new(data).to_s)
|
602
|
+
end
|
603
|
+
end
|
604
|
+
|
605
|
+
def test_XSDDate
|
606
|
+
o = XSD::XSDDate.new
|
607
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
608
|
+
assert_equal(XSD::DateLiteral, o.type.name)
|
609
|
+
assert_equal(nil, o.data)
|
610
|
+
assert_equal(true, o.is_nil)
|
611
|
+
|
612
|
+
targets = [
|
613
|
+
"2002-05-18Z",
|
614
|
+
"0001-01-01Z",
|
615
|
+
"9999-12-31Z",
|
616
|
+
"19999-12-31Z",
|
617
|
+
"2002-12-31+09:00",
|
618
|
+
"2002-12-31+00:01",
|
619
|
+
"2002-12-31-00:01",
|
620
|
+
"2002-12-31-23:59",
|
621
|
+
"2002-12-31+13:30",
|
622
|
+
"-2002-05-18Z",
|
623
|
+
"-19999-12-31Z",
|
624
|
+
"-2002-12-31+00:01",
|
625
|
+
"-0001-12-31+13:30",
|
626
|
+
]
|
627
|
+
targets.each do |str|
|
628
|
+
assert_parsed_result(XSD::XSDDate, str)
|
629
|
+
end
|
630
|
+
|
631
|
+
targets = [
|
632
|
+
["2002-12-31",
|
633
|
+
"2002-12-31Z"],
|
634
|
+
["2002-12-31+00:00",
|
635
|
+
"2002-12-31Z"],
|
636
|
+
["2002-12-31-00:00",
|
637
|
+
"2002-12-31Z"],
|
638
|
+
["-2002-12-31",
|
639
|
+
"-2002-12-31Z"],
|
640
|
+
["-2002-12-31+00:00",
|
641
|
+
"-2002-12-31Z"],
|
642
|
+
["-2002-12-31-00:00",
|
643
|
+
"-2002-12-31Z"],
|
644
|
+
]
|
645
|
+
targets.each do |data, expected|
|
646
|
+
assert_equal(expected, XSD::XSDDate.new(data).to_s)
|
647
|
+
d = Date.parse(data)
|
648
|
+
d >>= 12 if d.year < 0 # XSDDate.year(-1) == Date.year(0)
|
649
|
+
assert_equal(expected, XSD::XSDDate.new(d).to_s)
|
650
|
+
end
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
class TestXSD2 < Test::Unit::TestCase
|
655
|
+
def setup
|
656
|
+
# Nothing to do.
|
657
|
+
end
|
658
|
+
|
659
|
+
def teardown
|
660
|
+
# Nothing to do.
|
661
|
+
end
|
662
|
+
|
663
|
+
def assert_parsed_result(klass, str)
|
664
|
+
o = klass.new(str)
|
665
|
+
assert_equal(str, o.to_s)
|
666
|
+
end
|
667
|
+
|
668
|
+
def test_XSDGYearMonth
|
669
|
+
o = XSD::XSDGYearMonth.new
|
670
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
671
|
+
assert_equal(XSD::GYearMonthLiteral, o.type.name)
|
672
|
+
assert_equal(nil, o.data)
|
673
|
+
assert_equal(true, o.is_nil)
|
674
|
+
|
675
|
+
targets = [
|
676
|
+
"2002-05Z",
|
677
|
+
"0001-01Z",
|
678
|
+
"9999-12Z",
|
679
|
+
"19999-12Z",
|
680
|
+
"2002-12+09:00",
|
681
|
+
"2002-12+00:01",
|
682
|
+
"2002-12-00:01",
|
683
|
+
"2002-12-23:59",
|
684
|
+
"2002-12+13:30",
|
685
|
+
"-2002-05Z",
|
686
|
+
"-19999-12Z",
|
687
|
+
"-2002-12+00:01",
|
688
|
+
"-0001-12+13:30",
|
689
|
+
]
|
690
|
+
targets.each do |str|
|
691
|
+
assert_parsed_result(XSD::XSDGYearMonth, str)
|
692
|
+
end
|
693
|
+
|
694
|
+
targets = [
|
695
|
+
["2002-12",
|
696
|
+
"2002-12Z"],
|
697
|
+
["2002-12+00:00",
|
698
|
+
"2002-12Z"],
|
699
|
+
["2002-12-00:00",
|
700
|
+
"2002-12Z"],
|
701
|
+
["-2002-12",
|
702
|
+
"-2002-12Z"],
|
703
|
+
["-2002-12+00:00",
|
704
|
+
"-2002-12Z"],
|
705
|
+
["-2002-12-00:00",
|
706
|
+
"-2002-12Z"],
|
707
|
+
]
|
708
|
+
targets.each do |data, expected|
|
709
|
+
assert_equal(expected, XSD::XSDGYearMonth.new(data).to_s)
|
710
|
+
end
|
711
|
+
end
|
712
|
+
|
713
|
+
def test_XSDGYear
|
714
|
+
o = XSD::XSDGYear.new
|
715
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
716
|
+
assert_equal(XSD::GYearLiteral, o.type.name)
|
717
|
+
assert_equal(nil, o.data)
|
718
|
+
assert_equal(true, o.is_nil)
|
719
|
+
|
720
|
+
targets = [
|
721
|
+
"2002Z",
|
722
|
+
"0001Z",
|
723
|
+
"9999Z",
|
724
|
+
"19999Z",
|
725
|
+
"2002+09:00",
|
726
|
+
"2002+00:01",
|
727
|
+
"2002-00:01",
|
728
|
+
"2002-23:59",
|
729
|
+
"2002+13:30",
|
730
|
+
"-2002Z",
|
731
|
+
"-19999Z",
|
732
|
+
"-2002+00:01",
|
733
|
+
"-0001+13:30",
|
734
|
+
]
|
735
|
+
targets.each do |str|
|
736
|
+
assert_parsed_result(XSD::XSDGYear, str)
|
737
|
+
end
|
738
|
+
|
739
|
+
targets = [
|
740
|
+
["2002",
|
741
|
+
"2002Z"],
|
742
|
+
["2002+00:00",
|
743
|
+
"2002Z"],
|
744
|
+
["2002-00:00",
|
745
|
+
"2002Z"],
|
746
|
+
["-2002",
|
747
|
+
"-2002Z"],
|
748
|
+
["-2002+00:00",
|
749
|
+
"-2002Z"],
|
750
|
+
["-2002-00:00",
|
751
|
+
"-2002Z"],
|
752
|
+
]
|
753
|
+
targets.each do |data, expected|
|
754
|
+
assert_equal(expected, XSD::XSDGYear.new(data).to_s)
|
755
|
+
end
|
756
|
+
end
|
757
|
+
|
758
|
+
def test_XSDGMonthDay
|
759
|
+
o = XSD::XSDGMonthDay.new
|
760
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
761
|
+
assert_equal(XSD::GMonthDayLiteral, o.type.name)
|
762
|
+
assert_equal(nil, o.data)
|
763
|
+
assert_equal(true, o.is_nil)
|
764
|
+
|
765
|
+
targets = [
|
766
|
+
"--05-18Z",
|
767
|
+
"--01-01Z",
|
768
|
+
"--12-31Z",
|
769
|
+
"--12-31+09:00",
|
770
|
+
"--12-31+00:01",
|
771
|
+
"--12-31-00:01",
|
772
|
+
"--12-31-23:59",
|
773
|
+
"--12-31+13:30",
|
774
|
+
]
|
775
|
+
targets.each do |str|
|
776
|
+
assert_parsed_result(XSD::XSDGMonthDay, str)
|
777
|
+
end
|
778
|
+
|
779
|
+
targets = [
|
780
|
+
["--12-31",
|
781
|
+
"--12-31Z"],
|
782
|
+
["--12-31+00:00",
|
783
|
+
"--12-31Z"],
|
784
|
+
["--12-31-00:00",
|
785
|
+
"--12-31Z"],
|
786
|
+
]
|
787
|
+
targets.each do |data, expected|
|
788
|
+
assert_equal(expected, XSD::XSDGMonthDay.new(data).to_s)
|
789
|
+
end
|
790
|
+
end
|
791
|
+
|
792
|
+
def test_XSDGDay
|
793
|
+
o = XSD::XSDGDay.new
|
794
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
795
|
+
assert_equal(XSD::GDayLiteral, o.type.name)
|
796
|
+
assert_equal(nil, o.data)
|
797
|
+
assert_equal(true, o.is_nil)
|
798
|
+
|
799
|
+
targets = [
|
800
|
+
"---18Z",
|
801
|
+
"---01Z",
|
802
|
+
"---31Z",
|
803
|
+
"---31+09:00",
|
804
|
+
"---31+00:01",
|
805
|
+
"---31-00:01",
|
806
|
+
"---31-23:59",
|
807
|
+
"---31+13:30",
|
808
|
+
]
|
809
|
+
targets.each do |str|
|
810
|
+
assert_parsed_result(XSD::XSDGDay, str)
|
811
|
+
end
|
812
|
+
|
813
|
+
targets = [
|
814
|
+
["---31",
|
815
|
+
"---31Z"],
|
816
|
+
["---31+00:00",
|
817
|
+
"---31Z"],
|
818
|
+
["---31-00:00",
|
819
|
+
"---31Z"],
|
820
|
+
]
|
821
|
+
targets.each do |data, expected|
|
822
|
+
assert_equal(expected, XSD::XSDGDay.new(data).to_s)
|
823
|
+
end
|
824
|
+
end
|
825
|
+
|
826
|
+
def test_XSDGMonth
|
827
|
+
o = XSD::XSDGMonth.new
|
828
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
829
|
+
assert_equal(XSD::GMonthLiteral, o.type.name)
|
830
|
+
assert_equal(nil, o.data)
|
831
|
+
assert_equal(true, o.is_nil)
|
832
|
+
|
833
|
+
targets = [
|
834
|
+
"--05Z",
|
835
|
+
"--01Z",
|
836
|
+
"--12Z",
|
837
|
+
"--12+09:00",
|
838
|
+
"--12+00:01",
|
839
|
+
"--12-00:01",
|
840
|
+
"--12-23:59",
|
841
|
+
"--12+13:30",
|
842
|
+
]
|
843
|
+
targets.each do |str|
|
844
|
+
assert_parsed_result(XSD::XSDGMonth, str)
|
845
|
+
end
|
846
|
+
|
847
|
+
targets = [
|
848
|
+
["--12",
|
849
|
+
"--12Z"],
|
850
|
+
["--12+00:00",
|
851
|
+
"--12Z"],
|
852
|
+
["--12-00:00",
|
853
|
+
"--12Z"],
|
854
|
+
]
|
855
|
+
targets.each do |data, expected|
|
856
|
+
assert_equal(expected, XSD::XSDGMonth.new(data).to_s)
|
857
|
+
end
|
858
|
+
end
|
859
|
+
|
860
|
+
def test_XSDHexBinary
|
861
|
+
o = XSD::XSDHexBinary.new
|
862
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
863
|
+
assert_equal(XSD::HexBinaryLiteral, o.type.name)
|
864
|
+
assert_equal(nil, o.data)
|
865
|
+
assert_equal(true, o.is_nil)
|
866
|
+
|
867
|
+
targets = [
|
868
|
+
"abcdef",
|
869
|
+
"\xe3\x81\xaa\xe3\x81\xb2",
|
870
|
+
%Q(\0),
|
871
|
+
"",
|
872
|
+
]
|
873
|
+
targets.each do |str|
|
874
|
+
assert_equal(str, XSD::XSDHexBinary.new(str).string)
|
875
|
+
assert_equal(str.unpack("H*")[0 ].tr('a-f', 'A-F'),
|
876
|
+
XSD::XSDHexBinary.new(str).data)
|
877
|
+
o = XSD::XSDHexBinary.new
|
878
|
+
o.set_encoded(str.unpack("H*")[0 ].tr('a-f', 'A-F'))
|
879
|
+
assert_equal(str, o.string)
|
880
|
+
o.set_encoded(str.unpack("H*")[0 ].tr('A-F', 'a-f'))
|
881
|
+
assert_equal(str, o.string)
|
882
|
+
end
|
883
|
+
|
884
|
+
targets = [
|
885
|
+
"0FG7",
|
886
|
+
"0fg7",
|
887
|
+
]
|
888
|
+
targets.each do |d|
|
889
|
+
assert_raises(XSD::ValueSpaceError, d.to_s) do
|
890
|
+
o = XSD::XSDHexBinary.new
|
891
|
+
o.set_encoded(d)
|
892
|
+
p o.string
|
893
|
+
end
|
894
|
+
end
|
895
|
+
end
|
896
|
+
|
897
|
+
def test_XSDBase64Binary
|
898
|
+
o = XSD::XSDBase64Binary.new
|
899
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
900
|
+
assert_equal(XSD::Base64BinaryLiteral, o.type.name)
|
901
|
+
assert_equal(nil, o.data)
|
902
|
+
assert_equal(true, o.is_nil)
|
903
|
+
|
904
|
+
targets = [
|
905
|
+
"abcdef",
|
906
|
+
"\xe3\x81\xaa\xe3\x81\xb2",
|
907
|
+
%Q(\0),
|
908
|
+
"",
|
909
|
+
]
|
910
|
+
targets.each do |str|
|
911
|
+
assert_equal(str, XSD::XSDBase64Binary.new(str).string)
|
912
|
+
assert_equal([str ].pack("m").chomp, XSD::XSDBase64Binary.new(str).data)
|
913
|
+
o = XSD::XSDBase64Binary.new
|
914
|
+
o.set_encoded([str ].pack("m").chomp)
|
915
|
+
assert_equal(str, o.string)
|
916
|
+
end
|
917
|
+
|
918
|
+
targets = [
|
919
|
+
"-",
|
920
|
+
"*",
|
921
|
+
]
|
922
|
+
targets.each do |d|
|
923
|
+
assert_raises(XSD::ValueSpaceError, d.to_s) do
|
924
|
+
o = XSD::XSDBase64Binary.new
|
925
|
+
o.set_encoded(d)
|
926
|
+
p o.string
|
927
|
+
end
|
928
|
+
end
|
929
|
+
end
|
930
|
+
|
931
|
+
def test_XSDAnyURI
|
932
|
+
o = XSD::XSDAnyURI.new
|
933
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
934
|
+
assert_equal(XSD::AnyURILiteral, o.type.name)
|
935
|
+
assert_equal(nil, o.data)
|
936
|
+
assert_equal(true, o.is_nil)
|
937
|
+
|
938
|
+
# Too few tests here I know. Believe uri module. :)
|
939
|
+
targets = [
|
940
|
+
"foo",
|
941
|
+
"http://foo",
|
942
|
+
"http://foo/bar/baz",
|
943
|
+
"http://foo/bar#baz",
|
944
|
+
"http://foo/bar%20%20?a+b",
|
945
|
+
"HTTP://FOO/BAR%20%20?A+B",
|
946
|
+
]
|
947
|
+
targets.each do |str|
|
948
|
+
assert_parsed_result(XSD::XSDAnyURI, str)
|
949
|
+
end
|
950
|
+
end
|
951
|
+
|
952
|
+
def test_XSDQName
|
953
|
+
o = XSD::XSDQName.new
|
954
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
955
|
+
assert_equal(XSD::QNameLiteral, o.type.name)
|
956
|
+
assert_equal(nil, o.data)
|
957
|
+
assert_equal(true, o.is_nil)
|
958
|
+
|
959
|
+
# More strict test is needed but current implementation allows all non-':'
|
960
|
+
# chars like ' ', C0 or C1...
|
961
|
+
targets = [
|
962
|
+
"foo",
|
963
|
+
"foo:bar",
|
964
|
+
"a:b",
|
965
|
+
]
|
966
|
+
targets.each do |str|
|
967
|
+
assert_parsed_result(XSD::XSDQName, str)
|
968
|
+
end
|
969
|
+
end
|
970
|
+
|
971
|
+
|
972
|
+
###
|
973
|
+
## Derived types
|
974
|
+
#
|
975
|
+
|
976
|
+
def test_XSDInteger
|
977
|
+
o = XSD::XSDInteger.new
|
978
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
979
|
+
assert_equal(XSD::IntegerLiteral, o.type.name)
|
980
|
+
assert_equal(nil, o.data)
|
981
|
+
assert_equal(true, o.is_nil)
|
982
|
+
|
983
|
+
targets = [
|
984
|
+
0,
|
985
|
+
1000000000,
|
986
|
+
-9999999999,
|
987
|
+
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
|
988
|
+
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
|
989
|
+
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
|
990
|
+
]
|
991
|
+
targets.each do |int|
|
992
|
+
assert_equal(int, XSD::XSDInteger.new(int).data)
|
993
|
+
end
|
994
|
+
|
995
|
+
targets = [
|
996
|
+
"0",
|
997
|
+
"1000000000",
|
998
|
+
"-9999999999",
|
999
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1000
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1001
|
+
"-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
|
1002
|
+
]
|
1003
|
+
targets.each do |str|
|
1004
|
+
assert_equal(str, XSD::XSDInteger.new(str).to_s)
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
targets = [
|
1008
|
+
["-0", "0"],
|
1009
|
+
["+0", "0"],
|
1010
|
+
["000123", "123"],
|
1011
|
+
["-000123", "-123"],
|
1012
|
+
[
|
1013
|
+
"+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1014
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
1015
|
+
],
|
1016
|
+
]
|
1017
|
+
targets.each do |data, expected|
|
1018
|
+
assert_equal(expected, XSD::XSDInteger.new(data).to_s)
|
1019
|
+
end
|
1020
|
+
|
1021
|
+
targets = [
|
1022
|
+
"0.0",
|
1023
|
+
"-5.2",
|
1024
|
+
"0.000000000000a",
|
1025
|
+
"+-5",
|
1026
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
|
1027
|
+
]
|
1028
|
+
targets.each do |d|
|
1029
|
+
assert_raises(XSD::ValueSpaceError) do
|
1030
|
+
XSD::XSDInteger.new(d)
|
1031
|
+
end
|
1032
|
+
end
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
def test_XSDNonPositiveInteger
|
1036
|
+
o = XSD::XSDNonPositiveInteger.new
|
1037
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1038
|
+
assert_equal(XSD::NonPositiveIntegerLiteral, o.type.name)
|
1039
|
+
assert_equal(nil, o.data)
|
1040
|
+
assert_equal(true, o.is_nil)
|
1041
|
+
|
1042
|
+
targets = [
|
1043
|
+
0,
|
1044
|
+
-9999999999,
|
1045
|
+
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
|
1046
|
+
]
|
1047
|
+
targets.each do |int|
|
1048
|
+
assert_equal(int, XSD::XSDNonPositiveInteger.new(int).data)
|
1049
|
+
end
|
1050
|
+
|
1051
|
+
targets = [
|
1052
|
+
"0",
|
1053
|
+
"-9999999999",
|
1054
|
+
"-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
|
1055
|
+
]
|
1056
|
+
targets.each do |str|
|
1057
|
+
assert_equal(str, XSD::XSDNonPositiveInteger.new(str).to_s)
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
targets = [
|
1061
|
+
["-0", "0"],
|
1062
|
+
["-000123", "-123"],
|
1063
|
+
]
|
1064
|
+
targets.each do |data, expected|
|
1065
|
+
assert_equal(expected, XSD::XSDNonPositiveInteger.new(data).to_s)
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
targets = [
|
1069
|
+
"0.0",
|
1070
|
+
"-5.2",
|
1071
|
+
"0.000000000000a",
|
1072
|
+
"+-5",
|
1073
|
+
"-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
|
1074
|
+
]
|
1075
|
+
targets.each do |d|
|
1076
|
+
assert_raises(XSD::ValueSpaceError) do
|
1077
|
+
XSD::XSDNonPositiveInteger.new(d)
|
1078
|
+
end
|
1079
|
+
end
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
def test_XSDNegativeInteger
|
1083
|
+
o = XSD::XSDNegativeInteger.new
|
1084
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1085
|
+
assert_equal(XSD::NegativeIntegerLiteral, o.type.name)
|
1086
|
+
assert_equal(nil, o.data)
|
1087
|
+
assert_equal(true, o.is_nil)
|
1088
|
+
|
1089
|
+
targets = [
|
1090
|
+
-1,
|
1091
|
+
-9999999999,
|
1092
|
+
-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
|
1093
|
+
]
|
1094
|
+
targets.each do |int|
|
1095
|
+
assert_equal(int, XSD::XSDNegativeInteger.new(int).data)
|
1096
|
+
end
|
1097
|
+
|
1098
|
+
targets = [
|
1099
|
+
"-1",
|
1100
|
+
"-9999999999",
|
1101
|
+
"-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
|
1102
|
+
]
|
1103
|
+
targets.each do |str|
|
1104
|
+
assert_equal(str, XSD::XSDNegativeInteger.new(str).to_s)
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
targets = [
|
1108
|
+
["-000123", "-123"],
|
1109
|
+
]
|
1110
|
+
targets.each do |data, expected|
|
1111
|
+
assert_equal(expected, XSD::XSDNegativeInteger.new(data).to_s)
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
targets = [
|
1115
|
+
"-0.0",
|
1116
|
+
"-5.2",
|
1117
|
+
"-0.000000000000a",
|
1118
|
+
"+-5",
|
1119
|
+
"-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
|
1120
|
+
]
|
1121
|
+
targets.each do |d|
|
1122
|
+
assert_raises(XSD::ValueSpaceError) do
|
1123
|
+
XSD::XSDNegativeInteger.new(d)
|
1124
|
+
end
|
1125
|
+
end
|
1126
|
+
end
|
1127
|
+
|
1128
|
+
def test_XSDLong
|
1129
|
+
o = XSD::XSDLong.new
|
1130
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1131
|
+
assert_equal(XSD::LongLiteral, o.type.name)
|
1132
|
+
assert_equal(nil, o.data)
|
1133
|
+
assert_equal(true, o.is_nil)
|
1134
|
+
|
1135
|
+
targets = [
|
1136
|
+
0,
|
1137
|
+
123,
|
1138
|
+
-123,
|
1139
|
+
9223372036854775807,
|
1140
|
+
-9223372036854775808,
|
1141
|
+
]
|
1142
|
+
targets.each do |lng|
|
1143
|
+
assert_equal(lng, XSD::XSDLong.new(lng).data)
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
targets = [
|
1147
|
+
"0",
|
1148
|
+
"123",
|
1149
|
+
"-123",
|
1150
|
+
"9223372036854775807",
|
1151
|
+
"-9223372036854775808",
|
1152
|
+
]
|
1153
|
+
targets.each do |str|
|
1154
|
+
assert_equal(str, XSD::XSDLong.new(str).to_s)
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
targets = [
|
1158
|
+
["-0", "0"],
|
1159
|
+
["+0", "0"],
|
1160
|
+
["000123", "123"],
|
1161
|
+
["-000123", "-123"],
|
1162
|
+
]
|
1163
|
+
targets.each do |data, expected|
|
1164
|
+
assert_equal(expected, XSD::XSDLong.new(data).to_s)
|
1165
|
+
end
|
1166
|
+
|
1167
|
+
targets = [
|
1168
|
+
9223372036854775808,
|
1169
|
+
-9223372036854775809,
|
1170
|
+
"0.0",
|
1171
|
+
"-5.2",
|
1172
|
+
"0.000000000000a",
|
1173
|
+
"+-5",
|
1174
|
+
]
|
1175
|
+
targets.each do |d|
|
1176
|
+
assert_raises(XSD::ValueSpaceError) do
|
1177
|
+
XSD::XSDLong.new(d)
|
1178
|
+
end
|
1179
|
+
end
|
1180
|
+
end
|
1181
|
+
|
1182
|
+
def test_XSDInt
|
1183
|
+
o = XSD::XSDInt.new
|
1184
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1185
|
+
assert_equal(XSD::IntLiteral, o.type.name)
|
1186
|
+
assert_equal(nil, o.data)
|
1187
|
+
assert_equal(true, o.is_nil)
|
1188
|
+
|
1189
|
+
targets = [
|
1190
|
+
0,
|
1191
|
+
123,
|
1192
|
+
-123,
|
1193
|
+
2147483647,
|
1194
|
+
-2147483648,
|
1195
|
+
]
|
1196
|
+
targets.each do |lng|
|
1197
|
+
assert_equal(lng, XSD::XSDInt.new(lng).data)
|
1198
|
+
end
|
1199
|
+
|
1200
|
+
targets = [
|
1201
|
+
"0",
|
1202
|
+
"123",
|
1203
|
+
"-123",
|
1204
|
+
"2147483647",
|
1205
|
+
"-2147483648",
|
1206
|
+
]
|
1207
|
+
targets.each do |str|
|
1208
|
+
assert_equal(str, XSD::XSDInt.new(str).to_s)
|
1209
|
+
end
|
1210
|
+
|
1211
|
+
targets = [
|
1212
|
+
["-0", "0"],
|
1213
|
+
["+0", "0"],
|
1214
|
+
["000123", "123"],
|
1215
|
+
["-000123", "-123"],
|
1216
|
+
]
|
1217
|
+
targets.each do |data, expected|
|
1218
|
+
assert_equal(expected, XSD::XSDInt.new(data).to_s)
|
1219
|
+
end
|
1220
|
+
|
1221
|
+
targets = [
|
1222
|
+
2147483648,
|
1223
|
+
-2147483649,
|
1224
|
+
"0.0",
|
1225
|
+
"-5.2",
|
1226
|
+
"0.000000000000a",
|
1227
|
+
"+-5",
|
1228
|
+
]
|
1229
|
+
targets.each do |d|
|
1230
|
+
assert_raises(XSD::ValueSpaceError) do
|
1231
|
+
XSD::XSDInt.new(d)
|
1232
|
+
end
|
1233
|
+
end
|
1234
|
+
end
|
1235
|
+
|
1236
|
+
def test_XSDShort
|
1237
|
+
o = XSD::XSDShort.new
|
1238
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1239
|
+
assert_equal(XSD::ShortLiteral, o.type.name)
|
1240
|
+
assert_equal(nil, o.data)
|
1241
|
+
assert_equal(true, o.is_nil)
|
1242
|
+
|
1243
|
+
targets = [
|
1244
|
+
0,
|
1245
|
+
123,
|
1246
|
+
-123,
|
1247
|
+
32767,
|
1248
|
+
-32768,
|
1249
|
+
]
|
1250
|
+
targets.each do |lng|
|
1251
|
+
assert_equal(lng, XSD::XSDShort.new(lng).data)
|
1252
|
+
end
|
1253
|
+
|
1254
|
+
targets = [
|
1255
|
+
"0",
|
1256
|
+
"123",
|
1257
|
+
"-123",
|
1258
|
+
"32767",
|
1259
|
+
"-32768",
|
1260
|
+
]
|
1261
|
+
targets.each do |str|
|
1262
|
+
assert_equal(str, XSD::XSDShort.new(str).to_s)
|
1263
|
+
end
|
1264
|
+
|
1265
|
+
targets = [
|
1266
|
+
["-0", "0"],
|
1267
|
+
["+0", "0"],
|
1268
|
+
["000123", "123"],
|
1269
|
+
["-000123", "-123"],
|
1270
|
+
]
|
1271
|
+
targets.each do |data, expected|
|
1272
|
+
assert_equal(expected, XSD::XSDShort.new(data).to_s)
|
1273
|
+
end
|
1274
|
+
|
1275
|
+
targets = [
|
1276
|
+
32768,
|
1277
|
+
-32769,
|
1278
|
+
"0.0",
|
1279
|
+
"-5.2",
|
1280
|
+
"0.000000000000a",
|
1281
|
+
"+-5",
|
1282
|
+
]
|
1283
|
+
targets.each do |d|
|
1284
|
+
assert_raises(XSD::ValueSpaceError) do
|
1285
|
+
XSD::XSDShort.new(d)
|
1286
|
+
end
|
1287
|
+
end
|
1288
|
+
end
|
1289
|
+
|
1290
|
+
def test_XSDByte
|
1291
|
+
o = XSD::XSDByte.new
|
1292
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1293
|
+
assert_equal(XSD::ByteLiteral, o.type.name)
|
1294
|
+
assert_equal(nil, o.data)
|
1295
|
+
assert_equal(true, o.is_nil)
|
1296
|
+
|
1297
|
+
targets = [
|
1298
|
+
0,
|
1299
|
+
123,
|
1300
|
+
-123,
|
1301
|
+
127,
|
1302
|
+
-128,
|
1303
|
+
]
|
1304
|
+
targets.each do |lng|
|
1305
|
+
assert_equal(lng, XSD::XSDByte.new(lng).data)
|
1306
|
+
end
|
1307
|
+
|
1308
|
+
targets = [
|
1309
|
+
"0",
|
1310
|
+
"123",
|
1311
|
+
"-123",
|
1312
|
+
"127",
|
1313
|
+
"-128",
|
1314
|
+
]
|
1315
|
+
targets.each do |str|
|
1316
|
+
assert_equal(str, XSD::XSDByte.new(str).to_s)
|
1317
|
+
end
|
1318
|
+
|
1319
|
+
targets = [
|
1320
|
+
["-0", "0"],
|
1321
|
+
["+0", "0"],
|
1322
|
+
["000123", "123"],
|
1323
|
+
["-000123", "-123"],
|
1324
|
+
]
|
1325
|
+
targets.each do |data, expected|
|
1326
|
+
assert_equal(expected, XSD::XSDByte.new(data).to_s)
|
1327
|
+
end
|
1328
|
+
|
1329
|
+
targets = [
|
1330
|
+
128,
|
1331
|
+
-129,
|
1332
|
+
"0.0",
|
1333
|
+
"-5.2",
|
1334
|
+
"0.000000000000a",
|
1335
|
+
"+-5",
|
1336
|
+
]
|
1337
|
+
targets.each do |d|
|
1338
|
+
assert_raises(XSD::ValueSpaceError) do
|
1339
|
+
XSD::XSDByte.new(d)
|
1340
|
+
end
|
1341
|
+
end
|
1342
|
+
end
|
1343
|
+
|
1344
|
+
def test_XSDNonNegativeInteger
|
1345
|
+
o = XSD::XSDNonNegativeInteger.new
|
1346
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1347
|
+
assert_equal(XSD::NonNegativeIntegerLiteral, o.type.name)
|
1348
|
+
assert_equal(nil, o.data)
|
1349
|
+
assert_equal(true, o.is_nil)
|
1350
|
+
|
1351
|
+
targets = [
|
1352
|
+
0,
|
1353
|
+
1000000000,
|
1354
|
+
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
|
1355
|
+
]
|
1356
|
+
targets.each do |int|
|
1357
|
+
assert_equal(int, XSD::XSDNonNegativeInteger.new(int).data)
|
1358
|
+
end
|
1359
|
+
|
1360
|
+
targets = [
|
1361
|
+
"0",
|
1362
|
+
"1000000000",
|
1363
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1364
|
+
]
|
1365
|
+
targets.each do |str|
|
1366
|
+
assert_equal(str, XSD::XSDNonNegativeInteger.new(str).to_s)
|
1367
|
+
end
|
1368
|
+
|
1369
|
+
targets = [
|
1370
|
+
["-0", "0"],
|
1371
|
+
["+0", "0"],
|
1372
|
+
["000123", "123"],
|
1373
|
+
[
|
1374
|
+
"+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1375
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
1376
|
+
],
|
1377
|
+
]
|
1378
|
+
targets.each do |data, expected|
|
1379
|
+
assert_equal(expected, XSD::XSDNonNegativeInteger.new(data).to_s)
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
targets = [
|
1383
|
+
"0.0",
|
1384
|
+
"0.000000000000a",
|
1385
|
+
"+-5",
|
1386
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
|
1387
|
+
]
|
1388
|
+
targets.each do |d|
|
1389
|
+
assert_raises(XSD::ValueSpaceError) do
|
1390
|
+
XSD::XSDNonNegativeInteger.new(d)
|
1391
|
+
end
|
1392
|
+
end
|
1393
|
+
end
|
1394
|
+
|
1395
|
+
def test_XSDUnsignedLong
|
1396
|
+
o = XSD::XSDUnsignedLong.new
|
1397
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1398
|
+
assert_equal(XSD::UnsignedLongLiteral, o.type.name)
|
1399
|
+
assert_equal(nil, o.data)
|
1400
|
+
assert_equal(true, o.is_nil)
|
1401
|
+
|
1402
|
+
targets = [
|
1403
|
+
0,
|
1404
|
+
1000000000,
|
1405
|
+
18446744073709551615,
|
1406
|
+
]
|
1407
|
+
targets.each do |int|
|
1408
|
+
assert_equal(int, XSD::XSDUnsignedLong.new(int).data)
|
1409
|
+
end
|
1410
|
+
|
1411
|
+
targets = [
|
1412
|
+
"0",
|
1413
|
+
"1000000000",
|
1414
|
+
"18446744073709551615",
|
1415
|
+
]
|
1416
|
+
targets.each do |str|
|
1417
|
+
assert_equal(str, XSD::XSDUnsignedLong.new(str).to_s)
|
1418
|
+
end
|
1419
|
+
|
1420
|
+
targets = [
|
1421
|
+
["-0", "0"],
|
1422
|
+
["+0", "0"],
|
1423
|
+
["000123", "123"],
|
1424
|
+
["+18446744073709551615", "18446744073709551615"],
|
1425
|
+
]
|
1426
|
+
targets.each do |data, expected|
|
1427
|
+
assert_equal(expected, XSD::XSDUnsignedLong.new(data).to_s)
|
1428
|
+
end
|
1429
|
+
|
1430
|
+
targets = [
|
1431
|
+
"0.0",
|
1432
|
+
"0.000000000000a",
|
1433
|
+
"+-5",
|
1434
|
+
"18446744073709551615."
|
1435
|
+
]
|
1436
|
+
targets.each do |d|
|
1437
|
+
assert_raises(XSD::ValueSpaceError) do
|
1438
|
+
XSD::XSDUnsignedLong.new(d)
|
1439
|
+
end
|
1440
|
+
end
|
1441
|
+
end
|
1442
|
+
|
1443
|
+
def test_XSDUnsignedInt
|
1444
|
+
o = XSD::XSDUnsignedInt.new
|
1445
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1446
|
+
assert_equal(XSD::UnsignedIntLiteral, o.type.name)
|
1447
|
+
assert_equal(nil, o.data)
|
1448
|
+
assert_equal(true, o.is_nil)
|
1449
|
+
|
1450
|
+
targets = [
|
1451
|
+
0,
|
1452
|
+
1000000000,
|
1453
|
+
4294967295,
|
1454
|
+
]
|
1455
|
+
targets.each do |int|
|
1456
|
+
assert_equal(int, XSD::XSDUnsignedInt.new(int).data)
|
1457
|
+
end
|
1458
|
+
|
1459
|
+
targets = [
|
1460
|
+
"0",
|
1461
|
+
"1000000000",
|
1462
|
+
"4294967295",
|
1463
|
+
]
|
1464
|
+
targets.each do |str|
|
1465
|
+
assert_equal(str, XSD::XSDUnsignedInt.new(str).to_s)
|
1466
|
+
end
|
1467
|
+
|
1468
|
+
targets = [
|
1469
|
+
["-0", "0"],
|
1470
|
+
["+0", "0"],
|
1471
|
+
["000123", "123"],
|
1472
|
+
["+4294967295", "4294967295"],
|
1473
|
+
]
|
1474
|
+
targets.each do |data, expected|
|
1475
|
+
assert_equal(expected, XSD::XSDUnsignedInt.new(data).to_s)
|
1476
|
+
end
|
1477
|
+
|
1478
|
+
targets = [
|
1479
|
+
"0.0",
|
1480
|
+
"0.000000000000a",
|
1481
|
+
"+-5",
|
1482
|
+
"4294967295."
|
1483
|
+
]
|
1484
|
+
targets.each do |d|
|
1485
|
+
assert_raises(XSD::ValueSpaceError) do
|
1486
|
+
XSD::XSDUnsignedInt.new(d)
|
1487
|
+
end
|
1488
|
+
end
|
1489
|
+
end
|
1490
|
+
|
1491
|
+
def test_XSDUnsignedShort
|
1492
|
+
o = XSD::XSDUnsignedShort.new
|
1493
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1494
|
+
assert_equal(XSD::UnsignedShortLiteral, o.type.name)
|
1495
|
+
assert_equal(nil, o.data)
|
1496
|
+
assert_equal(true, o.is_nil)
|
1497
|
+
|
1498
|
+
targets = [
|
1499
|
+
0,
|
1500
|
+
10000,
|
1501
|
+
65535,
|
1502
|
+
]
|
1503
|
+
targets.each do |int|
|
1504
|
+
assert_equal(int, XSD::XSDUnsignedShort.new(int).data)
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
targets = [
|
1508
|
+
"0",
|
1509
|
+
"1000",
|
1510
|
+
"65535",
|
1511
|
+
]
|
1512
|
+
targets.each do |str|
|
1513
|
+
assert_equal(str, XSD::XSDUnsignedShort.new(str).to_s)
|
1514
|
+
end
|
1515
|
+
|
1516
|
+
targets = [
|
1517
|
+
["-0", "0"],
|
1518
|
+
["+0", "0"],
|
1519
|
+
["000123", "123"],
|
1520
|
+
["+65535", "65535"],
|
1521
|
+
]
|
1522
|
+
targets.each do |data, expected|
|
1523
|
+
assert_equal(expected, XSD::XSDUnsignedShort.new(data).to_s)
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
targets = [
|
1527
|
+
"0.0",
|
1528
|
+
"0.000000000000a",
|
1529
|
+
"+-5",
|
1530
|
+
"65535."
|
1531
|
+
]
|
1532
|
+
targets.each do |d|
|
1533
|
+
assert_raises(XSD::ValueSpaceError) do
|
1534
|
+
XSD::XSDUnsignedShort.new(d)
|
1535
|
+
end
|
1536
|
+
end
|
1537
|
+
end
|
1538
|
+
|
1539
|
+
def test_XSDUnsignedByte
|
1540
|
+
o = XSD::XSDUnsignedByte.new
|
1541
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1542
|
+
assert_equal(XSD::UnsignedByteLiteral, o.type.name)
|
1543
|
+
assert_equal(nil, o.data)
|
1544
|
+
assert_equal(true, o.is_nil)
|
1545
|
+
|
1546
|
+
targets = [
|
1547
|
+
0,
|
1548
|
+
10,
|
1549
|
+
255,
|
1550
|
+
]
|
1551
|
+
targets.each do |int|
|
1552
|
+
assert_equal(int, XSD::XSDUnsignedByte.new(int).data)
|
1553
|
+
end
|
1554
|
+
|
1555
|
+
targets = [
|
1556
|
+
"0",
|
1557
|
+
"10",
|
1558
|
+
"255",
|
1559
|
+
]
|
1560
|
+
targets.each do |str|
|
1561
|
+
assert_equal(str, XSD::XSDUnsignedByte.new(str).to_s)
|
1562
|
+
end
|
1563
|
+
|
1564
|
+
targets = [
|
1565
|
+
["-0", "0"],
|
1566
|
+
["+0", "0"],
|
1567
|
+
["000123", "123"],
|
1568
|
+
["+255", "255"],
|
1569
|
+
]
|
1570
|
+
targets.each do |data, expected|
|
1571
|
+
assert_equal(expected, XSD::XSDUnsignedByte.new(data).to_s)
|
1572
|
+
end
|
1573
|
+
|
1574
|
+
targets = [
|
1575
|
+
"0.0",
|
1576
|
+
"0.000000000000a",
|
1577
|
+
"+-5",
|
1578
|
+
"255."
|
1579
|
+
]
|
1580
|
+
targets.each do |d|
|
1581
|
+
assert_raises(XSD::ValueSpaceError) do
|
1582
|
+
XSD::XSDUnsignedByte.new(d)
|
1583
|
+
end
|
1584
|
+
end
|
1585
|
+
end
|
1586
|
+
|
1587
|
+
def test_XSDPositiveInteger
|
1588
|
+
o = XSD::XSDPositiveInteger.new
|
1589
|
+
assert_equal(XSD::Namespace, o.type.namespace)
|
1590
|
+
assert_equal(XSD::PositiveIntegerLiteral, o.type.name)
|
1591
|
+
assert_equal(nil, o.data)
|
1592
|
+
assert_equal(true, o.is_nil)
|
1593
|
+
|
1594
|
+
targets = [
|
1595
|
+
1,
|
1596
|
+
1000000000,
|
1597
|
+
12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
|
1598
|
+
]
|
1599
|
+
targets.each do |int|
|
1600
|
+
assert_equal(int, XSD::XSDPositiveInteger.new(int).data)
|
1601
|
+
end
|
1602
|
+
|
1603
|
+
targets = [
|
1604
|
+
"1",
|
1605
|
+
"1000000000",
|
1606
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1607
|
+
]
|
1608
|
+
targets.each do |str|
|
1609
|
+
assert_equal(str, XSD::XSDPositiveInteger.new(str).to_s)
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
targets = [
|
1613
|
+
["+1", "1"],
|
1614
|
+
["000123", "123"],
|
1615
|
+
[
|
1616
|
+
"+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
|
1617
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
|
1618
|
+
],
|
1619
|
+
]
|
1620
|
+
targets.each do |data, expected|
|
1621
|
+
assert_equal(expected, XSD::XSDPositiveInteger.new(data).to_s)
|
1622
|
+
end
|
1623
|
+
|
1624
|
+
targets = [
|
1625
|
+
"1.0",
|
1626
|
+
"1.000000000000a",
|
1627
|
+
"+-5",
|
1628
|
+
"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
|
1629
|
+
]
|
1630
|
+
targets.each do |d|
|
1631
|
+
assert_raises(XSD::ValueSpaceError) do
|
1632
|
+
XSD::XSDPositiveInteger.new(d)
|
1633
|
+
end
|
1634
|
+
end
|
1635
|
+
end
|
1636
|
+
end
|
1637
|
+
|
1638
|
+
|
1639
|
+
end
|