soap4r 1.5.5.20061022

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