mumboe-soap4r 1.5.8.2

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