From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/test/-ext-/array/test_resize.rb | 29 + jni/ruby/test/-ext-/bignum/test_big2str.rb | 29 + jni/ruby/test/-ext-/bignum/test_bigzero.rb | 13 + jni/ruby/test/-ext-/bignum/test_div.rb | 28 + jni/ruby/test/-ext-/bignum/test_mul.rb | 137 + jni/ruby/test/-ext-/bignum/test_pack.rb | 398 + jni/ruby/test/-ext-/bignum/test_str2big.rb | 37 + .../test/-ext-/bug_reporter/test_bug_reporter.rb | 25 + jni/ruby/test/-ext-/class/test_class2name.rb | 18 + jni/ruby/test/-ext-/debug/test_debug.rb | 58 + jni/ruby/test/-ext-/debug/test_profile_frames.rb | 104 + jni/ruby/test/-ext-/exception/test_data_error.rb | 13 + jni/ruby/test/-ext-/exception/test_enc_raise.rb | 15 + jni/ruby/test/-ext-/exception/test_ensured.rb | 31 + jni/ruby/test/-ext-/file/test_stat.rb | 14 + jni/ruby/test/-ext-/float/test_nextafter.rb | 57 + jni/ruby/test/-ext-/funcall/test_passing_block.rb | 22 + jni/ruby/test/-ext-/hash/test_delete.rb | 19 + jni/ruby/test/-ext-/iseq_load/test_iseq_load.rb | 95 + jni/ruby/test/-ext-/iter/test_iter_break.rb | 15 + jni/ruby/test/-ext-/iter/test_yield_block.rb | 21 + jni/ruby/test/-ext-/load/test_dot_dot.rb | 10 + jni/ruby/test/-ext-/marshal/test_usrmarshal.rb | 32 + jni/ruby/test/-ext-/method/test_arity.rb | 37 + jni/ruby/test/-ext-/num2int/test_num2int.rb | 267 + .../test/-ext-/path_to_class/test_path_to_class.rb | 12 + .../test/-ext-/postponed_job/test_postponed_job.rb | 28 + jni/ruby/test/-ext-/proc/test_bmethod.rb | 37 + jni/ruby/test/-ext-/rational/test_rat.rb | 31 + jni/ruby/test/-ext-/st/test_foreach.rb | 15 + jni/ruby/test/-ext-/st/test_numhash.rb | 49 + jni/ruby/test/-ext-/st/test_update.rb | 50 + jni/ruby/test/-ext-/string/test_coderange.rb | 59 + jni/ruby/test/-ext-/string/test_cstr.rb | 119 + jni/ruby/test/-ext-/string/test_ellipsize.rb | 46 + jni/ruby/test/-ext-/string/test_enc_associate.rb | 12 + jni/ruby/test/-ext-/string/test_enc_str_buf_cat.rb | 15 + jni/ruby/test/-ext-/string/test_modify_expand.rb | 15 + jni/ruby/test/-ext-/string/test_nofree.rb | 10 + jni/ruby/test/-ext-/string/test_normalize.rb | 106 + jni/ruby/test/-ext-/string/test_qsort.rb | 19 + jni/ruby/test/-ext-/string/test_set_len.rb | 25 + jni/ruby/test/-ext-/struct/test_member.rb | 15 + .../test/-ext-/symbol/test_inadvertent_creation.rb | 473 + jni/ruby/test/-ext-/symbol/test_type.rb | 124 + jni/ruby/test/-ext-/test_bug-3571.rb | 20 + jni/ruby/test/-ext-/test_bug-3662.rb | 10 + jni/ruby/test/-ext-/test_bug-5832.rb | 21 + jni/ruby/test/-ext-/test_printf.rb | 186 + jni/ruby/test/-ext-/test_recursion.rb | 35 + jni/ruby/test/-ext-/tracepoint/test_tracepoint.rb | 79 + jni/ruby/test/-ext-/typeddata/test_typeddata.rb | 16 + .../wait_for_single_fd/test_wait_for_single_fd.rb | 45 + jni/ruby/test/-ext-/win32/test_console_attr.rb | 43 + jni/ruby/test/-ext-/win32/test_dln.rb | 34 + jni/ruby/test/-ext-/win32/test_fd_setsize.rb | 24 + jni/ruby/test/base64/test_base64.rb | 100 + jni/ruby/test/benchmark/test_benchmark.rb | 161 + jni/ruby/test/bigdecimal/test_bigdecimal.rb | 1555 +++ jni/ruby/test/bigdecimal/test_bigdecimal_util.rb | 50 + jni/ruby/test/bigdecimal/test_bigmath.rb | 80 + jni/ruby/test/bigdecimal/testbase.rb | 27 + jni/ruby/test/cgi/test_cgi_cookie.rb | 110 + jni/ruby/test/cgi/test_cgi_core.rb | 312 + jni/ruby/test/cgi/test_cgi_header.rb | 181 + jni/ruby/test/cgi/test_cgi_modruby.rb | 146 + jni/ruby/test/cgi/test_cgi_multipart.rb | 380 + jni/ruby/test/cgi/test_cgi_session.rb | 172 + jni/ruby/test/cgi/test_cgi_tag_helper.rb | 353 + jni/ruby/test/cgi/test_cgi_util.rb | 104 + jni/ruby/test/cgi/testdata/file1.html | 10 + jni/ruby/test/cgi/testdata/large.png | Bin 0 -> 156414 bytes jni/ruby/test/cgi/testdata/small.png | Bin 0 -> 82 bytes jni/ruby/test/coverage/test_coverage.rb | 64 + jni/ruby/test/csv/base.rb | 8 + jni/ruby/test/csv/line_endings.gz | Bin 0 -> 59 bytes jni/ruby/test/csv/test_csv_parsing.rb | 221 + jni/ruby/test/csv/test_csv_writing.rb | 97 + jni/ruby/test/csv/test_data_converters.rb | 263 + jni/ruby/test/csv/test_encodings.rb | 337 + jni/ruby/test/csv/test_features.rb | 327 + jni/ruby/test/csv/test_headers.rb | 297 + jni/ruby/test/csv/test_interface.rb | 368 + jni/ruby/test/csv/test_row.rb | 355 + jni/ruby/test/csv/test_table.rb | 434 + jni/ruby/test/csv/ts_all.rb | 20 + jni/ruby/test/date/test_date.rb | 150 + jni/ruby/test/date/test_date_arith.rb | 264 + jni/ruby/test/date/test_date_attr.rb | 103 + jni/ruby/test/date/test_date_base.rb | 442 + jni/ruby/test/date/test_date_compat.rb | 21 + jni/ruby/test/date/test_date_conv.rb | 137 + jni/ruby/test/date/test_date_marshal.rb | 41 + jni/ruby/test/date/test_date_new.rb | 271 + jni/ruby/test/date/test_date_parse.rb | 1124 ++ jni/ruby/test/date/test_date_strftime.rb | 422 + jni/ruby/test/date/test_date_strptime.rb | 512 + jni/ruby/test/date/test_switch_hitter.rb | 664 + jni/ruby/test/dbm/test_dbm.rb | 631 + jni/ruby/test/digest/digest/foo.rb | 10 + jni/ruby/test/digest/test_digest.rb | 272 + jni/ruby/test/digest/test_digest_extend.rb | 158 + jni/ruby/test/drb/drbtest.rb | 368 + jni/ruby/test/drb/ignore_test_drb.rb | 13 + jni/ruby/test/drb/test_acl.rb | 197 + jni/ruby/test/drb/test_drb.rb | 357 + jni/ruby/test/drb/test_drbssl.rb | 76 + jni/ruby/test/drb/test_drbunix.rb | 59 + jni/ruby/test/drb/ut_array.rb | 16 + jni/ruby/test/drb/ut_array_drbssl.rb | 40 + jni/ruby/test/drb/ut_array_drbunix.rb | 16 + jni/ruby/test/drb/ut_drb.rb | 167 + jni/ruby/test/drb/ut_drb_drbssl.rb | 41 + jni/ruby/test/drb/ut_drb_drbunix.rb | 17 + jni/ruby/test/drb/ut_eq.rb | 36 + jni/ruby/test/drb/ut_eval.rb | 36 + jni/ruby/test/drb/ut_large.rb | 43 + jni/ruby/test/drb/ut_port.rb | 15 + jni/ruby/test/drb/ut_safe1.rb | 16 + jni/ruby/test/drb/ut_timerholder.rb | 53 + jni/ruby/test/dtrace/dummy.rb | 1 + jni/ruby/test/dtrace/helper.rb | 50 + jni/ruby/test/dtrace/test_array_create.rb | 35 + jni/ruby/test/dtrace/test_cmethod.rb | 49 + jni/ruby/test/dtrace/test_function_entry.rb | 87 + jni/ruby/test/dtrace/test_gc.rb | 26 + jni/ruby/test/dtrace/test_hash_create.rb | 52 + jni/ruby/test/dtrace/test_load.rb | 52 + jni/ruby/test/dtrace/test_method_cache.rb | 28 + jni/ruby/test/dtrace/test_object_create_start.rb | 35 + jni/ruby/test/dtrace/test_raise.rb | 29 + jni/ruby/test/dtrace/test_require.rb | 34 + jni/ruby/test/dtrace/test_singleton_function.rb | 55 + jni/ruby/test/dtrace/test_string.rb | 27 + jni/ruby/test/erb/hello.erb | 4 + jni/ruby/test/erb/test_erb.rb | 504 + jni/ruby/test/erb/test_erb_command.rb | 11 + jni/ruby/test/erb/test_erb_m17n.rb | 123 + jni/ruby/test/etc/test_etc.rb | 169 + jni/ruby/test/fiddle/helper.rb | 124 + jni/ruby/test/fiddle/test_c_struct_entry.rb | 76 + jni/ruby/test/fiddle/test_c_union_entity.rb | 34 + jni/ruby/test/fiddle/test_closure.rb | 84 + jni/ruby/test/fiddle/test_cparser.rb | 35 + jni/ruby/test/fiddle/test_fiddle.rb | 16 + jni/ruby/test/fiddle/test_func.rb | 92 + jni/ruby/test/fiddle/test_function.rb | 82 + jni/ruby/test/fiddle/test_handle.rb | 195 + jni/ruby/test/fiddle/test_import.rb | 150 + jni/ruby/test/fiddle/test_pointer.rb | 237 + jni/ruby/test/fileutils/clobber.rb | 91 + jni/ruby/test/fileutils/fileasserts.rb | 111 + jni/ruby/test/fileutils/test_dryrun.rb | 17 + jni/ruby/test/fileutils/test_fileutils.rb | 1570 +++ jni/ruby/test/fileutils/test_nowrite.rb | 17 + jni/ruby/test/fileutils/test_verbose.rb | 17 + jni/ruby/test/fileutils/visibility_tests.rb | 41 + jni/ruby/test/gdbm/test_gdbm.rb | 719 + jni/ruby/test/io/console/test_io_console.rb | 332 + jni/ruby/test/io/nonblock/test_flush.rb | 52 + jni/ruby/test/io/wait/test_io_wait.rb | 112 + jni/ruby/test/irb/test_completion.rb | 21 + jni/ruby/test/irb/test_option.rb | 11 + .../test/irb/test_raise_no_backtrace_exception.rb | 13 + jni/ruby/test/json/fixtures/fail1.json | 1 + jni/ruby/test/json/fixtures/fail10.json | 1 + jni/ruby/test/json/fixtures/fail11.json | 1 + jni/ruby/test/json/fixtures/fail12.json | 1 + jni/ruby/test/json/fixtures/fail13.json | 1 + jni/ruby/test/json/fixtures/fail14.json | 1 + jni/ruby/test/json/fixtures/fail18.json | 1 + jni/ruby/test/json/fixtures/fail19.json | 1 + jni/ruby/test/json/fixtures/fail2.json | 1 + jni/ruby/test/json/fixtures/fail20.json | 1 + jni/ruby/test/json/fixtures/fail21.json | 1 + jni/ruby/test/json/fixtures/fail22.json | 1 + jni/ruby/test/json/fixtures/fail23.json | 1 + jni/ruby/test/json/fixtures/fail24.json | 1 + jni/ruby/test/json/fixtures/fail25.json | 1 + jni/ruby/test/json/fixtures/fail27.json | 2 + jni/ruby/test/json/fixtures/fail28.json | 2 + jni/ruby/test/json/fixtures/fail3.json | 1 + jni/ruby/test/json/fixtures/fail4.json | 1 + jni/ruby/test/json/fixtures/fail5.json | 1 + jni/ruby/test/json/fixtures/fail6.json | 1 + jni/ruby/test/json/fixtures/fail7.json | 1 + jni/ruby/test/json/fixtures/fail8.json | 1 + jni/ruby/test/json/fixtures/fail9.json | 1 + jni/ruby/test/json/fixtures/pass1.json | 56 + jni/ruby/test/json/fixtures/pass15.json | 1 + jni/ruby/test/json/fixtures/pass16.json | 1 + jni/ruby/test/json/fixtures/pass17.json | 1 + jni/ruby/test/json/fixtures/pass2.json | 1 + jni/ruby/test/json/fixtures/pass26.json | 1 + jni/ruby/test/json/fixtures/pass3.json | 6 + jni/ruby/test/json/setup_variant.rb | 11 + jni/ruby/test/json/test_json.rb | 557 + jni/ruby/test/json/test_json_addition.rb | 196 + jni/ruby/test/json/test_json_encoding.rb | 65 + jni/ruby/test/json/test_json_fixtures.rb | 35 + jni/ruby/test/json/test_json_generate.rb | 322 + jni/ruby/test/json/test_json_generic_object.rb | 75 + jni/ruby/test/json/test_json_string_matching.rb | 39 + jni/ruby/test/json/test_json_unicode.rb | 72 + jni/ruby/test/lib/envutil.rb | 604 + jni/ruby/test/lib/find_executable.rb | 21 + jni/ruby/test/lib/leakchecker.rb | 167 + jni/ruby/test/lib/memory_status.rb | 111 + jni/ruby/test/lib/minitest/README.txt | 457 + jni/ruby/test/lib/minitest/autorun.rb | 13 + jni/ruby/test/lib/minitest/benchmark.rb | 417 + jni/ruby/test/lib/minitest/mock.rb | 195 + jni/ruby/test/lib/minitest/unit.rb | 1419 ++ jni/ruby/test/lib/profile_test_all.rb | 90 + jni/ruby/test/lib/test/unit.rb | 896 ++ jni/ruby/test/lib/test/unit/assertions.rb | 465 + jni/ruby/test/lib/test/unit/parallel.rb | 190 + jni/ruby/test/lib/test/unit/testcase.rb | 34 + jni/ruby/test/lib/tracepointchecker.rb | 118 + jni/ruby/test/lib/with_different_ofs.rb | 17 + jni/ruby/test/logger/test_logdevice.rb | 419 + jni/ruby/test/logger/test_logger.rb | 244 + jni/ruby/test/logger/test_severity.rb | 15 + jni/ruby/test/matrix/test_matrix.rb | 579 + jni/ruby/test/matrix/test_vector.rb | 215 + jni/ruby/test/minitest/metametameta.rb | 69 + jni/ruby/test/minitest/test_minitest_benchmark.rb | 130 + jni/ruby/test/minitest/test_minitest_mock.rb | 403 + jni/ruby/test/minitest/test_minitest_unit.rb | 1803 +++ jni/ruby/test/misc/test_ruby_mode.rb | 182 + jni/ruby/test/mkmf/base.rb | 139 + jni/ruby/test/mkmf/test_config.rb | 16 + jni/ruby/test/mkmf/test_constant.rb | 37 + jni/ruby/test/mkmf/test_convertible.rb | 34 + jni/ruby/test/mkmf/test_find_executable.rb | 50 + jni/ruby/test/mkmf/test_flags.rb | 56 + jni/ruby/test/mkmf/test_framework.rb | 48 + jni/ruby/test/mkmf/test_have_func.rb | 14 + jni/ruby/test/mkmf/test_have_library.rb | 55 + jni/ruby/test/mkmf/test_have_macro.rb | 35 + jni/ruby/test/mkmf/test_libs.rb | 86 + jni/ruby/test/mkmf/test_signedness.rb | 29 + jni/ruby/test/mkmf/test_sizeof.rb | 47 + jni/ruby/test/monitor/test_monitor.rb | 209 + jni/ruby/test/net/ftp/test_buffered_socket.rb | 40 + jni/ruby/test/net/ftp/test_ftp.rb | 833 ++ jni/ruby/test/net/http/test_buffered_io.rb | 17 + jni/ruby/test/net/http/test_http.rb | 933 ++ jni/ruby/test/net/http/test_http_request.rb | 79 + jni/ruby/test/net/http/test_httpheader.rb | 334 + jni/ruby/test/net/http/test_httpresponse.rb | 394 + jni/ruby/test/net/http/test_httpresponses.rb | 24 + jni/ruby/test/net/http/test_https.rb | 194 + jni/ruby/test/net/http/test_https_proxy.rb | 46 + jni/ruby/test/net/http/utils.rb | 108 + jni/ruby/test/net/imap/Makefile | 15 + jni/ruby/test/net/imap/cacert.pem | 66 + jni/ruby/test/net/imap/server.crt | 48 + jni/ruby/test/net/imap/server.key | 15 + jni/ruby/test/net/imap/test_imap.rb | 550 + .../test/net/imap/test_imap_response_parser.rb | 292 + jni/ruby/test/net/pop/test_pop.rb | 136 + jni/ruby/test/net/protocol/test_protocol.rb | 28 + jni/ruby/test/net/smtp/test_response.rb | 99 + jni/ruby/test/net/smtp/test_smtp.rb | 54 + jni/ruby/test/net/smtp/test_ssl_socket.rb | 91 + jni/ruby/test/nkf/test_kconv.rb | 81 + jni/ruby/test/nkf/test_nkf.rb | 22 + jni/ruby/test/objspace/test_objspace.rb | 288 + jni/ruby/test/open-uri/test_open-uri.rb | 832 ++ jni/ruby/test/open-uri/test_ssl.rb | 390 + jni/ruby/test/openssl/test_asn1.rb | 609 + jni/ruby/test/openssl/test_bn.rb | 52 + jni/ruby/test/openssl/test_buffering.rb | 87 + jni/ruby/test/openssl/test_cipher.rb | 260 + jni/ruby/test/openssl/test_config.rb | 297 + jni/ruby/test/openssl/test_digest.rb | 126 + jni/ruby/test/openssl/test_engine.rb | 75 + jni/ruby/test/openssl/test_fips.rb | 14 + jni/ruby/test/openssl/test_hmac.rb | 41 + jni/ruby/test/openssl/test_ns_spki.rb | 51 + jni/ruby/test/openssl/test_ocsp.rb | 47 + jni/ruby/test/openssl/test_pair.rb | 372 + jni/ruby/test/openssl/test_partial_record_read.rb | 34 + jni/ruby/test/openssl/test_pkcs12.rb | 209 + jni/ruby/test/openssl/test_pkcs5.rb | 97 + jni/ruby/test/openssl/test_pkcs7.rb | 297 + jni/ruby/test/openssl/test_pkey_dh.rb | 82 + jni/ruby/test/openssl/test_pkey_dsa.rb | 240 + jni/ruby/test/openssl/test_pkey_ec.rb | 211 + jni/ruby/test/openssl/test_pkey_rsa.rb | 313 + jni/ruby/test/openssl/test_ssl.rb | 933 ++ jni/ruby/test/openssl/test_ssl_session.rb | 380 + jni/ruby/test/openssl/test_x509cert.rb | 226 + jni/ruby/test/openssl/test_x509crl.rb | 220 + jni/ruby/test/openssl/test_x509ext.rb | 69 + jni/ruby/test/openssl/test_x509name.rb | 367 + jni/ruby/test/openssl/test_x509req.rb | 158 + jni/ruby/test/openssl/test_x509store.rb | 231 + jni/ruby/test/openssl/utils.rb | 333 + jni/ruby/test/optparse/test_acceptable.rb | 195 + jni/ruby/test/optparse/test_autoconf.rb | 63 + jni/ruby/test/optparse/test_bash_completion.rb | 42 + jni/ruby/test/optparse/test_getopts.rb | 34 + jni/ruby/test/optparse/test_noarg.rb | 57 + jni/ruby/test/optparse/test_optarg.rb | 46 + jni/ruby/test/optparse/test_optparse.rb | 66 + jni/ruby/test/optparse/test_placearg.rb | 56 + jni/ruby/test/optparse/test_reqarg.rb | 77 + jni/ruby/test/optparse/test_summary.rb | 46 + jni/ruby/test/optparse/test_zsh_completion.rb | 22 + jni/ruby/test/ostruct/test_ostruct.rb | 138 + jni/ruby/test/pathname/test_pathname.rb | 1389 ++ jni/ruby/test/psych/handlers/test_recorder.rb | 25 + jni/ruby/test/psych/helper.rb | 114 + jni/ruby/test/psych/json/test_stream.rb | 109 + jni/ruby/test/psych/nodes/test_enumerable.rb | 43 + jni/ruby/test/psych/test_alias_and_anchor.rb | 96 + jni/ruby/test/psych/test_array.rb | 57 + jni/ruby/test/psych/test_boolean.rb | 36 + jni/ruby/test/psych/test_class.rb | 36 + jni/ruby/test/psych/test_coder.rb | 184 + jni/ruby/test/psych/test_date_time.rb | 38 + jni/ruby/test/psych/test_deprecated.rb | 214 + jni/ruby/test/psych/test_document.rb | 46 + jni/ruby/test/psych/test_emitter.rb | 93 + jni/ruby/test/psych/test_encoding.rb | 259 + jni/ruby/test/psych/test_exception.rb | 157 + jni/ruby/test/psych/test_hash.rb | 49 + jni/ruby/test/psych/test_json_tree.rb | 65 + jni/ruby/test/psych/test_marshalable.rb | 54 + jni/ruby/test/psych/test_merge_keys.rb | 180 + jni/ruby/test/psych/test_nil.rb | 18 + jni/ruby/test/psych/test_null.rb | 19 + jni/ruby/test/psych/test_numeric.rb | 45 + jni/ruby/test/psych/test_object.rb | 44 + jni/ruby/test/psych/test_object_references.rb | 71 + jni/ruby/test/psych/test_omap.rb | 75 + jni/ruby/test/psych/test_parser.rb | 339 + jni/ruby/test/psych/test_psych.rb | 168 + jni/ruby/test/psych/test_safe_load.rb | 97 + jni/ruby/test/psych/test_scalar.rb | 11 + jni/ruby/test/psych/test_scalar_scanner.rb | 106 + jni/ruby/test/psych/test_serialize_subclasses.rb | 38 + jni/ruby/test/psych/test_set.rb | 49 + jni/ruby/test/psych/test_stream.rb | 93 + jni/ruby/test/psych/test_string.rb | 166 + jni/ruby/test/psych/test_struct.rb | 49 + jni/ruby/test/psych/test_symbol.rb | 25 + jni/ruby/test/psych/test_tainted.rb | 130 + jni/ruby/test/psych/test_to_yaml_properties.rb | 63 + jni/ruby/test/psych/test_tree_builder.rb | 79 + jni/ruby/test/psych/test_yaml.rb | 1288 ++ jni/ruby/test/psych/test_yamldbm.rb | 193 + jni/ruby/test/psych/test_yamlstore.rb | 85 + jni/ruby/test/psych/visitors/test_depth_first.rb | 49 + jni/ruby/test/psych/visitors/test_emitter.rb | 144 + jni/ruby/test/psych/visitors/test_to_ruby.rb | 326 + jni/ruby/test/psych/visitors/test_yaml_tree.rb | 173 + jni/ruby/test/rake/file_creation.rb | 34 + jni/ruby/test/rake/helper.rb | 129 + jni/ruby/test/rake/support/rakefile_definitions.rb | 478 + jni/ruby/test/rake/support/ruby_runner.rb | 34 + jni/ruby/test/rake/test_private_reader.rb | 42 + jni/ruby/test/rake/test_rake.rb | 40 + jni/ruby/test/rake/test_rake_application.rb | 643 + .../test/rake/test_rake_application_options.rb | 466 + jni/ruby/test/rake/test_rake_backtrace.rb | 119 + jni/ruby/test/rake/test_rake_clean.rb | 61 + jni/ruby/test/rake/test_rake_cpu_counter.rb | 68 + jni/ruby/test/rake/test_rake_definitions.rb | 84 + jni/ruby/test/rake/test_rake_directory_task.rb | 76 + jni/ruby/test/rake/test_rake_dsl.rb | 40 + jni/ruby/test/rake/test_rake_early_time.rb | 31 + jni/ruby/test/rake/test_rake_extension.rb | 59 + jni/ruby/test/rake/test_rake_file_creation_task.rb | 56 + jni/ruby/test/rake/test_rake_file_list.rb | 655 + jni/ruby/test/rake/test_rake_file_list_path_map.rb | 8 + jni/ruby/test/rake/test_rake_file_task.rb | 197 + jni/ruby/test/rake/test_rake_file_utils.rb | 309 + jni/ruby/test/rake/test_rake_ftp_file.rb | 74 + jni/ruby/test/rake/test_rake_functional.rb | 482 + jni/ruby/test/rake/test_rake_invocation_chain.rb | 64 + jni/ruby/test/rake/test_rake_late_time.rb | 18 + jni/ruby/test/rake/test_rake_linked_list.rb | 84 + jni/ruby/test/rake/test_rake_makefile_loader.rb | 46 + jni/ruby/test/rake/test_rake_multi_task.rb | 64 + jni/ruby/test/rake/test_rake_name_space.rb | 57 + jni/ruby/test/rake/test_rake_package_task.rb | 79 + jni/ruby/test/rake/test_rake_path_map.rb | 168 + jni/ruby/test/rake/test_rake_path_map_explode.rb | 34 + jni/ruby/test/rake/test_rake_path_map_partial.rb | 18 + .../test/rake/test_rake_pathname_extensions.rb | 15 + jni/ruby/test/rake/test_rake_pseudo_status.rb | 21 + jni/ruby/test/rake/test_rake_rake_test_loader.rb | 20 + jni/ruby/test/rake/test_rake_reduce_compat.rb | 26 + jni/ruby/test/rake/test_rake_require.rb | 40 + jni/ruby/test/rake/test_rake_rules.rb | 388 + jni/ruby/test/rake/test_rake_scope.rb | 44 + jni/ruby/test/rake/test_rake_task.rb | 393 + .../test/rake/test_rake_task_argument_parsing.rb | 119 + jni/ruby/test/rake/test_rake_task_arguments.rb | 127 + jni/ruby/test/rake/test_rake_task_lib.rb | 9 + jni/ruby/test/rake/test_rake_task_manager.rb | 178 + .../test_rake_task_manager_argument_resolution.rb | 19 + .../test/rake/test_rake_task_with_arguments.rb | 172 + jni/ruby/test/rake/test_rake_test_task.rb | 146 + jni/ruby/test/rake/test_rake_thread_pool.rb | 145 + .../test/rake/test_rake_top_level_functions.rb | 71 + jni/ruby/test/rake/test_rake_win32.rb | 72 + jni/ruby/test/rake/test_thread_history_display.rb | 101 + jni/ruby/test/rake/test_trace_output.rb | 52 + .../Amps and angle encoding.text | 21 + .../test/rdoc/MarkdownTest_1.0.3/Auto links.text | 13 + .../rdoc/MarkdownTest_1.0.3/Backslash escapes.text | 120 + .../Blockquotes with code blocks.text | 11 + .../test/rdoc/MarkdownTest_1.0.3/Code Blocks.text | 14 + .../test/rdoc/MarkdownTest_1.0.3/Code Spans.text | 6 + ...rd-wrapped paragraphs with list-like lines.text | 8 + .../rdoc/MarkdownTest_1.0.3/Horizontal rules.text | 67 + .../MarkdownTest_1.0.3/Inline HTML (Advanced).text | 15 + .../MarkdownTest_1.0.3/Inline HTML (Simple).text | 69 + .../MarkdownTest_1.0.3/Inline HTML comments.text | 13 + .../MarkdownTest_1.0.3/Links, inline style.text | 12 + .../MarkdownTest_1.0.3/Links, reference style.text | 71 + .../Links, shortcut references.text | 20 + .../Literal quotes in titles.text | 7 + .../Markdown Documentation - Basics.text | 306 + .../Markdown Documentation - Syntax.text | 888 ++ .../MarkdownTest_1.0.3/Nested blockquotes.text | 5 + .../Ordered and unordered lists.text | 131 + .../MarkdownTest_1.0.3/Strong and em together.text | 7 + jni/ruby/test/rdoc/MarkdownTest_1.0.3/Tabs.text | 21 + .../test/rdoc/MarkdownTest_1.0.3/Tidyness.text | 5 + jni/ruby/test/rdoc/README | 1 + jni/ruby/test/rdoc/binary.dat | Bin 0 -> 1024 bytes jni/ruby/test/rdoc/hidden.zip.txt | 1 + jni/ruby/test/rdoc/test.ja.largedoc | 3 + jni/ruby/test/rdoc/test.ja.rdoc | 10 + jni/ruby/test/rdoc/test.ja.txt | 8 + jni/ruby/test/rdoc/test.txt | 1 + jni/ruby/test/rdoc/test_rdoc_alias.rb | 13 + jni/ruby/test/rdoc/test_rdoc_any_method.rb | 460 + jni/ruby/test/rdoc/test_rdoc_attr.rb | 190 + jni/ruby/test/rdoc/test_rdoc_class_module.rb | 1492 ++ jni/ruby/test/rdoc/test_rdoc_code_object.rb | 450 + jni/ruby/test/rdoc/test_rdoc_comment.rb | 504 + jni/ruby/test/rdoc/test_rdoc_constant.rb | 181 + jni/ruby/test/rdoc/test_rdoc_context.rb | 901 ++ jni/ruby/test/rdoc/test_rdoc_context_section.rb | 130 + jni/ruby/test/rdoc/test_rdoc_cross_reference.rb | 192 + jni/ruby/test/rdoc/test_rdoc_encoding.rb | 227 + jni/ruby/test/rdoc/test_rdoc_extend.rb | 94 + jni/ruby/test/rdoc/test_rdoc_generator_darkfish.rb | 229 + .../test/rdoc/test_rdoc_generator_json_index.rb | 320 + jni/ruby/test/rdoc/test_rdoc_generator_markup.rb | 59 + jni/ruby/test/rdoc/test_rdoc_generator_pot.rb | 91 + jni/ruby/test/rdoc/test_rdoc_generator_pot_po.rb | 51 + .../test/rdoc/test_rdoc_generator_pot_po_entry.rb | 139 + jni/ruby/test/rdoc/test_rdoc_generator_ri.rb | 78 + jni/ruby/test/rdoc/test_rdoc_i18n_locale.rb | 73 + jni/ruby/test/rdoc/test_rdoc_i18n_text.rb | 123 + jni/ruby/test/rdoc/test_rdoc_include.rb | 108 + jni/ruby/test/rdoc/test_rdoc_markdown.rb | 980 ++ jni/ruby/test/rdoc/test_rdoc_markdown_test.rb | 1884 +++ jni/ruby/test/rdoc/test_rdoc_markup.rb | 95 + .../rdoc/test_rdoc_markup_attribute_manager.rb | 364 + jni/ruby/test/rdoc/test_rdoc_markup_attributes.rb | 39 + jni/ruby/test/rdoc/test_rdoc_markup_document.rb | 207 + jni/ruby/test/rdoc/test_rdoc_markup_formatter.rb | 175 + jni/ruby/test/rdoc/test_rdoc_markup_hard_break.rb | 31 + jni/ruby/test/rdoc/test_rdoc_markup_heading.rb | 29 + jni/ruby/test/rdoc/test_rdoc_markup_include.rb | 19 + .../rdoc/test_rdoc_markup_indented_paragraph.rb | 53 + jni/ruby/test/rdoc/test_rdoc_markup_paragraph.rb | 32 + jni/ruby/test/rdoc/test_rdoc_markup_parser.rb | 1680 +++ jni/ruby/test/rdoc/test_rdoc_markup_pre_process.rb | 473 + jni/ruby/test/rdoc/test_rdoc_markup_raw.rb | 22 + jni/ruby/test/rdoc/test_rdoc_markup_to_ansi.rb | 369 + jni/ruby/test/rdoc/test_rdoc_markup_to_bs.rb | 366 + jni/ruby/test/rdoc/test_rdoc_markup_to_html.rb | 663 + .../test/rdoc/test_rdoc_markup_to_html_crossref.rb | 225 + .../test/rdoc/test_rdoc_markup_to_html_snippet.rb | 711 + .../rdoc/test_rdoc_markup_to_joined_paragraph.rb | 32 + jni/ruby/test/rdoc/test_rdoc_markup_to_label.rb | 112 + jni/ruby/test/rdoc/test_rdoc_markup_to_markdown.rb | 389 + jni/ruby/test/rdoc/test_rdoc_markup_to_rdoc.rb | 377 + .../rdoc/test_rdoc_markup_to_table_of_contents.rb | 126 + jni/ruby/test/rdoc/test_rdoc_markup_to_tt_only.rb | 246 + jni/ruby/test/rdoc/test_rdoc_markup_verbatim.rb | 29 + jni/ruby/test/rdoc/test_rdoc_method_attr.rb | 193 + jni/ruby/test/rdoc/test_rdoc_normal_class.rb | 47 + jni/ruby/test/rdoc/test_rdoc_normal_module.rb | 42 + jni/ruby/test/rdoc/test_rdoc_options.rb | 766 + jni/ruby/test/rdoc/test_rdoc_parser.rb | 327 + jni/ruby/test/rdoc/test_rdoc_parser_c.rb | 1896 +++ jni/ruby/test/rdoc/test_rdoc_parser_changelog.rb | 315 + jni/ruby/test/rdoc/test_rdoc_parser_markdown.rb | 61 + jni/ruby/test/rdoc/test_rdoc_parser_rd.rb | 55 + jni/ruby/test/rdoc/test_rdoc_parser_ruby.rb | 3322 +++++ jni/ruby/test/rdoc/test_rdoc_parser_simple.rb | 115 + jni/ruby/test/rdoc/test_rdoc_rd.rb | 30 + jni/ruby/test/rdoc/test_rdoc_rd_block_parser.rb | 535 + jni/ruby/test/rdoc/test_rdoc_rd_inline.rb | 63 + jni/ruby/test/rdoc/test_rdoc_rd_inline_parser.rb | 177 + jni/ruby/test/rdoc/test_rdoc_rdoc.rb | 455 + jni/ruby/test/rdoc/test_rdoc_require.rb | 25 + jni/ruby/test/rdoc/test_rdoc_ri_driver.rb | 1436 ++ jni/ruby/test/rdoc/test_rdoc_ri_paths.rb | 155 + jni/ruby/test/rdoc/test_rdoc_ruby_lex.rb | 421 + jni/ruby/test/rdoc/test_rdoc_ruby_token.rb | 19 + jni/ruby/test/rdoc/test_rdoc_rubygems_hook.rb | 251 + jni/ruby/test/rdoc/test_rdoc_servlet.rb | 535 + jni/ruby/test/rdoc/test_rdoc_single_class.rb | 20 + jni/ruby/test/rdoc/test_rdoc_stats.rb | 722 + jni/ruby/test/rdoc/test_rdoc_store.rb | 993 ++ jni/ruby/test/rdoc/test_rdoc_task.rb | 170 + jni/ruby/test/rdoc/test_rdoc_text.rb | 557 + jni/ruby/test/rdoc/test_rdoc_token_stream.rb | 42 + jni/ruby/test/rdoc/test_rdoc_tom_doc.rb | 520 + jni/ruby/test/rdoc/test_rdoc_top_level.rb | 287 + jni/ruby/test/rdoc/xref_data.rb | 76 + jni/ruby/test/rdoc/xref_test_case.rb | 67 + jni/ruby/test/readline/test_readline.rb | 530 + jni/ruby/test/readline/test_readline_history.rb | 292 + jni/ruby/test/resolv/test_addr.rb | 29 + jni/ruby/test/resolv/test_dns.rb | 200 + jni/ruby/test/resolv/test_resource.rb | 21 + jni/ruby/test/rexml/data/LostineRiver.kml.gz | Bin 0 -> 50154 bytes jni/ruby/test/rexml/data/ProductionSupport.xml | 29 + jni/ruby/test/rexml/data/axis.xml | 25 + jni/ruby/test/rexml/data/bad.xml | 5 + jni/ruby/test/rexml/data/basic.xml | 11 + jni/ruby/test/rexml/data/basicupdate.xml | 47 + jni/ruby/test/rexml/data/broken.rss | 20 + jni/ruby/test/rexml/data/contents.xml | 70 + jni/ruby/test/rexml/data/dash.xml | 12 + jni/ruby/test/rexml/data/defaultNamespace.xml | 6 + jni/ruby/test/rexml/data/doctype_test.xml | 34 + jni/ruby/test/rexml/data/documentation.xml | 542 + jni/ruby/test/rexml/data/euc.xml | 296 + jni/ruby/test/rexml/data/evaluate.xml | 28 + jni/ruby/test/rexml/data/fibo.xml | 29 + jni/ruby/test/rexml/data/foo.xml | 10 + jni/ruby/test/rexml/data/google.2.xml | 156 + jni/ruby/test/rexml/data/id.xml | 21 + jni/ruby/test/rexml/data/iso8859-1.xml | 4 + jni/ruby/test/rexml/data/jaxen24.xml | 2 + jni/ruby/test/rexml/data/jaxen3.xml | 15 + jni/ruby/test/rexml/data/lang.xml | 11 + jni/ruby/test/rexml/data/lang0.xml | 18 + jni/ruby/test/rexml/data/message.xml | 27 + jni/ruby/test/rexml/data/moreover.xml | 244 + jni/ruby/test/rexml/data/much_ado.xml | 6850 +++++++++ jni/ruby/test/rexml/data/namespaces.xml | 18 + jni/ruby/test/rexml/data/nitf.xml | 67 + jni/ruby/test/rexml/data/numbers.xml | 18 + jni/ruby/test/rexml/data/ofbiz-issues-full-177.xml | 13971 +++++++++++++++++++ jni/ruby/test/rexml/data/pi.xml | 13 + jni/ruby/test/rexml/data/pi2.xml | 6 + jni/ruby/test/rexml/data/project.xml | 1 + jni/ruby/test/rexml/data/simple.xml | 2 + jni/ruby/test/rexml/data/stream_accents.xml | 4 + jni/ruby/test/rexml/data/t63-1.xml | Bin 0 -> 161690 bytes jni/ruby/test/rexml/data/t63-2.svg | 2828 ++++ jni/ruby/test/rexml/data/t75.xml | 31 + jni/ruby/test/rexml/data/test/tests.xml | 683 + jni/ruby/test/rexml/data/test/tests.xsl | 369 + jni/ruby/test/rexml/data/testNamespaces.xml | 22 + jni/ruby/test/rexml/data/testsrc.xml | 64 + jni/ruby/test/rexml/data/text.xml | 10 + jni/ruby/test/rexml/data/ticket_61.xml | 4 + jni/ruby/test/rexml/data/ticket_68.xml | 590 + jni/ruby/test/rexml/data/tutorial.xml | 678 + jni/ruby/test/rexml/data/underscore.xml | 6 + jni/ruby/test/rexml/data/utf16.xml | Bin 0 -> 207464 bytes jni/ruby/test/rexml/data/web.xml | 42 + jni/ruby/test/rexml/data/web2.xml | 7 + jni/ruby/test/rexml/data/working.rss | 202 + jni/ruby/test/rexml/data/xmlfile-bug.xml | 15 + jni/ruby/test/rexml/data/xp.tst | 27 + jni/ruby/test/rexml/data/yahoo.xml | 80 + jni/ruby/test/rexml/listener.rb | 50 + .../rexml/parse/test_document_type_declaration.rb | 49 + .../test/rexml/parse/test_notation_declaration.rb | 99 + jni/ruby/test/rexml/parser/test_sax2.rb | 202 + jni/ruby/test/rexml/parser/test_tree.rb | 42 + jni/ruby/test/rexml/parser/test_ultra_light.rb | 69 + jni/ruby/test/rexml/rexml_test_utils.rb | 6 + jni/ruby/test/rexml/test_attributes.rb | 222 + jni/ruby/test/rexml/test_attributes_mixin.rb | 31 + jni/ruby/test/rexml/test_changing_encoding.rb | 44 + jni/ruby/test/rexml/test_comment.rb | 25 + jni/ruby/test/rexml/test_contrib.rb | 584 + jni/ruby/test/rexml/test_core.rb | 1467 ++ jni/ruby/test/rexml/test_doctype.rb | 106 + jni/ruby/test/rexml/test_document.rb | 415 + jni/ruby/test/rexml/test_elements.rb | 118 + jni/ruby/test/rexml/test_encoding.rb | 107 + jni/ruby/test/rexml/test_entity.rb | 205 + jni/ruby/test/rexml/test_functions.rb | 224 + jni/ruby/test/rexml/test_functions_number.rb | 34 + jni/ruby/test/rexml/test_jaxen.rb | 129 + jni/ruby/test/rexml/test_light.rb | 106 + jni/ruby/test/rexml/test_lightparser.rb | 15 + jni/ruby/test/rexml/test_listener.rb | 130 + jni/ruby/test/rexml/test_martin_fowler.rb | 39 + jni/ruby/test/rexml/test_namespace.rb | 40 + jni/ruby/test/rexml/test_order.rb | 109 + jni/ruby/test/rexml/test_preceding_sibling.rb | 40 + jni/ruby/test/rexml/test_pullparser.rb | 102 + jni/ruby/test/rexml/test_rexml_issuezilla.rb | 18 + jni/ruby/test/rexml/test_sax.rb | 286 + jni/ruby/test/rexml/test_stream.rb | 129 + jni/ruby/test/rexml/test_text.rb | 21 + jni/ruby/test/rexml/test_ticket_80.rb | 58 + jni/ruby/test/rexml/test_validation_rng.rb | 792 ++ jni/ruby/test/rexml/test_xml_declaration.rb | 35 + jni/ruby/test/rexml/xpath/test_attribute.rb | 29 + .../rexml/xpath/test_axis_preceding_sibling.rb | 39 + jni/ruby/test/rexml/xpath/test_base.rb | 1089 ++ jni/ruby/test/rexml/xpath/test_node.rb | 42 + jni/ruby/test/rexml/xpath/test_predicate.rb | 82 + jni/ruby/test/rexml/xpath/test_text.rb | 74 + jni/ruby/test/rinda/test_rinda.rb | 810 ++ jni/ruby/test/rinda/test_tuplebag.rb | 172 + jni/ruby/test/ripper/dummyparser.rb | 220 + jni/ruby/test/ripper/test_files.rb | 23 + jni/ruby/test/ripper/test_filter.rb | 83 + jni/ruby/test/ripper/test_parser_events.rb | 1232 ++ jni/ruby/test/ripper/test_ripper.rb | 63 + jni/ruby/test/ripper/test_scanner_events.rb | 909 ++ jni/ruby/test/ripper/test_sexp.rb | 44 + jni/ruby/test/rss/dot.png | Bin 0 -> 111 bytes jni/ruby/test/rss/rss-assertions.rb | 2090 +++ jni/ruby/test/rss/rss-testcase.rb | 478 + jni/ruby/test/rss/test_1.0.rb | 307 + jni/ruby/test/rss/test_2.0.rb | 411 + jni/ruby/test/rss/test_accessor.rb | 103 + jni/ruby/test/rss/test_atom.rb | 683 + jni/ruby/test/rss/test_content.rb | 104 + jni/ruby/test/rss/test_dublincore.rb | 269 + jni/ruby/test/rss/test_image.rb | 214 + jni/ruby/test/rss/test_inherit.rb | 40 + jni/ruby/test/rss/test_itunes.rb | 347 + jni/ruby/test/rss/test_maker_0.9.rb | 474 + jni/ruby/test/rss/test_maker_1.0.rb | 516 + jni/ruby/test/rss/test_maker_2.0.rb | 757 + jni/ruby/test/rss/test_maker_atom_entry.rb | 393 + jni/ruby/test/rss/test_maker_atom_feed.rb | 454 + jni/ruby/test/rss/test_maker_content.rb | 47 + jni/ruby/test/rss/test_maker_dc.rb | 149 + jni/ruby/test/rss/test_maker_image.rb | 62 + jni/ruby/test/rss/test_maker_itunes.rb | 469 + jni/ruby/test/rss/test_maker_slash.rb | 37 + jni/ruby/test/rss/test_maker_sy.rb | 44 + jni/ruby/test/rss/test_maker_taxo.rb | 81 + jni/ruby/test/rss/test_maker_trackback.rb | 41 + jni/ruby/test/rss/test_maker_xml-stylesheet.rb | 83 + jni/ruby/test/rss/test_parser.rb | 64 + jni/ruby/test/rss/test_parser_1.0.rb | 528 + jni/ruby/test/rss/test_parser_2.0.rb | 122 + jni/ruby/test/rss/test_parser_atom_entry.rb | 163 + jni/ruby/test/rss/test_parser_atom_feed.rb | 276 + jni/ruby/test/rss/test_setup_maker_0.9.rb | 246 + jni/ruby/test/rss/test_setup_maker_1.0.rb | 550 + jni/ruby/test/rss/test_setup_maker_2.0.rb | 308 + jni/ruby/test/rss/test_setup_maker_atom_entry.rb | 409 + jni/ruby/test/rss/test_setup_maker_atom_feed.rb | 445 + jni/ruby/test/rss/test_setup_maker_itunes.rb | 143 + jni/ruby/test/rss/test_setup_maker_slash.rb | 38 + jni/ruby/test/rss/test_slash.rb | 64 + jni/ruby/test/rss/test_syndication.rb | 125 + jni/ruby/test/rss/test_taxonomy.rb | 172 + jni/ruby/test/rss/test_to_s.rb | 670 + jni/ruby/test/rss/test_trackback.rb | 135 + jni/ruby/test/rss/test_version.rb | 9 + jni/ruby/test/rss/test_xml-stylesheet.rb | 108 + jni/ruby/test/ruby/allpairs.rb | 102 + jni/ruby/test/ruby/beginmainend.rb | 80 + jni/ruby/test/ruby/enc/test_big5.rb | 28 + jni/ruby/test/ruby/enc/test_cp949.rb | 28 + jni/ruby/test/ruby/enc/test_emoji.rb | 442 + jni/ruby/test/ruby/enc/test_euc_jp.rb | 24 + jni/ruby/test/ruby/enc/test_euc_kr.rb | 36 + jni/ruby/test/ruby/enc/test_euc_tw.rb | 28 + jni/ruby/test/ruby/enc/test_gb18030.rb | 126 + jni/ruby/test/ruby/enc/test_gbk.rb | 28 + jni/ruby/test/ruby/enc/test_iso_8859.rb | 163 + jni/ruby/test/ruby/enc/test_koi8.rb | 22 + jni/ruby/test/ruby/enc/test_shift_jis.rb | 27 + jni/ruby/test/ruby/enc/test_utf16.rb | 384 + jni/ruby/test/ruby/enc/test_utf32.rb | 93 + jni/ruby/test/ruby/enc/test_windows_1251.rb | 16 + jni/ruby/test/ruby/endblockwarn_rb | 12 + jni/ruby/test/ruby/lbtest.rb | 49 + jni/ruby/test/ruby/marshaltestlib.rb | 436 + jni/ruby/test/ruby/sentence.rb | 668 + jni/ruby/test/ruby/test_alias.rb | 196 + jni/ruby/test/ruby/test_argf.rb | 859 ++ jni/ruby/test/ruby/test_arity.rb | 69 + jni/ruby/test/ruby/test_array.rb | 2533 ++++ jni/ruby/test/ruby/test_assignment.rb | 760 + jni/ruby/test/ruby/test_autoload.rb | 207 + jni/ruby/test/ruby/test_backtrace.rb | 246 + jni/ruby/test/ruby/test_basicinstructions.rb | 700 + jni/ruby/test/ruby/test_beginendblock.rb | 190 + jni/ruby/test/ruby/test_bignum.rb | 711 + jni/ruby/test/ruby/test_call.rb | 34 + jni/ruby/test/ruby/test_case.rb | 124 + jni/ruby/test/ruby/test_class.rb | 402 + jni/ruby/test/ruby/test_clone.rb | 28 + jni/ruby/test/ruby/test_comparable.rb | 94 + jni/ruby/test/ruby/test_complex.rb | 1014 ++ jni/ruby/test/ruby/test_complex2.rb | 735 + jni/ruby/test/ruby/test_complexrational.rb | 407 + jni/ruby/test/ruby/test_condition.rb | 16 + jni/ruby/test/ruby/test_const.rb | 72 + jni/ruby/test/ruby/test_continuation.rb | 134 + jni/ruby/test/ruby/test_defined.rb | 211 + jni/ruby/test/ruby/test_dir.rb | 328 + jni/ruby/test/ruby/test_dir_m17n.rb | 389 + jni/ruby/test/ruby/test_econv.rb | 926 ++ jni/ruby/test/ruby/test_encoding.rb | 123 + jni/ruby/test/ruby/test_enum.rb | 733 + jni/ruby/test/ruby/test_enumerator.rb | 628 + jni/ruby/test/ruby/test_env.rb | 552 + jni/ruby/test/ruby/test_eval.rb | 510 + jni/ruby/test/ruby/test_exception.rb | 701 + jni/ruby/test/ruby/test_fiber.rb | 347 + jni/ruby/test/ruby/test_file.rb | 423 + jni/ruby/test/ruby/test_file_exhaustive.rb | 1238 ++ jni/ruby/test/ruby/test_fixnum.rb | 315 + jni/ruby/test/ruby/test_flip.rb | 41 + jni/ruby/test/ruby/test_float.rb | 683 + jni/ruby/test/ruby/test_fnmatch.rb | 131 + jni/ruby/test/ruby/test_gc.rb | 379 + jni/ruby/test/ruby/test_hash.rb | 1300 ++ jni/ruby/test/ruby/test_ifunless.rb | 14 + jni/ruby/test/ruby/test_integer.rb | 280 + jni/ruby/test/ruby/test_integer_comb.rb | 631 + jni/ruby/test/ruby/test_io.rb | 3171 +++++ jni/ruby/test/ruby/test_io_m17n.rb | 2566 ++++ jni/ruby/test/ruby/test_iseq.rb | 144 + jni/ruby/test/ruby/test_iterator.rb | 497 + jni/ruby/test/ruby/test_keyword.rb | 579 + jni/ruby/test/ruby/test_lambda.rb | 173 + jni/ruby/test/ruby/test_lazy_enumerator.rb | 494 + jni/ruby/test/ruby/test_literal.rb | 461 + jni/ruby/test/ruby/test_m17n.rb | 1599 +++ jni/ruby/test/ruby/test_m17n_comb.rb | 1638 +++ jni/ruby/test/ruby/test_marshal.rb | 650 + jni/ruby/test/ruby/test_math.rb | 292 + jni/ruby/test/ruby/test_metaclass.rb | 167 + jni/ruby/test/ruby/test_method.rb | 894 ++ jni/ruby/test/ruby/test_mixed_unicode_escapes.rb | 25 + jni/ruby/test/ruby/test_module.rb | 2032 +++ jni/ruby/test/ruby/test_not.rb | 12 + jni/ruby/test/ruby/test_notimp.rb | 84 + jni/ruby/test/ruby/test_numeric.rb | 366 + jni/ruby/test/ruby/test_object.rb | 861 ++ jni/ruby/test/ruby/test_objectspace.rb | 112 + jni/ruby/test/ruby/test_optimization.rb | 292 + jni/ruby/test/ruby/test_pack.rb | 730 + jni/ruby/test/ruby/test_parse.rb | 882 ++ jni/ruby/test/ruby/test_path.rb | 259 + jni/ruby/test/ruby/test_pipe.rb | 29 + jni/ruby/test/ruby/test_primitive.rb | 423 + jni/ruby/test/ruby/test_proc.rb | 1323 ++ jni/ruby/test/ruby/test_process.rb | 2023 +++ jni/ruby/test/ruby/test_rand.rb | 527 + jni/ruby/test/ruby/test_range.rb | 583 + jni/ruby/test/ruby/test_rational.rb | 927 ++ jni/ruby/test/ruby/test_rational2.rb | 1386 ++ jni/ruby/test/ruby/test_readpartial.rb | 72 + jni/ruby/test/ruby/test_refinement.rb | 1450 ++ jni/ruby/test/ruby/test_regexp.rb | 1102 ++ jni/ruby/test/ruby/test_require.rb | 704 + jni/ruby/test/ruby/test_rubyoptions.rb | 796 ++ jni/ruby/test/ruby/test_rubyvm.rb | 17 + jni/ruby/test/ruby/test_settracefunc.rb | 1355 ++ jni/ruby/test/ruby/test_signal.rb | 294 + jni/ruby/test/ruby/test_sleep.rb | 16 + jni/ruby/test/ruby/test_sprintf.rb | 412 + jni/ruby/test/ruby/test_sprintf_comb.rb | 553 + jni/ruby/test/ruby/test_string.rb | 2314 +++ jni/ruby/test/ruby/test_stringchar.rb | 181 + jni/ruby/test/ruby/test_struct.rb | 374 + jni/ruby/test/ruby/test_super.rb | 528 + jni/ruby/test/ruby/test_symbol.rb | 289 + jni/ruby/test/ruby/test_syntax.rb | 622 + jni/ruby/test/ruby/test_system.rb | 162 + jni/ruby/test/ruby/test_thread.rb | 1036 ++ jni/ruby/test/ruby/test_threadgroup.rb | 57 + jni/ruby/test/ruby/test_time.rb | 1049 ++ jni/ruby/test/ruby/test_time_tz.rb | 415 + jni/ruby/test/ruby/test_trace.rb | 61 + jni/ruby/test/ruby/test_transcode.rb | 2121 +++ jni/ruby/test/ruby/test_undef.rb | 37 + jni/ruby/test/ruby/test_unicode_escape.rb | 270 + jni/ruby/test/ruby/test_variable.rb | 121 + jni/ruby/test/ruby/test_weakmap.rb | 133 + jni/ruby/test/ruby/test_whileuntil.rb | 82 + jni/ruby/test/ruby/test_yield.rb | 393 + jni/ruby/test/ruby/ut_eof.rb | 128 + jni/ruby/test/rubygems/alternate_cert.pem | 18 + jni/ruby/test/rubygems/alternate_cert_32.pem | 18 + jni/ruby/test/rubygems/alternate_key.pem | 27 + jni/ruby/test/rubygems/bad_rake.rb | 1 + jni/ruby/test/rubygems/bogussources.rb | 8 + jni/ruby/test/rubygems/ca_cert.pem | 68 + jni/ruby/test/rubygems/child_cert.pem | 18 + jni/ruby/test/rubygems/child_cert_32.pem | 18 + jni/ruby/test/rubygems/child_key.pem | 27 + jni/ruby/test/rubygems/client.pem | 49 + jni/ruby/test/rubygems/data/gem-private_key.pem | 27 + jni/ruby/test/rubygems/data/gem-public_cert.pem | 20 + jni/ruby/test/rubygems/data/null-type.gemspec.rz | Bin 0 -> 554 bytes jni/ruby/test/rubygems/encrypted_private_key.pem | 30 + jni/ruby/test/rubygems/expired_cert.pem | 18 + jni/ruby/test/rubygems/fake_certlib/openssl.rb | 7 + jni/ruby/test/rubygems/fix_openssl_warnings.rb | 12 + jni/ruby/test/rubygems/foo/discover.rb | 0 jni/ruby/test/rubygems/future_cert.pem | 18 + jni/ruby/test/rubygems/future_cert_32.pem | 18 + jni/ruby/test/rubygems/good_rake.rb | 1 + jni/ruby/test/rubygems/grandchild_cert.pem | 18 + jni/ruby/test/rubygems/grandchild_cert_32.pem | 18 + jni/ruby/test/rubygems/grandchild_key.pem | 27 + jni/ruby/test/rubygems/invalid_client.pem | 49 + jni/ruby/test/rubygems/invalid_issuer_cert.pem | 18 + jni/ruby/test/rubygems/invalid_issuer_cert_32.pem | 18 + jni/ruby/test/rubygems/invalid_key.pem | 27 + jni/ruby/test/rubygems/invalid_signer_cert.pem | 18 + jni/ruby/test/rubygems/invalid_signer_cert_32.pem | 18 + jni/ruby/test/rubygems/invalidchild_cert.pem | 18 + jni/ruby/test/rubygems/invalidchild_cert_32.pem | 18 + jni/ruby/test/rubygems/invalidchild_key.pem | 27 + .../rubygems/plugin/exception/rubygems_plugin.rb | 2 + .../test/rubygems/plugin/load/rubygems_plugin.rb | 3 + .../plugin/standarderror/rubygems_plugin.rb | 2 + jni/ruby/test/rubygems/private_key.pem | 27 + jni/ruby/test/rubygems/public_cert.pem | 18 + jni/ruby/test/rubygems/public_cert_32.pem | 18 + jni/ruby/test/rubygems/public_key.pem | 9 + .../rubygems/rubygems/commands/crash_command.rb | 5 + jni/ruby/test/rubygems/rubygems_plugin.rb | 21 + jni/ruby/test/rubygems/sff/discover.rb | 0 jni/ruby/test/rubygems/simple_gem.rb | 66 + .../test/rubygems/specifications/bar-0.0.2.gemspec | 9 + .../test/rubygems/specifications/foo-0.0.1.gemspec | Bin 0 -> 269 bytes jni/ruby/test/rubygems/ssl_cert.pem | 19 + jni/ruby/test/rubygems/ssl_key.pem | 15 + jni/ruby/test/rubygems/test_bundled_ca.rb | 60 + jni/ruby/test/rubygems/test_config.rb | 14 + jni/ruby/test/rubygems/test_deprecate.rb | 76 + jni/ruby/test/rubygems/test_gem.rb | 1576 +++ jni/ruby/test/rubygems/test_gem_available_set.rb | 128 + jni/ruby/test/rubygems/test_gem_command.rb | 243 + jni/ruby/test/rubygems/test_gem_command_manager.rb | 263 + .../rubygems/test_gem_commands_build_command.rb | 110 + .../rubygems/test_gem_commands_cert_command.rb | 670 + .../rubygems/test_gem_commands_check_command.rb | 68 + .../rubygems/test_gem_commands_cleanup_command.rb | 167 + .../rubygems/test_gem_commands_contents_command.rb | 239 + .../test_gem_commands_dependency_command.rb | 221 + .../test_gem_commands_environment_command.rb | 153 + .../rubygems/test_gem_commands_fetch_command.rb | 126 + .../test_gem_commands_generate_index_command.rb | 50 + .../rubygems/test_gem_commands_help_command.rb | 74 + .../rubygems/test_gem_commands_install_command.rb | 997 ++ .../rubygems/test_gem_commands_list_command.rb | 33 + .../rubygems/test_gem_commands_lock_command.rb | 68 + jni/ruby/test/rubygems/test_gem_commands_mirror.rb | 32 + .../rubygems/test_gem_commands_open_command.rb | 46 + .../rubygems/test_gem_commands_outdated_command.rb | 33 + .../rubygems/test_gem_commands_owner_command.rb | 204 + .../rubygems/test_gem_commands_pristine_command.rb | 462 + .../rubygems/test_gem_commands_push_command.rb | 262 + .../rubygems/test_gem_commands_query_command.rb | 668 + .../rubygems/test_gem_commands_search_command.rb | 17 + .../rubygems/test_gem_commands_server_command.rb | 59 + .../rubygems/test_gem_commands_setup_command.rb | 136 + .../rubygems/test_gem_commands_sources_command.rb | 248 + .../test_gem_commands_specification_command.rb | 250 + .../rubygems/test_gem_commands_stale_command.rb | 40 + .../test_gem_commands_uninstall_command.rb | 281 + .../rubygems/test_gem_commands_unpack_command.rb | 210 + .../rubygems/test_gem_commands_update_command.rb | 543 + .../rubygems/test_gem_commands_which_command.rb | 85 + .../rubygems/test_gem_commands_yank_command.rb | 97 + jni/ruby/test/rubygems/test_gem_config_file.rb | 467 + jni/ruby/test/rubygems/test_gem_dependency.rb | 357 + .../test/rubygems/test_gem_dependency_installer.rb | 1208 ++ jni/ruby/test/rubygems/test_gem_dependency_list.rb | 259 + .../test_gem_dependency_resolution_error.rb | 28 + jni/ruby/test/rubygems/test_gem_doctor.rb | 168 + jni/ruby/test/rubygems/test_gem_ext_builder.rb | 334 + .../test/rubygems/test_gem_ext_cmake_builder.rb | 84 + .../rubygems/test_gem_ext_configure_builder.rb | 82 + .../test/rubygems/test_gem_ext_ext_conf_builder.rb | 206 + .../test/rubygems/test_gem_ext_rake_builder.rb | 64 + jni/ruby/test/rubygems/test_gem_gem_runner.rb | 68 + .../test/rubygems/test_gem_gemcutter_utilities.rb | 234 + .../test_gem_impossible_dependencies_error.rb | 61 + jni/ruby/test/rubygems/test_gem_indexer.rb | 366 + .../rubygems/test_gem_install_update_options.rb | 184 + jni/ruby/test/rubygems/test_gem_installer.rb | 1533 ++ .../test/rubygems/test_gem_local_remote_options.rb | 133 + jni/ruby/test/rubygems/test_gem_name_tuple.rb | 44 + jni/ruby/test/rubygems/test_gem_package.rb | 824 ++ jni/ruby/test/rubygems/test_gem_package_old.rb | 89 + .../test/rubygems/test_gem_package_tar_header.rb | 146 + .../test/rubygems/test_gem_package_tar_reader.rb | 89 + .../rubygems/test_gem_package_tar_reader_entry.rb | 134 + .../test/rubygems/test_gem_package_tar_writer.rb | 254 + jni/ruby/test/rubygems/test_gem_package_task.rb | 80 + jni/ruby/test/rubygems/test_gem_path_support.rb | 84 + jni/ruby/test/rubygems/test_gem_platform.rb | 296 + jni/ruby/test/rubygems/test_gem_rdoc.rb | 269 + jni/ruby/test/rubygems/test_gem_remote_fetcher.rb | 987 ++ jni/ruby/test/rubygems/test_gem_request.rb | 362 + .../rubygems/test_gem_request_connection_pools.rb | 120 + jni/ruby/test/rubygems/test_gem_request_set.rb | 597 + .../test_gem_request_set_gem_dependency_api.rb | 823 ++ .../test/rubygems/test_gem_request_set_lockfile.rb | 1276 ++ jni/ruby/test/rubygems/test_gem_requirement.rb | 376 + jni/ruby/test/rubygems/test_gem_resolver.rb | 733 + .../test_gem_resolver_activation_request.rb | 73 + .../test/rubygems/test_gem_resolver_api_set.rb | 208 + .../test_gem_resolver_api_specification.rb | 144 + .../test/rubygems/test_gem_resolver_best_set.rb | 137 + .../rubygems/test_gem_resolver_composed_set.rb | 45 + .../test/rubygems/test_gem_resolver_conflict.rb | 87 + .../test_gem_resolver_dependency_request.rb | 84 + .../test/rubygems/test_gem_resolver_git_set.rb | 189 + .../test_gem_resolver_git_specification.rb | 112 + .../test/rubygems/test_gem_resolver_index_set.rb | 89 + .../test_gem_resolver_index_specification.rb | 89 + .../test_gem_resolver_installed_specification.rb | 49 + .../rubygems/test_gem_resolver_installer_set.rb | 261 + .../test_gem_resolver_local_specification.rb | 45 + .../test/rubygems/test_gem_resolver_lock_set.rb | 63 + .../test_gem_resolver_lock_specification.rb | 98 + .../rubygems/test_gem_resolver_requirement_list.rb | 20 + .../rubygems/test_gem_resolver_specification.rb | 64 + .../test/rubygems/test_gem_resolver_vendor_set.rb | 83 + .../test_gem_resolver_vendor_specification.rb | 83 + jni/ruby/test/rubygems/test_gem_security.rb | 306 + jni/ruby/test/rubygems/test_gem_security_policy.rb | 540 + jni/ruby/test/rubygems/test_gem_security_signer.rb | 208 + .../test/rubygems/test_gem_security_trust_dir.rb | 98 + jni/ruby/test/rubygems/test_gem_server.rb | 404 + jni/ruby/test/rubygems/test_gem_silent_ui.rb | 116 + jni/ruby/test/rubygems/test_gem_source.rb | 241 + .../test/rubygems/test_gem_source_fetch_problem.rb | 19 + jni/ruby/test/rubygems/test_gem_source_git.rb | 308 + .../test/rubygems/test_gem_source_installed.rb | 36 + jni/ruby/test/rubygems/test_gem_source_list.rb | 111 + jni/ruby/test/rubygems/test_gem_source_local.rb | 106 + jni/ruby/test/rubygems/test_gem_source_lock.rb | 114 + .../test/rubygems/test_gem_source_specific_file.rb | 75 + jni/ruby/test/rubygems/test_gem_source_vendor.rb | 31 + jni/ruby/test/rubygems/test_gem_spec_fetcher.rb | 310 + jni/ruby/test/rubygems/test_gem_specification.rb | 3138 +++++ jni/ruby/test/rubygems/test_gem_stream_ui.rb | 238 + .../test/rubygems/test_gem_stub_specification.rb | 199 + jni/ruby/test/rubygems/test_gem_text.rb | 74 + jni/ruby/test/rubygems/test_gem_uninstaller.rb | 483 + .../test_gem_unsatisfiable_dependency_error.rb | 32 + jni/ruby/test/rubygems/test_gem_uri_formatter.rb | 28 + jni/ruby/test/rubygems/test_gem_util.rb | 31 + jni/ruby/test/rubygems/test_gem_validator.rb | 45 + jni/ruby/test/rubygems/test_gem_version.rb | 213 + jni/ruby/test/rubygems/test_gem_version_option.rb | 151 + jni/ruby/test/rubygems/test_kernel.rb | 85 + jni/ruby/test/rubygems/test_require.rb | 275 + jni/ruby/test/rubygems/wrong_key_cert.pem | 18 + jni/ruby/test/rubygems/wrong_key_cert_32.pem | 18 + jni/ruby/test/runner.rb | 45 + jni/ruby/test/scanf/data.txt | 6 + jni/ruby/test/scanf/test_scanf.rb | 303 + jni/ruby/test/scanf/test_scanfblocks.rb | 81 + jni/ruby/test/scanf/test_scanfio.rb | 20 + jni/ruby/test/sdbm/test_sdbm.rb | 541 + jni/ruby/test/shell/test_command_processor.rb | 68 + jni/ruby/test/socket/test_addrinfo.rb | 651 + jni/ruby/test/socket/test_ancdata.rb | 66 + jni/ruby/test/socket/test_basicsocket.rb | 88 + jni/ruby/test/socket/test_nonblock.rb | 297 + jni/ruby/test/socket/test_socket.rb | 654 + jni/ruby/test/socket/test_sockopt.rb | 65 + jni/ruby/test/socket/test_tcp.rb | 79 + jni/ruby/test/socket/test_udp.rb | 72 + jni/ruby/test/socket/test_unix.rb | 666 + jni/ruby/test/stringio/test_stringio.rb | 589 + jni/ruby/test/strscan/test_stringscanner.rb | 720 + jni/ruby/test/syslog/test_syslog_logger.rb | 572 + jni/ruby/test/test_abbrev.rb | 54 + jni/ruby/test/test_cmath.rb | 16 + jni/ruby/test/test_delegate.rb | 240 + jni/ruby/test/test_find.rb | 301 + jni/ruby/test/test_ipaddr.rb | 271 + jni/ruby/test/test_mathn.rb | 119 + jni/ruby/test/test_mutex_m.rb | 26 + jni/ruby/test/test_open3.rb | 268 + jni/ruby/test/test_pp.rb | 195 + jni/ruby/test/test_prettyprint.rb | 519 + jni/ruby/test/test_prime.rb | 174 + jni/ruby/test/test_pstore.rb | 144 + jni/ruby/test/test_pty.rb | 241 + jni/ruby/test/test_rbconfig.rb | 53 + jni/ruby/test/test_securerandom.rb | 185 + jni/ruby/test/test_set.rb | 697 + jni/ruby/test/test_shellwords.rb | 61 + jni/ruby/test/test_singleton.rb | 103 + jni/ruby/test/test_syslog.rb | 189 + jni/ruby/test/test_tempfile.rb | 343 + jni/ruby/test/test_time.rb | 500 + jni/ruby/test/test_timeout.rb | 100 + jni/ruby/test/test_tmpdir.rb | 39 + jni/ruby/test/test_tracer.rb | 60 + jni/ruby/test/test_tsort.rb | 113 + jni/ruby/test/test_unicode_normalize.rb | 184 + jni/ruby/test/test_weakref.rb | 71 + jni/ruby/test/test_win32api.rb | 23 + jni/ruby/test/testunit/test4test_hideskip.rb | 9 + jni/ruby/test/testunit/test4test_redefinition.rb | 13 + jni/ruby/test/testunit/test4test_sorting.rb | 17 + jni/ruby/test/testunit/test_assertion.rb | 8 + jni/ruby/test/testunit/test_hideskip.rb | 16 + jni/ruby/test/testunit/test_parallel.rb | 191 + jni/ruby/test/testunit/test_rake_integration.rb | 35 + jni/ruby/test/testunit/test_redefinition.rb | 15 + jni/ruby/test/testunit/test_sorting.rb | 17 + .../testunit/tests_for_parallel/ptest_first.rb | 7 + .../testunit/tests_for_parallel/ptest_forth.rb | 29 + .../testunit/tests_for_parallel/ptest_second.rb | 11 + .../testunit/tests_for_parallel/ptest_third.rb | 10 + .../test/testunit/tests_for_parallel/runner.rb | 13 + jni/ruby/test/thread/test_cv.rb | 221 + jni/ruby/test/thread/test_queue.rb | 280 + jni/ruby/test/thread/test_sync.rb | 63 + jni/ruby/test/uri/test_common.rb | 174 + jni/ruby/test/uri/test_ftp.rb | 66 + jni/ruby/test/uri/test_generic.rb | 847 ++ jni/ruby/test/uri/test_http.rb | 64 + jni/ruby/test/uri/test_ldap.rb | 100 + jni/ruby/test/uri/test_mailto.rb | 136 + jni/ruby/test/uri/test_parser.rb | 47 + jni/ruby/test/webrick/.htaccess | 1 + jni/ruby/test/webrick/test_cgi.rb | 151 + jni/ruby/test/webrick/test_cookie.rb | 131 + jni/ruby/test/webrick/test_filehandler.rb | 309 + jni/ruby/test/webrick/test_htmlutils.rb | 20 + jni/ruby/test/webrick/test_httpauth.rb | 198 + jni/ruby/test/webrick/test_httpproxy.rb | 284 + jni/ruby/test/webrick/test_httprequest.rb | 411 + jni/ruby/test/webrick/test_httpresponse.rb | 149 + jni/ruby/test/webrick/test_httpserver.rb | 412 + jni/ruby/test/webrick/test_httputils.rb | 100 + jni/ruby/test/webrick/test_httpversion.rb | 40 + jni/ruby/test/webrick/test_server.rb | 131 + jni/ruby/test/webrick/test_utils.rb | 64 + jni/ruby/test/webrick/utils.rb | 70 + jni/ruby/test/webrick/webrick.cgi | 36 + jni/ruby/test/webrick/webrick_long_filename.cgi | 36 + jni/ruby/test/win32ole/err_in_callback.rb | 9 + jni/ruby/test/win32ole/orig_data.csv | 5 + jni/ruby/test/win32ole/test_err_in_callback.rb | 55 + .../test/win32ole/test_folderitem2_invokeverb.rb | 65 + jni/ruby/test/win32ole/test_nil2vtempty.rb | 36 + jni/ruby/test/win32ole/test_ole_methods.rb | 36 + jni/ruby/test/win32ole/test_propertyputref.rb | 30 + jni/ruby/test/win32ole/test_thread.rb | 33 + jni/ruby/test/win32ole/test_win32ole.rb | 564 + jni/ruby/test/win32ole/test_win32ole_event.rb | 391 + jni/ruby/test/win32ole/test_win32ole_method.rb | 146 + jni/ruby/test/win32ole/test_win32ole_param.rb | 106 + jni/ruby/test/win32ole/test_win32ole_record.rb | 313 + jni/ruby/test/win32ole/test_win32ole_type.rb | 249 + jni/ruby/test/win32ole/test_win32ole_typelib.rb | 116 + jni/ruby/test/win32ole/test_win32ole_variable.rb | 61 + jni/ruby/test/win32ole/test_win32ole_variant.rb | 725 + jni/ruby/test/win32ole/test_win32ole_variant_m.rb | 35 + .../test/win32ole/test_win32ole_variant_outarg.rb | 68 + jni/ruby/test/win32ole/test_word.rb | 71 + jni/ruby/test/xmlrpc/data/blog.xml | 18 + jni/ruby/test/xmlrpc/data/bug_bool.expected | 3 + jni/ruby/test/xmlrpc/data/bug_bool.xml | 8 + jni/ruby/test/xmlrpc/data/bug_cdata.expected | 3 + jni/ruby/test/xmlrpc/data/bug_cdata.xml | 8 + jni/ruby/test/xmlrpc/data/bug_covert.expected | 10 + jni/ruby/test/xmlrpc/data/bug_covert.xml | 6 + jni/ruby/test/xmlrpc/data/datetime_iso8601.xml | 8 + jni/ruby/test/xmlrpc/data/fault.xml | 16 + jni/ruby/test/xmlrpc/data/value.expected | 7 + jni/ruby/test/xmlrpc/data/value.xml | 22 + jni/ruby/test/xmlrpc/data/xml1.expected | 243 + jni/ruby/test/xmlrpc/data/xml1.xml | 1 + jni/ruby/test/xmlrpc/htpasswd | 2 + jni/ruby/test/xmlrpc/test_client.rb | 317 + jni/ruby/test/xmlrpc/test_cookie.rb | 96 + jni/ruby/test/xmlrpc/test_datetime.rb | 161 + jni/ruby/test/xmlrpc/test_features.rb | 50 + jni/ruby/test/xmlrpc/test_marshal.rb | 110 + jni/ruby/test/xmlrpc/test_parser.rb | 93 + jni/ruby/test/xmlrpc/test_webrick_server.rb | 135 + jni/ruby/test/xmlrpc/webrick_testing.rb | 55 + jni/ruby/test/zlib/test_zlib.rb | 1094 ++ 1110 files changed, 268613 insertions(+) create mode 100644 jni/ruby/test/-ext-/array/test_resize.rb create mode 100644 jni/ruby/test/-ext-/bignum/test_big2str.rb create mode 100644 jni/ruby/test/-ext-/bignum/test_bigzero.rb create mode 100644 jni/ruby/test/-ext-/bignum/test_div.rb create mode 100644 jni/ruby/test/-ext-/bignum/test_mul.rb create mode 100644 jni/ruby/test/-ext-/bignum/test_pack.rb create mode 100644 jni/ruby/test/-ext-/bignum/test_str2big.rb create mode 100644 jni/ruby/test/-ext-/bug_reporter/test_bug_reporter.rb create mode 100644 jni/ruby/test/-ext-/class/test_class2name.rb create mode 100644 jni/ruby/test/-ext-/debug/test_debug.rb create mode 100644 jni/ruby/test/-ext-/debug/test_profile_frames.rb create mode 100644 jni/ruby/test/-ext-/exception/test_data_error.rb create mode 100644 jni/ruby/test/-ext-/exception/test_enc_raise.rb create mode 100644 jni/ruby/test/-ext-/exception/test_ensured.rb create mode 100644 jni/ruby/test/-ext-/file/test_stat.rb create mode 100644 jni/ruby/test/-ext-/float/test_nextafter.rb create mode 100644 jni/ruby/test/-ext-/funcall/test_passing_block.rb create mode 100644 jni/ruby/test/-ext-/hash/test_delete.rb create mode 100644 jni/ruby/test/-ext-/iseq_load/test_iseq_load.rb create mode 100644 jni/ruby/test/-ext-/iter/test_iter_break.rb create mode 100644 jni/ruby/test/-ext-/iter/test_yield_block.rb create mode 100644 jni/ruby/test/-ext-/load/test_dot_dot.rb create mode 100644 jni/ruby/test/-ext-/marshal/test_usrmarshal.rb create mode 100644 jni/ruby/test/-ext-/method/test_arity.rb create mode 100644 jni/ruby/test/-ext-/num2int/test_num2int.rb create mode 100644 jni/ruby/test/-ext-/path_to_class/test_path_to_class.rb create mode 100644 jni/ruby/test/-ext-/postponed_job/test_postponed_job.rb create mode 100644 jni/ruby/test/-ext-/proc/test_bmethod.rb create mode 100644 jni/ruby/test/-ext-/rational/test_rat.rb create mode 100644 jni/ruby/test/-ext-/st/test_foreach.rb create mode 100644 jni/ruby/test/-ext-/st/test_numhash.rb create mode 100644 jni/ruby/test/-ext-/st/test_update.rb create mode 100644 jni/ruby/test/-ext-/string/test_coderange.rb create mode 100644 jni/ruby/test/-ext-/string/test_cstr.rb create mode 100644 jni/ruby/test/-ext-/string/test_ellipsize.rb create mode 100644 jni/ruby/test/-ext-/string/test_enc_associate.rb create mode 100644 jni/ruby/test/-ext-/string/test_enc_str_buf_cat.rb create mode 100644 jni/ruby/test/-ext-/string/test_modify_expand.rb create mode 100644 jni/ruby/test/-ext-/string/test_nofree.rb create mode 100644 jni/ruby/test/-ext-/string/test_normalize.rb create mode 100644 jni/ruby/test/-ext-/string/test_qsort.rb create mode 100644 jni/ruby/test/-ext-/string/test_set_len.rb create mode 100644 jni/ruby/test/-ext-/struct/test_member.rb create mode 100644 jni/ruby/test/-ext-/symbol/test_inadvertent_creation.rb create mode 100644 jni/ruby/test/-ext-/symbol/test_type.rb create mode 100644 jni/ruby/test/-ext-/test_bug-3571.rb create mode 100644 jni/ruby/test/-ext-/test_bug-3662.rb create mode 100644 jni/ruby/test/-ext-/test_bug-5832.rb create mode 100644 jni/ruby/test/-ext-/test_printf.rb create mode 100644 jni/ruby/test/-ext-/test_recursion.rb create mode 100644 jni/ruby/test/-ext-/tracepoint/test_tracepoint.rb create mode 100644 jni/ruby/test/-ext-/typeddata/test_typeddata.rb create mode 100644 jni/ruby/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb create mode 100644 jni/ruby/test/-ext-/win32/test_console_attr.rb create mode 100644 jni/ruby/test/-ext-/win32/test_dln.rb create mode 100644 jni/ruby/test/-ext-/win32/test_fd_setsize.rb create mode 100644 jni/ruby/test/base64/test_base64.rb create mode 100644 jni/ruby/test/benchmark/test_benchmark.rb create mode 100644 jni/ruby/test/bigdecimal/test_bigdecimal.rb create mode 100644 jni/ruby/test/bigdecimal/test_bigdecimal_util.rb create mode 100644 jni/ruby/test/bigdecimal/test_bigmath.rb create mode 100644 jni/ruby/test/bigdecimal/testbase.rb create mode 100644 jni/ruby/test/cgi/test_cgi_cookie.rb create mode 100644 jni/ruby/test/cgi/test_cgi_core.rb create mode 100644 jni/ruby/test/cgi/test_cgi_header.rb create mode 100644 jni/ruby/test/cgi/test_cgi_modruby.rb create mode 100644 jni/ruby/test/cgi/test_cgi_multipart.rb create mode 100644 jni/ruby/test/cgi/test_cgi_session.rb create mode 100644 jni/ruby/test/cgi/test_cgi_tag_helper.rb create mode 100644 jni/ruby/test/cgi/test_cgi_util.rb create mode 100644 jni/ruby/test/cgi/testdata/file1.html create mode 100644 jni/ruby/test/cgi/testdata/large.png create mode 100644 jni/ruby/test/cgi/testdata/small.png create mode 100644 jni/ruby/test/coverage/test_coverage.rb create mode 100644 jni/ruby/test/csv/base.rb create mode 100644 jni/ruby/test/csv/line_endings.gz create mode 100755 jni/ruby/test/csv/test_csv_parsing.rb create mode 100755 jni/ruby/test/csv/test_csv_writing.rb create mode 100755 jni/ruby/test/csv/test_data_converters.rb create mode 100755 jni/ruby/test/csv/test_encodings.rb create mode 100755 jni/ruby/test/csv/test_features.rb create mode 100755 jni/ruby/test/csv/test_headers.rb create mode 100755 jni/ruby/test/csv/test_interface.rb create mode 100755 jni/ruby/test/csv/test_row.rb create mode 100755 jni/ruby/test/csv/test_table.rb create mode 100644 jni/ruby/test/csv/ts_all.rb create mode 100644 jni/ruby/test/date/test_date.rb create mode 100644 jni/ruby/test/date/test_date_arith.rb create mode 100644 jni/ruby/test/date/test_date_attr.rb create mode 100644 jni/ruby/test/date/test_date_base.rb create mode 100644 jni/ruby/test/date/test_date_compat.rb create mode 100644 jni/ruby/test/date/test_date_conv.rb create mode 100644 jni/ruby/test/date/test_date_marshal.rb create mode 100644 jni/ruby/test/date/test_date_new.rb create mode 100644 jni/ruby/test/date/test_date_parse.rb create mode 100644 jni/ruby/test/date/test_date_strftime.rb create mode 100644 jni/ruby/test/date/test_date_strptime.rb create mode 100644 jni/ruby/test/date/test_switch_hitter.rb create mode 100644 jni/ruby/test/dbm/test_dbm.rb create mode 100644 jni/ruby/test/digest/digest/foo.rb create mode 100644 jni/ruby/test/digest/test_digest.rb create mode 100644 jni/ruby/test/digest/test_digest_extend.rb create mode 100644 jni/ruby/test/drb/drbtest.rb create mode 100644 jni/ruby/test/drb/ignore_test_drb.rb create mode 100644 jni/ruby/test/drb/test_acl.rb create mode 100644 jni/ruby/test/drb/test_drb.rb create mode 100644 jni/ruby/test/drb/test_drbssl.rb create mode 100644 jni/ruby/test/drb/test_drbunix.rb create mode 100644 jni/ruby/test/drb/ut_array.rb create mode 100644 jni/ruby/test/drb/ut_array_drbssl.rb create mode 100644 jni/ruby/test/drb/ut_array_drbunix.rb create mode 100644 jni/ruby/test/drb/ut_drb.rb create mode 100644 jni/ruby/test/drb/ut_drb_drbssl.rb create mode 100644 jni/ruby/test/drb/ut_drb_drbunix.rb create mode 100644 jni/ruby/test/drb/ut_eq.rb create mode 100644 jni/ruby/test/drb/ut_eval.rb create mode 100644 jni/ruby/test/drb/ut_large.rb create mode 100644 jni/ruby/test/drb/ut_port.rb create mode 100644 jni/ruby/test/drb/ut_safe1.rb create mode 100644 jni/ruby/test/drb/ut_timerholder.rb create mode 100644 jni/ruby/test/dtrace/dummy.rb create mode 100644 jni/ruby/test/dtrace/helper.rb create mode 100644 jni/ruby/test/dtrace/test_array_create.rb create mode 100644 jni/ruby/test/dtrace/test_cmethod.rb create mode 100644 jni/ruby/test/dtrace/test_function_entry.rb create mode 100644 jni/ruby/test/dtrace/test_gc.rb create mode 100644 jni/ruby/test/dtrace/test_hash_create.rb create mode 100644 jni/ruby/test/dtrace/test_load.rb create mode 100644 jni/ruby/test/dtrace/test_method_cache.rb create mode 100644 jni/ruby/test/dtrace/test_object_create_start.rb create mode 100644 jni/ruby/test/dtrace/test_raise.rb create mode 100644 jni/ruby/test/dtrace/test_require.rb create mode 100644 jni/ruby/test/dtrace/test_singleton_function.rb create mode 100644 jni/ruby/test/dtrace/test_string.rb create mode 100644 jni/ruby/test/erb/hello.erb create mode 100644 jni/ruby/test/erb/test_erb.rb create mode 100644 jni/ruby/test/erb/test_erb_command.rb create mode 100644 jni/ruby/test/erb/test_erb_m17n.rb create mode 100644 jni/ruby/test/etc/test_etc.rb create mode 100644 jni/ruby/test/fiddle/helper.rb create mode 100644 jni/ruby/test/fiddle/test_c_struct_entry.rb create mode 100644 jni/ruby/test/fiddle/test_c_union_entity.rb create mode 100644 jni/ruby/test/fiddle/test_closure.rb create mode 100644 jni/ruby/test/fiddle/test_cparser.rb create mode 100644 jni/ruby/test/fiddle/test_fiddle.rb create mode 100644 jni/ruby/test/fiddle/test_func.rb create mode 100644 jni/ruby/test/fiddle/test_function.rb create mode 100644 jni/ruby/test/fiddle/test_handle.rb create mode 100644 jni/ruby/test/fiddle/test_import.rb create mode 100644 jni/ruby/test/fiddle/test_pointer.rb create mode 100644 jni/ruby/test/fileutils/clobber.rb create mode 100644 jni/ruby/test/fileutils/fileasserts.rb create mode 100644 jni/ruby/test/fileutils/test_dryrun.rb create mode 100644 jni/ruby/test/fileutils/test_fileutils.rb create mode 100644 jni/ruby/test/fileutils/test_nowrite.rb create mode 100644 jni/ruby/test/fileutils/test_verbose.rb create mode 100644 jni/ruby/test/fileutils/visibility_tests.rb create mode 100644 jni/ruby/test/gdbm/test_gdbm.rb create mode 100644 jni/ruby/test/io/console/test_io_console.rb create mode 100644 jni/ruby/test/io/nonblock/test_flush.rb create mode 100644 jni/ruby/test/io/wait/test_io_wait.rb create mode 100644 jni/ruby/test/irb/test_completion.rb create mode 100644 jni/ruby/test/irb/test_option.rb create mode 100644 jni/ruby/test/irb/test_raise_no_backtrace_exception.rb create mode 100644 jni/ruby/test/json/fixtures/fail1.json create mode 100644 jni/ruby/test/json/fixtures/fail10.json create mode 100644 jni/ruby/test/json/fixtures/fail11.json create mode 100644 jni/ruby/test/json/fixtures/fail12.json create mode 100644 jni/ruby/test/json/fixtures/fail13.json create mode 100644 jni/ruby/test/json/fixtures/fail14.json create mode 100644 jni/ruby/test/json/fixtures/fail18.json create mode 100644 jni/ruby/test/json/fixtures/fail19.json create mode 100644 jni/ruby/test/json/fixtures/fail2.json create mode 100644 jni/ruby/test/json/fixtures/fail20.json create mode 100644 jni/ruby/test/json/fixtures/fail21.json create mode 100644 jni/ruby/test/json/fixtures/fail22.json create mode 100644 jni/ruby/test/json/fixtures/fail23.json create mode 100644 jni/ruby/test/json/fixtures/fail24.json create mode 100644 jni/ruby/test/json/fixtures/fail25.json create mode 100644 jni/ruby/test/json/fixtures/fail27.json create mode 100644 jni/ruby/test/json/fixtures/fail28.json create mode 100644 jni/ruby/test/json/fixtures/fail3.json create mode 100644 jni/ruby/test/json/fixtures/fail4.json create mode 100644 jni/ruby/test/json/fixtures/fail5.json create mode 100644 jni/ruby/test/json/fixtures/fail6.json create mode 100644 jni/ruby/test/json/fixtures/fail7.json create mode 100644 jni/ruby/test/json/fixtures/fail8.json create mode 100644 jni/ruby/test/json/fixtures/fail9.json create mode 100644 jni/ruby/test/json/fixtures/pass1.json create mode 100644 jni/ruby/test/json/fixtures/pass15.json create mode 100644 jni/ruby/test/json/fixtures/pass16.json create mode 100644 jni/ruby/test/json/fixtures/pass17.json create mode 100644 jni/ruby/test/json/fixtures/pass2.json create mode 100644 jni/ruby/test/json/fixtures/pass26.json create mode 100644 jni/ruby/test/json/fixtures/pass3.json create mode 100644 jni/ruby/test/json/setup_variant.rb create mode 100755 jni/ruby/test/json/test_json.rb create mode 100755 jni/ruby/test/json/test_json_addition.rb create mode 100644 jni/ruby/test/json/test_json_encoding.rb create mode 100755 jni/ruby/test/json/test_json_fixtures.rb create mode 100755 jni/ruby/test/json/test_json_generate.rb create mode 100644 jni/ruby/test/json/test_json_generic_object.rb create mode 100644 jni/ruby/test/json/test_json_string_matching.rb create mode 100755 jni/ruby/test/json/test_json_unicode.rb create mode 100644 jni/ruby/test/lib/envutil.rb create mode 100644 jni/ruby/test/lib/find_executable.rb create mode 100644 jni/ruby/test/lib/leakchecker.rb create mode 100644 jni/ruby/test/lib/memory_status.rb create mode 100644 jni/ruby/test/lib/minitest/README.txt create mode 100644 jni/ruby/test/lib/minitest/autorun.rb create mode 100644 jni/ruby/test/lib/minitest/benchmark.rb create mode 100644 jni/ruby/test/lib/minitest/mock.rb create mode 100644 jni/ruby/test/lib/minitest/unit.rb create mode 100644 jni/ruby/test/lib/profile_test_all.rb create mode 100644 jni/ruby/test/lib/test/unit.rb create mode 100644 jni/ruby/test/lib/test/unit/assertions.rb create mode 100644 jni/ruby/test/lib/test/unit/parallel.rb create mode 100644 jni/ruby/test/lib/test/unit/testcase.rb create mode 100644 jni/ruby/test/lib/tracepointchecker.rb create mode 100644 jni/ruby/test/lib/with_different_ofs.rb create mode 100644 jni/ruby/test/logger/test_logdevice.rb create mode 100644 jni/ruby/test/logger/test_logger.rb create mode 100644 jni/ruby/test/logger/test_severity.rb create mode 100644 jni/ruby/test/matrix/test_matrix.rb create mode 100644 jni/ruby/test/matrix/test_vector.rb create mode 100644 jni/ruby/test/minitest/metametameta.rb create mode 100644 jni/ruby/test/minitest/test_minitest_benchmark.rb create mode 100644 jni/ruby/test/minitest/test_minitest_mock.rb create mode 100644 jni/ruby/test/minitest/test_minitest_unit.rb create mode 100644 jni/ruby/test/misc/test_ruby_mode.rb create mode 100644 jni/ruby/test/mkmf/base.rb create mode 100644 jni/ruby/test/mkmf/test_config.rb create mode 100644 jni/ruby/test/mkmf/test_constant.rb create mode 100644 jni/ruby/test/mkmf/test_convertible.rb create mode 100644 jni/ruby/test/mkmf/test_find_executable.rb create mode 100644 jni/ruby/test/mkmf/test_flags.rb create mode 100644 jni/ruby/test/mkmf/test_framework.rb create mode 100644 jni/ruby/test/mkmf/test_have_func.rb create mode 100644 jni/ruby/test/mkmf/test_have_library.rb create mode 100644 jni/ruby/test/mkmf/test_have_macro.rb create mode 100644 jni/ruby/test/mkmf/test_libs.rb create mode 100644 jni/ruby/test/mkmf/test_signedness.rb create mode 100644 jni/ruby/test/mkmf/test_sizeof.rb create mode 100644 jni/ruby/test/monitor/test_monitor.rb create mode 100644 jni/ruby/test/net/ftp/test_buffered_socket.rb create mode 100644 jni/ruby/test/net/ftp/test_ftp.rb create mode 100644 jni/ruby/test/net/http/test_buffered_io.rb create mode 100644 jni/ruby/test/net/http/test_http.rb create mode 100644 jni/ruby/test/net/http/test_http_request.rb create mode 100644 jni/ruby/test/net/http/test_httpheader.rb create mode 100644 jni/ruby/test/net/http/test_httpresponse.rb create mode 100644 jni/ruby/test/net/http/test_httpresponses.rb create mode 100644 jni/ruby/test/net/http/test_https.rb create mode 100644 jni/ruby/test/net/http/test_https_proxy.rb create mode 100644 jni/ruby/test/net/http/utils.rb create mode 100644 jni/ruby/test/net/imap/Makefile create mode 100644 jni/ruby/test/net/imap/cacert.pem create mode 100644 jni/ruby/test/net/imap/server.crt create mode 100644 jni/ruby/test/net/imap/server.key create mode 100644 jni/ruby/test/net/imap/test_imap.rb create mode 100644 jni/ruby/test/net/imap/test_imap_response_parser.rb create mode 100644 jni/ruby/test/net/pop/test_pop.rb create mode 100644 jni/ruby/test/net/protocol/test_protocol.rb create mode 100644 jni/ruby/test/net/smtp/test_response.rb create mode 100644 jni/ruby/test/net/smtp/test_smtp.rb create mode 100644 jni/ruby/test/net/smtp/test_ssl_socket.rb create mode 100644 jni/ruby/test/nkf/test_kconv.rb create mode 100644 jni/ruby/test/nkf/test_nkf.rb create mode 100644 jni/ruby/test/objspace/test_objspace.rb create mode 100644 jni/ruby/test/open-uri/test_open-uri.rb create mode 100644 jni/ruby/test/open-uri/test_ssl.rb create mode 100644 jni/ruby/test/openssl/test_asn1.rb create mode 100644 jni/ruby/test/openssl/test_bn.rb create mode 100644 jni/ruby/test/openssl/test_buffering.rb create mode 100644 jni/ruby/test/openssl/test_cipher.rb create mode 100644 jni/ruby/test/openssl/test_config.rb create mode 100644 jni/ruby/test/openssl/test_digest.rb create mode 100644 jni/ruby/test/openssl/test_engine.rb create mode 100644 jni/ruby/test/openssl/test_fips.rb create mode 100644 jni/ruby/test/openssl/test_hmac.rb create mode 100644 jni/ruby/test/openssl/test_ns_spki.rb create mode 100644 jni/ruby/test/openssl/test_ocsp.rb create mode 100644 jni/ruby/test/openssl/test_pair.rb create mode 100644 jni/ruby/test/openssl/test_partial_record_read.rb create mode 100644 jni/ruby/test/openssl/test_pkcs12.rb create mode 100644 jni/ruby/test/openssl/test_pkcs5.rb create mode 100644 jni/ruby/test/openssl/test_pkcs7.rb create mode 100644 jni/ruby/test/openssl/test_pkey_dh.rb create mode 100644 jni/ruby/test/openssl/test_pkey_dsa.rb create mode 100644 jni/ruby/test/openssl/test_pkey_ec.rb create mode 100644 jni/ruby/test/openssl/test_pkey_rsa.rb create mode 100644 jni/ruby/test/openssl/test_ssl.rb create mode 100644 jni/ruby/test/openssl/test_ssl_session.rb create mode 100644 jni/ruby/test/openssl/test_x509cert.rb create mode 100644 jni/ruby/test/openssl/test_x509crl.rb create mode 100644 jni/ruby/test/openssl/test_x509ext.rb create mode 100644 jni/ruby/test/openssl/test_x509name.rb create mode 100644 jni/ruby/test/openssl/test_x509req.rb create mode 100644 jni/ruby/test/openssl/test_x509store.rb create mode 100644 jni/ruby/test/openssl/utils.rb create mode 100644 jni/ruby/test/optparse/test_acceptable.rb create mode 100644 jni/ruby/test/optparse/test_autoconf.rb create mode 100644 jni/ruby/test/optparse/test_bash_completion.rb create mode 100644 jni/ruby/test/optparse/test_getopts.rb create mode 100644 jni/ruby/test/optparse/test_noarg.rb create mode 100644 jni/ruby/test/optparse/test_optarg.rb create mode 100644 jni/ruby/test/optparse/test_optparse.rb create mode 100644 jni/ruby/test/optparse/test_placearg.rb create mode 100644 jni/ruby/test/optparse/test_reqarg.rb create mode 100644 jni/ruby/test/optparse/test_summary.rb create mode 100644 jni/ruby/test/optparse/test_zsh_completion.rb create mode 100644 jni/ruby/test/ostruct/test_ostruct.rb create mode 100644 jni/ruby/test/pathname/test_pathname.rb create mode 100644 jni/ruby/test/psych/handlers/test_recorder.rb create mode 100644 jni/ruby/test/psych/helper.rb create mode 100644 jni/ruby/test/psych/json/test_stream.rb create mode 100644 jni/ruby/test/psych/nodes/test_enumerable.rb create mode 100644 jni/ruby/test/psych/test_alias_and_anchor.rb create mode 100644 jni/ruby/test/psych/test_array.rb create mode 100644 jni/ruby/test/psych/test_boolean.rb create mode 100644 jni/ruby/test/psych/test_class.rb create mode 100644 jni/ruby/test/psych/test_coder.rb create mode 100644 jni/ruby/test/psych/test_date_time.rb create mode 100644 jni/ruby/test/psych/test_deprecated.rb create mode 100644 jni/ruby/test/psych/test_document.rb create mode 100644 jni/ruby/test/psych/test_emitter.rb create mode 100644 jni/ruby/test/psych/test_encoding.rb create mode 100644 jni/ruby/test/psych/test_exception.rb create mode 100644 jni/ruby/test/psych/test_hash.rb create mode 100644 jni/ruby/test/psych/test_json_tree.rb create mode 100644 jni/ruby/test/psych/test_marshalable.rb create mode 100644 jni/ruby/test/psych/test_merge_keys.rb create mode 100644 jni/ruby/test/psych/test_nil.rb create mode 100644 jni/ruby/test/psych/test_null.rb create mode 100644 jni/ruby/test/psych/test_numeric.rb create mode 100644 jni/ruby/test/psych/test_object.rb create mode 100644 jni/ruby/test/psych/test_object_references.rb create mode 100644 jni/ruby/test/psych/test_omap.rb create mode 100644 jni/ruby/test/psych/test_parser.rb create mode 100644 jni/ruby/test/psych/test_psych.rb create mode 100644 jni/ruby/test/psych/test_safe_load.rb create mode 100644 jni/ruby/test/psych/test_scalar.rb create mode 100644 jni/ruby/test/psych/test_scalar_scanner.rb create mode 100644 jni/ruby/test/psych/test_serialize_subclasses.rb create mode 100644 jni/ruby/test/psych/test_set.rb create mode 100644 jni/ruby/test/psych/test_stream.rb create mode 100644 jni/ruby/test/psych/test_string.rb create mode 100644 jni/ruby/test/psych/test_struct.rb create mode 100644 jni/ruby/test/psych/test_symbol.rb create mode 100644 jni/ruby/test/psych/test_tainted.rb create mode 100644 jni/ruby/test/psych/test_to_yaml_properties.rb create mode 100644 jni/ruby/test/psych/test_tree_builder.rb create mode 100644 jni/ruby/test/psych/test_yaml.rb create mode 100644 jni/ruby/test/psych/test_yamldbm.rb create mode 100644 jni/ruby/test/psych/test_yamlstore.rb create mode 100644 jni/ruby/test/psych/visitors/test_depth_first.rb create mode 100644 jni/ruby/test/psych/visitors/test_emitter.rb create mode 100644 jni/ruby/test/psych/visitors/test_to_ruby.rb create mode 100644 jni/ruby/test/psych/visitors/test_yaml_tree.rb create mode 100644 jni/ruby/test/rake/file_creation.rb create mode 100644 jni/ruby/test/rake/helper.rb create mode 100644 jni/ruby/test/rake/support/rakefile_definitions.rb create mode 100644 jni/ruby/test/rake/support/ruby_runner.rb create mode 100644 jni/ruby/test/rake/test_private_reader.rb create mode 100644 jni/ruby/test/rake/test_rake.rb create mode 100644 jni/ruby/test/rake/test_rake_application.rb create mode 100644 jni/ruby/test/rake/test_rake_application_options.rb create mode 100644 jni/ruby/test/rake/test_rake_backtrace.rb create mode 100644 jni/ruby/test/rake/test_rake_clean.rb create mode 100644 jni/ruby/test/rake/test_rake_cpu_counter.rb create mode 100644 jni/ruby/test/rake/test_rake_definitions.rb create mode 100644 jni/ruby/test/rake/test_rake_directory_task.rb create mode 100644 jni/ruby/test/rake/test_rake_dsl.rb create mode 100644 jni/ruby/test/rake/test_rake_early_time.rb create mode 100644 jni/ruby/test/rake/test_rake_extension.rb create mode 100644 jni/ruby/test/rake/test_rake_file_creation_task.rb create mode 100644 jni/ruby/test/rake/test_rake_file_list.rb create mode 100644 jni/ruby/test/rake/test_rake_file_list_path_map.rb create mode 100644 jni/ruby/test/rake/test_rake_file_task.rb create mode 100644 jni/ruby/test/rake/test_rake_file_utils.rb create mode 100644 jni/ruby/test/rake/test_rake_ftp_file.rb create mode 100644 jni/ruby/test/rake/test_rake_functional.rb create mode 100644 jni/ruby/test/rake/test_rake_invocation_chain.rb create mode 100644 jni/ruby/test/rake/test_rake_late_time.rb create mode 100644 jni/ruby/test/rake/test_rake_linked_list.rb create mode 100644 jni/ruby/test/rake/test_rake_makefile_loader.rb create mode 100644 jni/ruby/test/rake/test_rake_multi_task.rb create mode 100644 jni/ruby/test/rake/test_rake_name_space.rb create mode 100644 jni/ruby/test/rake/test_rake_package_task.rb create mode 100644 jni/ruby/test/rake/test_rake_path_map.rb create mode 100644 jni/ruby/test/rake/test_rake_path_map_explode.rb create mode 100644 jni/ruby/test/rake/test_rake_path_map_partial.rb create mode 100644 jni/ruby/test/rake/test_rake_pathname_extensions.rb create mode 100644 jni/ruby/test/rake/test_rake_pseudo_status.rb create mode 100644 jni/ruby/test/rake/test_rake_rake_test_loader.rb create mode 100644 jni/ruby/test/rake/test_rake_reduce_compat.rb create mode 100644 jni/ruby/test/rake/test_rake_require.rb create mode 100644 jni/ruby/test/rake/test_rake_rules.rb create mode 100644 jni/ruby/test/rake/test_rake_scope.rb create mode 100644 jni/ruby/test/rake/test_rake_task.rb create mode 100644 jni/ruby/test/rake/test_rake_task_argument_parsing.rb create mode 100644 jni/ruby/test/rake/test_rake_task_arguments.rb create mode 100644 jni/ruby/test/rake/test_rake_task_lib.rb create mode 100644 jni/ruby/test/rake/test_rake_task_manager.rb create mode 100644 jni/ruby/test/rake/test_rake_task_manager_argument_resolution.rb create mode 100644 jni/ruby/test/rake/test_rake_task_with_arguments.rb create mode 100644 jni/ruby/test/rake/test_rake_test_task.rb create mode 100644 jni/ruby/test/rake/test_rake_thread_pool.rb create mode 100644 jni/ruby/test/rake/test_rake_top_level_functions.rb create mode 100644 jni/ruby/test/rake/test_rake_win32.rb create mode 100644 jni/ruby/test/rake/test_thread_history_display.rb create mode 100644 jni/ruby/test/rake/test_trace_output.rb create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Amps and angle encoding.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Auto links.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Backslash escapes.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Blockquotes with code blocks.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Code Blocks.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Code Spans.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Horizontal rules.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Advanced).text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Inline HTML (Simple).text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Inline HTML comments.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Links, inline style.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Links, reference style.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Links, shortcut references.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Literal quotes in titles.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Basics.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Nested blockquotes.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Ordered and unordered lists.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Strong and em together.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Tabs.text create mode 100644 jni/ruby/test/rdoc/MarkdownTest_1.0.3/Tidyness.text create mode 100644 jni/ruby/test/rdoc/README create mode 100644 jni/ruby/test/rdoc/binary.dat create mode 100644 jni/ruby/test/rdoc/hidden.zip.txt create mode 100644 jni/ruby/test/rdoc/test.ja.largedoc create mode 100644 jni/ruby/test/rdoc/test.ja.rdoc create mode 100644 jni/ruby/test/rdoc/test.ja.txt create mode 100644 jni/ruby/test/rdoc/test.txt create mode 100644 jni/ruby/test/rdoc/test_rdoc_alias.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_any_method.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_attr.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_class_module.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_code_object.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_comment.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_constant.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_context.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_context_section.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_cross_reference.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_encoding.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_extend.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_darkfish.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_json_index.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_markup.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_pot.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_pot_po.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_pot_po_entry.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_generator_ri.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_i18n_locale.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_i18n_text.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_include.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markdown.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markdown_test.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_attribute_manager.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_attributes.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_document.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_formatter.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_hard_break.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_heading.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_include.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_indented_paragraph.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_paragraph.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_parser.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_pre_process.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_raw.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_ansi.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_bs.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_html.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_html_crossref.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_html_snippet.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_label.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_markdown.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_rdoc.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_table_of_contents.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_to_tt_only.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_markup_verbatim.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_method_attr.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_normal_class.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_normal_module.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_options.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser_c.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser_changelog.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser_markdown.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser_rd.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser_ruby.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_parser_simple.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_rd.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_rd_block_parser.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_rd_inline.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_rd_inline_parser.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_rdoc.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_require.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_ri_driver.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_ri_paths.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_ruby_lex.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_ruby_token.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_rubygems_hook.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_servlet.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_single_class.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_stats.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_store.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_task.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_text.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_token_stream.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_tom_doc.rb create mode 100644 jni/ruby/test/rdoc/test_rdoc_top_level.rb create mode 100644 jni/ruby/test/rdoc/xref_data.rb create mode 100644 jni/ruby/test/rdoc/xref_test_case.rb create mode 100644 jni/ruby/test/readline/test_readline.rb create mode 100644 jni/ruby/test/readline/test_readline_history.rb create mode 100644 jni/ruby/test/resolv/test_addr.rb create mode 100644 jni/ruby/test/resolv/test_dns.rb create mode 100644 jni/ruby/test/resolv/test_resource.rb create mode 100644 jni/ruby/test/rexml/data/LostineRiver.kml.gz create mode 100644 jni/ruby/test/rexml/data/ProductionSupport.xml create mode 100644 jni/ruby/test/rexml/data/axis.xml create mode 100644 jni/ruby/test/rexml/data/bad.xml create mode 100644 jni/ruby/test/rexml/data/basic.xml create mode 100644 jni/ruby/test/rexml/data/basicupdate.xml create mode 100644 jni/ruby/test/rexml/data/broken.rss create mode 100644 jni/ruby/test/rexml/data/contents.xml create mode 100644 jni/ruby/test/rexml/data/dash.xml create mode 100644 jni/ruby/test/rexml/data/defaultNamespace.xml create mode 100644 jni/ruby/test/rexml/data/doctype_test.xml create mode 100644 jni/ruby/test/rexml/data/documentation.xml create mode 100644 jni/ruby/test/rexml/data/euc.xml create mode 100644 jni/ruby/test/rexml/data/evaluate.xml create mode 100644 jni/ruby/test/rexml/data/fibo.xml create mode 100644 jni/ruby/test/rexml/data/foo.xml create mode 100644 jni/ruby/test/rexml/data/google.2.xml create mode 100644 jni/ruby/test/rexml/data/id.xml create mode 100644 jni/ruby/test/rexml/data/iso8859-1.xml create mode 100644 jni/ruby/test/rexml/data/jaxen24.xml create mode 100644 jni/ruby/test/rexml/data/jaxen3.xml create mode 100644 jni/ruby/test/rexml/data/lang.xml create mode 100644 jni/ruby/test/rexml/data/lang0.xml create mode 100644 jni/ruby/test/rexml/data/message.xml create mode 100644 jni/ruby/test/rexml/data/moreover.xml create mode 100644 jni/ruby/test/rexml/data/much_ado.xml create mode 100644 jni/ruby/test/rexml/data/namespaces.xml create mode 100644 jni/ruby/test/rexml/data/nitf.xml create mode 100644 jni/ruby/test/rexml/data/numbers.xml create mode 100644 jni/ruby/test/rexml/data/ofbiz-issues-full-177.xml create mode 100644 jni/ruby/test/rexml/data/pi.xml create mode 100644 jni/ruby/test/rexml/data/pi2.xml create mode 100644 jni/ruby/test/rexml/data/project.xml create mode 100644 jni/ruby/test/rexml/data/simple.xml create mode 100644 jni/ruby/test/rexml/data/stream_accents.xml create mode 100644 jni/ruby/test/rexml/data/t63-1.xml create mode 100644 jni/ruby/test/rexml/data/t63-2.svg create mode 100644 jni/ruby/test/rexml/data/t75.xml create mode 100644 jni/ruby/test/rexml/data/test/tests.xml create mode 100644 jni/ruby/test/rexml/data/test/tests.xsl create mode 100644 jni/ruby/test/rexml/data/testNamespaces.xml create mode 100644 jni/ruby/test/rexml/data/testsrc.xml create mode 100644 jni/ruby/test/rexml/data/text.xml create mode 100644 jni/ruby/test/rexml/data/ticket_61.xml create mode 100644 jni/ruby/test/rexml/data/ticket_68.xml create mode 100644 jni/ruby/test/rexml/data/tutorial.xml create mode 100644 jni/ruby/test/rexml/data/underscore.xml create mode 100644 jni/ruby/test/rexml/data/utf16.xml create mode 100644 jni/ruby/test/rexml/data/web.xml create mode 100644 jni/ruby/test/rexml/data/web2.xml create mode 100644 jni/ruby/test/rexml/data/working.rss create mode 100644 jni/ruby/test/rexml/data/xmlfile-bug.xml create mode 100644 jni/ruby/test/rexml/data/xp.tst create mode 100644 jni/ruby/test/rexml/data/yahoo.xml create mode 100644 jni/ruby/test/rexml/listener.rb create mode 100644 jni/ruby/test/rexml/parse/test_document_type_declaration.rb create mode 100644 jni/ruby/test/rexml/parse/test_notation_declaration.rb create mode 100644 jni/ruby/test/rexml/parser/test_sax2.rb create mode 100644 jni/ruby/test/rexml/parser/test_tree.rb create mode 100644 jni/ruby/test/rexml/parser/test_ultra_light.rb create mode 100644 jni/ruby/test/rexml/rexml_test_utils.rb create mode 100644 jni/ruby/test/rexml/test_attributes.rb create mode 100644 jni/ruby/test/rexml/test_attributes_mixin.rb create mode 100644 jni/ruby/test/rexml/test_changing_encoding.rb create mode 100644 jni/ruby/test/rexml/test_comment.rb create mode 100644 jni/ruby/test/rexml/test_contrib.rb create mode 100644 jni/ruby/test/rexml/test_core.rb create mode 100644 jni/ruby/test/rexml/test_doctype.rb create mode 100644 jni/ruby/test/rexml/test_document.rb create mode 100644 jni/ruby/test/rexml/test_elements.rb create mode 100644 jni/ruby/test/rexml/test_encoding.rb create mode 100644 jni/ruby/test/rexml/test_entity.rb create mode 100644 jni/ruby/test/rexml/test_functions.rb create mode 100644 jni/ruby/test/rexml/test_functions_number.rb create mode 100644 jni/ruby/test/rexml/test_jaxen.rb create mode 100644 jni/ruby/test/rexml/test_light.rb create mode 100644 jni/ruby/test/rexml/test_lightparser.rb create mode 100644 jni/ruby/test/rexml/test_listener.rb create mode 100644 jni/ruby/test/rexml/test_martin_fowler.rb create mode 100644 jni/ruby/test/rexml/test_namespace.rb create mode 100644 jni/ruby/test/rexml/test_order.rb create mode 100644 jni/ruby/test/rexml/test_preceding_sibling.rb create mode 100644 jni/ruby/test/rexml/test_pullparser.rb create mode 100644 jni/ruby/test/rexml/test_rexml_issuezilla.rb create mode 100644 jni/ruby/test/rexml/test_sax.rb create mode 100644 jni/ruby/test/rexml/test_stream.rb create mode 100644 jni/ruby/test/rexml/test_text.rb create mode 100644 jni/ruby/test/rexml/test_ticket_80.rb create mode 100644 jni/ruby/test/rexml/test_validation_rng.rb create mode 100644 jni/ruby/test/rexml/test_xml_declaration.rb create mode 100644 jni/ruby/test/rexml/xpath/test_attribute.rb create mode 100644 jni/ruby/test/rexml/xpath/test_axis_preceding_sibling.rb create mode 100644 jni/ruby/test/rexml/xpath/test_base.rb create mode 100644 jni/ruby/test/rexml/xpath/test_node.rb create mode 100644 jni/ruby/test/rexml/xpath/test_predicate.rb create mode 100644 jni/ruby/test/rexml/xpath/test_text.rb create mode 100644 jni/ruby/test/rinda/test_rinda.rb create mode 100644 jni/ruby/test/rinda/test_tuplebag.rb create mode 100644 jni/ruby/test/ripper/dummyparser.rb create mode 100644 jni/ruby/test/ripper/test_files.rb create mode 100644 jni/ruby/test/ripper/test_filter.rb create mode 100644 jni/ruby/test/ripper/test_parser_events.rb create mode 100644 jni/ruby/test/ripper/test_ripper.rb create mode 100644 jni/ruby/test/ripper/test_scanner_events.rb create mode 100644 jni/ruby/test/ripper/test_sexp.rb create mode 100644 jni/ruby/test/rss/dot.png create mode 100644 jni/ruby/test/rss/rss-assertions.rb create mode 100644 jni/ruby/test/rss/rss-testcase.rb create mode 100644 jni/ruby/test/rss/test_1.0.rb create mode 100644 jni/ruby/test/rss/test_2.0.rb create mode 100644 jni/ruby/test/rss/test_accessor.rb create mode 100644 jni/ruby/test/rss/test_atom.rb create mode 100644 jni/ruby/test/rss/test_content.rb create mode 100644 jni/ruby/test/rss/test_dublincore.rb create mode 100644 jni/ruby/test/rss/test_image.rb create mode 100644 jni/ruby/test/rss/test_inherit.rb create mode 100644 jni/ruby/test/rss/test_itunes.rb create mode 100644 jni/ruby/test/rss/test_maker_0.9.rb create mode 100644 jni/ruby/test/rss/test_maker_1.0.rb create mode 100644 jni/ruby/test/rss/test_maker_2.0.rb create mode 100644 jni/ruby/test/rss/test_maker_atom_entry.rb create mode 100644 jni/ruby/test/rss/test_maker_atom_feed.rb create mode 100644 jni/ruby/test/rss/test_maker_content.rb create mode 100644 jni/ruby/test/rss/test_maker_dc.rb create mode 100644 jni/ruby/test/rss/test_maker_image.rb create mode 100644 jni/ruby/test/rss/test_maker_itunes.rb create mode 100644 jni/ruby/test/rss/test_maker_slash.rb create mode 100644 jni/ruby/test/rss/test_maker_sy.rb create mode 100644 jni/ruby/test/rss/test_maker_taxo.rb create mode 100644 jni/ruby/test/rss/test_maker_trackback.rb create mode 100644 jni/ruby/test/rss/test_maker_xml-stylesheet.rb create mode 100644 jni/ruby/test/rss/test_parser.rb create mode 100644 jni/ruby/test/rss/test_parser_1.0.rb create mode 100644 jni/ruby/test/rss/test_parser_2.0.rb create mode 100644 jni/ruby/test/rss/test_parser_atom_entry.rb create mode 100644 jni/ruby/test/rss/test_parser_atom_feed.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_0.9.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_1.0.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_2.0.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_atom_entry.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_atom_feed.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_itunes.rb create mode 100644 jni/ruby/test/rss/test_setup_maker_slash.rb create mode 100644 jni/ruby/test/rss/test_slash.rb create mode 100644 jni/ruby/test/rss/test_syndication.rb create mode 100644 jni/ruby/test/rss/test_taxonomy.rb create mode 100644 jni/ruby/test/rss/test_to_s.rb create mode 100644 jni/ruby/test/rss/test_trackback.rb create mode 100644 jni/ruby/test/rss/test_version.rb create mode 100644 jni/ruby/test/rss/test_xml-stylesheet.rb create mode 100644 jni/ruby/test/ruby/allpairs.rb create mode 100644 jni/ruby/test/ruby/beginmainend.rb create mode 100644 jni/ruby/test/ruby/enc/test_big5.rb create mode 100644 jni/ruby/test/ruby/enc/test_cp949.rb create mode 100644 jni/ruby/test/ruby/enc/test_emoji.rb create mode 100644 jni/ruby/test/ruby/enc/test_euc_jp.rb create mode 100644 jni/ruby/test/ruby/enc/test_euc_kr.rb create mode 100644 jni/ruby/test/ruby/enc/test_euc_tw.rb create mode 100644 jni/ruby/test/ruby/enc/test_gb18030.rb create mode 100644 jni/ruby/test/ruby/enc/test_gbk.rb create mode 100644 jni/ruby/test/ruby/enc/test_iso_8859.rb create mode 100644 jni/ruby/test/ruby/enc/test_koi8.rb create mode 100644 jni/ruby/test/ruby/enc/test_shift_jis.rb create mode 100644 jni/ruby/test/ruby/enc/test_utf16.rb create mode 100644 jni/ruby/test/ruby/enc/test_utf32.rb create mode 100644 jni/ruby/test/ruby/enc/test_windows_1251.rb create mode 100644 jni/ruby/test/ruby/endblockwarn_rb create mode 100644 jni/ruby/test/ruby/lbtest.rb create mode 100644 jni/ruby/test/ruby/marshaltestlib.rb create mode 100644 jni/ruby/test/ruby/sentence.rb create mode 100644 jni/ruby/test/ruby/test_alias.rb create mode 100644 jni/ruby/test/ruby/test_argf.rb create mode 100644 jni/ruby/test/ruby/test_arity.rb create mode 100644 jni/ruby/test/ruby/test_array.rb create mode 100644 jni/ruby/test/ruby/test_assignment.rb create mode 100644 jni/ruby/test/ruby/test_autoload.rb create mode 100644 jni/ruby/test/ruby/test_backtrace.rb create mode 100644 jni/ruby/test/ruby/test_basicinstructions.rb create mode 100644 jni/ruby/test/ruby/test_beginendblock.rb create mode 100644 jni/ruby/test/ruby/test_bignum.rb create mode 100644 jni/ruby/test/ruby/test_call.rb create mode 100644 jni/ruby/test/ruby/test_case.rb create mode 100644 jni/ruby/test/ruby/test_class.rb create mode 100644 jni/ruby/test/ruby/test_clone.rb create mode 100644 jni/ruby/test/ruby/test_comparable.rb create mode 100644 jni/ruby/test/ruby/test_complex.rb create mode 100644 jni/ruby/test/ruby/test_complex2.rb create mode 100644 jni/ruby/test/ruby/test_complexrational.rb create mode 100644 jni/ruby/test/ruby/test_condition.rb create mode 100644 jni/ruby/test/ruby/test_const.rb create mode 100644 jni/ruby/test/ruby/test_continuation.rb create mode 100644 jni/ruby/test/ruby/test_defined.rb create mode 100644 jni/ruby/test/ruby/test_dir.rb create mode 100644 jni/ruby/test/ruby/test_dir_m17n.rb create mode 100644 jni/ruby/test/ruby/test_econv.rb create mode 100644 jni/ruby/test/ruby/test_encoding.rb create mode 100644 jni/ruby/test/ruby/test_enum.rb create mode 100644 jni/ruby/test/ruby/test_enumerator.rb create mode 100644 jni/ruby/test/ruby/test_env.rb create mode 100644 jni/ruby/test/ruby/test_eval.rb create mode 100644 jni/ruby/test/ruby/test_exception.rb create mode 100644 jni/ruby/test/ruby/test_fiber.rb create mode 100644 jni/ruby/test/ruby/test_file.rb create mode 100644 jni/ruby/test/ruby/test_file_exhaustive.rb create mode 100644 jni/ruby/test/ruby/test_fixnum.rb create mode 100644 jni/ruby/test/ruby/test_flip.rb create mode 100644 jni/ruby/test/ruby/test_float.rb create mode 100644 jni/ruby/test/ruby/test_fnmatch.rb create mode 100644 jni/ruby/test/ruby/test_gc.rb create mode 100644 jni/ruby/test/ruby/test_hash.rb create mode 100644 jni/ruby/test/ruby/test_ifunless.rb create mode 100644 jni/ruby/test/ruby/test_integer.rb create mode 100644 jni/ruby/test/ruby/test_integer_comb.rb create mode 100644 jni/ruby/test/ruby/test_io.rb create mode 100644 jni/ruby/test/ruby/test_io_m17n.rb create mode 100644 jni/ruby/test/ruby/test_iseq.rb create mode 100644 jni/ruby/test/ruby/test_iterator.rb create mode 100644 jni/ruby/test/ruby/test_keyword.rb create mode 100644 jni/ruby/test/ruby/test_lambda.rb create mode 100644 jni/ruby/test/ruby/test_lazy_enumerator.rb create mode 100644 jni/ruby/test/ruby/test_literal.rb create mode 100644 jni/ruby/test/ruby/test_m17n.rb create mode 100644 jni/ruby/test/ruby/test_m17n_comb.rb create mode 100644 jni/ruby/test/ruby/test_marshal.rb create mode 100644 jni/ruby/test/ruby/test_math.rb create mode 100644 jni/ruby/test/ruby/test_metaclass.rb create mode 100644 jni/ruby/test/ruby/test_method.rb create mode 100644 jni/ruby/test/ruby/test_mixed_unicode_escapes.rb create mode 100644 jni/ruby/test/ruby/test_module.rb create mode 100644 jni/ruby/test/ruby/test_not.rb create mode 100644 jni/ruby/test/ruby/test_notimp.rb create mode 100644 jni/ruby/test/ruby/test_numeric.rb create mode 100644 jni/ruby/test/ruby/test_object.rb create mode 100644 jni/ruby/test/ruby/test_objectspace.rb create mode 100644 jni/ruby/test/ruby/test_optimization.rb create mode 100644 jni/ruby/test/ruby/test_pack.rb create mode 100644 jni/ruby/test/ruby/test_parse.rb create mode 100644 jni/ruby/test/ruby/test_path.rb create mode 100644 jni/ruby/test/ruby/test_pipe.rb create mode 100644 jni/ruby/test/ruby/test_primitive.rb create mode 100644 jni/ruby/test/ruby/test_proc.rb create mode 100644 jni/ruby/test/ruby/test_process.rb create mode 100644 jni/ruby/test/ruby/test_rand.rb create mode 100644 jni/ruby/test/ruby/test_range.rb create mode 100644 jni/ruby/test/ruby/test_rational.rb create mode 100644 jni/ruby/test/ruby/test_rational2.rb create mode 100644 jni/ruby/test/ruby/test_readpartial.rb create mode 100644 jni/ruby/test/ruby/test_refinement.rb create mode 100644 jni/ruby/test/ruby/test_regexp.rb create mode 100644 jni/ruby/test/ruby/test_require.rb create mode 100644 jni/ruby/test/ruby/test_rubyoptions.rb create mode 100644 jni/ruby/test/ruby/test_rubyvm.rb create mode 100644 jni/ruby/test/ruby/test_settracefunc.rb create mode 100644 jni/ruby/test/ruby/test_signal.rb create mode 100644 jni/ruby/test/ruby/test_sleep.rb create mode 100644 jni/ruby/test/ruby/test_sprintf.rb create mode 100644 jni/ruby/test/ruby/test_sprintf_comb.rb create mode 100644 jni/ruby/test/ruby/test_string.rb create mode 100644 jni/ruby/test/ruby/test_stringchar.rb create mode 100644 jni/ruby/test/ruby/test_struct.rb create mode 100644 jni/ruby/test/ruby/test_super.rb create mode 100644 jni/ruby/test/ruby/test_symbol.rb create mode 100644 jni/ruby/test/ruby/test_syntax.rb create mode 100644 jni/ruby/test/ruby/test_system.rb create mode 100644 jni/ruby/test/ruby/test_thread.rb create mode 100644 jni/ruby/test/ruby/test_threadgroup.rb create mode 100644 jni/ruby/test/ruby/test_time.rb create mode 100644 jni/ruby/test/ruby/test_time_tz.rb create mode 100644 jni/ruby/test/ruby/test_trace.rb create mode 100644 jni/ruby/test/ruby/test_transcode.rb create mode 100644 jni/ruby/test/ruby/test_undef.rb create mode 100644 jni/ruby/test/ruby/test_unicode_escape.rb create mode 100644 jni/ruby/test/ruby/test_variable.rb create mode 100644 jni/ruby/test/ruby/test_weakmap.rb create mode 100644 jni/ruby/test/ruby/test_whileuntil.rb create mode 100644 jni/ruby/test/ruby/test_yield.rb create mode 100644 jni/ruby/test/ruby/ut_eof.rb create mode 100644 jni/ruby/test/rubygems/alternate_cert.pem create mode 100644 jni/ruby/test/rubygems/alternate_cert_32.pem create mode 100644 jni/ruby/test/rubygems/alternate_key.pem create mode 100644 jni/ruby/test/rubygems/bad_rake.rb create mode 100644 jni/ruby/test/rubygems/bogussources.rb create mode 100644 jni/ruby/test/rubygems/ca_cert.pem create mode 100644 jni/ruby/test/rubygems/child_cert.pem create mode 100644 jni/ruby/test/rubygems/child_cert_32.pem create mode 100644 jni/ruby/test/rubygems/child_key.pem create mode 100644 jni/ruby/test/rubygems/client.pem create mode 100644 jni/ruby/test/rubygems/data/gem-private_key.pem create mode 100644 jni/ruby/test/rubygems/data/gem-public_cert.pem create mode 100644 jni/ruby/test/rubygems/data/null-type.gemspec.rz create mode 100644 jni/ruby/test/rubygems/encrypted_private_key.pem create mode 100644 jni/ruby/test/rubygems/expired_cert.pem create mode 100644 jni/ruby/test/rubygems/fake_certlib/openssl.rb create mode 100644 jni/ruby/test/rubygems/fix_openssl_warnings.rb create mode 100644 jni/ruby/test/rubygems/foo/discover.rb create mode 100644 jni/ruby/test/rubygems/future_cert.pem create mode 100644 jni/ruby/test/rubygems/future_cert_32.pem create mode 100644 jni/ruby/test/rubygems/good_rake.rb create mode 100644 jni/ruby/test/rubygems/grandchild_cert.pem create mode 100644 jni/ruby/test/rubygems/grandchild_cert_32.pem create mode 100644 jni/ruby/test/rubygems/grandchild_key.pem create mode 100644 jni/ruby/test/rubygems/invalid_client.pem create mode 100644 jni/ruby/test/rubygems/invalid_issuer_cert.pem create mode 100644 jni/ruby/test/rubygems/invalid_issuer_cert_32.pem create mode 100644 jni/ruby/test/rubygems/invalid_key.pem create mode 100644 jni/ruby/test/rubygems/invalid_signer_cert.pem create mode 100644 jni/ruby/test/rubygems/invalid_signer_cert_32.pem create mode 100644 jni/ruby/test/rubygems/invalidchild_cert.pem create mode 100644 jni/ruby/test/rubygems/invalidchild_cert_32.pem create mode 100644 jni/ruby/test/rubygems/invalidchild_key.pem create mode 100644 jni/ruby/test/rubygems/plugin/exception/rubygems_plugin.rb create mode 100644 jni/ruby/test/rubygems/plugin/load/rubygems_plugin.rb create mode 100644 jni/ruby/test/rubygems/plugin/standarderror/rubygems_plugin.rb create mode 100644 jni/ruby/test/rubygems/private_key.pem create mode 100644 jni/ruby/test/rubygems/public_cert.pem create mode 100644 jni/ruby/test/rubygems/public_cert_32.pem create mode 100644 jni/ruby/test/rubygems/public_key.pem create mode 100644 jni/ruby/test/rubygems/rubygems/commands/crash_command.rb create mode 100644 jni/ruby/test/rubygems/rubygems_plugin.rb create mode 100644 jni/ruby/test/rubygems/sff/discover.rb create mode 100644 jni/ruby/test/rubygems/simple_gem.rb create mode 100644 jni/ruby/test/rubygems/specifications/bar-0.0.2.gemspec create mode 100644 jni/ruby/test/rubygems/specifications/foo-0.0.1.gemspec create mode 100644 jni/ruby/test/rubygems/ssl_cert.pem create mode 100644 jni/ruby/test/rubygems/ssl_key.pem create mode 100644 jni/ruby/test/rubygems/test_bundled_ca.rb create mode 100644 jni/ruby/test/rubygems/test_config.rb create mode 100644 jni/ruby/test/rubygems/test_deprecate.rb create mode 100644 jni/ruby/test/rubygems/test_gem.rb create mode 100644 jni/ruby/test/rubygems/test_gem_available_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_command_manager.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_build_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_cert_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_check_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_cleanup_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_contents_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_dependency_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_environment_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_fetch_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_generate_index_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_help_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_install_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_list_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_lock_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_mirror.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_open_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_outdated_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_owner_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_pristine_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_push_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_query_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_search_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_server_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_setup_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_sources_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_specification_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_stale_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_uninstall_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_unpack_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_update_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_which_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_commands_yank_command.rb create mode 100644 jni/ruby/test/rubygems/test_gem_config_file.rb create mode 100644 jni/ruby/test/rubygems/test_gem_dependency.rb create mode 100644 jni/ruby/test/rubygems/test_gem_dependency_installer.rb create mode 100644 jni/ruby/test/rubygems/test_gem_dependency_list.rb create mode 100644 jni/ruby/test/rubygems/test_gem_dependency_resolution_error.rb create mode 100644 jni/ruby/test/rubygems/test_gem_doctor.rb create mode 100644 jni/ruby/test/rubygems/test_gem_ext_builder.rb create mode 100644 jni/ruby/test/rubygems/test_gem_ext_cmake_builder.rb create mode 100644 jni/ruby/test/rubygems/test_gem_ext_configure_builder.rb create mode 100644 jni/ruby/test/rubygems/test_gem_ext_ext_conf_builder.rb create mode 100644 jni/ruby/test/rubygems/test_gem_ext_rake_builder.rb create mode 100644 jni/ruby/test/rubygems/test_gem_gem_runner.rb create mode 100644 jni/ruby/test/rubygems/test_gem_gemcutter_utilities.rb create mode 100644 jni/ruby/test/rubygems/test_gem_impossible_dependencies_error.rb create mode 100644 jni/ruby/test/rubygems/test_gem_indexer.rb create mode 100644 jni/ruby/test/rubygems/test_gem_install_update_options.rb create mode 100644 jni/ruby/test/rubygems/test_gem_installer.rb create mode 100644 jni/ruby/test/rubygems/test_gem_local_remote_options.rb create mode 100644 jni/ruby/test/rubygems/test_gem_name_tuple.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package_old.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package_tar_header.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package_tar_reader.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package_tar_reader_entry.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package_tar_writer.rb create mode 100644 jni/ruby/test/rubygems/test_gem_package_task.rb create mode 100644 jni/ruby/test/rubygems/test_gem_path_support.rb create mode 100644 jni/ruby/test/rubygems/test_gem_platform.rb create mode 100644 jni/ruby/test/rubygems/test_gem_rdoc.rb create mode 100644 jni/ruby/test/rubygems/test_gem_remote_fetcher.rb create mode 100644 jni/ruby/test/rubygems/test_gem_request.rb create mode 100644 jni/ruby/test/rubygems/test_gem_request_connection_pools.rb create mode 100644 jni/ruby/test/rubygems/test_gem_request_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_request_set_gem_dependency_api.rb create mode 100644 jni/ruby/test/rubygems/test_gem_request_set_lockfile.rb create mode 100644 jni/ruby/test/rubygems/test_gem_requirement.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_activation_request.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_api_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_api_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_best_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_composed_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_conflict.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_dependency_request.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_git_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_git_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_index_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_index_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_installed_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_installer_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_local_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_lock_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_lock_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_requirement_list.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_vendor_set.rb create mode 100644 jni/ruby/test/rubygems/test_gem_resolver_vendor_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_security.rb create mode 100644 jni/ruby/test/rubygems/test_gem_security_policy.rb create mode 100644 jni/ruby/test/rubygems/test_gem_security_signer.rb create mode 100644 jni/ruby/test/rubygems/test_gem_security_trust_dir.rb create mode 100644 jni/ruby/test/rubygems/test_gem_server.rb create mode 100644 jni/ruby/test/rubygems/test_gem_silent_ui.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_fetch_problem.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_git.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_installed.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_list.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_local.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_lock.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_specific_file.rb create mode 100644 jni/ruby/test/rubygems/test_gem_source_vendor.rb create mode 100644 jni/ruby/test/rubygems/test_gem_spec_fetcher.rb create mode 100644 jni/ruby/test/rubygems/test_gem_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_stream_ui.rb create mode 100644 jni/ruby/test/rubygems/test_gem_stub_specification.rb create mode 100644 jni/ruby/test/rubygems/test_gem_text.rb create mode 100644 jni/ruby/test/rubygems/test_gem_uninstaller.rb create mode 100644 jni/ruby/test/rubygems/test_gem_unsatisfiable_dependency_error.rb create mode 100644 jni/ruby/test/rubygems/test_gem_uri_formatter.rb create mode 100644 jni/ruby/test/rubygems/test_gem_util.rb create mode 100644 jni/ruby/test/rubygems/test_gem_validator.rb create mode 100644 jni/ruby/test/rubygems/test_gem_version.rb create mode 100644 jni/ruby/test/rubygems/test_gem_version_option.rb create mode 100644 jni/ruby/test/rubygems/test_kernel.rb create mode 100644 jni/ruby/test/rubygems/test_require.rb create mode 100644 jni/ruby/test/rubygems/wrong_key_cert.pem create mode 100644 jni/ruby/test/rubygems/wrong_key_cert_32.pem create mode 100644 jni/ruby/test/runner.rb create mode 100644 jni/ruby/test/scanf/data.txt create mode 100644 jni/ruby/test/scanf/test_scanf.rb create mode 100644 jni/ruby/test/scanf/test_scanfblocks.rb create mode 100644 jni/ruby/test/scanf/test_scanfio.rb create mode 100644 jni/ruby/test/sdbm/test_sdbm.rb create mode 100644 jni/ruby/test/shell/test_command_processor.rb create mode 100644 jni/ruby/test/socket/test_addrinfo.rb create mode 100644 jni/ruby/test/socket/test_ancdata.rb create mode 100644 jni/ruby/test/socket/test_basicsocket.rb create mode 100644 jni/ruby/test/socket/test_nonblock.rb create mode 100644 jni/ruby/test/socket/test_socket.rb create mode 100644 jni/ruby/test/socket/test_sockopt.rb create mode 100644 jni/ruby/test/socket/test_tcp.rb create mode 100644 jni/ruby/test/socket/test_udp.rb create mode 100644 jni/ruby/test/socket/test_unix.rb create mode 100644 jni/ruby/test/stringio/test_stringio.rb create mode 100644 jni/ruby/test/strscan/test_stringscanner.rb create mode 100644 jni/ruby/test/syslog/test_syslog_logger.rb create mode 100644 jni/ruby/test/test_abbrev.rb create mode 100644 jni/ruby/test/test_cmath.rb create mode 100644 jni/ruby/test/test_delegate.rb create mode 100644 jni/ruby/test/test_find.rb create mode 100644 jni/ruby/test/test_ipaddr.rb create mode 100644 jni/ruby/test/test_mathn.rb create mode 100644 jni/ruby/test/test_mutex_m.rb create mode 100644 jni/ruby/test/test_open3.rb create mode 100644 jni/ruby/test/test_pp.rb create mode 100644 jni/ruby/test/test_prettyprint.rb create mode 100644 jni/ruby/test/test_prime.rb create mode 100644 jni/ruby/test/test_pstore.rb create mode 100644 jni/ruby/test/test_pty.rb create mode 100644 jni/ruby/test/test_rbconfig.rb create mode 100644 jni/ruby/test/test_securerandom.rb create mode 100644 jni/ruby/test/test_set.rb create mode 100644 jni/ruby/test/test_shellwords.rb create mode 100644 jni/ruby/test/test_singleton.rb create mode 100644 jni/ruby/test/test_syslog.rb create mode 100644 jni/ruby/test/test_tempfile.rb create mode 100644 jni/ruby/test/test_time.rb create mode 100644 jni/ruby/test/test_timeout.rb create mode 100644 jni/ruby/test/test_tmpdir.rb create mode 100644 jni/ruby/test/test_tracer.rb create mode 100644 jni/ruby/test/test_tsort.rb create mode 100644 jni/ruby/test/test_unicode_normalize.rb create mode 100644 jni/ruby/test/test_weakref.rb create mode 100644 jni/ruby/test/test_win32api.rb create mode 100644 jni/ruby/test/testunit/test4test_hideskip.rb create mode 100644 jni/ruby/test/testunit/test4test_redefinition.rb create mode 100644 jni/ruby/test/testunit/test4test_sorting.rb create mode 100644 jni/ruby/test/testunit/test_assertion.rb create mode 100644 jni/ruby/test/testunit/test_hideskip.rb create mode 100644 jni/ruby/test/testunit/test_parallel.rb create mode 100644 jni/ruby/test/testunit/test_rake_integration.rb create mode 100644 jni/ruby/test/testunit/test_redefinition.rb create mode 100644 jni/ruby/test/testunit/test_sorting.rb create mode 100644 jni/ruby/test/testunit/tests_for_parallel/ptest_first.rb create mode 100644 jni/ruby/test/testunit/tests_for_parallel/ptest_forth.rb create mode 100644 jni/ruby/test/testunit/tests_for_parallel/ptest_second.rb create mode 100644 jni/ruby/test/testunit/tests_for_parallel/ptest_third.rb create mode 100644 jni/ruby/test/testunit/tests_for_parallel/runner.rb create mode 100644 jni/ruby/test/thread/test_cv.rb create mode 100644 jni/ruby/test/thread/test_queue.rb create mode 100644 jni/ruby/test/thread/test_sync.rb create mode 100644 jni/ruby/test/uri/test_common.rb create mode 100644 jni/ruby/test/uri/test_ftp.rb create mode 100644 jni/ruby/test/uri/test_generic.rb create mode 100644 jni/ruby/test/uri/test_http.rb create mode 100644 jni/ruby/test/uri/test_ldap.rb create mode 100644 jni/ruby/test/uri/test_mailto.rb create mode 100644 jni/ruby/test/uri/test_parser.rb create mode 100644 jni/ruby/test/webrick/.htaccess create mode 100644 jni/ruby/test/webrick/test_cgi.rb create mode 100644 jni/ruby/test/webrick/test_cookie.rb create mode 100644 jni/ruby/test/webrick/test_filehandler.rb create mode 100644 jni/ruby/test/webrick/test_htmlutils.rb create mode 100644 jni/ruby/test/webrick/test_httpauth.rb create mode 100644 jni/ruby/test/webrick/test_httpproxy.rb create mode 100644 jni/ruby/test/webrick/test_httprequest.rb create mode 100644 jni/ruby/test/webrick/test_httpresponse.rb create mode 100644 jni/ruby/test/webrick/test_httpserver.rb create mode 100644 jni/ruby/test/webrick/test_httputils.rb create mode 100644 jni/ruby/test/webrick/test_httpversion.rb create mode 100644 jni/ruby/test/webrick/test_server.rb create mode 100644 jni/ruby/test/webrick/test_utils.rb create mode 100644 jni/ruby/test/webrick/utils.rb create mode 100644 jni/ruby/test/webrick/webrick.cgi create mode 100644 jni/ruby/test/webrick/webrick_long_filename.cgi create mode 100644 jni/ruby/test/win32ole/err_in_callback.rb create mode 100644 jni/ruby/test/win32ole/orig_data.csv create mode 100644 jni/ruby/test/win32ole/test_err_in_callback.rb create mode 100644 jni/ruby/test/win32ole/test_folderitem2_invokeverb.rb create mode 100644 jni/ruby/test/win32ole/test_nil2vtempty.rb create mode 100644 jni/ruby/test/win32ole/test_ole_methods.rb create mode 100644 jni/ruby/test/win32ole/test_propertyputref.rb create mode 100644 jni/ruby/test/win32ole/test_thread.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_event.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_method.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_param.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_record.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_type.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_typelib.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_variable.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_variant.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_variant_m.rb create mode 100644 jni/ruby/test/win32ole/test_win32ole_variant_outarg.rb create mode 100644 jni/ruby/test/win32ole/test_word.rb create mode 100644 jni/ruby/test/xmlrpc/data/blog.xml create mode 100644 jni/ruby/test/xmlrpc/data/bug_bool.expected create mode 100644 jni/ruby/test/xmlrpc/data/bug_bool.xml create mode 100644 jni/ruby/test/xmlrpc/data/bug_cdata.expected create mode 100644 jni/ruby/test/xmlrpc/data/bug_cdata.xml create mode 100644 jni/ruby/test/xmlrpc/data/bug_covert.expected create mode 100644 jni/ruby/test/xmlrpc/data/bug_covert.xml create mode 100644 jni/ruby/test/xmlrpc/data/datetime_iso8601.xml create mode 100644 jni/ruby/test/xmlrpc/data/fault.xml create mode 100644 jni/ruby/test/xmlrpc/data/value.expected create mode 100644 jni/ruby/test/xmlrpc/data/value.xml create mode 100644 jni/ruby/test/xmlrpc/data/xml1.expected create mode 100644 jni/ruby/test/xmlrpc/data/xml1.xml create mode 100644 jni/ruby/test/xmlrpc/htpasswd create mode 100644 jni/ruby/test/xmlrpc/test_client.rb create mode 100644 jni/ruby/test/xmlrpc/test_cookie.rb create mode 100644 jni/ruby/test/xmlrpc/test_datetime.rb create mode 100644 jni/ruby/test/xmlrpc/test_features.rb create mode 100644 jni/ruby/test/xmlrpc/test_marshal.rb create mode 100644 jni/ruby/test/xmlrpc/test_parser.rb create mode 100644 jni/ruby/test/xmlrpc/test_webrick_server.rb create mode 100644 jni/ruby/test/xmlrpc/webrick_testing.rb create mode 100644 jni/ruby/test/zlib/test_zlib.rb (limited to 'jni/ruby/test') diff --git a/jni/ruby/test/-ext-/array/test_resize.rb b/jni/ruby/test/-ext-/array/test_resize.rb new file mode 100644 index 0000000..8e526b5 --- /dev/null +++ b/jni/ruby/test/-ext-/array/test_resize.rb @@ -0,0 +1,29 @@ +require 'test/unit' +require '-test-/array/resize' + +class TestArray < Test::Unit::TestCase + class TestResize < Test::Unit::TestCase + def test_expand + feature = '[ruby-dev:42912]' + ary = [*1..10] + ary.__resize__(10) + assert_equal(10, ary.size, feature) + assert_equal([*1..10], ary, feature) + ary.__resize__(100) + assert_equal(100, ary.size, feature) + assert_equal([*1..10]+[nil]*90, ary, feature) + ary.__resize__(20) + assert_equal(20, ary.size, feature) + assert_equal([*1..10]+[nil]*10, ary, feature) + ary.__resize__(2) + assert_equal(2, ary.size, feature) + assert_equal([1,2], ary, feature) + ary.__resize__(3) + assert_equal(3, ary.size, feature) + assert_equal([1,2,nil], ary, feature) + ary.__resize__(10) + assert_equal(10, ary.size, feature) + assert_equal([1,2]+[nil]*8, ary, feature) + end + end +end diff --git a/jni/ruby/test/-ext-/bignum/test_big2str.rb b/jni/ruby/test/-ext-/bignum/test_big2str.rb new file mode 100644 index 0000000..0af552e --- /dev/null +++ b/jni/ruby/test/-ext-/bignum/test_big2str.rb @@ -0,0 +1,29 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestBig2str < Test::Unit::TestCase + + SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT + BITSPERDIG = Bignum::BITSPERDIG + BDIGMAX = (1 << BITSPERDIG) - 1 + + def test_big2str_generic + x = 10**1000 + assert_equal("1" + "0" * 1000, x.big2str_generic(10)) + end + + def test_big2str_poweroftwo + e = BITSPERDIG*2 + x = 0b10**e + assert_equal("1" + "0" * e, x.big2str_poweroftwo(2)) + end + + def test_big2str_gmp + x = 10**1000 + assert_equal("1" + "0" * 1000, x.big2str_gmp(10)) + rescue NotImplementedError + end + + end +end diff --git a/jni/ruby/test/-ext-/bignum/test_bigzero.rb b/jni/ruby/test/-ext-/bignum/test_bigzero.rb new file mode 100644 index 0000000..f75c459 --- /dev/null +++ b/jni/ruby/test/-ext-/bignum/test_bigzero.rb @@ -0,0 +1,13 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestBigZero < Test::Unit::TestCase + def test_equal_0 + bug8204 = '[ruby-core:53893] [Bug #8204]' + (0..10).each do |i| + assert_equal(0, Bug::Bignum.zero(i), "#{bug8204} Bignum.zero(#{i})") + end + end + end +end diff --git a/jni/ruby/test/-ext-/bignum/test_div.rb b/jni/ruby/test/-ext-/bignum/test_div.rb new file mode 100644 index 0000000..9c1a3c3 --- /dev/null +++ b/jni/ruby/test/-ext-/bignum/test_div.rb @@ -0,0 +1,28 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestDiv < Test::Unit::TestCase + + SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT + BITSPERDIG = Bignum::BITSPERDIG + BDIGMAX = (1 << BITSPERDIG) - 1 + + def test_divrem_normal + x = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 3 + y = (1 << BITSPERDIG) | 1 + q = (1 << BITSPERDIG) | 1 + r = 2 + assert_equal([q, r], x.big_divrem_normal(y)) + end + + def test_divrem_gmp + x = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 3 + y = (1 << BITSPERDIG) | 1 + q = (1 << BITSPERDIG) | 1 + r = 2 + assert_equal([q, r], x.big_divrem_gmp(y)) + rescue NotImplementedError + end + end +end diff --git a/jni/ruby/test/-ext-/bignum/test_mul.rb b/jni/ruby/test/-ext-/bignum/test_mul.rb new file mode 100644 index 0000000..3e78247 --- /dev/null +++ b/jni/ruby/test/-ext-/bignum/test_mul.rb @@ -0,0 +1,137 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestMul < Test::Unit::TestCase + + SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT + BITSPERDIG = Bignum::BITSPERDIG + BDIGMAX = (1 << BITSPERDIG) - 1 + + def test_mul_normal + x = (1 << BITSPERDIG) | 1 + y = (1 << BITSPERDIG) | 1 + z = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 1 + assert_equal(z, x.big_mul_normal(y)) + end + + def test_mul_normal_zero_in_x + x = (1 << (2*BITSPERDIG)) | 1 + y = (1 << BITSPERDIG) | 1 + z = (1 << (BITSPERDIG*3)) | (1 << (BITSPERDIG*2)) | (1 << BITSPERDIG) | 1 + assert_equal(z, x.big_mul_normal(y)) + end + + def test_mul_normal_zero_in_y + x = (1 << BITSPERDIG) | 1 + y = (1 << (2*BITSPERDIG)) | 1 + z = (1 << (BITSPERDIG*3)) | (1 << (BITSPERDIG*2)) | (1 << BITSPERDIG) | 1 + assert_equal(z, x.big_mul_normal(y)) + end + + def test_mul_normal_max_max + x = (1 << (2*BITSPERDIG)) - 1 + y = (1 << (2*BITSPERDIG)) - 1 + z = (1 << (4*BITSPERDIG)) - (1 << (2*BITSPERDIG+1)) + 1 + assert_equal(z, x.big_mul_normal(y)) + end + + def test_sq_fast + x = (1 << BITSPERDIG) | 1 + z = (1 << 2*BITSPERDIG) | (2 << BITSPERDIG) | 1 + assert_equal(z, x.big_sq_fast) + end + + def test_sq_fast_max2 + x = (BDIGMAX << BITSPERDIG) | BDIGMAX + assert_equal(x.big_mul_normal(x), x.big_sq_fast) + end + + def test_sq_fast_zero_in_middle + x = (BDIGMAX << 2*BITSPERDIG) | BDIGMAX + assert_equal(x.big_mul_normal(x), x.big_sq_fast) + end + + def test_mul_balance + x = (1 << BITSPERDIG) | 1 + y = (1 << BITSPERDIG) | 1 + z = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 1 + assert_equal(z, x.big_mul_balance(y)) + end + + def test_mul_balance_2x16 + x = (1 << Bignum::BITSPERDIG) | 1 + y = (1 << Bignum::BITSPERDIG*16) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_balance(y)) + end + + def test_mul_balance_2x17 + x = (1 << Bignum::BITSPERDIG) | 1 + y = (1 << Bignum::BITSPERDIG*17) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_balance(y)) + end + + def test_mul_karatsuba + x = (1 << BITSPERDIG) | 1 + y = (1 << BITSPERDIG) | 1 + z = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 1 + assert_equal(z, x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_odd_y + x = (1 << BITSPERDIG) | 1 + y = (1 << (2*BITSPERDIG)) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_odd_xy + x = (1 << (2*BITSPERDIG)) | 1 + y = (1 << (2*BITSPERDIG)) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_x1_gt_x0 + x = (2 << BITSPERDIG) | 1 + y = (1 << BITSPERDIG) | 2 + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_y1_gt_y0 + x = (1 << BITSPERDIG) | 2 + y = (2 << BITSPERDIG) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_x1_gt_x0_and_y1_gt_y0 + x = (2 << BITSPERDIG) | 1 + y = (2 << BITSPERDIG) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_carry2 + x = (1 << BITSPERDIG) | BDIGMAX + y = (1 << BITSPERDIG) | BDIGMAX + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_karatsuba_borrow + x = (BDIGMAX << BITSPERDIG) | 1 + y = (BDIGMAX << BITSPERDIG) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y)) + end + + def test_mul_toom3 + x = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1 + y = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_toom3(y)) + end + + def test_mul_gmp + x = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1 + y = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_gmp(y)) + rescue NotImplementedError + end + + end +end diff --git a/jni/ruby/test/-ext-/bignum/test_pack.rb b/jni/ruby/test/-ext-/bignum/test_pack.rb new file mode 100644 index 0000000..f2a3df8 --- /dev/null +++ b/jni/ruby/test/-ext-/bignum/test_pack.rb @@ -0,0 +1,398 @@ +# coding: ASCII-8BIT + +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestPack < Test::Unit::TestCase + + MSWORD_FIRST = Integer::INTEGER_PACK_MSWORD_FIRST + LSWORD_FIRST = Integer::INTEGER_PACK_LSWORD_FIRST + MSBYTE_FIRST = Integer::INTEGER_PACK_MSBYTE_FIRST + LSBYTE_FIRST = Integer::INTEGER_PACK_LSBYTE_FIRST + NATIVE_BYTE_ORDER = Integer::INTEGER_PACK_NATIVE_BYTE_ORDER + TWOCOMP = Integer::INTEGER_PACK_2COMP + LITTLE_ENDIAN = Integer::INTEGER_PACK_LITTLE_ENDIAN + BIG_ENDIAN = Integer::INTEGER_PACK_BIG_ENDIAN + NEGATIVE = Integer::INTEGER_PACK_NEGATIVE + GENERIC = Integer::INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION + + def test_pack_zero + assert_equal([0, ""], 0.test_pack(0, 1, 0, BIG_ENDIAN)) + end + + def test_pack_argument_check + assert_raise(ArgumentError) { 0.test_pack_raw("", 2, 1, 0, MSBYTE_FIRST) } + assert_raise(ArgumentError) { 0.test_pack_raw("", 0, 1, 0, MSWORD_FIRST) } + assert_raise(ArgumentError) { 0.test_pack_raw("", 0, 0, 0, BIG_ENDIAN) } + assert_raise(ArgumentError) { 0.test_pack_raw("", 0, 1, 8, BIG_ENDIAN) } + + # assume sizeof(ssize_t) == sizeof(intptr_t) + assert_raise(ArgumentError) { 0.test_pack_raw("", 1 << ([""].pack("p").length * 8 - 1), 0, BIG_ENDIAN) } + end + + def test_pack_wordsize + assert_equal([1, "\x01"], 1.test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([1, "\x00\x01"], 1.test_pack(1, 2, 0, BIG_ENDIAN)) + assert_equal([1, "\x00\x00\x01"], 1.test_pack(1, 3, 0, BIG_ENDIAN)) + assert_equal([1, "\x01"], 1.test_pack(1, 1, 0, LITTLE_ENDIAN)) + assert_equal([1, "\x01\x00"], 1.test_pack(1, 2, 0, LITTLE_ENDIAN)) + assert_equal([1, "\x01\x00\x00"], 1.test_pack(1, 3, 0, LITTLE_ENDIAN)) + end + + def test_pack_fixed_buffer + assert_equal([0, "\x00\x00"], 0.test_pack(2, 1, 0, BIG_ENDIAN)) + assert_equal([1, "\x00\x01"], 0x01.test_pack(2, 1, 0, BIG_ENDIAN)) + assert_equal([1, "\x02\x01"], 0x0201.test_pack(2, 1, 0, BIG_ENDIAN)) + assert_equal([2, "\x02\x01"], 0x030201.test_pack(2, 1, 0, BIG_ENDIAN)) + assert_equal([2, "\x02\x01"], 0x04030201.test_pack(2, 1, 0, BIG_ENDIAN)) + assert_equal([0, "\x00\x00"], 0.test_pack(2, 1, 0, LITTLE_ENDIAN)) + assert_equal([1, "\x01\x00"], 0x01.test_pack(2, 1, 0, LITTLE_ENDIAN)) + assert_equal([1, "\x01\x02"], 0x0201.test_pack(2, 1, 0, LITTLE_ENDIAN)) + assert_equal([2, "\x01\x02"], 0x030201.test_pack(2, 1, 0, LITTLE_ENDIAN)) + assert_equal([2, "\x01\x02"], 0x04030201.test_pack(2, 1, 0, LITTLE_ENDIAN)) + end + + def test_pack_wordorder_and_endian + assert_equal([1, "\x12\x34\x56\x78"], 0x12345678.test_pack(2, 2, 0, MSWORD_FIRST|MSBYTE_FIRST)) + assert_equal([1, "\x34\x12\x78\x56"], 0x12345678.test_pack(2, 2, 0, MSWORD_FIRST|LSBYTE_FIRST)) + assert_equal([1, "\x56\x78\x12\x34"], 0x12345678.test_pack(2, 2, 0, LSWORD_FIRST|MSBYTE_FIRST)) + assert_equal([1, "\x78\x56\x34\x12"], 0x12345678.test_pack(2, 2, 0, LSWORD_FIRST|LSBYTE_FIRST)) + end + + def test_pack_native_endian + assert_equal([1, [0x1234].pack("S!")], 0x1234.test_pack(1, 2, 0, MSWORD_FIRST|NATIVE_BYTE_ORDER)) + end + + def test_pack_nail + assert_equal([1, "\x01\x00\x00\x00\x01\x01"], 0b100011.test_pack(6, 1, 7, BIG_ENDIAN)) + assert_equal([1, "\x01\x02\x03\x04\x05\x06\x07\x08"], 0x12345678.test_pack(8, 1, 4, BIG_ENDIAN)) + assert_equal([1, "\x00\x12\x00\x34\x00\x56\x00\x78"], 0x12345678.test_pack(4, 2, 8, BIG_ENDIAN)) + end + + def test_pack_overflow + assert_equal([-2, "\x1"], (-0x11).test_pack(1, 1, 4, BIG_ENDIAN)) + assert_equal([-2, "\x0"], (-0x10).test_pack(1, 1, 4, BIG_ENDIAN)) + assert_equal([-1, "\xF"], (-0x0F).test_pack(1, 1, 4, BIG_ENDIAN)) + assert_equal([+1, "\xF"], (+0x0F).test_pack(1, 1, 4, BIG_ENDIAN)) + assert_equal([+2, "\x0"], (+0x10).test_pack(1, 1, 4, BIG_ENDIAN)) + assert_equal([+2, "\x1"], (+0x11).test_pack(1, 1, 4, BIG_ENDIAN)) + + assert_equal([-2, "\x01"], (-0x101).test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([-2, "\x00"], (-0x100).test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([-1, "\xFF"], (-0x0FF).test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([+1, "\xFF"], (+0x0FF).test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([+2, "\x00"], (+0x100).test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([+2, "\x01"], (+0x101).test_pack(1, 1, 0, BIG_ENDIAN)) + + assert_equal([-2, "\x00\x00\x00\x00\x00\x00\x00\x01"], (-0x10000000000000001).test_pack(2, 4, 0, BIG_ENDIAN)) + assert_equal([-2, "\x00\x00\x00\x00\x00\x00\x00\x00"], (-0x10000000000000000).test_pack(2, 4, 0, BIG_ENDIAN)) + assert_equal([-1, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (-0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, BIG_ENDIAN)) + assert_equal([+1, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (+0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, BIG_ENDIAN)) + assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x00"], (+0x10000000000000000).test_pack(2, 4, 0, BIG_ENDIAN)) + assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x01"], (+0x10000000000000001).test_pack(2, 4, 0, BIG_ENDIAN)) + + 1.upto(16) {|wordsize| + 1.upto(20) {|numwords| + w = numwords*wordsize + n = 256**w + assert_equal([-2, "\x00"*(w-1)+"\x01"], (-n-1).test_pack(numwords, wordsize, 0, BIG_ENDIAN)) + assert_equal([-2, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, BIG_ENDIAN)) + assert_equal([-1, "\xFF"*w], (-n+1).test_pack(numwords, wordsize, 0, BIG_ENDIAN)) + assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, BIG_ENDIAN)) + assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, BIG_ENDIAN)) + assert_equal([+2, "\x00"*(w-1)+"\x01"], (+n+1).test_pack(numwords, wordsize, 0, BIG_ENDIAN)) + } + } + + 1.upto(16) {|wordsize| + 1.upto(20) {|numwords| + w = numwords*wordsize + n = 256**w + assert_equal([-2, "\x01"+"\x00"*(w-1)], (-n-1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN)) + assert_equal([-2, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN)) + assert_equal([-1, "\xFF"*w], (-n+1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN)) + assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN)) + assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN)) + assert_equal([+2, "\x01"+"\x00"*(w-1)], (+n+1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN)) + } + } + end + + def test_pack_sign + assert_equal([-1, "\x01"], (-1).test_pack(1, 1, 0, BIG_ENDIAN)) + assert_equal([-1, "\x80\x70\x60\x50\x40\x30\x20\x10"], (-0x8070605040302010).test_pack(8, 1, 0, BIG_ENDIAN)) + end + + def test_pack_orders + [MSWORD_FIRST, LSWORD_FIRST].each {|word_order| + [MSBYTE_FIRST, LSBYTE_FIRST, NATIVE_BYTE_ORDER].each {|byte_order| + 1.upto(16) {|wordsize| + 1.upto(20) {|numwords| + w = numwords*wordsize + n = 0; + 0.upto(w) {|i| + n |= ((i+1) % 256) << (i*8) + } + assert_equal(n.test_pack(numwords, wordsize, 0, word_order|byte_order|GENERIC), + n.test_pack(numwords, wordsize, 0, word_order|byte_order), + "#{'%#x' % n}.test_pack(#{numwords}, #{wordsize}, 0, #{'%#x' % (word_order|byte_order)})") + } + } + } + } + end + + def test_pack2comp_zero + assert_equal([0, ""], 0.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + end + + def test_pack2comp_emptybuf + assert_equal([-2, ""], (-3).test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-2, ""], (-2).test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, ""], (-1).test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([ 0, ""], 0.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, ""], 1.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, ""], 2.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN)) + end + + def test_pack2comp_nearly_zero + assert_equal([-1, "\xFE"], (-2).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\xFF"], (-1).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([ 0, "\x00"], 0.test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+1, "\x01"], 1.test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+1, "\x02"], 2.test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + end + + def test_pack2comp_overflow + assert_equal([-2, "\xF"], (-0x11).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x0"], (-0x10).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x1"], (-0x0F).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN)) + assert_equal([+1, "\xF"], (+0x0F).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x0"], (+0x10).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x1"], (+0x11).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN)) + + assert_equal([-2, "\xFF"], (-0x101).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x00"], (-0x100).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x01"], (-0x0FF).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+1, "\xFF"], (+0x0FF).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x00"], (+0x100).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x01"], (+0x101).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN)) + + assert_equal([-2, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (-0x10000000000000001).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x00\x00\x00\x00\x00\x00\x00\x00"], (-0x10000000000000000).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x00\x00\x00\x00\x00\x00\x00\x01"], (-0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+1, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (+0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x00"], (+0x10000000000000000).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x01"], (+0x10000000000000001).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN)) + + 1.upto(16) {|wordsize| + 1.upto(20) {|numwords| + w = numwords*wordsize + n = 256**w + assert_equal([-2, "\xFF"*w ], (-n-1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([-1, "\x00"*(w-1)+"\x01"], (-n+1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal([+2, "\x00"*(w-1)+"\x01"], (+n+1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN)) + } + } + + 1.upto(16) {|wordsize| + 1.upto(20) {|numwords| + w = numwords*wordsize + n = 256**w + assert_equal([-2, "\xFF"*w ], (-n-1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN)) + assert_equal([-1, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN)) + assert_equal([-1, "\x01"+"\x00"*(w-1)], (-n+1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN)) + assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN)) + assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN)) + assert_equal([+2, "\x01"+"\x00"*(w-1)], (+n+1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN)) + } + } + + 2.upto(16) {|wordsize| + w = wordsize + b = 8*wordsize-1 + n = 2**b + assert_equal([-2, "\x7F"+"\xFF"*(w-2)+"\xFF"], (-n-1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST)) + assert_equal([-1, "\x00"+"\x00"*(w-2)+"\x00"], (-n ).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST)) + assert_equal([-1, "\x00"+"\x00"*(w-2)+"\x01"], (-n+1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST)) + assert_equal([+1, "\x7F"+"\xFF"*(w-2)+"\xFF"], (+n-1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST)) + assert_equal([+2, "\x00"+"\x00"*(w-2)+"\x00"], (+n ).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST)) + assert_equal([+2, "\x00"+"\x00"*(w-2)+"\x01"], (+n+1).test_pack(1, wordsize, 1, TWOCOMP|MSBYTE_FIRST)) + } + + 2.upto(16) {|wordsize| + w = wordsize + b = 8*wordsize-1 + n = 2**b + assert_equal([-2, "\xFF"+"\xFF"*(w-2)+"\x7F"], (-n-1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST)) + assert_equal([-1, "\x00"+"\x00"*(w-2)+"\x00"], (-n ).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST)) + assert_equal([-1, "\x01"+"\x00"*(w-2)+"\x00"], (-n+1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST)) + assert_equal([+1, "\xFF"+"\xFF"*(w-2)+"\x7F"], (+n-1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST)) + assert_equal([+2, "\x00"+"\x00"*(w-2)+"\x00"], (+n ).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST)) + assert_equal([+2, "\x01"+"\x00"*(w-2)+"\x00"], (+n+1).test_pack(1, wordsize, 1, TWOCOMP|LSBYTE_FIRST)) + } + + end + + def test_unpack_zero + assert_equal(0, Integer.test_unpack("", 0, 1, 0, BIG_ENDIAN)) + end + + def test_unpack_argument_check + assert_raise(ArgumentError) { Integer.test_unpack("x", 2, 1, 0, MSBYTE_FIRST) } + assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 1, 0, MSWORD_FIRST) } + assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 0, 0, BIG_ENDIAN) } + assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 1, 8, BIG_ENDIAN) } + + # assume sizeof(ssize_t) == sizeof(intptr_t) + assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 1 << ([""].pack("p").length * 8 - 1), 0, BIG_ENDIAN) } + end + + def test_unpack_wordsize + assert_equal(1, Integer.test_unpack("\x01", 1, 1, 0, BIG_ENDIAN)) + assert_equal(1, Integer.test_unpack("\x00\x01", 1, 2, 0, BIG_ENDIAN)) + assert_equal(1, Integer.test_unpack("\x00\x00\x01", 1, 3, 0, BIG_ENDIAN)) + assert_equal(1, Integer.test_unpack("\x01", 1, 1, 0, LITTLE_ENDIAN)) + assert_equal(1, Integer.test_unpack("\x01\x00", 1, 2, 0, LITTLE_ENDIAN)) + assert_equal(1, Integer.test_unpack("\x01\x00\x00", 1, 3, 0, LITTLE_ENDIAN)) + end + + def test_unpack_wordorder_and_endian + assert_equal(0x01020304, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, MSWORD_FIRST|MSBYTE_FIRST)) + assert_equal(0x02010403, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, MSWORD_FIRST|LSBYTE_FIRST)) + assert_equal(0x03040102, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, LSWORD_FIRST|MSBYTE_FIRST)) + assert_equal(0x04030201, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, LSWORD_FIRST|LSBYTE_FIRST)) + end + + def test_unpack_native_endian + assert_equal("\x12\x34".unpack("S!")[0], Integer.test_unpack("\x12\x34", 1, 2, 0, MSWORD_FIRST|NATIVE_BYTE_ORDER)) + end + + def test_unpack_nail + assert_equal(0b100011, Integer.test_unpack("\x01\x00\x00\x00\x01\x01", 6, 1, 7, BIG_ENDIAN)) + assert_equal(0x12345678, Integer.test_unpack("\x01\x02\x03\x04\x05\x06\x07\x08", 8, 1, 4, BIG_ENDIAN)) + assert_equal(0x12345678, Integer.test_unpack("\x00\x12\x00\x34\x00\x56\x00\x78", 4, 2, 8, BIG_ENDIAN)) + end + + def test_unpack_sign + assert_equal(-1, Integer.test_unpack("\x01", 1, 1, 0, BIG_ENDIAN|NEGATIVE)) + assert_equal(-0x8070605040302010, Integer.test_unpack("\x80\x70\x60\x50\x40\x30\x20\x10", 8, 1, 0, BIG_ENDIAN|NEGATIVE)) + end + + def test_unpack_orders + [MSWORD_FIRST, LSWORD_FIRST].each {|word_order| + [MSBYTE_FIRST, LSBYTE_FIRST, NATIVE_BYTE_ORDER].each {|byte_order| + 1.upto(16) {|wordsize| + 1.upto(20) {|numwords| + w = numwords*wordsize + ary = [] + 0.upto(w) {|i| + ary << ((i+1) % 256); + } + str = ary.pack("C*") + flags = word_order|byte_order + assert_equal(Integer.test_unpack(str, numwords, wordsize, 0, flags|GENERIC), + Integer.test_unpack(str, numwords, wordsize, 0, flags), + "Integer.test_unpack(#{str.dump}, #{numwords}, #{wordsize}, 0, #{'%#x' % flags})") + } + } + } + } + end + + def test_unpack2comp_single_byte + assert_equal(-128, Integer.test_unpack("\x80", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal( -2, Integer.test_unpack("\xFE", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal( -1, Integer.test_unpack("\xFF", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal( 0, Integer.test_unpack("\x00", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal( 1, Integer.test_unpack("\x01", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal( 2, Integer.test_unpack("\x02", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal( 127, Integer.test_unpack("\x7F", 1, 1, 0, TWOCOMP|BIG_ENDIAN)) + end + + def test_unpack2comp_sequence_of_ff + assert_equal(-1, Integer.test_unpack("\xFF"*2, 2, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*3, 3, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*4, 4, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*5, 5, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*6, 6, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*7, 7, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*8, 8, 1, 0, TWOCOMP|BIG_ENDIAN)) + assert_equal(-1, Integer.test_unpack("\xFF"*9, 9, 1, 0, TWOCOMP|BIG_ENDIAN)) + end + + def test_unpack2comp_negative_single_byte + assert_equal(-256, Integer.test_unpack("\x00", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + assert_equal(-255, Integer.test_unpack("\x01", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + assert_equal(-254, Integer.test_unpack("\x02", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + assert_equal(-129, Integer.test_unpack("\x7F", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + assert_equal(-128, Integer.test_unpack("\x80", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + assert_equal( -2, Integer.test_unpack("\xFE", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + assert_equal( -1, Integer.test_unpack("\xFF", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE)) + end + + def test_unpack2comp_negative_zero + 0.upto(100) {|n| + str = "\x00"*n + flags = TWOCOMP|BIG_ENDIAN|NEGATIVE + assert_equal(-(256**n), Integer.test_unpack(str, n, 1, 0, flags)) + flags = TWOCOMP|LITTLE_ENDIAN|NEGATIVE + assert_equal(-(256**n), Integer.test_unpack(str, n, 1, 0, flags), + "Integer.test_unpack(#{str.dump}, #{n}, 1, 0, #{'%#x' % flags})") + } + end + end + + def test_numbits_2comp + assert_equal(4, -9.test_numbits_2comp_without_sign) + assert_equal(3, -8.test_numbits_2comp_without_sign) + assert_equal(3, -7.test_numbits_2comp_without_sign) + assert_equal(3, -6.test_numbits_2comp_without_sign) + assert_equal(3, -5.test_numbits_2comp_without_sign) + assert_equal(2, -4.test_numbits_2comp_without_sign) + assert_equal(2, -3.test_numbits_2comp_without_sign) + assert_equal(1, -2.test_numbits_2comp_without_sign) + assert_equal(0, -1.test_numbits_2comp_without_sign) + assert_equal(0, 0.test_numbits_2comp_without_sign) + assert_equal(1, 1.test_numbits_2comp_without_sign) + assert_equal(2, 2.test_numbits_2comp_without_sign) + assert_equal(2, 3.test_numbits_2comp_without_sign) + assert_equal(3, 4.test_numbits_2comp_without_sign) + assert_equal(3, 5.test_numbits_2comp_without_sign) + assert_equal(3, 6.test_numbits_2comp_without_sign) + assert_equal(3, 7.test_numbits_2comp_without_sign) + assert_equal(4, 8.test_numbits_2comp_without_sign) + assert_equal(4, 9.test_numbits_2comp_without_sign) + end + + def test_numbytes_2comp + assert_equal(6, -0x8000000001.test_numbytes_2comp_with_sign) + assert_equal(5, -0x8000000000.test_numbytes_2comp_with_sign) + assert_equal(5, -0x80000001.test_numbytes_2comp_with_sign) + assert_equal(4, -0x80000000.test_numbytes_2comp_with_sign) + assert_equal(4, -0x800001.test_numbytes_2comp_with_sign) + assert_equal(3, -0x800000.test_numbytes_2comp_with_sign) + assert_equal(3, -0x8001.test_numbytes_2comp_with_sign) + assert_equal(2, -0x8000.test_numbytes_2comp_with_sign) + assert_equal(2, -0x81.test_numbytes_2comp_with_sign) + assert_equal(1, -0x80.test_numbytes_2comp_with_sign) + assert_equal(1, -1.test_numbytes_2comp_with_sign) + assert_equal(1, 0.test_numbytes_2comp_with_sign) + assert_equal(1, 1.test_numbytes_2comp_with_sign) + assert_equal(1, 0x7f.test_numbytes_2comp_with_sign) + assert_equal(2, 0x80.test_numbytes_2comp_with_sign) + assert_equal(2, 0x7fff.test_numbytes_2comp_with_sign) + assert_equal(3, 0x8000.test_numbytes_2comp_with_sign) + assert_equal(3, 0x7fffff.test_numbytes_2comp_with_sign) + assert_equal(4, 0x800000.test_numbytes_2comp_with_sign) + assert_equal(4, 0x7fffffff.test_numbytes_2comp_with_sign) + assert_equal(5, 0x80000000.test_numbytes_2comp_with_sign) + assert_equal(5, 0x7fffffffff.test_numbytes_2comp_with_sign) + assert_equal(6, 0x8000000000.test_numbytes_2comp_with_sign) + end + +end diff --git a/jni/ruby/test/-ext-/bignum/test_str2big.rb b/jni/ruby/test/-ext-/bignum/test_str2big.rb new file mode 100644 index 0000000..4304be8 --- /dev/null +++ b/jni/ruby/test/-ext-/bignum/test_str2big.rb @@ -0,0 +1,37 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestStr2big < Test::Unit::TestCase + + SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT + BITSPERDIG = Bignum::BITSPERDIG + BDIGMAX = (1 << BITSPERDIG) - 1 + + def test_str2big_poweroftwo + s = "1" + "0" * 1000 + n = 16 ** 1000 + assert_equal(n, s.str2big_poweroftwo(16, true)) + end + + def test_str2big_normal + s = "1" + "0" * 1000 + n = 10 ** 1000 + assert_equal(n, s.str2big_normal(10, true)) + end + + def test_str2big_karatsuba + s = "1" + "0" * 1000 + n = 10 ** 1000 + assert_equal(n, s.str2big_karatsuba(10, true)) + end + + def test_str2big_gmp + s = "1" + "0" * 1000 + n = 10 ** 1000 + assert_equal(n, s.str2big_gmp(10, true)) + rescue NotImplementedError + end + + end +end diff --git a/jni/ruby/test/-ext-/bug_reporter/test_bug_reporter.rb b/jni/ruby/test/-ext-/bug_reporter/test_bug_reporter.rb new file mode 100644 index 0000000..6ac5b8f --- /dev/null +++ b/jni/ruby/test/-ext-/bug_reporter/test_bug_reporter.rb @@ -0,0 +1,25 @@ +require 'test/unit' +require 'tmpdir' + +class TestBugReporter < Test::Unit::TestCase + def test_bug_reporter_add + expected_stderr = [ + :*, + /\[BUG\]\sSegmentation\sfault.*\n/, + /#{ Regexp.quote(RUBY_DESCRIPTION) }\n\n/, + :*, + /Sample bug reporter: 12345/, + :* + ] + tmpdir = Dir.mktmpdir + + args = ["--disable-gems", "-r-test-/bug_reporter/bug_reporter", + "-C", tmpdir] + stdin = "register_sample_bug_reporter(12345); Process.kill :SEGV, $$" + _, stderr, status = EnvUtil.invoke_ruby(args, stdin, false, true) + stderr.force_encoding("ASCII-8BIT") + assert_pattern_list(expected_stderr, stderr) + ensure + FileUtils.rm_rf(tmpdir) if tmpdir + end +end diff --git a/jni/ruby/test/-ext-/class/test_class2name.rb b/jni/ruby/test/-ext-/class/test_class2name.rb new file mode 100644 index 0000000..070be5a --- /dev/null +++ b/jni/ruby/test/-ext-/class/test_class2name.rb @@ -0,0 +1,18 @@ +require 'test/unit' +require "-test-/class" + +class Test_Class < Test::Unit::TestCase + class Test_Class2Name < superclass + def test_toplevel_class + assert_equal("Object", Bug::Class.class2name(::Object)) + end + + def test_toplevel_module + assert_equal("Kernel", Bug::Class.class2name(::Kernel)) + end + + def test_singleton_class + assert_equal("Object", Bug::Class.class2name(::Object.new.singleton_class)) + end + end +end diff --git a/jni/ruby/test/-ext-/debug/test_debug.rb b/jni/ruby/test/-ext-/debug/test_debug.rb new file mode 100644 index 0000000..ec506e0 --- /dev/null +++ b/jni/ruby/test/-ext-/debug/test_debug.rb @@ -0,0 +1,58 @@ +require 'test/unit' +require '-test-/debug' + +class TestDebug < Test::Unit::TestCase + + def binds_check(binds, msg = nil) + count = Hash.new(0) + assert_instance_of(Array, binds, msg) + binds.each{|(_self, bind, klass, iseq, loc)| + if _self == self + count[:self] += 1 + end + + if bind + assert_instance_of(Binding, bind, msg) + count[:bind] += 1 + end + + if klass + assert(klass.instance_of?(Module) || klass.instance_of?(Class), msg) + count[:class] += 1 + end + + if iseq + count[:iseq] += 1 + assert_instance_of(RubyVM::InstructionSequence, iseq, msg) + + # check same location + assert_equal(loc.path, iseq.path, msg) + assert_equal(loc.absolute_path, iseq.absolute_path, msg) + assert_equal(loc.label, iseq.label, msg) + assert_operator(loc.lineno, :>=, iseq.first_lineno, msg) + end + + assert_instance_of(Thread::Backtrace::Location, loc, msg) + + } + assert_operator(0, :<, count[:self], msg) + assert_operator(0, :<, count[:bind], msg) + assert_operator(0, :<, count[:iseq], msg) + assert_operator(0, :<, count[:class], msg) + end + + def test_inspector_open + binds = Bug::Debug.inspector + binds_check binds + end + + def inspector_in_eval + eval("Bug::Debug.inspector") + end + + def test_inspector_open_in_eval + bug7635 = '[ruby-core:51640]' + binds = inspector_in_eval + binds_check binds, bug7635 + end +end diff --git a/jni/ruby/test/-ext-/debug/test_profile_frames.rb b/jni/ruby/test/-ext-/debug/test_profile_frames.rb new file mode 100644 index 0000000..1879c22 --- /dev/null +++ b/jni/ruby/test/-ext-/debug/test_profile_frames.rb @@ -0,0 +1,104 @@ +require 'test/unit' +require '-test-/debug' + +class SampleClassForTestProfileFrames + class Sample2 + def baz(block) + instance_eval "def zab(block) block.call end" + [self, zab(block)] + end + end + + def self.bar(block) + Sample2.new.baz(block) + end + + def foo(block) + self.class.bar(block) + end +end + +class TestProfileFrames < Test::Unit::TestCase + def test_profile_frames + obj, frames = Fiber.new{ + Fiber.yield SampleClassForTestProfileFrames.new.foo(lambda{ Bug::Debug.profile_frames(0, 10) }) + }.resume + + labels = [ + "block (2 levels) in test_profile_frames", + "zab", + "baz", + "bar", + "foo", + "block in test_profile_frames", + ] + base_labels = [ + "test_profile_frames", + "zab", + "baz", + "bar", + "foo", + "test_profile_frames", + ] + full_labels = [ + "block (2 levels) in TestProfileFrames#test_profile_frames", + "#{obj.inspect}.zab", + "SampleClassForTestProfileFrames::Sample2#baz", + "SampleClassForTestProfileFrames.bar", + "SampleClassForTestProfileFrames#foo", + "block in TestProfileFrames#test_profile_frames", + ] + classes = [ + TestProfileFrames, + obj, + SampleClassForTestProfileFrames::Sample2, + SampleClassForTestProfileFrames, # singleton method + SampleClassForTestProfileFrames, + TestProfileFrames, + ] + singleton_method_p = [ + false, true, false, true, false, false, false, + ] + method_names = [ + "test_profile_frames", + "zab", + "baz", + "bar", + "foo", + "test_profile_frames", + ] + qualified_method_names = [ + "TestProfileFrames#test_profile_frames", + "#{obj.inspect}.zab", + "SampleClassForTestProfileFrames::Sample2#baz", + "SampleClassForTestProfileFrames.bar", + "SampleClassForTestProfileFrames#foo", + "TestProfileFrames#test_profile_frames", + ] + paths = [ file=__FILE__, "(eval)", file, file, file, file ] + absolute_paths = [ file, nil, file, file, file, file ] + + # pp frames + + assert_equal(labels.size, frames.size) + + frames.each.with_index{|(path, absolute_path, label, base_label, full_label, first_lineno, + classpath, singleton_p, method_name, qualified_method_name), i| + err_msg = "#{i}th frame" + assert_equal(paths[i], path, err_msg) + assert_equal(absolute_paths[i], absolute_path, err_msg) + assert_equal(labels[i], label, err_msg) + assert_equal(base_labels[i], base_label, err_msg) + assert_equal(singleton_method_p[i], singleton_p, err_msg) + assert_equal(method_names[i], method_name, err_msg) + assert_match(qualified_method_names[i], qualified_method_name, err_msg) + assert_match(full_labels[i], full_label, err_msg) + assert_match(classes[i].inspect, classpath, err_msg) + if label == method_name + c = classes[i] + m = singleton_p ? c.method(method_name) : c.instance_method(method_name) + assert_equal(m.source_location[1], first_lineno, err_msg) + end + } + end +end diff --git a/jni/ruby/test/-ext-/exception/test_data_error.rb b/jni/ruby/test/-ext-/exception/test_data_error.rb new file mode 100644 index 0000000..53cbb28 --- /dev/null +++ b/jni/ruby/test/-ext-/exception/test_data_error.rb @@ -0,0 +1,13 @@ +require 'test/unit' + +module Bug + class TestException < Test::Unit::TestCase + def test_cleanup_data_error + bug9167 = '[ruby-core:58643] [Bug #9167]' + assert_normal_exit(<<-'end;', bug9167) # do + require '-test-/exception' + raise Bug::Exception::DataError, "Error" + end; + end + end +end diff --git a/jni/ruby/test/-ext-/exception/test_enc_raise.rb b/jni/ruby/test/-ext-/exception/test_enc_raise.rb new file mode 100644 index 0000000..a578b16 --- /dev/null +++ b/jni/ruby/test/-ext-/exception/test_enc_raise.rb @@ -0,0 +1,15 @@ +require 'test/unit' +require '-test-/exception' + +module Bug + class TestException < Test::Unit::TestCase + def test_enc_raise + feature5650 = '[ruby-core:41160]' + Encoding.list.each do |enc| + next unless enc.ascii_compatible? + e = assert_raise(Bug::Exception) {Bug::Exception.enc_raise(enc, "[Feature #5650]")} + assert_equal(enc, e.message.encoding, feature5650) + end + end + end +end diff --git a/jni/ruby/test/-ext-/exception/test_ensured.rb b/jni/ruby/test/-ext-/exception/test_ensured.rb new file mode 100644 index 0000000..97d9794 --- /dev/null +++ b/jni/ruby/test/-ext-/exception/test_ensured.rb @@ -0,0 +1,31 @@ +require 'test/unit' + +module Bug + class Bug7802 < RuntimeError + end + + class TestException < Test::Unit::TestCase + def test_ensured + assert_separately([], <<-'end;') # do + + require '-test-/exception' + + module Bug + class Bug7802 < RuntimeError + def try_method + raise self + end + + def ensured_method + [1].detect {|i| true} + end + end + end + + assert_raise(Bug::Bug7802, '[ruby-core:52022] [Bug #7802]') { + Bug::Exception.ensured(Bug::Bug7802.new) + } + end; + end + end +end diff --git a/jni/ruby/test/-ext-/file/test_stat.rb b/jni/ruby/test/-ext-/file/test_stat.rb new file mode 100644 index 0000000..b9aa132 --- /dev/null +++ b/jni/ruby/test/-ext-/file/test_stat.rb @@ -0,0 +1,14 @@ +require 'test/unit' +require "-test-/file" + +class Test_FileStat < Test::Unit::TestCase + def test_stat_for_fd + st = open(__FILE__) {|f| Bug::File::Stat.for_fd(f.fileno)} + assert_equal(File.stat(__FILE__), st) + end + + def test_stat_for_path + st = Bug::File::Stat.for_path(__FILE__) + assert_equal(File.stat(__FILE__), st) + end +end diff --git a/jni/ruby/test/-ext-/float/test_nextafter.rb b/jni/ruby/test/-ext-/float/test_nextafter.rb new file mode 100644 index 0000000..e3a3e72 --- /dev/null +++ b/jni/ruby/test/-ext-/float/test_nextafter.rb @@ -0,0 +1,57 @@ +require 'test/unit' +require "-test-/float" + +class TestFloatExt < Test::Unit::TestCase + NEXTAFTER_VALUES = [ + -Float::INFINITY, + -Float::MAX, + -100.0, + -1.0-Float::EPSILON, + -1.0, + -Float::EPSILON, + -Float::MIN/2, + -Math.ldexp(0.5, Float::MIN_EXP - Float::MANT_DIG + 1), + -0.0, + 0.0, + Math.ldexp(0.5, Float::MIN_EXP - Float::MANT_DIG + 1), + Float::MIN/2, + Float::MIN, + Float::EPSILON, + 1.0, + 1.0+Float::EPSILON, + 100.0, + Float::MAX, + Float::INFINITY, + Float::NAN + ] + + test_number = 0 + NEXTAFTER_VALUES.each {|n1| + NEXTAFTER_VALUES.each {|n2| + tag = n2.infinite? ? "ruby" : "other" + test_name = "test_nextafter_#{test_number}_#{tag}_#{n1}_#{n2}" + test_number += 1 + define_method(test_name) { + v1 = Bug::Float.missing_nextafter(n1, n2) + v2 = Bug::Float.system_nextafter(n1, n2) + assert_kind_of(Float, v1) + assert_kind_of(Float, v2) + if v1.nan? + assert(v2.nan?, "Bug::Float.system_nextafter(#{n1}, #{n2}).nan?") + else + assert_equal(v1, v2, + "Bug::Float.missing_nextafter(#{'%a' % n1}, #{'%a' % n2}) = #{'%a' % v1} != " + + "#{'%a' % v2} = Bug::Float.system_nextafter(#{'%a' % n1}, #{'%a' % n2})") + if v1 == 0 + s1 = 1.0/v1 < 0 ? "negative-zero" : "positive-zero" + s2 = 1.0/v2 < 0 ? "negative-zero" : "positive-zero" + assert_equal(s1, s2, + "Bug::Float.missing_nextafter(#{'%a' % n1}, #{'%a' % n2}) = #{'%a' % v1} != " + + "#{'%a' % v2} = Bug::Float.system_nextafter(#{'%a' % n1}, #{'%a' % n2})") + end + end + } + } + } + +end diff --git a/jni/ruby/test/-ext-/funcall/test_passing_block.rb b/jni/ruby/test/-ext-/funcall/test_passing_block.rb new file mode 100644 index 0000000..87aed22 --- /dev/null +++ b/jni/ruby/test/-ext-/funcall/test_passing_block.rb @@ -0,0 +1,22 @@ +require 'test/unit' + +class TestFuncall < Test::Unit::TestCase + module Relay + def self.target(*args, &block) + yield(*args) if block + end + end + require '-test-/funcall/funcall' + + def test_with_funcall2 + ok = nil + Relay.with_funcall2("feature#4504") {|arg| ok = arg || true} + assert_nil(ok) + end + + def test_with_funcall_passing_block + ok = nil + Relay.with_funcall_passing_block("feature#4504") {|arg| ok = arg || true} + assert_equal("feature#4504", ok) + end +end diff --git a/jni/ruby/test/-ext-/hash/test_delete.rb b/jni/ruby/test/-ext-/hash/test_delete.rb new file mode 100644 index 0000000..13f3595 --- /dev/null +++ b/jni/ruby/test/-ext-/hash/test_delete.rb @@ -0,0 +1,19 @@ +require 'test/unit' +require '-test-/hash' + +class TestHash < Test::Unit::TestCase + class TestDelete < Test::Unit::TestCase + def test_delete + hash = Bug::Hash.new + hash[1] = 2 + called = false + assert_equal 1, hash.size + assert_equal [2], hash.delete!(1) {called = true} + assert_equal false, called, "block called" + assert_equal 0, hash.size + assert_equal nil, hash.delete!(1) {called = true} + assert_equal false, called, "block called" + assert_equal 0, hash.size + end + end +end diff --git a/jni/ruby/test/-ext-/iseq_load/test_iseq_load.rb b/jni/ruby/test/-ext-/iseq_load/test_iseq_load.rb new file mode 100644 index 0000000..5bbd49e --- /dev/null +++ b/jni/ruby/test/-ext-/iseq_load/test_iseq_load.rb @@ -0,0 +1,95 @@ +require 'test/unit' + +class TestIseqLoad < Test::Unit::TestCase + require '-test-/iseq_load/iseq_load' + ISeq = RubyVM::InstructionSequence + + def test_bug8543 + assert_iseq_roundtrip <<-'end;' + puts "tralivali" + def funct(a, b) + a**b + end + 3.times { |i| puts "Hello, world#{funct(2,i)}!" } + end; + end + + def test_case_when + assert_iseq_roundtrip <<-'end;' + def user_mask(target) + target.each_char.inject(0) do |mask, chr| + case chr + when "u" + mask | 04700 + when "g" + mask | 02070 + when "o" + mask | 01007 + when "a" + mask | 07777 + else + raise ArgumentError, "invalid `who' symbol in file mode: #{chr}" + end + end + end + end; + end + + def test_splatsplat + assert_iseq_roundtrip('def splatsplat(**); end') + end + + def test_hidden + assert_iseq_roundtrip('def x(a, (b, *c), d: false); end') + end + + def assert_iseq_roundtrip(src) + a = ISeq.compile(src).to_a + b = ISeq.iseq_load(a).to_a + warn diff(a, b) if a != b + assert_equal a, b + assert_equal a, ISeq.iseq_load(b).to_a + end + + def test_next_in_block_in_block + skip "failing due to stack_max mismatch" + assert_iseq_roundtrip <<-'end;' + 3.times { 3.times { next } } + end; + end + + def test_break_ensure + skip "failing due to exception entry sp mismatch" + assert_iseq_roundtrip <<-'end;' + def m + bad = true + while true + begin + break + ensure + bad = false + end + end + end + end; + end + + # FIXME: still failing + def test_require_integration + skip "iseq loader require integration tests still failing" + f = File.expand_path(__FILE__) + # $(top_srcdir)/test/ruby/test_....rb + 3.times { f = File.dirname(f) } + Dir[File.join(f, 'ruby', '*.rb')].each do |f| + iseq = ISeq.compile_file(f) + orig = iseq.to_a.freeze + + loaded = ISeq.iseq_load(orig).to_a + if loaded != orig + warn f + warn diff(orig, loaded) + end + #assert_equal orig, loaded + end + end +end diff --git a/jni/ruby/test/-ext-/iter/test_iter_break.rb b/jni/ruby/test/-ext-/iter/test_iter_break.rb new file mode 100644 index 0000000..5bac633 --- /dev/null +++ b/jni/ruby/test/-ext-/iter/test_iter_break.rb @@ -0,0 +1,15 @@ +require 'test/unit' +require '-test-/iter' + +module TestIter +end + +class TestIter::IterBreak < Test::Unit::TestCase + def test_iter_break + backport7896 = '[ruby-core:52607]' + assert_equal(nil, 1.times{Bug::Iter::Breakable.iter_break}, backport7896) + + feature5895 = '[ruby-dev:45132]' + assert_equal(42, 1.times{Bug::Iter::Breakable.iter_break_value(42)}, feature5895) + end +end diff --git a/jni/ruby/test/-ext-/iter/test_yield_block.rb b/jni/ruby/test/-ext-/iter/test_yield_block.rb new file mode 100644 index 0000000..bec993c --- /dev/null +++ b/jni/ruby/test/-ext-/iter/test_yield_block.rb @@ -0,0 +1,21 @@ +require 'test/unit' +require '-test-/iter' + +module TestIter +end + +class TestIter::YieldBlock < Test::Unit::TestCase + class YieldTest + include Bug::Iter::Yield + attr_reader :blockarg + def test(arg, &block) + block.call(arg) {|blockarg| @blockarg = blockarg} + end + end + + def test_yield_block + a = YieldTest.new + a.yield_block(:test, "foo") {|x, &b| assert_kind_of(Proc, b); b.call(x)} + assert_equal("foo", a.blockarg) + end +end diff --git a/jni/ruby/test/-ext-/load/test_dot_dot.rb b/jni/ruby/test/-ext-/load/test_dot_dot.rb new file mode 100644 index 0000000..82aa10a --- /dev/null +++ b/jni/ruby/test/-ext-/load/test_dot_dot.rb @@ -0,0 +1,10 @@ +require 'test/unit' + +class Test_DotDot < Test::Unit::TestCase + def test_load_dot_dot + feature = '[ruby-dev:41774]' + assert_nothing_raised(LoadError, feature) { + require '-test-/load/dot.dot/dot.dot' + } + end +end diff --git a/jni/ruby/test/-ext-/marshal/test_usrmarshal.rb b/jni/ruby/test/-ext-/marshal/test_usrmarshal.rb new file mode 100644 index 0000000..8d8db01 --- /dev/null +++ b/jni/ruby/test/-ext-/marshal/test_usrmarshal.rb @@ -0,0 +1,32 @@ +require 'test/unit' +require '-test-/marshal/usr' + +module Bug end + +module Bug::Marshal + class TestUsrMarshal < Test::Unit::TestCase + def old_dump + @old_dump ||= + begin + src = "module Bug; module Marshal; class UsrMarshal; def initialize(val) @value = val; end; end; ::Marshal.dump(UsrMarshal.new(42), STDOUT); end; end" + EnvUtil.invoke_ruby([], src, true)[0] + end + end + + def test_marshal + v = ::Marshal.load(::Marshal.dump(UsrMarshal.new(42))) + assert_instance_of(UsrMarshal, v) + assert_equal(42, v.value) + end + + def test_incompat + assert_raise_with_message(ArgumentError, "dump format error") {::Marshal.load(old_dump)} + end + + def test_compat + out, err = EnvUtil.invoke_ruby(["-r-test-/marshal/usr", "-r-test-/marshal/compat", "-e", "::Marshal.dump(::Marshal.load(STDIN), STDOUT)"], old_dump, true, true) + assert_equal(::Marshal.dump(UsrMarshal.new(42)), out) + assert_equal("", err) + end + end +end diff --git a/jni/ruby/test/-ext-/method/test_arity.rb b/jni/ruby/test/-ext-/method/test_arity.rb new file mode 100644 index 0000000..79ef23b --- /dev/null +++ b/jni/ruby/test/-ext-/method/test_arity.rb @@ -0,0 +1,37 @@ +require '-test-/method' +require 'test/unit' + +class TestMethod < Test::Unit::TestCase + class TestArity < Test::Unit::TestCase + class A + def foo0() + end + def foom1(*a) + end + def foom2(a,*b) + end + def foo1(a) + end + def foo2(a,b) + end + end + + class B nil) + } + assert_not_pinneddown(name) + end + + def test_execopt_redirect_value + name = noninterned_name.intern + assert_raise(ArgumentError) { + system(".", [] => name) + } + assert_not_pinneddown(name) + end + + def test_execopt_redirect_path + name = noninterned_name.intern + assert_raise(TypeError) { + system(".", [] => [name, 0]) + } + assert_not_pinneddown(name) + end + + def test_execopt_redirect_symbol + name = noninterned_name.intern + assert_raise(ArgumentError) { + system(".", in: name) + } + assert_not_pinneddown(name) + end + + def assert_no_immortal_symbol_created(name) + name = noninterned_name(name) + yield(name) + assert_not_pinneddown(name) + end + + def assert_no_immortal_symbol_in_method_missing(name) + assert_no_immortal_symbol_created("send should not leak - #{name}") do |name| + assert_raise(NoMethodError) {yield(name)} + end + end + + def test_send_leak_string + assert_no_immortal_symbol_in_method_missing("str") do |name| + 42.send(name) + end + end + + def test_send_leak_symbol + assert_no_immortal_symbol_in_method_missing("sym") do |name| + 42.send(name.to_sym) + end + end + + def test_send_leak_string_custom_method_missing + x = Object.new + def x.method_missing(*); super; end + assert_no_immortal_symbol_in_method_missing("str mm") do |name| + x.send(name) + end + end + + def test_send_leak_symbol_custom_method_missing + x = Object.new + def x.method_missing(*); super; end + assert_no_immortal_symbol_in_method_missing("sym mm") do |name| + x.send(name.to_sym) + end + end + + def test_send_leak_string_no_optimization + assert_no_immortal_symbol_in_method_missing("str slow") do |name| + 42.method(:send).call(name) + end + end + + def test_send_leak_symbol_no_optimization + assert_no_immortal_symbol_in_method_missing("sym slow") do |name| + 42.method(:send).call(name.to_sym) + end + end + + def test_send_leak_string_custom_method_missing_no_optimization + x = Object.new + def x.method_missing(*); super; end + assert_no_immortal_symbol_in_method_missing("str mm slow") do |name| + x.method(:send).call(name) + end + end + + def test_send_leak_symbol_custom_method_missing_no_optimization + x = Object.new + def x.method_missing(*); super; end + assert_no_immortal_symbol_in_method_missing("sym mm slow") do |name| + x.method(:send).call(name.to_sym) + end + end + + def test_kwarg_symbol_leak_no_rest + foo = -> (arg: 42) {} + assert_no_immortal_symbol_created("kwarg no rest") do |name| + assert_raise(ArgumentError) { foo.call(name.to_sym => 42) } + end + end + + def test_kwarg_symbol_leak_with_rest + foo = -> (arg: 2, **options) {} + assert_no_immortal_symbol_created("kwarg with rest") do |name| + foo.call(name.to_sym => 42) + end + end + + def test_kwarg_symbol_leak_just_rest + foo = -> (**options) {} + assert_no_immortal_symbol_created("kwarg just rest") do |name| + foo.call(name.to_sym => 42) + end + end + end +end diff --git a/jni/ruby/test/-ext-/symbol/test_type.rb b/jni/ruby/test/-ext-/symbol/test_type.rb new file mode 100644 index 0000000..f1749f5 --- /dev/null +++ b/jni/ruby/test/-ext-/symbol/test_type.rb @@ -0,0 +1,124 @@ +require 'test/unit' +require "-test-/symbol" + +module Test_Symbol + class TestType < Test::Unit::TestCase + def test_id2str_fstring_bug9171 + fstr = eval("# encoding: us-ascii + 'foobar'.freeze") + assert_same fstr, Bug::Symbol.id2str(:foobar) + + fstr = eval("# encoding: us-ascii + '>'.freeze") + assert_same fstr, Bug::Symbol.id2str(:>) + end + + def assert_symtype(sym, pred, msg = nil) + assert_send([Bug::Symbol, pred, sym], msg) + end + + def assert_not_symtype(sym, pred, msg = nil) + assert_not_send([Bug::Symbol, pred, sym], msg) + end + + def test_const + assert_symtype("Foo", :const?) + assert_not_symtype("F!", :const?) + assert_not_symtype("foo", :const?) + assert_not_symtype("@foo", :const?) + assert_not_symtype("@@foo", :const?) + assert_not_symtype("$foo", :const?) + assert_not_symtype("foo=", :const?) + assert_not_symtype("[foo]", :const?) + assert_not_symtype("xFoo", :const?) + end + + def test_local + assert_symtype("foo", :local?) + assert_symtype("fooBar", :local?) + assert_symtype("foo_bar", :local?) + assert_not_symtype("foo!", :local?) + assert_not_symtype("foo?", :local?) + assert_not_symtype("Foo", :local?) + assert_not_symtype("@foo", :local?) + assert_not_symtype("@@foo", :local?) + assert_not_symtype("$foo", :local?) + assert_not_symtype("foo=", :local?) + assert_not_symtype("[foo]", :local?) + end + + def test_global + assert_symtype("$foo", :global?) + assert_symtype("$$", :global?) + assert_not_symtype("$()", :global?) + assert_not_symtype("$", :global?) + assert_not_symtype("foo", :global?) + assert_not_symtype("Foo", :global?) + assert_not_symtype("@foo", :global?) + assert_not_symtype("@@foo", :global?) + assert_not_symtype("foo=", :global?) + assert_not_symtype("[foo]", :global?) + end + + def test_instance + assert_symtype("@foo", :instance?) + assert_not_symtype("@", :instance?) + assert_not_symtype("@1", :instance?) + assert_not_symtype("@@", :instance?) + assert_not_symtype("foo", :instance?) + assert_not_symtype("Foo", :instance?) + assert_not_symtype("@@foo", :instance?) + assert_not_symtype("$foo", :instance?) + assert_not_symtype("foo=", :instance?) + assert_not_symtype("[foo]", :instance?) + end + + def test_class + assert_symtype("@@foo", :class?) + assert_not_symtype("@@", :class?) + assert_not_symtype("@", :class?) + assert_not_symtype("@@1", :class?) + assert_not_symtype("foo", :class?) + assert_not_symtype("Foo", :class?) + assert_not_symtype("@foo", :class?) + assert_not_symtype("$foo", :class?) + assert_not_symtype("foo=", :class?) + assert_not_symtype("[foo]", :class?) + end + + def test_attrset + assert_symtype("foo=", :attrset?) + assert_symtype("Foo=", :attrset?) + assert_symtype("@foo=", :attrset?) + assert_symtype("@@foo=", :attrset?) + assert_symtype("$foo=", :attrset?) + assert_symtype("0=", :attrset?) + assert_symtype("@=", :attrset?) + assert_symtype("@@=", :attrset?) + assert_not_symtype("foo", :attrset?) + assert_not_symtype("Foo", :attrset?) + assert_not_symtype("@foo", :attrset?) + assert_not_symtype("@@foo", :attrset?) + assert_not_symtype("$foo", :attrset?) + assert_not_symtype("[foo]", :attrset?) + assert_symtype("[foo]=", :attrset?) + assert_equal(:"foo=", Bug::Symbol.attrset("foo")) + assert_symtype(Bug::Symbol.attrset("foo"), :attrset?) + assert_equal(:"Foo=", Bug::Symbol.attrset("Foo")) + assert_symtype(Bug::Symbol.attrset("Foo"), :attrset?) + assert_equal(:"@foo=", Bug::Symbol.attrset("@foo")) + assert_symtype(Bug::Symbol.attrset("@foo"), :attrset?) + assert_equal(:"@@foo=", Bug::Symbol.attrset("@@foo")) + assert_symtype(Bug::Symbol.attrset("@@foo"), :attrset?) + assert_equal(:"$foo=", Bug::Symbol.attrset("$foo")) + assert_symtype(Bug::Symbol.attrset("$foo"), :attrset?) + assert_equal(:"[foo]=", Bug::Symbol.attrset("[foo]")) + assert_symtype(Bug::Symbol.attrset("[foo]"), :attrset?) + assert_equal(:[]=, Bug::Symbol.attrset(:[])) + assert_symtype(Bug::Symbol.attrset("foo?="), :attrset?) + assert_equal(:"foo?=", Bug::Symbol.attrset(:foo?)) + assert_symtype(Bug::Symbol.attrset("foo!="), :attrset?) + assert_equal(:"foo!=", Bug::Symbol.attrset(:foo!)) + end + end +end diff --git a/jni/ruby/test/-ext-/test_bug-3571.rb b/jni/ruby/test/-ext-/test_bug-3571.rb new file mode 100644 index 0000000..d7c26d1 --- /dev/null +++ b/jni/ruby/test/-ext-/test_bug-3571.rb @@ -0,0 +1,20 @@ +require 'test/unit' + +class Test_BUG_3571 < Test::Unit::TestCase + def test_block_call_id + bug3571 = '[ruby-dev:41852]' + src = < e + STDERR.puts e.message, e.backtrace[$0.size..-1] +end +SRC + out = [ + "start() function is unimplemented on this machine", + "-:2:in `start'", + "-:2:in `
'", + ] + assert_in_out_err(%w"-r-test-/bug-3571/bug", src, [], out, bug3571) + end +end diff --git a/jni/ruby/test/-ext-/test_bug-3662.rb b/jni/ruby/test/-ext-/test_bug-3662.rb new file mode 100644 index 0000000..73c0697 --- /dev/null +++ b/jni/ruby/test/-ext-/test_bug-3662.rb @@ -0,0 +1,10 @@ +require '-test-/bug-3662/bug' + +class Test_BUG_3662 < Test::Unit::TestCase + def test_funcall_notimplement + bug3662 = '[ruby-dev:41953]' + assert_raise(NotImplementedError, bug3662) { + Bug.funcall(:notimplement) + } + end +end diff --git a/jni/ruby/test/-ext-/test_bug-5832.rb b/jni/ruby/test/-ext-/test_bug-5832.rb new file mode 100644 index 0000000..11f8a52 --- /dev/null +++ b/jni/ruby/test/-ext-/test_bug-5832.rb @@ -0,0 +1,21 @@ +require '-test-/bug-5832/bug' + +class Test_BUG_5832 < Test::Unit::TestCase + def test_block_passing + bug5832 = '[ruby-dev:45071]' + + c = Class.new do + define_method(:call_invoke_block_from_c) do + Bug.funcall_callback(self) + end + + def callback + yield if block_given? + end + end + + assert_nothing_raised(RuntimeError, bug5832) do + c.new.call_invoke_block_from_c { raise 'unreachable' } + end + end +end diff --git a/jni/ruby/test/-ext-/test_printf.rb b/jni/ruby/test/-ext-/test_printf.rb new file mode 100644 index 0000000..1f06ad6 --- /dev/null +++ b/jni/ruby/test/-ext-/test_printf.rb @@ -0,0 +1,186 @@ +require 'test/unit' +require "-test-/printf" +require_relative '../ruby/allpairs' + +class Test_SPrintf < Test::Unit::TestCase + def to_s + "#{self.class}:#{object_id}" + end + + def inspect + "<#{self.class}:#{object_id}>" + end + + def test_to_str + assert_equal("<#{self.class}:#{object_id}>", Bug::Printf.s(self)) + end + + def test_inspect + assert_equal("{<#{self.class}:#{object_id}>}", Bug::Printf.v(self)) + end + + def test_quote + assert_equal('["\n"]', Bug::Printf.q("\n")) + assert_equal('[aaa]', Bug::Printf.q('aaa')) + assert_equal('[a a]', Bug::Printf.q('a a')) + end + + def test_encoding + def self.to_s + "\u{3042 3044 3046 3048 304a}" + end + assert_equal("<\u{3042 3044 3046 3048 304a}>", Bug::Printf.s(self)) + end + + def test_taint + obj = Object.new.taint + assert_equal({to_s: true, inspect: true}, + { + to_s: Bug::Printf.s(obj).tainted?, + inspect: Bug::Printf.v(obj).tainted?, + }) + end + + VS = [ + #-0x1000000000000000000000000000000000000000000000002, + #-0x1000000000000000000000000000000000000000000000001, + #-0x1000000000000000000000000000000000000000000000000, + #-0xffffffffffffffffffffffffffffffffffffffffffffffff, + #-0x1000000000000000000000002, + #-0x1000000000000000000000001, + #-0x1000000000000000000000000, + #-0xffffffffffffffffffffffff, + -0x10000000000000002, + -0x10000000000000001, + -0x10000000000000000, + -0xffffffffffffffff, + -0x4000000000000002, + -0x4000000000000001, + -0x4000000000000000, + -0x3fffffffffffffff, + -0x100000002, + -0x100000001, + -0x100000000, + -0xffffffff, + #-0xc717a08d, # 0xc717a08d * 0x524b2245 = 0x4000000000000001 + -0x80000002, + -0x80000001, + -0x80000000, + -0x7fffffff, + #-0x524b2245, + -0x40000002, + -0x40000001, + -0x40000000, + -0x3fffffff, + #-0x10002, + #-0x10001, + #-0x10000, + #-0xffff, + #-0x8101, # 0x8101 * 0x7f01 = 0x40000001 + #-0x8002, + #-0x8001, + #-0x8000, + #-0x7fff, + #-0x7f01, + #-65, + #-64, + #-63, + #-62, + #-33, + #-32, + #-31, + #-30, + -3, + -2, + -1, + 0, + 1, + 2, + 3, + #30, + #31, + #32, + #33, + #62, + #63, + #64, + #65, + #0x7f01, + #0x7ffe, + #0x7fff, + #0x8000, + #0x8001, + #0x8101, + #0xfffe, + #0xffff, + #0x10000, + #0x10001, + 0x3ffffffe, + 0x3fffffff, + 0x40000000, + 0x40000001, + #0x524b2245, + 0x7ffffffe, + 0x7fffffff, + 0x80000000, + 0x80000001, + #0xc717a08d, + 0xfffffffe, + 0xffffffff, + 0x100000000, + 0x100000001, + 0x3ffffffffffffffe, + 0x3fffffffffffffff, + 0x4000000000000000, + 0x4000000000000001, + 0xfffffffffffffffe, + 0xffffffffffffffff, + 0x10000000000000000, + 0x10000000000000001, + #0xffffffffffffffffffffffff, + #0x1000000000000000000000000, + #0x1000000000000000000000001, + #0xffffffffffffffffffffffffffffffffffffffffffffffff, + #0x1000000000000000000000000000000000000000000000000, + #0x1000000000000000000000000000000000000000000000001 + ] + VS.reverse! + + FLAGS = [[nil, ' '], [nil, '#'], [nil, '+'], [nil, '-'], [nil, '0']] + + def self.assertions_format_integer(format, type, **opts) + proc { + VS.each {|v| + begin + r = Bug::Printf.(type, v, **opts) + rescue RangeError + else + e = sprintf format, v + assert_equal([e, format], r, "rb_sprintf(#{format.dump}, #{v})") + end + } + } + end + + AllPairs.each(%w[d], + # octal and hexadecimal deal with negative values differently + [nil, 0, 5, 20], + [nil, true, 0], # 8, 20 + *FLAGS) { + |type, width, prec, sp, hs, pl, mi, zr| + precision = ".#{prec unless prec == true}" if prec + format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}" + define_method("test_format_integer(#{format})", + assertions_format_integer(format, type, + space: sp, hash: hs, + plus: pl, minus: mi, + zero: zr, width: width, + prec: prec)) + } + + def test_string_prec + assert_equal("a", Bug::Printf.("s", "a", prec: 3)[0]) + assert_equal(" a", Bug::Printf.("s", "a", width: 3, prec: 3)[0]) + assert_equal("a ", Bug::Printf.("s", "a", minus: true, width: 3, prec: 3)[0]) + end +end diff --git a/jni/ruby/test/-ext-/test_recursion.rb b/jni/ruby/test/-ext-/test_recursion.rb new file mode 100644 index 0000000..06faf6d --- /dev/null +++ b/jni/ruby/test/-ext-/test_recursion.rb @@ -0,0 +1,35 @@ +# -*- coding: us-ascii -*- +require 'test/unit' + +class TestRecursion < Test::Unit::TestCase + require '-test-/recursion' + + def setup + @obj = Struct.new(:visited).new(false) + @obj.extend(Bug::Recursive) + end + + def test_recursive + def @obj.doit + self.visited = true + exec_recursive(:doit) + raise "recursive" + end + assert_raise_with_message(RuntimeError, "recursive") { + @obj.exec_recursive(:doit) + } + assert(@obj.visited, "obj.hash was not called") + end + + def test_recursive_outer + def @obj.doit + self.visited = true + exec_recursive_outer(:doit) + raise "recursive_outer should short circuit intermediate calls" + end + assert_nothing_raised { + @obj.exec_recursive_outer(:doit) + } + assert(@obj.visited, "obj.hash was not called") + end +end diff --git a/jni/ruby/test/-ext-/tracepoint/test_tracepoint.rb b/jni/ruby/test/-ext-/tracepoint/test_tracepoint.rb new file mode 100644 index 0000000..b5a6e76 --- /dev/null +++ b/jni/ruby/test/-ext-/tracepoint/test_tracepoint.rb @@ -0,0 +1,79 @@ +require 'test/unit' +require '-test-/tracepoint' + +class TestTracepointObj < Test::Unit::TestCase + def test_not_available_from_ruby + assert_raise ArgumentError do + TracePoint.trace(:obj_new){} + end + end + + def test_tracks_objspace_events + result = Bug.tracepoint_track_objspace_events{ + 99 + 'abc' + _="foobar" + Object.new + nil + } + + newobj_count, free_count, gc_start_count, gc_end_mark_count, gc_end_sweep_count, *newobjs = *result + assert_equal 2, newobj_count + assert_equal 2, newobjs.size + assert_equal 'foobar', newobjs[0] + assert_equal Object, newobjs[1].class + assert_operator free_count, :>=, 0 + assert_operator gc_start_count, :==, gc_end_mark_count + assert_operator gc_start_count, :>=, gc_end_sweep_count + end + + def test_tracks_objspace_count + stat1 = {} + stat2 = {} + GC.disable + GC.stat(stat1) + result = Bug.tracepoint_track_objspace_events{ + GC.enable + 1_000_000.times{''} + GC.disable + } + GC.stat(stat2) + GC.enable + + newobj_count, free_count, gc_start_count, gc_end_mark_count, gc_end_sweep_count, *newobjs = *result + + assert_operator stat2[:total_allocated_objects] - stat1[:total_allocated_objects], :>=, newobj_count + assert_operator 1_000_000, :<=, newobj_count + + assert_operator stat2[:total_freed_objects] + stat2[:heap_final_slots] - stat1[:total_freed_objects], :>=, free_count + assert_operator stat2[:count] - stat1[:count], :==, gc_start_count + + assert_operator gc_start_count, :==, gc_end_mark_count + assert_operator gc_start_count, :>=, gc_end_sweep_count + assert_operator stat2[:count] - stat1[:count] - 1, :<=, gc_end_sweep_count + end + + def test_tracepoint_specify_normal_and_internal_events + assert_raise(TypeError){ Bug.tracepoint_specify_normal_and_internal_events } + end + + def test_after_gc_start_hook_with_GC_stress + bug8492 = '[ruby-dev:47400] [Bug #8492]: infinite after_gc_start_hook reentrance' + assert_nothing_raised(Timeout::Error, bug8492) do + assert_in_out_err(%w[-r-test-/tracepoint], <<-'end;', /\A[1-9]/, timeout: 2) + stress, GC.stress = GC.stress, false + count = 0 + Bug.after_gc_start_hook = proc {count += 1} + begin + GC.stress = true + 3.times {Object.new} + ensure + GC.stress = stress + Bug.after_gc_start_hook = nil + end + puts count + end; + end + end + +end diff --git a/jni/ruby/test/-ext-/typeddata/test_typeddata.rb b/jni/ruby/test/-ext-/typeddata/test_typeddata.rb new file mode 100644 index 0000000..c24ad08 --- /dev/null +++ b/jni/ruby/test/-ext-/typeddata/test_typeddata.rb @@ -0,0 +1,16 @@ +require 'test/unit' +require "-test-/typeddata/typeddata" + +class Test_TypedData < Test::Unit::TestCase + def test_wrong_argtype + assert_raise_with_message(TypeError, "wrong argument type false (expected typed_data)") {Bug::TypedData.check(false)} + + assert_raise_with_message(TypeError, "wrong argument type true (expected typed_data)") {Bug::TypedData.check(true)} + + assert_raise_with_message(TypeError, "wrong argument type Symbol (expected typed_data)") {Bug::TypedData.check(:e)} + + assert_raise_with_message(TypeError, "wrong argument type Fixnum (expected typed_data)") {Bug::TypedData.check(0)} + + assert_raise_with_message(TypeError, "wrong argument type String (expected typed_data)") {Bug::TypedData.check("a")} + end +end diff --git a/jni/ruby/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb b/jni/ruby/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb new file mode 100644 index 0000000..e88dbef --- /dev/null +++ b/jni/ruby/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb @@ -0,0 +1,45 @@ +require 'test/unit' + +class TestWaitForSingleFD < Test::Unit::TestCase + require '-test-/wait_for_single_fd/wait_for_single_fd' + + def with_pipe + r, w = IO.pipe + begin + yield r, w + ensure + r.close unless r.closed? + w.close unless w.closed? + end + end + + def test_wait_for_valid_fd + with_pipe do |r,w| + rc = IO.wait_for_single_fd(w.fileno, RB_WAITFD_OUT, nil) + assert_equal RB_WAITFD_OUT, rc + end + end + + def test_wait_for_invalid_fd + # FreeBSD 8.2 or prior sticks this + # http://bugs.ruby-lang.org/issues/5524 + skip if /freebsd[1-8]/ =~ RUBY_PLATFORM + with_pipe do |r,w| + wfd = w.fileno + w.close + assert_raise(Errno::EBADF) do + IO.wait_for_single_fd(wfd, RB_WAITFD_OUT, nil) + end + end + end + + def test_wait_for_closed_pipe + with_pipe do |r,w| + w.close + rc = IO.wait_for_single_fd(r.fileno, RB_WAITFD_IN, nil) + assert_equal RB_WAITFD_IN, rc + end + end + + +end diff --git a/jni/ruby/test/-ext-/win32/test_console_attr.rb b/jni/ruby/test/-ext-/win32/test_console_attr.rb new file mode 100644 index 0000000..3afb2d9 --- /dev/null +++ b/jni/ruby/test/-ext-/win32/test_console_attr.rb @@ -0,0 +1,43 @@ +if /mswin|mingw/ =~ RUBY_PLATFORM and STDOUT.tty? + require '-test-/win32/console' + require 'io/console' + require 'test/unit' + + class Test_Win32Console < Test::Unit::TestCase + def reset + STDOUT.console_attribute(7) + end + + alias setup reset + alias teardown reset + + def test_default + info = STDOUT.console_info + assert_equal(7, info.attr); + end + + def test_reverse + print "\e[7m" + info = STDOUT.console_info + assert_equal(0x70, info.attr); + end + + def test_bold + print "\e[1m" + info = STDOUT.console_info + assert_equal(0x8, info.attr&0x8); + end + + def test_bold_reverse + print "\e[1;7m" + info = STDOUT.console_info + assert_equal(0xf0, info.attr); + end + + def test_reverse_bold + print "\e[7;1m" + info = STDOUT.console_info + assert_equal(0xf0, info.attr); + end + end +end diff --git a/jni/ruby/test/-ext-/win32/test_dln.rb b/jni/ruby/test/-ext-/win32/test_dln.rb new file mode 100644 index 0000000..2801ebe --- /dev/null +++ b/jni/ruby/test/-ext-/win32/test_dln.rb @@ -0,0 +1,34 @@ +require 'test/unit' +require 'tmpdir' +require 'rbconfig' + +module Bug + module Win32 + class TestDln < Test::Unit::TestCase + def test_check_imported + bug = '[Bug #6303]' + assert_in_out_err(['-r-test-/win32/dln', '-eexit'], '', [], [], bug, timeout: 10) + end + + def test_nonascii_load + bug9699 = '[ruby-core:61845] [Bug #9699]' + so = "-test-/win32/dln/empty." + RbConfig::CONFIG["DLEXT"] + so = $:.find {|d| d = ::File.join(d, so); break d if ::File.exist?(d)} + assert_not_nil(so) + Dir.mkdir(dir = ::File.join(testdir = Dir.mktmpdir("test"), "\u{30c6 30b9 30c8}")) + ::File.copy_stream(so, ::File.join(dir, ::File.basename(so))) + assert_separately(['-', bug9699, testdir, ::File.basename(so)], <<-'end;') + bug, dir, so = *ARGV + assert_nothing_raised(LoadError, bug) do + require ::File.join(dir, "\u{30c6 30b9 30c8}", so) + end + end; + ensure + ::File.unlink(::File.join(dir, ::File.basename(so))) rescue nil + Dir.rmdir(dir) rescue nil + Dir.rmdir(testdir) rescue nil + end + + end + end +end if /mswin|mingw/ =~ RUBY_PLATFORM diff --git a/jni/ruby/test/-ext-/win32/test_fd_setsize.rb b/jni/ruby/test/-ext-/win32/test_fd_setsize.rb new file mode 100644 index 0000000..6fe889c --- /dev/null +++ b/jni/ruby/test/-ext-/win32/test_fd_setsize.rb @@ -0,0 +1,24 @@ +require 'test/unit' + +module Bug + module Win32 + class TestFdSetSize < Test::Unit::TestCase + def test_select_with_unmatched_fd_setsize + bug6532 = '[ruby-core:44588]' + assert_in_out_err([], <<-INPUT, %w(:ok), [], bug6532) + require '-test-/win32/fd_setsize' + Bug::Win32.test_select + p :ok + INPUT + end + + def test_fdset_with_unmatched_fd_setsize + bug6532 = '[ruby-core:44588]' + assert_in_out_err([], <<-INPUT, %w(:ok), [], bug6532) + require '-test-/win32/fd_setsize' + p :ok if Bug::Win32.test_fdset + INPUT + end + end + end +end if /mswin|mingw/ =~ RUBY_PLATFORM diff --git a/jni/ruby/test/base64/test_base64.rb b/jni/ruby/test/base64/test_base64.rb new file mode 100644 index 0000000..c5e61b3 --- /dev/null +++ b/jni/ruby/test/base64/test_base64.rb @@ -0,0 +1,100 @@ +# coding: US-ASCII +require "test/unit" +require "base64" + +class TestBase64 < Test::Unit::TestCase + def test_sample + assert_equal("U2VuZCByZWluZm9yY2VtZW50cw==\n", Base64.encode64('Send reinforcements')) + assert_equal('Send reinforcements', Base64.decode64("U2VuZCByZWluZm9yY2VtZW50cw==\n")) + assert_equal( + "Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g\nUnVieQ==\n", + Base64.encode64("Now is the time for all good coders\nto learn Ruby")) + assert_equal( + "Now is the time for all good coders\nto learn Ruby", + Base64.decode64("Tm93IGlzIHRoZSB0aW1lIGZvciBhbGwgZ29vZCBjb2RlcnMKdG8gbGVhcm4g\nUnVieQ==\n")) + assert_equal( + "VGhpcyBpcyBsaW5lIG9uZQpUaGlzIGlzIGxpbmUgdHdvClRoaXMgaXMgbGlu\nZSB0aHJlZQpBbmQgc28gb24uLi4K\n", + Base64.encode64("This is line one\nThis is line two\nThis is line three\nAnd so on...\n")) + assert_equal( + "This is line one\nThis is line two\nThis is line three\nAnd so on...\n", + Base64.decode64("VGhpcyBpcyBsaW5lIG9uZQpUaGlzIGlzIGxpbmUgdHdvClRoaXMgaXMgbGluZSB0aHJlZQpBbmQgc28gb24uLi4K")) + end + + def test_encode64 + assert_equal("", Base64.encode64("")) + assert_equal("AA==\n", Base64.encode64("\0")) + assert_equal("AAA=\n", Base64.encode64("\0\0")) + assert_equal("AAAA\n", Base64.encode64("\0\0\0")) + assert_equal("/w==\n", Base64.encode64("\377")) + assert_equal("//8=\n", Base64.encode64("\377\377")) + assert_equal("////\n", Base64.encode64("\377\377\377")) + assert_equal("/+8=\n", Base64.encode64("\xff\xef")) + end + + def test_decode64 + assert_equal("", Base64.decode64("")) + assert_equal("\0", Base64.decode64("AA==\n")) + assert_equal("\0\0", Base64.decode64("AAA=\n")) + assert_equal("\0\0\0", Base64.decode64("AAAA\n")) + assert_equal("\377", Base64.decode64("/w==\n")) + assert_equal("\377\377", Base64.decode64("//8=\n")) + assert_equal("\377\377\377", Base64.decode64("////\n")) + assert_equal("\xff\xef", Base64.decode64("/+8=\n")) + end + + def test_strict_encode64 + assert_equal("", Base64.strict_encode64("")) + assert_equal("AA==", Base64.strict_encode64("\0")) + assert_equal("AAA=", Base64.strict_encode64("\0\0")) + assert_equal("AAAA", Base64.strict_encode64("\0\0\0")) + assert_equal("/w==", Base64.strict_encode64("\377")) + assert_equal("//8=", Base64.strict_encode64("\377\377")) + assert_equal("////", Base64.strict_encode64("\377\377\377")) + assert_equal("/+8=", Base64.strict_encode64("\xff\xef")) + end + + def test_strict_decode64 + assert_equal("", Base64.strict_decode64("")) + assert_equal("\0", Base64.strict_decode64("AA==")) + assert_equal("\0\0", Base64.strict_decode64("AAA=")) + assert_equal("\0\0\0", Base64.strict_decode64("AAAA")) + assert_equal("\377", Base64.strict_decode64("/w==")) + assert_equal("\377\377", Base64.strict_decode64("//8=")) + assert_equal("\377\377\377", Base64.strict_decode64("////")) + assert_equal("\xff\xef", Base64.strict_decode64("/+8=")) + + assert_raise(ArgumentError) { Base64.strict_decode64("^") } + assert_raise(ArgumentError) { Base64.strict_decode64("A") } + assert_raise(ArgumentError) { Base64.strict_decode64("A^") } + assert_raise(ArgumentError) { Base64.strict_decode64("AA") } + assert_raise(ArgumentError) { Base64.strict_decode64("AA=") } + assert_raise(ArgumentError) { Base64.strict_decode64("AA===") } + assert_raise(ArgumentError) { Base64.strict_decode64("AA=x") } + assert_raise(ArgumentError) { Base64.strict_decode64("AAA") } + assert_raise(ArgumentError) { Base64.strict_decode64("AAA^") } + assert_raise(ArgumentError) { Base64.strict_decode64("AB==") } + assert_raise(ArgumentError) { Base64.strict_decode64("AAB=") } + end + + def test_urlsafe_encode64 + assert_equal("", Base64.urlsafe_encode64("")) + assert_equal("AA==", Base64.urlsafe_encode64("\0")) + assert_equal("AAA=", Base64.urlsafe_encode64("\0\0")) + assert_equal("AAAA", Base64.urlsafe_encode64("\0\0\0")) + assert_equal("_w==", Base64.urlsafe_encode64("\377")) + assert_equal("__8=", Base64.urlsafe_encode64("\377\377")) + assert_equal("____", Base64.urlsafe_encode64("\377\377\377")) + assert_equal("_-8=", Base64.urlsafe_encode64("\xff\xef")) + end + + def test_urlsafe_decode64 + assert_equal("", Base64.urlsafe_decode64("")) + assert_equal("\0", Base64.urlsafe_decode64("AA==")) + assert_equal("\0\0", Base64.urlsafe_decode64("AAA=")) + assert_equal("\0\0\0", Base64.urlsafe_decode64("AAAA")) + assert_equal("\377", Base64.urlsafe_decode64("_w==")) + assert_equal("\377\377", Base64.urlsafe_decode64("__8=")) + assert_equal("\377\377\377", Base64.urlsafe_decode64("____")) + assert_equal("\xff\xef", Base64.urlsafe_decode64("_+8=")) + end +end diff --git a/jni/ruby/test/benchmark/test_benchmark.rb b/jni/ruby/test/benchmark/test_benchmark.rb new file mode 100644 index 0000000..1b9964e --- /dev/null +++ b/jni/ruby/test/benchmark/test_benchmark.rb @@ -0,0 +1,161 @@ +require 'test/unit' +require 'benchmark' + +class TestBenchmark < Test::Unit::TestCase + BENCH_FOR_TIMES_UPTO = lambda do |x| + n = 1000 + tf = x.report("for:") { for _ in 1..n; '1'; end } + tt = x.report("times:") { n.times do ; '1'; end } + tu = x.report("upto:") { 1.upto(n) do ; '1'; end } + [tf+tt+tu, (tf+tt+tu)/3] + end + + BENCH_FOR_TIMES_UPTO_NO_LABEL = lambda do |x| + n = 1000 + x.report { for _ in 1..n; '1'; end } + x.report { n.times do ; '1'; end } + x.report { 1.upto(n) do ; '1'; end } + end + + def labels + %w[first second third] + end + + def bench(type = :bm, *args, &block) + if block + Benchmark.send(type, *args, &block) + else + Benchmark.send(type, *args) do |x| + labels.each { |label| + x.report(label) {} + } + end + end + end + + def capture_output + capture_io { yield }.first.gsub(/[ \-]\d\.\d{6}/, ' --time--') + end + + def capture_bench_output(type, *args, &block) + capture_output { bench(type, *args, &block) } + end + + def test_tms_outputs_nicely + assert_equal(" 0.000000 0.000000 0.000000 ( 0.000000)\n", Benchmark::Tms.new.to_s) + assert_equal(" 1.000000 2.000000 10.000000 ( 5.000000)\n", Benchmark::Tms.new(1,2,3,4,5).to_s) + assert_equal("1.000000 2.000000 3.000000 4.000000 10.000000 (5.000000) label", + Benchmark::Tms.new(1,2,3,4,5,'label').format('%u %y %U %Y %t %r %n')) + assert_equal("1.000000 2.000", Benchmark::Tms.new(1).format('%u %.3f', 2)) + assert_equal("100.000000 150.000000 250.000000 (200.000000)\n", + Benchmark::Tms.new(100, 150, 0, 0, 200).to_s) + end + + def test_tms_wont_modify_the_format_String_given + format = "format %u" + Benchmark::Tms.new.format(format) + assert_equal("format %u", format) + end + + BENCHMARK_OUTPUT_WITH_TOTAL_AVG = <total: --time-- --time-- --time-- ( --time--) +>avg: --time-- --time-- --time-- ( --time--) +BENCH + + def test_benchmark_does_not_print_any_space_if_the_given_caption_is_empty + assert_equal(<<-BENCH, capture_bench_output(:benchmark)) +first --time-- --time-- --time-- ( --time--) +second --time-- --time-- --time-- ( --time--) +third --time-- --time-- --time-- ( --time--) +BENCH + end + + def test_benchmark_makes_extra_calcultations_with_an_Array_at_the_end_of_the_benchmark_and_show_the_result + assert_equal(BENCHMARK_OUTPUT_WITH_TOTAL_AVG, + capture_bench_output(:benchmark, + Benchmark::CAPTION, 7, + Benchmark::FORMAT, ">total:", ">avg:", + &BENCH_FOR_TIMES_UPTO)) + end + + def test_bm_returns_an_Array_of_the_times_with_the_labels + [:bm, :bmbm].each do |meth| + capture_io do + results = bench(meth) + assert_instance_of(Array, results) + assert_equal(labels.size, results.size) + results.zip(labels).each { |tms, label| + assert_instance_of(Benchmark::Tms, tms) + assert_equal(label, tms.label) + } + end + end + end + + def test_bm_correctly_output_when_the_label_width_is_given + assert_equal(<<-BENCH, capture_bench_output(:bm, 6)) + user system total real +first --time-- --time-- --time-- ( --time--) +second --time-- --time-- --time-- ( --time--) +third --time-- --time-- --time-- ( --time--) +BENCH + end + + def test_bm_correctly_output_when_no_label_is_given + assert_equal(<<-BENCH, capture_bench_output(:bm, &BENCH_FOR_TIMES_UPTO_NO_LABEL)) + user system total real + --time-- --time-- --time-- ( --time--) + --time-- --time-- --time-- ( --time--) + --time-- --time-- --time-- ( --time--) +BENCH + end + + def test_bm_can_make_extra_calcultations_with_an_array_at_the_end_of_the_benchmark + assert_equal(BENCHMARK_OUTPUT_WITH_TOTAL_AVG, + capture_bench_output(:bm, 7, ">total:", ">avg:", + &BENCH_FOR_TIMES_UPTO)) + end + + BMBM_OUTPUT = <, 0) + end + + def assert_negative_infinite(x) + assert(x.infinite?, "Expected #{x.inspect} to be negative infinite") + assert_operator(x, :<, 0) + end + + def assert_positive_zero(x) + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, x.sign, + "Expected #{x.inspect} to be positive zero") + end + + def assert_negative_zero(x) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, x.sign, + "Expected #{x.inspect} to be negative zero") + end + + def test_not_equal + assert_not_equal BigDecimal("1"), BigDecimal.allocate + end + + def test_global_new + assert_equal(1, BigDecimal("1")) + assert_equal(1, BigDecimal("1", 1)) + assert_raise(ArgumentError) { BigDecimal("1", -1) } + assert_raise(ArgumentError) { BigDecimal(4.2) } + begin + BigDecimal(4.2) + rescue ArgumentError => error + assert_match(/Float/, error.message) + end + assert_raise(ArgumentError) { BigDecimal(42.quo(7)) } + begin + BigDecimal(42.quo(7)) + rescue ArgumentError => error + assert_match(/Rational/, error.message) + end + end + + def test_global_new_with_integer + assert_equal(BigDecimal("1"), BigDecimal(1)) + assert_equal(BigDecimal("-1"), BigDecimal(-1)) + assert_equal(BigDecimal((2**100).to_s), BigDecimal(2**100)) + assert_equal(BigDecimal((-2**100).to_s), BigDecimal(-2**100)) + end + + def test_global_new_with_rational + assert_equal(BigDecimal("0.333333333333333333333"), BigDecimal(1.quo(3), 21)) + assert_equal(BigDecimal("-0.333333333333333333333"), BigDecimal(-1.quo(3), 21)) + assert_raise(ArgumentError) { BigDecimal(1.quo(3)) } + end + + def test_global_new_with_float + assert_equal(BigDecimal("0.1235"), BigDecimal(0.1234567, 4)) + assert_equal(BigDecimal("-0.1235"), BigDecimal(-0.1234567, 4)) + assert_raise(ArgumentError) { BigDecimal(0.1) } + assert_raise(ArgumentError) { BigDecimal(0.1, Float::DIG + 2) } + assert_nothing_raised { BigDecimal(0.1, Float::DIG + 1) } + + bug9214 = '[ruby-core:58858]' + assert_equal(BigDecimal(-0.0, Float::DIG).sign, -1, bug9214) + end + + def test_global_new_with_big_decimal + assert_equal(BigDecimal(1), BigDecimal(BigDecimal(1))) + assert_equal(BigDecimal('+0'), BigDecimal(BigDecimal('+0'))) + assert_equal(BigDecimal('-0'), BigDecimal(BigDecimal('-0'))) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_positive_infinite(BigDecimal(BigDecimal('Infinity'))) + assert_negative_infinite(BigDecimal(BigDecimal('-Infinity'))) + assert_nan(BigDecimal(BigDecimal('NaN'))) + end + end + + def test_global_new_with_tainted_string + Thread.new { + $SAFE = 1 + BigDecimal('1'.taint) + }.join + end + + def test_new + assert_equal(1, BigDecimal.new("1")) + assert_equal(1, BigDecimal.new("1", 1)) + assert_equal(1, BigDecimal.new(" 1 ")) + assert_equal(111, BigDecimal.new("1_1_1_")) + assert_equal(0, BigDecimal.new("_1_1_1")) + assert_equal(10**(-1), BigDecimal.new("1E-1"), '#4825') + + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_equal( 1, BigDecimal.new("Infinity").infinite?) + assert_equal(-1, BigDecimal.new("-Infinity").infinite?) + assert_equal(true, BigDecimal.new("NaN").nan?) + assert_equal( 1, BigDecimal.new("1E1111111111111111111").infinite?) + end + + def test_new_with_integer + assert_equal(BigDecimal("1"), BigDecimal.new(1)) + assert_equal(BigDecimal("-1"), BigDecimal.new(-1)) + assert_equal(BigDecimal((2**100).to_s), BigDecimal.new(2**100)) + assert_equal(BigDecimal((-2**100).to_s), BigDecimal.new(-2**100)) + end + + def test_new_with_rational + assert_equal(BigDecimal("0.333333333333333333333"), BigDecimal.new(1.quo(3), 21)) + assert_equal(BigDecimal("-0.333333333333333333333"), BigDecimal.new(-1.quo(3), 21)) + assert_raise(ArgumentError) { BigDecimal.new(1.quo(3)) } + end + + def test_new_with_float + assert_equal(BigDecimal("0.1235"), BigDecimal(0.1234567, 4)) + assert_equal(BigDecimal("-0.1235"), BigDecimal(-0.1234567, 4)) + assert_raise(ArgumentError) { BigDecimal.new(0.1) } + assert_raise(ArgumentError) { BigDecimal.new(0.1, Float::DIG + 2) } + assert_nothing_raised { BigDecimal.new(0.1, Float::DIG + 1) } + end + + def test_new_with_big_decimal + assert_equal(BigDecimal(1), BigDecimal.new(BigDecimal(1))) + assert_equal(BigDecimal('+0'), BigDecimal.new(BigDecimal('+0'))) + assert_equal(BigDecimal('-0'), BigDecimal.new(BigDecimal('-0'))) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_positive_infinite(BigDecimal.new(BigDecimal('Infinity'))) + assert_negative_infinite(BigDecimal.new(BigDecimal('-Infinity'))) + assert_nan(BigDecimal(BigDecimal.new('NaN'))) + end + end + + def test_new_with_tainted_string + Thread.new { + $SAFE = 1 + BigDecimal.new('1'.taint) + }.join + end + + def _test_mode(type) + BigDecimal.mode(type, true) + assert_raise(FloatDomainError) { yield } + + BigDecimal.mode(type, false) + assert_nothing_raised { yield } + end + + def test_mode + assert_raise(ArgumentError) { BigDecimal.mode(BigDecimal::EXCEPTION_ALL, 1) } + assert_raise(ArgumentError) { BigDecimal.mode(BigDecimal::ROUND_MODE, 256) } + assert_raise(ArgumentError) { BigDecimal.mode(BigDecimal::ROUND_MODE, :xyzzy) } + assert_raise(TypeError) { BigDecimal.mode(0xf000, true) } + + begin + saved_mode = BigDecimal.mode(BigDecimal::ROUND_MODE) + + [ BigDecimal::ROUND_UP, + BigDecimal::ROUND_DOWN, + BigDecimal::ROUND_HALF_UP, + BigDecimal::ROUND_HALF_DOWN, + BigDecimal::ROUND_CEILING, + BigDecimal::ROUND_FLOOR, + BigDecimal::ROUND_HALF_EVEN, + ].each do |mode| + BigDecimal.mode(BigDecimal::ROUND_MODE, mode) + assert_equal(mode, BigDecimal.mode(BigDecimal::ROUND_MODE)) + end + ensure + BigDecimal.mode(BigDecimal::ROUND_MODE, saved_mode) + end + + BigDecimal.save_rounding_mode do + ROUNDING_MODE_MAP.each do |const, sym| + BigDecimal.mode(BigDecimal::ROUND_MODE, sym) + assert_equal(const, BigDecimal.mode(BigDecimal::ROUND_MODE)) + end + end + end + + def test_thread_local_mode + begin + saved_mode = BigDecimal.mode(BigDecimal::ROUND_MODE) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_UP) + Thread.start { + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN) + assert_equal(BigDecimal::ROUND_HALF_EVEN, BigDecimal.mode(BigDecimal::ROUND_MODE)) + }.join + assert_equal(BigDecimal::ROUND_UP, BigDecimal.mode(BigDecimal::ROUND_MODE)) + ensure + BigDecimal.mode(BigDecimal::ROUND_MODE, saved_mode) + end + end + + def test_save_exception_mode + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + mode = BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) + end + assert_equal(mode, BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW)) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_FLOOR) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN) + end + assert_equal(BigDecimal::ROUND_HALF_EVEN, BigDecimal.mode(BigDecimal::ROUND_MODE)) + + assert_equal(42, BigDecimal.save_exception_mode { 42 }) + end + + def test_save_rounding_mode + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_FLOOR) + BigDecimal.save_rounding_mode do + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN) + end + assert_equal(BigDecimal::ROUND_FLOOR, BigDecimal.mode(BigDecimal::ROUND_MODE)) + + assert_equal(42, BigDecimal.save_rounding_mode { 42 }) + end + + def test_save_limit + begin + old = BigDecimal.limit + BigDecimal.limit(100) + BigDecimal.save_limit do + BigDecimal.limit(200) + end + assert_equal(100, BigDecimal.limit); + ensure + BigDecimal.limit(old) + end + + assert_equal(42, BigDecimal.save_limit { 42 }) + end + + def test_exception_nan + _test_mode(BigDecimal::EXCEPTION_NaN) { BigDecimal.new("NaN") } + end + + def test_exception_infinity + _test_mode(BigDecimal::EXCEPTION_INFINITY) { BigDecimal.new("Infinity") } + end + + def test_exception_underflow + _test_mode(BigDecimal::EXCEPTION_UNDERFLOW) do + x = BigDecimal.new("0.1") + 100.times do + x *= x + end + end + end + + def test_exception_overflow + _test_mode(BigDecimal::EXCEPTION_OVERFLOW) do + x = BigDecimal.new("10") + 100.times do + x *= x + end + end + end + + def test_exception_zerodivide + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + _test_mode(BigDecimal::EXCEPTION_ZERODIVIDE) { 1 / BigDecimal.new("0") } + _test_mode(BigDecimal::EXCEPTION_ZERODIVIDE) { -1 / BigDecimal.new("0") } + end + + def test_round_up + n4 = BigDecimal.new("4") # n4 / 9 = 0.44444... + n5 = BigDecimal.new("5") # n5 / 9 = 0.55555... + n6 = BigDecimal.new("6") # n6 / 9 = 0.66666... + m4, m5, m6 = -n4, -n5, -n6 + n2h = BigDecimal.new("2.5") + n3h = BigDecimal.new("3.5") + m2h, m3h = -n2h, -n3h + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_UP) + assert_operator(n4, :<, n4 / 9 * 9) + assert_operator(n5, :<, n5 / 9 * 9) + assert_operator(n6, :<, n6 / 9 * 9) + assert_operator(m4, :>, m4 / 9 * 9) + assert_operator(m5, :>, m5 / 9 * 9) + assert_operator(m6, :>, m6 / 9 * 9) + assert_equal(3, n2h.round) + assert_equal(4, n3h.round) + assert_equal(-3, m2h.round) + assert_equal(-4, m3h.round) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_DOWN) + assert_operator(n4, :>, n4 / 9 * 9) + assert_operator(n5, :>, n5 / 9 * 9) + assert_operator(n6, :>, n6 / 9 * 9) + assert_operator(m4, :<, m4 / 9 * 9) + assert_operator(m5, :<, m5 / 9 * 9) + assert_operator(m6, :<, m6 / 9 * 9) + assert_equal(2, n2h.round) + assert_equal(3, n3h.round) + assert_equal(-2, m2h.round) + assert_equal(-3, m3h.round) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_UP) + assert_operator(n4, :>, n4 / 9 * 9) + assert_operator(n5, :<, n5 / 9 * 9) + assert_operator(n6, :<, n6 / 9 * 9) + assert_operator(m4, :<, m4 / 9 * 9) + assert_operator(m5, :>, m5 / 9 * 9) + assert_operator(m6, :>, m6 / 9 * 9) + assert_equal(3, n2h.round) + assert_equal(4, n3h.round) + assert_equal(-3, m2h.round) + assert_equal(-4, m3h.round) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_DOWN) + assert_operator(n4, :>, n4 / 9 * 9) + assert_operator(n5, :>, n5 / 9 * 9) + assert_operator(n6, :<, n6 / 9 * 9) + assert_operator(m4, :<, m4 / 9 * 9) + assert_operator(m5, :<, m5 / 9 * 9) + assert_operator(m6, :>, m6 / 9 * 9) + assert_equal(2, n2h.round) + assert_equal(3, n3h.round) + assert_equal(-2, m2h.round) + assert_equal(-3, m3h.round) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN) + assert_operator(n4, :>, n4 / 9 * 9) + assert_operator(n5, :<, n5 / 9 * 9) + assert_operator(n6, :<, n6 / 9 * 9) + assert_operator(m4, :<, m4 / 9 * 9) + assert_operator(m5, :>, m5 / 9 * 9) + assert_operator(m6, :>, m6 / 9 * 9) + assert_equal(2, n2h.round) + assert_equal(4, n3h.round) + assert_equal(-2, m2h.round) + assert_equal(-4, m3h.round) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_CEILING) + assert_operator(n4, :<, n4 / 9 * 9) + assert_operator(n5, :<, n5 / 9 * 9) + assert_operator(n6, :<, n6 / 9 * 9) + assert_operator(m4, :<, m4 / 9 * 9) + assert_operator(m5, :<, m5 / 9 * 9) + assert_operator(m6, :<, m6 / 9 * 9) + assert_equal(3, n2h.round) + assert_equal(4, n3h.round) + assert_equal(-2, m2h.round) + assert_equal(-3, m3h.round) + + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_FLOOR) + assert_operator(n4, :>, n4 / 9 * 9) + assert_operator(n5, :>, n5 / 9 * 9) + assert_operator(n6, :>, n6 / 9 * 9) + assert_operator(m4, :>, m4 / 9 * 9) + assert_operator(m5, :>, m5 / 9 * 9) + assert_operator(m6, :>, m6 / 9 * 9) + assert_equal(2, n2h.round) + assert_equal(3, n3h.round) + assert_equal(-3, m2h.round) + assert_equal(-4, m3h.round) + end + + def test_zero_p + assert_equal(true, BigDecimal.new("0").zero?) + assert_equal(false, BigDecimal.new("1").zero?) + assert_equal(true, BigDecimal.new("0E200000000000000").zero?) + end + + def test_nonzero_p + assert_equal(nil, BigDecimal.new("0").nonzero?) + assert_equal(BigDecimal.new("1"), BigDecimal.new("1").nonzero?) + end + + def test_double_fig + assert_kind_of(Integer, BigDecimal.double_fig) + end + + def test_cmp + n1 = BigDecimal.new("1") + n2 = BigDecimal.new("2") + assert_equal( 0, n1 <=> n1) + assert_equal( 1, n2 <=> n1) + assert_equal(-1, n1 <=> n2) + assert_operator(n1, :==, n1) + assert_operator(n1, :!=, n2) + assert_operator(n1, :<, n2) + assert_operator(n1, :<=, n1) + assert_operator(n1, :<=, n2) + assert_operator(n2, :>, n1) + assert_operator(n2, :>=, n1) + assert_operator(n1, :>=, n1) + + assert_operator(BigDecimal.new("-0"), :==, BigDecimal.new("0")) + assert_operator(BigDecimal.new("0"), :<, BigDecimal.new("1")) + assert_operator(BigDecimal.new("1"), :>, BigDecimal.new("0")) + assert_operator(BigDecimal.new("1"), :>, BigDecimal.new("-1")) + assert_operator(BigDecimal.new("-1"), :<, BigDecimal.new("1")) + assert_operator(BigDecimal.new((2**100).to_s), :>, BigDecimal.new("1")) + assert_operator(BigDecimal.new("1"), :<, BigDecimal.new((2**100).to_s)) + + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + inf = BigDecimal.new("Infinity") + assert_operator(inf, :>, 1) + assert_operator(1, :<, inf) + + assert_operator(BigDecimal("1E-1"), :==, 10**(-1), '#4825') + assert_equal(0, BigDecimal("1E-1") <=> 10**(-1), '#4825') + end + + def test_cmp_issue9192 + bug9192 = '[ruby-core:58756] [#9192]' + operators = { :== => :==, :< => :>, :> => :<, :<= => :>=, :>= => :<= } + 5.upto(8) do |i| + s = "706.0#{i}" + d = BigDecimal(s) + f = s.to_f + operators.each do |op, inv| + assert_equal(d.send(op, f), f.send(inv, d), + "(BigDecimal(#{s.inspect}) #{op} #{s}) and (#{s} #{inv} BigDecimal(#{s.inspect})) is different #{bug9192}") + end + end + end + + def test_cmp_nan + n1 = BigDecimal.new("1") + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_equal(nil, BigDecimal.new("NaN") <=> n1) + assert_equal(false, BigDecimal.new("NaN") > n1) + end + + def test_cmp_failing_coercion + n1 = BigDecimal.new("1") + assert_equal(nil, n1 <=> nil) + assert_raise(ArgumentError){n1 > nil} + end + + def test_cmp_coerce + n1 = BigDecimal.new("1") + n2 = BigDecimal.new("2") + o1 = Object.new; def o1.coerce(x); [x, BigDecimal.new("1")]; end + o2 = Object.new; def o2.coerce(x); [x, BigDecimal.new("2")]; end + assert_equal( 0, n1 <=> o1) + assert_equal( 1, n2 <=> o1) + assert_equal(-1, n1 <=> o2) + assert_operator(n1, :==, o1) + assert_operator(n1, :!=, o2) + assert_operator(n1, :<, o2) + assert_operator(n1, :<=, o1) + assert_operator(n1, :<=, o2) + assert_operator(n2, :>, o1) + assert_operator(n2, :>=, o1) + assert_operator(n1, :>=, 1) + end + + def test_cmp_bignum + assert_operator(BigDecimal.new((2**100).to_s), :==, 2**100) + end + + def test_cmp_data + d = Time.now; def d.coerce(x); [x, x]; end + assert_operator(BigDecimal.new((2**100).to_s), :==, d) + end + + def test_precs + a = BigDecimal.new("1").precs + assert_instance_of(Array, a) + assert_equal(2, a.size) + assert_kind_of(Integer, a[0]) + assert_kind_of(Integer, a[1]) + end + + def test_hash + a = [] + b = BigDecimal.new("1") + 10.times { a << b *= 10 } + h = {} + a.each_with_index {|x, i| h[x] = i } + a.each_with_index do |x, i| + assert_equal(i, h[x]) + end + end + + def test_marshal + s = Marshal.dump(BigDecimal("1", 1)) + assert_equal(BigDecimal("1", 1), Marshal.load(s)) + + # corrupt data + s = s.gsub(/BigDecimal.*\z/m) {|x| x.gsub(/\d/m, "-") } + assert_raise(TypeError) { Marshal.load(s) } + end + + def test_finite_infinite_nan + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, false) + + x = BigDecimal.new("0") + assert_equal(true, x.finite?) + assert_equal(nil, x.infinite?) + assert_equal(false, x.nan?) + y = 1 / x + assert_equal(false, y.finite?) + assert_equal(1, y.infinite?) + assert_equal(false, y.nan?) + y = -1 / x + assert_equal(false, y.finite?) + assert_equal(-1, y.infinite?) + assert_equal(false, y.nan?) + + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + y = 0 / x + assert_equal(false, y.finite?) + assert_equal(nil, y.infinite?) + assert_equal(true, y.nan?) + end + + def test_to_i + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + + x = BigDecimal.new("0") + assert_kind_of(Integer, x.to_i) + assert_equal(0, x.to_i) + assert_raise(FloatDomainError){( 1 / x).to_i} + assert_raise(FloatDomainError){(-1 / x).to_i} + assert_raise(FloatDomainError) {( 0 / x).to_i} + x = BigDecimal.new("1") + assert_equal(1, x.to_i) + x = BigDecimal.new((2**100).to_s) + assert_equal(2**100, x.to_i) + end + + def test_to_f + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, false) + + x = BigDecimal.new("0") + assert_instance_of(Float, x.to_f) + assert_equal(0.0, x.to_f) + assert_equal( 1.0 / 0.0, ( 1 / x).to_f) + assert_equal(-1.0 / 0.0, (-1 / x).to_f) + assert_equal(true, ( 0 / x).to_f.nan?) + x = BigDecimal.new("1") + assert_equal(1.0, x.to_f) + x = BigDecimal.new((2**100).to_s) + assert_equal((2**100).to_f, x.to_f) + x = BigDecimal.new("1" + "0" * 10000) + assert_equal(0, BigDecimal.new("-0").to_f) + + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) + assert_raise(FloatDomainError) { x.to_f } + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + assert_kind_of(Float, x .to_f) + assert_kind_of(Float, (-x).to_f) + + bug6944 = '[ruby-core:47342]' + + BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true) + x = "1e#{Float::MIN_10_EXP - 2*Float::DIG}" + assert_raise(FloatDomainError, x) {BigDecimal(x).to_f} + x = "-#{x}" + assert_raise(FloatDomainError, x) {BigDecimal(x).to_f} + x = "1e#{Float::MIN_10_EXP - Float::DIG}" + assert_nothing_raised(FloatDomainError, x) { + assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944) + } + x = "-#{x}" + assert_nothing_raised(FloatDomainError, x) { + assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944) + } + + BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, false) + x = "1e#{Float::MIN_10_EXP - 2*Float::DIG}" + assert_equal( 0.0, BigDecimal(x).to_f, x) + x = "-#{x}" + assert_equal(-0.0, BigDecimal(x).to_f, x) + x = "1e#{Float::MIN_10_EXP - Float::DIG}" + assert_nothing_raised(FloatDomainError, x) { + assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944) + } + x = "-#{x}" + assert_nothing_raised(FloatDomainError, x) { + assert_in_delta(0.0, BigDecimal(x).to_f, 10**Float::MIN_10_EXP, bug6944) + } + + assert_equal( 0.0, BigDecimal( '9e-325').to_f) + assert_equal( 0.0, BigDecimal( '10e-325').to_f) + assert_equal(-0.0, BigDecimal( '-9e-325').to_f) + assert_equal(-0.0, BigDecimal('-10e-325').to_f) + end + + def test_coerce + a, b = BigDecimal.new("1").coerce(1.0) + assert_instance_of(BigDecimal, a) + assert_instance_of(BigDecimal, b) + assert_equal(2, 1 + BigDecimal.new("1"), '[ruby-core:25697]') + + a, b = BigDecimal("1").coerce(1.quo(10)) + assert_equal(BigDecimal("0.1"), a, '[ruby-core:34318]') + + a, b = BigDecimal("0.11111").coerce(1.quo(3)) + assert_equal(BigDecimal("0." + "3"*a.precs[0]), a) + + assert_nothing_raised(TypeError, '#7176') do + BigDecimal.new('1') + Rational(1) + end + end + + def test_uplus + x = BigDecimal.new("1") + assert_equal(x, x.send(:+@)) + end + + def test_add + x = BigDecimal.new("1") + assert_equal(BigDecimal.new("2"), x + x) + assert_equal(1, BigDecimal.new("0") + 1) + assert_equal(1, x + 0) + + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, (BigDecimal.new("0") + 0).sign) + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, (BigDecimal.new("-0") + 0).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, (BigDecimal.new("-0") + BigDecimal.new("-0")).sign) + + x = BigDecimal.new((2**100).to_s) + assert_equal(BigDecimal.new((2**100+1).to_s), x + 1) + end + + def test_sub + x = BigDecimal.new("1") + assert_equal(BigDecimal.new("0"), x - x) + assert_equal(-1, BigDecimal.new("0") - 1) + assert_equal(1, x - 0) + + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, (BigDecimal.new("0") - 0).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, (BigDecimal.new("-0") - 0).sign) + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, (BigDecimal.new("-0") - BigDecimal.new("-0")).sign) + + x = BigDecimal.new((2**100).to_s) + assert_equal(BigDecimal.new((2**100-1).to_s), x - 1) + end + + def test_sub_with_float + assert_kind_of(BigDecimal, BigDecimal.new("3") - 1.0) + end + + def test_sub_with_rational + assert_kind_of(BigDecimal, BigDecimal.new("3") - 1.quo(3)) + end + + def test_mult + x = BigDecimal.new((2**100).to_s) + assert_equal(BigDecimal.new((2**100 * 3).to_s), (x * 3).to_i) + assert_equal(x, (x * 1).to_i) + assert_equal(x, (BigDecimal("1") * x).to_i) + assert_equal(BigDecimal.new((2**200).to_s), (x * x).to_i) + end + + def test_mult_with_float + assert_kind_of(BigDecimal, BigDecimal.new("3") * 1.5) + end + + def test_mult_with_rational + assert_kind_of(BigDecimal, BigDecimal.new("3") * 1.quo(3)) + end + + def test_mult_with_nil + assert_raise(TypeError) { + BigDecimal('1.1') * nil + } + end + + def test_div + x = BigDecimal.new((2**100).to_s) + assert_equal(BigDecimal.new((2**100 / 3).to_s), (x / 3).to_i) + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, (BigDecimal.new("0") / 1).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, (BigDecimal.new("-0") / 1).sign) + assert_equal(2, BigDecimal.new("2") / 1) + assert_equal(-2, BigDecimal.new("2") / -1) + + assert_equal(BigDecimal('1486.868686869'), BigDecimal('1472.0') / BigDecimal('0.99'), '[ruby-core:59365] [#9316]') + + assert_equal(4.124045235, BigDecimal('0.9932') / (700 * BigDecimal('0.344045') / BigDecimal('1000.0')), '[#9305]') + end + + def test_div_with_float + assert_kind_of(BigDecimal, BigDecimal.new("3") / 1.5) + end + + def test_div_with_rational + assert_kind_of(BigDecimal, BigDecimal.new("3") / 1.quo(3)) + end + + def test_mod + x = BigDecimal.new((2**100).to_s) + assert_equal(1, x % 3) + assert_equal(2, (-x) % 3) + assert_equal(-2, x % -3) + assert_equal(-1, (-x) % -3) + end + + def test_mod_with_float + assert_kind_of(BigDecimal, BigDecimal.new("3") % 1.5) + end + + def test_mod_with_rational + assert_kind_of(BigDecimal, BigDecimal.new("3") % 1.quo(3)) + end + + def test_remainder + x = BigDecimal.new((2**100).to_s) + assert_equal(1, x.remainder(3)) + assert_equal(-1, (-x).remainder(3)) + assert_equal(1, x.remainder(-3)) + assert_equal(-1, (-x).remainder(-3)) + end + + def test_remainder_with_float + assert_kind_of(BigDecimal, BigDecimal.new("3").remainder(1.5)) + end + + def test_remainder_with_rational + assert_kind_of(BigDecimal, BigDecimal.new("3").remainder(1.quo(3))) + end + + def test_divmod + x = BigDecimal.new((2**100).to_s) + assert_equal([(x / 3).floor, 1], x.divmod(3)) + assert_equal([(-x / 3).floor, 2], (-x).divmod(3)) + + assert_equal([0, 0], BigDecimal.new("0").divmod(2)) + + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_raise(ZeroDivisionError){BigDecimal.new("0").divmod(0)} + end + + def test_add_bigdecimal + x = BigDecimal.new((2**100).to_s) + assert_equal(3000000000000000000000000000000, x.add(x, 1)) + assert_equal(2500000000000000000000000000000, x.add(x, 2)) + assert_equal(2540000000000000000000000000000, x.add(x, 3)) + end + + def test_sub_bigdecimal + x = BigDecimal.new((2**100).to_s) + assert_equal(1000000000000000000000000000000, x.sub(1, 1)) + assert_equal(1300000000000000000000000000000, x.sub(1, 2)) + assert_equal(1270000000000000000000000000000, x.sub(1, 3)) + end + + def test_mult_bigdecimal + x = BigDecimal.new((2**100).to_s) + assert_equal(4000000000000000000000000000000, x.mult(3, 1)) + assert_equal(3800000000000000000000000000000, x.mult(3, 2)) + assert_equal(3800000000000000000000000000000, x.mult(3, 3)) + end + + def test_div_bigdecimal + x = BigDecimal.new((2**100).to_s) + assert_equal(422550200076076467165567735125, x.div(3)) + assert_equal(400000000000000000000000000000, x.div(3, 1)) + assert_equal(420000000000000000000000000000, x.div(3, 2)) + assert_equal(423000000000000000000000000000, x.div(3, 3)) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert_equal(0, BigDecimal("0").div(BigDecimal("Infinity"))) + end + end + + def test_abs_bigdecimal + x = BigDecimal.new((2**100).to_s) + assert_equal(1267650600228229401496703205376, x.abs) + x = BigDecimal.new("-" + (2**100).to_s) + assert_equal(1267650600228229401496703205376, x.abs) + x = BigDecimal.new("0") + assert_equal(0, x.abs) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + x = BigDecimal.new("NaN") + assert_equal(true, x.abs.nan?) + end + + def test_sqrt_bigdecimal + x = BigDecimal.new("0.09") + assert_in_delta(0.3, x.sqrt(1), 0.001) + x = BigDecimal.new((2**100).to_s) + y = BigDecimal("1125899906842624") + e = y.exponent + assert_equal(true, (x.sqrt(100) - y).abs < BigDecimal("1E#{e-100}")) + assert_equal(true, (x.sqrt(200) - y).abs < BigDecimal("1E#{e-200}")) + assert_equal(true, (x.sqrt(300) - y).abs < BigDecimal("1E#{e-300}")) + x = BigDecimal.new("-" + (2**100).to_s) + assert_raise(FloatDomainError) { x.sqrt(1) } + x = BigDecimal.new((2**200).to_s) + assert_equal(2**100, x.sqrt(1)) + + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_raise(FloatDomainError) { BigDecimal.new("NaN").sqrt(1) } + + assert_equal(0, BigDecimal.new("0").sqrt(1)) + assert_equal(1, BigDecimal.new("1").sqrt(1)) + end + + def test_sqrt_5266 + x = BigDecimal('2' + '0'*100) + assert_equal('0.14142135623730950488016887242096980785696718753769480731', + x.sqrt(56).to_s(56).split(' ')[0]) + assert_equal('0.1414213562373095048801688724209698078569671875376948073', + x.sqrt(55).to_s(55).split(' ')[0]) + + x = BigDecimal('2' + '0'*200) + assert_equal('0.14142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462', + x.sqrt(110).to_s(110).split(' ')[0]) + assert_equal('0.1414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846', + x.sqrt(109).to_s(109).split(' ')[0]) + end + + def test_fix + x = BigDecimal.new("1.1") + assert_equal(1, x.fix) + end + + def test_frac + x = BigDecimal.new("1.1") + assert_equal(0.1, x.frac) + assert_equal(0.1, BigDecimal.new("0.1").frac) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_equal(true, BigDecimal.new("NaN").frac.nan?) + end + + def test_round + assert_equal(3, BigDecimal.new("3.14159").round) + assert_equal(9, BigDecimal.new("8.7").round) + assert_equal(3.142, BigDecimal.new("3.14159").round(3)) + assert_equal(13300.0, BigDecimal.new("13345.234").round(-2)) + + x = BigDecimal.new("111.111") + assert_equal(111 , x.round) + assert_equal(111.1 , x.round(1)) + assert_equal(111.11 , x.round(2)) + assert_equal(111.111, x.round(3)) + assert_equal(111.111, x.round(4)) + assert_equal(110 , x.round(-1)) + assert_equal(100 , x.round(-2)) + assert_equal( 0 , x.round(-3)) + assert_equal( 0 , x.round(-4)) + + x = BigDecimal.new("2.5") + assert_equal(3, x.round(0, BigDecimal::ROUND_UP)) + assert_equal(2, x.round(0, BigDecimal::ROUND_DOWN)) + assert_equal(3, x.round(0, BigDecimal::ROUND_HALF_UP)) + assert_equal(2, x.round(0, BigDecimal::ROUND_HALF_DOWN)) + assert_equal(2, x.round(0, BigDecimal::ROUND_HALF_EVEN)) + assert_equal(3, x.round(0, BigDecimal::ROUND_CEILING)) + assert_equal(2, x.round(0, BigDecimal::ROUND_FLOOR)) + assert_raise(ArgumentError) { x.round(0, 256) } + + ROUNDING_MODE_MAP.each do |const, sym| + assert_equal(x.round(0, const), x.round(0, sym)) + end + + bug3803 = '[ruby-core:32136]' + 15.times do |n| + x = BigDecimal.new("5#{'0'*n}1") + assert_equal(10**(n+2), x.round(-(n+2), BigDecimal::ROUND_HALF_DOWN), bug3803) + assert_equal(10**(n+2), x.round(-(n+2), BigDecimal::ROUND_HALF_EVEN), bug3803) + x = BigDecimal.new("0.5#{'0'*n}1") + assert_equal(1, x.round(0, BigDecimal::ROUND_HALF_DOWN), bug3803) + assert_equal(1, x.round(0, BigDecimal::ROUND_HALF_EVEN), bug3803) + x = BigDecimal.new("-0.5#{'0'*n}1") + assert_equal(-1, x.round(0, BigDecimal::ROUND_HALF_DOWN), bug3803) + assert_equal(-1, x.round(0, BigDecimal::ROUND_HALF_EVEN), bug3803) + end + end + + def test_truncate + assert_equal(3, BigDecimal.new("3.14159").truncate) + assert_equal(8, BigDecimal.new("8.7").truncate) + assert_equal(3.141, BigDecimal.new("3.14159").truncate(3)) + assert_equal(13300.0, BigDecimal.new("13345.234").truncate(-2)) + end + + def test_floor + assert_equal(3, BigDecimal.new("3.14159").floor) + assert_equal(-10, BigDecimal.new("-9.1").floor) + assert_equal(3.141, BigDecimal.new("3.14159").floor(3)) + assert_equal(13300.0, BigDecimal.new("13345.234").floor(-2)) + end + + def test_ceil + assert_equal(4, BigDecimal.new("3.14159").ceil) + assert_equal(-9, BigDecimal.new("-9.1").ceil) + assert_equal(3.142, BigDecimal.new("3.14159").ceil(3)) + assert_equal(13400.0, BigDecimal.new("13345.234").ceil(-2)) + end + + def test_to_s + assert_equal('-123.45678 90123 45678 9', BigDecimal.new('-123.45678901234567890').to_s('5F')) + assert_equal('+123.45678901 23456789', BigDecimal.new('123.45678901234567890').to_s('+8F')) + assert_equal(' 123.4567890123456789', BigDecimal.new('123.45678901234567890').to_s(' F')) + assert_equal('0.1234567890123456789E3', BigDecimal.new('123.45678901234567890').to_s) + assert_equal('0.12345 67890 12345 6789E3', BigDecimal.new('123.45678901234567890').to_s(5)) + end + + def test_split + x = BigDecimal.new('-123.45678901234567890') + assert_equal([-1, "1234567890123456789", 10, 3], x.split) + assert_equal([1, "0", 10, 0], BigDecimal.new("0").split) + assert_equal([-1, "0", 10, 0], BigDecimal.new("-0").split) + + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_equal([0, "NaN", 10, 0], BigDecimal.new("NaN").split) + assert_equal([1, "Infinity", 10, 0], BigDecimal.new("Infinity").split) + assert_equal([-1, "Infinity", 10, 0], BigDecimal.new("-Infinity").split) + end + + def test_exponent + x = BigDecimal.new('-123.45678901234567890') + assert_equal(3, x.exponent) + end + + def test_inspect + x = BigDecimal.new("1234.5678") + prec, maxprec = x.precs + assert_match(/^#$/, x.inspect) + end + + def test_power + assert_nothing_raised(TypeError, '[ruby-core:47632]') do + 1000.times { BigDecimal.new('1001.10')**0.75 } + end + end + + def test_power_with_nil + assert_raise(TypeError) do + BigDecimal(3) ** nil + end + end + + def test_power_of_nan + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert_nan(BigDecimal::NAN ** 0) + assert_nan(BigDecimal::NAN ** 1) + assert_nan(BigDecimal::NAN ** 42) + assert_nan(BigDecimal::NAN ** -42) + assert_nan(BigDecimal::NAN ** 42.0) + assert_nan(BigDecimal::NAN ** -42.0) + assert_nan(BigDecimal::NAN ** BigDecimal(42)) + assert_nan(BigDecimal::NAN ** BigDecimal(-42)) + assert_nan(BigDecimal::NAN ** BigDecimal::INFINITY) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert_nan(BigDecimal::NAN ** (-BigDecimal::INFINITY)) + end + end + end + + def test_power_with_Bignum + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert_equal(0, BigDecimal(0) ** (2**100)) + + assert_positive_infinite(BigDecimal(0) ** -(2**100)) + assert_positive_infinite((-BigDecimal(0)) ** -(2**100)) + assert_negative_infinite((-BigDecimal(0)) ** -(2**100 + 1)) + + assert_equal(1, BigDecimal(1) ** (2**100)) + + assert_positive_infinite(BigDecimal(3) ** (2**100)) + assert_positive_zero(BigDecimal(3) ** (-2**100)) + + assert_negative_infinite(BigDecimal(-3) ** (2**100)) + assert_positive_infinite(BigDecimal(-3) ** (2**100 + 1)) + assert_negative_zero(BigDecimal(-3) ** (-2**100)) + assert_positive_zero(BigDecimal(-3) ** (-2**100 - 1)) + + assert_positive_zero(BigDecimal(0.5, Float::DIG) ** (2**100)) + assert_positive_infinite(BigDecimal(0.5, Float::DIG) ** (-2**100)) + + assert_negative_zero(BigDecimal(-0.5, Float::DIG) ** (2**100)) + assert_positive_zero(BigDecimal(-0.5, Float::DIG) ** (2**100 - 1)) + assert_negative_infinite(BigDecimal(-0.5, Float::DIG) ** (-2**100)) + assert_positive_infinite(BigDecimal(-0.5, Float::DIG) ** (-2**100 - 1)) + end + end + + def test_power_with_BigDecimal + assert_nothing_raised do + assert_in_delta(3 ** 3, BigDecimal(3) ** BigDecimal(3)) + end + end + + def test_power_of_finite_with_zero + x = BigDecimal(1) + assert_equal(1, x ** 0) + assert_equal(1, x ** 0.quo(1)) + assert_equal(1, x ** 0.0) + assert_equal(1, x ** BigDecimal(0)) + + x = BigDecimal(42) + assert_equal(1, x ** 0) + assert_equal(1, x ** 0.quo(1)) + assert_equal(1, x ** 0.0) + assert_equal(1, x ** BigDecimal(0)) + + x = BigDecimal(-42) + assert_equal(1, x ** 0) + assert_equal(1, x ** 0.quo(1)) + assert_equal(1, x ** 0.0) + assert_equal(1, x ** BigDecimal(0)) + end + + def test_power_of_three + x = BigDecimal(3) + assert_equal(81, x ** 4) + assert_equal(1.quo(81), x ** -4) + assert_in_delta(1.0/81, x ** -4) + end + + def test_power_of_zero + zero = BigDecimal(0) + assert_equal(0, zero ** 4) + assert_equal(0, zero ** 4.quo(1)) + assert_equal(0, zero ** 4.0) + assert_equal(0, zero ** BigDecimal(4)) + assert_equal(1, zero ** 0) + assert_equal(1, zero ** 0.quo(1)) + assert_equal(1, zero ** 0.0) + assert_equal(1, zero ** BigDecimal(0)) + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + assert_positive_infinite(zero ** -1) + assert_positive_infinite(zero ** -1.quo(1)) + assert_positive_infinite(zero ** -1.0) + assert_positive_infinite(zero ** BigDecimal(-1)) + + m_zero = BigDecimal("-0") + assert_negative_infinite(m_zero ** -1) + assert_negative_infinite(m_zero ** -1.quo(1)) + assert_negative_infinite(m_zero ** -1.0) + assert_negative_infinite(m_zero ** BigDecimal(-1)) + assert_positive_infinite(m_zero ** -2) + assert_positive_infinite(m_zero ** -2.quo(1)) + assert_positive_infinite(m_zero ** -2.0) + assert_positive_infinite(m_zero ** BigDecimal(-2)) + end + end + + def test_power_of_positive_infinity + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + assert_positive_infinite(BigDecimal::INFINITY ** 3) + assert_positive_infinite(BigDecimal::INFINITY ** 3.quo(1)) + assert_positive_infinite(BigDecimal::INFINITY ** 3.0) + assert_positive_infinite(BigDecimal::INFINITY ** BigDecimal(3)) + assert_positive_infinite(BigDecimal::INFINITY ** 2) + assert_positive_infinite(BigDecimal::INFINITY ** 2.quo(1)) + assert_positive_infinite(BigDecimal::INFINITY ** 2.0) + assert_positive_infinite(BigDecimal::INFINITY ** BigDecimal(2)) + assert_positive_infinite(BigDecimal::INFINITY ** 1) + assert_positive_infinite(BigDecimal::INFINITY ** 1.quo(1)) + assert_positive_infinite(BigDecimal::INFINITY ** 1.0) + assert_positive_infinite(BigDecimal::INFINITY ** BigDecimal(1)) + assert_equal(1, BigDecimal::INFINITY ** 0) + assert_equal(1, BigDecimal::INFINITY ** 0.quo(1)) + assert_equal(1, BigDecimal::INFINITY ** 0.0) + assert_equal(1, BigDecimal::INFINITY ** BigDecimal(0)) + assert_positive_zero(BigDecimal::INFINITY ** -1) + assert_positive_zero(BigDecimal::INFINITY ** -1.quo(1)) + assert_positive_zero(BigDecimal::INFINITY ** -1.0) + assert_positive_zero(BigDecimal::INFINITY ** BigDecimal(-1)) + assert_positive_zero(BigDecimal::INFINITY ** -2) + assert_positive_zero(BigDecimal::INFINITY ** -2.0) + assert_positive_zero(BigDecimal::INFINITY ** BigDecimal(-2)) + end + end + + def test_power_of_negative_infinity + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + assert_negative_infinite((-BigDecimal::INFINITY) ** 3) + assert_negative_infinite((-BigDecimal::INFINITY) ** 3.quo(1)) + assert_negative_infinite((-BigDecimal::INFINITY) ** 3.0) + assert_negative_infinite((-BigDecimal::INFINITY) ** BigDecimal(3)) + assert_positive_infinite((-BigDecimal::INFINITY) ** 2) + assert_positive_infinite((-BigDecimal::INFINITY) ** 2.quo(1)) + assert_positive_infinite((-BigDecimal::INFINITY) ** 2.0) + assert_positive_infinite((-BigDecimal::INFINITY) ** BigDecimal(2)) + assert_negative_infinite((-BigDecimal::INFINITY) ** 1) + assert_negative_infinite((-BigDecimal::INFINITY) ** 1.quo(1)) + assert_negative_infinite((-BigDecimal::INFINITY) ** 1.0) + assert_negative_infinite((-BigDecimal::INFINITY) ** BigDecimal(1)) + assert_equal(1, (-BigDecimal::INFINITY) ** 0) + assert_equal(1, (-BigDecimal::INFINITY) ** 0.quo(1)) + assert_equal(1, (-BigDecimal::INFINITY) ** 0.0) + assert_equal(1, (-BigDecimal::INFINITY) ** BigDecimal(0)) + assert_negative_zero((-BigDecimal::INFINITY) ** -1) + assert_negative_zero((-BigDecimal::INFINITY) ** -1.quo(1)) + assert_negative_zero((-BigDecimal::INFINITY) ** -1.0) + assert_negative_zero((-BigDecimal::INFINITY) ** BigDecimal(-1)) + assert_positive_zero((-BigDecimal::INFINITY) ** -2) + assert_positive_zero((-BigDecimal::INFINITY) ** -2.quo(1)) + assert_positive_zero((-BigDecimal::INFINITY) ** -2.0) + assert_positive_zero((-BigDecimal::INFINITY) ** BigDecimal(-2)) + end + end + + def test_power_without_prec + pi = BigDecimal("3.14159265358979323846264338327950288419716939937511") + e = BigDecimal("2.71828182845904523536028747135266249775724709369996") + pow = BigDecimal("22.4591577183610454734271522045437350275893151339967843873233068") + assert_equal(pow, pi.power(e)) + end + + def test_power_with_prec + pi = BigDecimal("3.14159265358979323846264338327950288419716939937511") + e = BigDecimal("2.71828182845904523536028747135266249775724709369996") + pow = BigDecimal("22.459157718361045473") + assert_equal(pow, pi.power(e, 20)) + + b = BigDecimal('1.034482758620689655172413793103448275862068965517241379310344827586206896551724') + assert_equal(BigDecimal('0.114523E1'), b.power(4, 5), '[Bug #8818] [ruby-core:56802]') + end + + def test_limit + BigDecimal.limit(1) + x = BigDecimal.new("3") + assert_equal(90, x ** 4) # OK? must it be 80? + # 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ??? + assert_raise(ArgumentError) { BigDecimal.limit(-1) } + + bug7458 = '[ruby-core:50269] [#7458]' + one = BigDecimal('1') + epsilon = BigDecimal('0.7E-18') + BigDecimal.save_limit do + BigDecimal.limit(0) + assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(0) #{bug7458}") + + 1.upto(18) do |lim| + BigDecimal.limit(lim) + assert_equal(BigDecimal("1.0"), one + epsilon, "limit(#{lim}) #{bug7458}") + end + + BigDecimal.limit(19) + assert_equal(BigDecimal("1.000000000000000001"), one + epsilon, "limit(19) #{bug7458}") + + BigDecimal.limit(20) + assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(20) #{bug7458}") + end + end + + def test_sign + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, false) + + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, BigDecimal.new("0").sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, BigDecimal.new("-0").sign) + assert_equal(BigDecimal::SIGN_POSITIVE_FINITE, BigDecimal.new("1").sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_FINITE, BigDecimal.new("-1").sign) + assert_equal(BigDecimal::SIGN_POSITIVE_INFINITE, (BigDecimal.new("1") / 0).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_INFINITE, (BigDecimal.new("-1") / 0).sign) + assert_equal(BigDecimal::SIGN_NaN, (BigDecimal.new("0") / 0).sign) + end + + def test_inf + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + inf = BigDecimal.new("Infinity") + + assert_equal(inf, inf + inf) + assert_equal(true, (inf + (-inf)).nan?) + assert_equal(true, (inf - inf).nan?) + assert_equal(inf, inf - (-inf)) + assert_equal(inf, inf * inf) + assert_equal(true, (inf / inf).nan?) + + assert_equal(inf, inf + 1) + assert_equal(inf, inf - 1) + assert_equal(inf, inf * 1) + assert_equal(true, (inf * 0).nan?) + assert_equal(inf, inf / 1) + + assert_equal(inf, 1 + inf) + assert_equal(-inf, 1 - inf) + assert_equal(inf, 1 * inf) + assert_equal(-inf, -1 * inf) + assert_equal(true, (0 * inf).nan?) + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, (1 / inf).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, (-1 / inf).sign) + end + + def test_to_special_string + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + nan = BigDecimal.new("NaN") + assert_equal("NaN", nan.to_s) + inf = BigDecimal.new("Infinity") + assert_equal("Infinity", inf.to_s) + assert_equal(" Infinity", inf.to_s(" ")) + assert_equal("+Infinity", inf.to_s("+")) + assert_equal("-Infinity", (-inf).to_s) + pzero = BigDecimal.new("0") + assert_equal("0.0", pzero.to_s) + assert_equal(" 0.0", pzero.to_s(" ")) + assert_equal("+0.0", pzero.to_s("+")) + assert_equal("-0.0", (-pzero).to_s) + end + + def test_to_string + assert_equal("0.01", BigDecimal("0.01").to_s("F")) + s = "0." + "0" * 100 + "1" + assert_equal(s, BigDecimal(s).to_s("F")) + s = "1" + "0" * 100 + ".0" + assert_equal(s, BigDecimal(s).to_s("F")) + end + + def test_ctov + assert_equal(0.1, BigDecimal.new("1E-1")) + assert_equal(10, BigDecimal.new("1E+1")) + assert_equal(1, BigDecimal.new("+1")) + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false) + + assert_equal(BigDecimal::SIGN_POSITIVE_INFINITE, BigDecimal.new("1E1" + "0" * 10000).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_INFINITE, BigDecimal.new("-1E1" + "0" * 10000).sign) + assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, BigDecimal.new("1E-1" + "0" * 10000).sign) + assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, BigDecimal.new("-1E-1" + "0" * 10000).sign) + end + + def test_split_under_gc_stress + bug3258 = '[ruby-dev:41213]' + expect = 10.upto(20).map{|i|[1, "1", 10, i+1].inspect} + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, expect, [], bug3258) + GC.stress = true + 10.upto(20) do |i| + p BigDecimal.new("1"+"0"*i).split + end + EOS + end + + def test_coerce_under_gc_stress + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" + b = BigDecimal.new("1") + GC.stress = true + 10.times do + begin + b.coerce(:too_long_to_embed_as_string) + rescue => e + raise unless e.is_a?(TypeError) + raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect + end + end + EOS + end + + def test_INFINITY + assert(BigDecimal::INFINITY.infinite?, "BigDecimal::INFINITY is not a infinity") + end + + def test_NAN + assert(BigDecimal::NAN.nan?, "BigDecimal::NAN is not NaN") + end + + def test_exp_with_zerp_precision + assert_raise(ArgumentError) do + BigMath.exp(1, 0) + end + end + + def test_exp_with_negative_precision + assert_raise(ArgumentError) do + BigMath.exp(1, -42) + end + end + + def test_exp_with_complex + assert_raise(ArgumentError) do + BigMath.exp(Complex(1, 2), 20) + end + end + + def test_exp_with_negative_infinite + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert_equal(0, BigMath.exp(-BigDecimal::INFINITY, 20)) + end + end + + def test_exp_with_positive_infinite + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert(BigMath.exp(BigDecimal::INFINITY, 20) > 0) + assert(BigMath.exp(BigDecimal::INFINITY, 20).infinite?) + end + end + + def test_exp_with_nan + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert(BigMath.exp(BigDecimal::NAN, 20).nan?) + end + end + + def test_exp_with_1 + assert_in_epsilon(Math::E, BigMath.exp(1, 20)) + end + + def test_BigMath_exp + prec = 20 + assert_in_epsilon(Math.exp(20), BigMath.exp(BigDecimal("20"), prec)) + assert_in_epsilon(Math.exp(40), BigMath.exp(BigDecimal("40"), prec)) + assert_in_epsilon(Math.exp(-20), BigMath.exp(BigDecimal("-20"), prec)) + assert_in_epsilon(Math.exp(-40), BigMath.exp(BigDecimal("-40"), prec)) + end + + def test_BigMath_exp_with_float + prec = 20 + assert_in_epsilon(Math.exp(20), BigMath.exp(20.0, prec)) + assert_in_epsilon(Math.exp(40), BigMath.exp(40.0, prec)) + assert_in_epsilon(Math.exp(-20), BigMath.exp(-20.0, prec)) + assert_in_epsilon(Math.exp(-40), BigMath.exp(-40.0, prec)) + end + + def test_BigMath_exp_with_fixnum + prec = 20 + assert_in_epsilon(Math.exp(20), BigMath.exp(20, prec)) + assert_in_epsilon(Math.exp(40), BigMath.exp(40, prec)) + assert_in_epsilon(Math.exp(-20), BigMath.exp(-20, prec)) + assert_in_epsilon(Math.exp(-40), BigMath.exp(-40, prec)) + end + + def test_BigMath_exp_with_rational + prec = 20 + assert_in_epsilon(Math.exp(20), BigMath.exp(Rational(40,2), prec)) + assert_in_epsilon(Math.exp(40), BigMath.exp(Rational(80,2), prec)) + assert_in_epsilon(Math.exp(-20), BigMath.exp(Rational(-40,2), prec)) + assert_in_epsilon(Math.exp(-40), BigMath.exp(Rational(-80,2), prec)) + end + + def test_BigMath_exp_under_gc_stress + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" + 10.times do + begin + BigMath.exp(:too_long_to_embed_as_string, 6) + rescue => e + raise unless e.is_a?(ArgumentError) + raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect + end + end + EOS + end + + def test_BigMath_log_with_string + assert_raise(ArgumentError) do + BigMath.log("foo", 20) + end + end + + def test_BigMath_log_with_nil + assert_raise(ArgumentError) do + BigMath.log(nil, 20) + end + end + + def test_BigMath_log_with_non_integer_precision + assert_raise(ArgumentError) do + BigMath.log(1, 0.5) + end + end + + def test_BigMath_log_with_nil_precision + assert_raise(ArgumentError) do + BigMath.log(1, nil) + end + end + + def test_BigMath_log_with_complex + assert_raise(Math::DomainError) do + BigMath.log(Complex(1, 2), 20) + end + end + + def test_BigMath_log_with_zero_arg + assert_raise(Math::DomainError) do + BigMath.log(0, 20) + end + end + + def test_BigMath_log_with_negative_arg + assert_raise(Math::DomainError) do + BigMath.log(-1, 20) + end + end + + def test_BigMath_log_with_zero_precision + assert_raise(ArgumentError) do + BigMath.log(1, 0) + end + end + + def test_BigMath_log_with_negative_precision + assert_raise(ArgumentError) do + BigMath.log(1, -42) + end + end + + def test_BigMath_log_with_negative_infinite + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert_raise(Math::DomainError) do + BigMath.log(-BigDecimal::INFINITY, 20) + end + end + end + + def test_BigMath_log_with_positive_infinite + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false) + assert(BigMath.log(BigDecimal::INFINITY, 20) > 0) + assert(BigMath.log(BigDecimal::INFINITY, 20).infinite?) + end + end + + def test_BigMath_log_with_nan + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert(BigMath.log(BigDecimal::NAN, 20).nan?) + end + end + + def test_BigMath_log_with_float_nan + BigDecimal.save_exception_mode do + BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false) + assert(BigMath.log(Float::NAN, 20).nan?) + end + end + + def test_BigMath_log_with_1 + assert_in_delta(0.0, BigMath.log(1, 20)) + assert_in_delta(0.0, BigMath.log(1.0, 20)) + assert_in_delta(0.0, BigMath.log(BigDecimal(1), 20)) + end + + def test_BigMath_log_with_exp_1 + assert_in_delta(1.0, BigMath.log(BigMath.E(10), 10)) + end + + def test_BigMath_log_with_2 + assert_in_delta(Math.log(2), BigMath.log(2, 20)) + assert_in_delta(Math.log(2), BigMath.log(2.0, 20)) + assert_in_delta(Math.log(2), BigMath.log(BigDecimal(2), 20)) + end + + def test_BigMath_log_with_square_of_E + assert_in_delta(2, BigMath.log(BigMath.E(20)**2, 20)) + end + + def test_BigMath_log_with_high_precision_case + e = BigDecimal('2.71828182845904523536028747135266249775724709369996') + e_3 = e.mult(e, 50).mult(e, 50) + log_3 = BigMath.log(e_3, 50) + assert_in_delta(3, log_3, 0.0000000000_0000000000_0000000000_0000000000_0000000001) + end + + def test_BigMath_log_with_42 + assert_in_delta(Math.log(42), BigMath.log(42, 20)) + assert_in_delta(Math.log(42), BigMath.log(42.0, 20)) + assert_in_delta(Math.log(42), BigMath.log(BigDecimal(42), 20)) + end + + def test_BigMath_log_with_101 + # this is mainly a performance test (should be very fast, not the 0.3 s) + assert_in_delta(Math.log(101), BigMath.log(101, 20), 1E-15) + end + + def test_BigMath_log_with_reciprocal_of_42 + assert_in_delta(Math.log(1e-42), BigMath.log(1e-42, 20)) + assert_in_delta(Math.log(1e-42), BigMath.log(BigDecimal("1e-42"), 20)) + end + + def test_BigMath_log_under_gc_stress + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" + 10.times do + begin + BigMath.log(:too_long_to_embed_as_string, 6) + rescue => e + raise unless e.is_a?(ArgumentError) + raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect + end + end + EOS + end + + def test_dup + [1, -1, 2**100, -2**100].each do |i| + x = BigDecimal(i) + assert_equal(x, x.dup) + end + end + + def test_dup_subclass + c = Class.new(BigDecimal) + x = c.new(1) + y = x.dup + assert_equal(1, y) + assert_kind_of(c, y) + end + + def test_to_d + bug6093 = '[ruby-core:42969]' + code = "exit(BigDecimal.new('10.0') == 10.0.to_d)" + assert_ruby_status(%w[-rbigdecimal -rbigdecimal/util -rmathn -], code, bug6093) + end + + def test_bug6406 + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + Thread.current.keys.to_s + EOS + end +end diff --git a/jni/ruby/test/bigdecimal/test_bigdecimal_util.rb b/jni/ruby/test/bigdecimal/test_bigdecimal_util.rb new file mode 100644 index 0000000..e4d6400 --- /dev/null +++ b/jni/ruby/test/bigdecimal/test_bigdecimal_util.rb @@ -0,0 +1,50 @@ +require_relative "testbase" + +require 'bigdecimal/util' + +class TestBigDecimalUtil < Test::Unit::TestCase + def test_BigDecimal_to_d + x = BigDecimal(1) + assert_same(x, x.to_d) + end + + def test_Integer_to_d + assert_equal(BigDecimal(1), 1.to_d) + assert_equal(BigDecimal(2<<100), (2<<100).to_d) + end + + def test_Float_to_d_without_precision + delta = 1.0/10**(Float::DIG) + assert_in_delta(BigDecimal(0.5, Float::DIG), 0.5.to_d, delta) + assert_in_delta(BigDecimal(355.0/113.0, Float::DIG), (355.0/113.0).to_d, delta) + assert_equal(9.05.to_d.to_s('F'), "9.05") + + bug9214 = '[ruby-core:58858]' + assert_equal((-0.0).to_d.sign, -1, bug9214) + end + + def test_Float_to_d_with_precision + digits = 5 + delta = 1.0/10**(digits) + assert_in_delta(BigDecimal(0.5, 5), 0.5.to_d(digits), delta) + assert_in_delta(BigDecimal(355.0/113.0, 5), (355.0/113.0).to_d(digits), delta) + + bug9214 = '[ruby-core:58858]' + assert_equal((-0.0).to_d(digits).sign, -1, bug9214) + end + + def test_Rational_to_d + digits = 100 + delta = 1.0/10**(digits) + assert_in_delta(BigDecimal(1.quo(2), digits), 1.quo(2).to_d(digits), delta) + assert_in_delta(BigDecimal(355.quo(113), digits), 355.quo(113).to_d(digits), delta) + end + + def test_Rational_to_d_with_zero_precision + assert_raise(ArgumentError) { 355.quo(113).to_d(0) } + end + + def test_Rational_to_d_with_negative_precision + assert_raise(ArgumentError) { 355.quo(113).to_d(-42) } + end +end diff --git a/jni/ruby/test/bigdecimal/test_bigmath.rb b/jni/ruby/test/bigdecimal/test_bigmath.rb new file mode 100644 index 0000000..740c755 --- /dev/null +++ b/jni/ruby/test/bigdecimal/test_bigmath.rb @@ -0,0 +1,80 @@ +require_relative "testbase" +require "bigdecimal/math" + +class TestBigMath < Test::Unit::TestCase + include TestBigDecimalBase + include BigMath + N = 20 + PINF = BigDecimal("+Infinity") + MINF = BigDecimal("-Infinity") + NAN = BigDecimal("NaN") + + def test_const + assert_in_delta(Math::PI, PI(N)) + assert_in_delta(Math::E, E(N)) + end + + def test_sqrt + assert_in_delta(2**0.5, sqrt(BigDecimal("2"), N)) + assert_equal(10, sqrt(BigDecimal("100"), N)) + assert_equal(0.0, sqrt(BigDecimal("0"), N)) + assert_equal(0.0, sqrt(BigDecimal("-0"), N)) + assert_raise(FloatDomainError) {sqrt(BigDecimal("-1.0"), N)} + assert_raise(FloatDomainError) {sqrt(NAN, N)} + assert_raise(FloatDomainError) {sqrt(PINF, N)} + end + + def test_sin + assert_in_delta(0.0, sin(BigDecimal("0.0"), N)) + assert_in_delta(Math.sqrt(2.0) / 2, sin(PI(N) / 4, N)) + assert_in_delta(1.0, sin(PI(N) / 2, N)) + assert_in_delta(0.0, sin(PI(N) * 2, N)) + assert_in_delta(0.0, sin(PI(N), N)) + assert_in_delta(-1.0, sin(PI(N) / -2, N)) + assert_in_delta(0.0, sin(PI(N) * -2, N)) + assert_in_delta(0.0, sin(-PI(N), N)) + assert_in_delta(0.0, sin(PI(N) * 21, N)) + assert_in_delta(0.0, sin(PI(N) * 30, N)) + assert_in_delta(-1.0, sin(PI(N) * BigDecimal("301.5"), N)) + end + + def test_cos + assert_in_delta(1.0, cos(BigDecimal("0.0"), N)) + assert_in_delta(Math.sqrt(2.0) / 2, cos(PI(N) / 4, N)) + assert_in_delta(0.0, cos(PI(N) / 2, N)) + assert_in_delta(1.0, cos(PI(N) * 2, N)) + assert_in_delta(-1.0, cos(PI(N), N)) + assert_in_delta(0.0, cos(PI(N) / -2, N)) + assert_in_delta(1.0, cos(PI(N) * -2, N)) + assert_in_delta(-1.0, cos(-PI(N), N)) + assert_in_delta(-1.0, cos(PI(N) * 21, N)) + assert_in_delta(1.0, cos(PI(N) * 30, N)) + assert_in_delta(0.0, cos(PI(N) * BigDecimal("301.5"), N)) + end + + def test_atan + assert_equal(0.0, atan(BigDecimal("0.0"), N)) + assert_in_delta(Math::PI/4, atan(BigDecimal("1.0"), N)) + assert_in_delta(Math::PI/6, atan(sqrt(BigDecimal("3.0"), N) / 3, N)) + assert_in_delta(Math::PI/2, atan(PINF, N)) + assert_equal(BigDecimal("0.823840753418636291769355073102514088959345624027952954058347023122539489"), + atan(BigDecimal("1.08"), 72).round(72), '[ruby-dev:41257]') + end + + def test_log + assert_equal(0, BigMath.log(BigDecimal("1.0"), 10)) + assert_in_epsilon(Math.log(10)*1000, BigMath.log(BigDecimal("1e1000"), 10)) + assert_raise(Math::DomainError) {BigMath.log(BigDecimal("0"), 10)} + assert_raise(Math::DomainError) {BigMath.log(BigDecimal("-1"), 10)} + assert_separately(%w[-rbigdecimal], <<-SRC) + begin + x = BigMath.log(BigDecimal("1E19999999999999"), 10) + rescue FloatDomainError + else + unless x.infinite? + assert_in_epsilon(Math.log(10)*19999999999999, x) + end + end + SRC + end +end diff --git a/jni/ruby/test/bigdecimal/testbase.rb b/jni/ruby/test/bigdecimal/testbase.rb new file mode 100644 index 0000000..c014e61 --- /dev/null +++ b/jni/ruby/test/bigdecimal/testbase.rb @@ -0,0 +1,27 @@ +require "test/unit" +require "bigdecimal" + +module TestBigDecimalBase + def setup + @mode = BigDecimal.mode(BigDecimal::EXCEPTION_ALL) + BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true) + BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true) + BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) + BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_UP) + BigDecimal.limit(0) + end + + def teardown + [BigDecimal::EXCEPTION_INFINITY, BigDecimal::EXCEPTION_NaN, + BigDecimal::EXCEPTION_UNDERFLOW, BigDecimal::EXCEPTION_OVERFLOW].each do |mode| + BigDecimal.mode(mode, !(@mode & mode).zero?) + end + end + + def under_gc_stress + stress, GC.stress = GC.stress, true + yield + ensure + GC.stress = stress + end +end diff --git a/jni/ruby/test/cgi/test_cgi_cookie.rb b/jni/ruby/test/cgi/test_cgi_cookie.rb new file mode 100644 index 0000000..c1c6a30 --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_cookie.rb @@ -0,0 +1,110 @@ +require 'test/unit' +require 'cgi' +require 'stringio' + + +class CGICookieTest < Test::Unit::TestCase + + + def setup + ENV['REQUEST_METHOD'] = 'GET' + @str1="\xE3\x82\x86\xE3\x82\x93\xE3\x82\x86\xE3\x82\x93" + @str1.force_encoding("UTF-8") if defined?(::Encoding) + end + + def teardown + %W[REQUEST_METHOD SCRIPT_NAME].each do |name| + ENV.delete(name) + end + end + + + def test_cgi_cookie_new_simple + cookie = CGI::Cookie.new('name1', 'val1', '&<>"', @str1) + assert_equal('name1', cookie.name) + assert_equal(['val1', '&<>"', @str1], cookie.value) + assert_nil(cookie.domain) + assert_nil(cookie.expires) + assert_equal('', cookie.path) + assert_equal(false, cookie.secure) + assert_equal("name1=val1&%26%3C%3E%22&%E3%82%86%E3%82%93%E3%82%86%E3%82%93; path=", cookie.to_s) + end + + + def test_cgi_cookie_new_complex + t = Time.gm(2030, 12, 31, 23, 59, 59) + value = ['val1', '&<>"', "\xA5\xE0\xA5\xB9\xA5\xAB"] + value[2].force_encoding("EUC-JP") if defined?(::Encoding) + cookie = CGI::Cookie.new('name'=>'name1', + 'value'=>value, + 'path'=>'/cgi-bin/myapp/', + 'domain'=>'www.example.com', + 'expires'=>t, + 'secure'=>true + ) + assert_equal('name1', cookie.name) + assert_equal(value, cookie.value) + assert_equal('www.example.com', cookie.domain) + assert_equal(t, cookie.expires) + assert_equal('/cgi-bin/myapp/', cookie.path) + assert_equal(true, cookie.secure) + assert_equal('name1=val1&%26%3C%3E%22&%A5%E0%A5%B9%A5%AB; domain=www.example.com; path=/cgi-bin/myapp/; expires=Tue, 31 Dec 2030 23:59:59 GMT; secure', cookie.to_s) + end + + + def test_cgi_cookie_scriptname + cookie = CGI::Cookie.new('name1', 'value1') + assert_equal('', cookie.path) + cookie = CGI::Cookie.new('name'=>'name1', 'value'=>'value1') + assert_equal('', cookie.path) + ## when ENV['SCRIPT_NAME'] is set, cookie.path is set automatically + ENV['SCRIPT_NAME'] = '/cgi-bin/app/example.cgi' + cookie = CGI::Cookie.new('name1', 'value1') + assert_equal('/cgi-bin/app/', cookie.path) + cookie = CGI::Cookie.new('name'=>'name1', 'value'=>'value1') + assert_equal('/cgi-bin/app/', cookie.path) + end + + + def test_cgi_cookie_parse + ## ';' separator + cookie_str = 'name1=val1&val2; name2=val2&%26%3C%3E%22&%E3%82%86%E3%82%93%E3%82%86%E3%82%93;_session_id=12345' + cookies = CGI::Cookie.parse(cookie_str) + list = [ + ['name1', ['val1', 'val2']], + ['name2', ['val2', '&<>"',@str1]], + ['_session_id', ['12345']], + ] + list.each do |name, value| + cookie = cookies[name] + assert_equal(name, cookie.name) + assert_equal(value, cookie.value) + end + ## ',' separator + cookie_str = 'name1=val1&val2, name2=val2&%26%3C%3E%22&%E3%82%86%E3%82%93%E3%82%86%E3%82%93,_session_id=12345' + cookies = CGI::Cookie.parse(cookie_str) + list.each do |name, value| + cookie = cookies[name] + assert_equal(name, cookie.name) + assert_equal(value, cookie.value) + end + end + + + def test_cgi_cookie_arrayinterface + cookie = CGI::Cookie.new('name1', 'a', 'b', 'c') + assert_equal('a', cookie[0]) + assert_equal('c', cookie[2]) + assert_nil(cookie[3]) + assert_equal('a', cookie.first) + assert_equal('c', cookie.last) + assert_equal(['A', 'B', 'C'], cookie.collect{|e| e.upcase}) + end + + + + instance_methods.each do |method| + private method if method =~ /^test_(.*)/ && $1 != ENV['TEST'] + end if ENV['TEST'] + +end diff --git a/jni/ruby/test/cgi/test_cgi_core.rb b/jni/ruby/test/cgi/test_cgi_core.rb new file mode 100644 index 0000000..274d088 --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_core.rb @@ -0,0 +1,312 @@ +require 'test/unit' +require 'cgi' +require 'stringio' + + +class CGICoreTest < Test::Unit::TestCase + + + def setup + #@environ = { + # 'SERVER_PROTOCOL' => 'HTTP/1.1', + # 'REQUEST_METHOD' => 'GET', + # 'SERVER_SOFTWARE' => 'Apache 2.2.0', + #} + #ENV.update(@environ) + end + + + def teardown + @environ.each do |key, val| ENV.delete(key) end + $stdout = STDOUT + end + + def test_cgi_parse_illegal_query + @environ = { + 'REQUEST_METHOD' => 'GET', + 'QUERY_STRING' => 'a=111&&b=222&c&d=', + 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + assert_equal(["a","b","c","d"],cgi.keys.sort) + assert_equal("",cgi["d"]) + end + + def test_cgi_core_params_GET + @environ = { + 'REQUEST_METHOD' => 'GET', + 'QUERY_STRING' => 'id=123&id=456&id=&id&str=%40h+%3D%7E+%2F%5E%24%2F', + 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + ## cgi[] + assert_equal('123', cgi['id']) + assert_equal('@h =~ /^$/', cgi['str']) + ## cgi.params + assert_equal(['123', '456', ''], cgi.params['id']) + assert_equal(['@h =~ /^$/'], cgi.params['str']) + ## cgi.keys + assert_equal(['id', 'str'], cgi.keys.sort) + ## cgi.key?, cgi.has_key?, cgi.include? + assert_equal(true, cgi.key?('id')) + assert_equal(true, cgi.has_key?('id')) + assert_equal(true, cgi.include?('id')) + assert_equal(false, cgi.key?('foo')) + assert_equal(false, cgi.has_key?('foo')) + assert_equal(false, cgi.include?('foo')) + ## invalid parameter name + assert_equal('', cgi['*notfound*']) # [ruby-dev:30740] + assert_equal([], cgi.params['*notfound*']) + end + + + def test_cgi_core_params_POST + query_str = 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F' + @environ = { + 'REQUEST_METHOD' => 'POST', + 'CONTENT_LENGTH' => query_str.length.to_s, + 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + $stdin = StringIO.new + $stdin << query_str + $stdin.rewind + cgi = CGI.new + ## cgi[] + assert_equal('123', cgi['id']) + assert_equal('@h =~ /^$/', cgi['str']) + ## cgi.params + assert_equal(['123', '456', ''], cgi.params['id']) + assert_equal(['@h =~ /^$/'], cgi.params['str']) + ## invalid parameter name + assert_equal('', cgi['*notfound*']) + assert_equal([], cgi.params['*notfound*']) + end + + def test_cgi_core_params_encoding_check + query_str = 'str=%BE%BE%B9%BE' + @environ = { + 'REQUEST_METHOD' => 'POST', + 'CONTENT_LENGTH' => query_str.length.to_s, + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + $stdin = StringIO.new + $stdin << query_str + $stdin.rewind + if defined?(::Encoding) + hash={} + cgi = CGI.new(:accept_charset=>"UTF-8"){|key,val|hash[key]=val} + ## cgi[] + assert_equal("\xBE\xBE\xB9\xBE".force_encoding("UTF-8"), cgi['str']) + ## cgi.params + assert_equal(["\xBE\xBE\xB9\xBE".force_encoding("UTF-8")], cgi.params['str']) + ## accept-charset error + assert_equal({"str"=>"\xBE\xBE\xB9\xBE".force_encoding("UTF-8")},hash) + + $stdin.rewind + assert_raise(CGI::InvalidEncoding) do + cgi = CGI.new(:accept_charset=>"UTF-8") + end + + $stdin.rewind + cgi = CGI.new(:accept_charset=>"EUC-JP") + ## cgi[] + assert_equal("\xBE\xBE\xB9\xBE".force_encoding("EUC-JP"), cgi['str']) + ## cgi.params + assert_equal(["\xBE\xBE\xB9\xBE".force_encoding("EUC-JP")], cgi.params['str']) + else + assert(true) + end + end + + + def test_cgi_core_cookie + @environ = { + 'REQUEST_METHOD' => 'GET', + 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F', + 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + assert_not_equal(nil,cgi.cookies) + [ ['_session_id', ['12345'], ], + ['name1', ['val1', 'val2'], ], + ].each do |key, expected| + cookie = cgi.cookies[key] + assert_kind_of(CGI::Cookie, cookie) + assert_equal(expected, cookie.value) + assert_equal(false, cookie.secure) + assert_nil(cookie.expires) + assert_nil(cookie.domain) + assert_equal('', cookie.path) + end + end + + + def test_cgi_core_maxcontentlength + @environ = { + 'REQUEST_METHOD' => 'POST', + 'CONTENT_LENGTH' => (64 * 1024 * 1024).to_s + } + ENV.update(@environ) + ex = assert_raise(StandardError) do + CGI.new + end + assert_equal("too large post data.", ex.message) + end if CGI.const_defined?(:MAX_CONTENT_LENGTH) + + + def test_cgi_core_out + @environ = { + 'REQUEST_METHOD' => 'GET', + 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F', + 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + ## euc string + euc_str = "\270\253\244\355\241\242\277\315\244\254\245\264\245\337\244\316\244\350\244\246\244\300" + ## utf8 (not converted) + options = { 'charset'=>'utf8' } + $stdout = StringIO.new + cgi.out(options) { euc_str } + assert_nil(options['language']) + actual = $stdout.string + expected = "Content-Type: text/html; charset=utf8\r\n" + + "Content-Length: 22\r\n" + + "\r\n" + + euc_str + if defined?(::Encoding) + actual.force_encoding("ASCII-8BIT") + expected.force_encoding("ASCII-8BIT") + end + assert_equal(expected, actual) + ## language is keeped + options = { 'charset'=>'Shift_JIS', 'language'=>'en' } + $stdout = StringIO.new + cgi.out(options) { euc_str } + assert_equal('en', options['language']) + ## HEAD method + ENV['REQUEST_METHOD'] = 'HEAD' + options = { 'charset'=>'utf8' } + $stdout = StringIO.new + cgi.out(options) { euc_str } + actual = $stdout.string + expected = "Content-Type: text/html; charset=utf8\r\n" + + "Content-Length: 22\r\n" + + "\r\n" + assert_equal(expected, actual) + end + + + def test_cgi_core_print + @environ = { + 'REQUEST_METHOD' => 'GET', + } + ENV.update(@environ) + cgi = CGI.new + $stdout = StringIO.new + str = "foobar" + cgi.print(str) + expected = str + actual = $stdout.string + assert_equal(expected, actual) + end + + + def test_cgi_core_environs + @environ = { + 'REQUEST_METHOD' => 'GET', + } + ENV.update(@environ) + cgi = CGI.new + ## + list1 = %w[ AUTH_TYPE CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO + PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST + REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME + SERVER_NAME SERVER_PROTOCOL SERVER_SOFTWARE + HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING + HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM HTTP_HOST + HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT + ] + # list2 = %w[ CONTENT_LENGTH SERVER_PORT ] + ## string expected + list1.each do |name| + @environ[name] = "**#{name}**" + end + ENV.update(@environ) + list1.each do |name| + method = name.sub(/\AHTTP_/, '').downcase + actual = cgi.__send__ method + expected = "**#{name}**" + assert_equal(expected, actual) + end + ## integer expected + ENV['CONTENT_LENGTH'] = '123' + ENV['SERVER_PORT'] = '8080' + assert_equal(123, cgi.content_length) + assert_equal(8080, cgi.server_port) + ## raw cookie + ENV['HTTP_COOKIE'] = 'name1=val1' + ENV['HTTP_COOKIE2'] = 'name2=val2' + assert_equal('name1=val1', cgi.raw_cookie) + assert_equal('name2=val2', cgi.raw_cookie2) + end + + + def test_cgi_core_htmltype_header + @environ = { + 'REQUEST_METHOD' => 'GET', + } + ENV.update(@environ) + ## no htmltype + cgi = CGI.new + assert_raise(NoMethodError) do cgi.doctype end + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) + ## html3 + cgi = CGI.new('html3') + expected = '' + assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) + ## html4 + cgi = CGI.new('html4') + expected = '' + assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) + ## html4 transitional + cgi = CGI.new('html4Tr') + expected = '' + assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) + ## html4 frameset + cgi = CGI.new('html4Fr') + expected = '' + assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) + ## html5 + cgi = CGI.new('html5') + expected = '' + assert_equal(expected, cgi.doctype) + assert_match(/^
<\/HEADER>$/i,cgi.header) + end + + + instance_methods.each do |method| + private method if method =~ /^test_(.*)/ && $1 != ENV['TEST'] + end if ENV['TEST'] + +end diff --git a/jni/ruby/test/cgi/test_cgi_header.rb b/jni/ruby/test/cgi/test_cgi_header.rb new file mode 100644 index 0000000..9022301 --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_header.rb @@ -0,0 +1,181 @@ +require 'test/unit' +require 'cgi' +require 'time' + + +class CGIHeaderTest < Test::Unit::TestCase + + + def setup + @environ = { + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'REQUEST_METHOD' => 'GET', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + } + ENV.update(@environ) + end + + + def teardown + @environ.each do |key, val| ENV.delete(key) end + end + + + def test_cgi_http_header_simple + cgi = CGI.new + ## default content type + expected = "Content-Type: text/html\r\n\r\n" + actual = cgi.http_header + assert_equal(expected, actual) + ## content type specified as string + expected = "Content-Type: text/xhtml; charset=utf8\r\n\r\n" + actual = cgi.http_header('text/xhtml; charset=utf8') + assert_equal(expected, actual) + ## content type specified as hash + expected = "Content-Type: image/png\r\n\r\n" + actual = cgi.http_header('type'=>'image/png') + assert_equal(expected, actual) + ## charset specified + expected = "Content-Type: text/html; charset=utf8\r\n\r\n" + actual = cgi.http_header('charset'=>'utf8') + assert_equal(expected, actual) + end + + + def test_cgi_http_header_complex + cgi = CGI.new + options = { + 'type' => 'text/xhtml', + 'charset' => 'utf8', + 'status' => 'REDIRECT', + 'server' => 'webrick', + 'connection' => 'close', + 'length' => 123, + 'language' => 'ja', + 'expires' => Time.gm(2000, 1, 23, 12, 34, 56), + 'location' => 'http://www.ruby-lang.org/', + } + expected = "Status: 302 Found\r\n" + expected << "Server: webrick\r\n" + expected << "Connection: close\r\n" + expected << "Content-Type: text/xhtml; charset=utf8\r\n" + expected << "Content-Length: 123\r\n" + expected << "Content-Language: ja\r\n" + expected << "Expires: Sun, 23 Jan 2000 12:34:56 GMT\r\n" + expected << "location: http://www.ruby-lang.org/\r\n" + expected << "\r\n" + actual = cgi.http_header(options) + assert_equal(expected, actual) + end + + + def test_cgi_http_header_argerr + cgi = CGI.new + expected = ArgumentError + + assert_raise(expected) do + cgi.http_header(nil) + end + end + + + def test_cgi_http_header_cookie + cgi = CGI.new + cookie1 = CGI::Cookie.new('name1', 'abc', '123') + cookie2 = CGI::Cookie.new('name'=>'name2', 'value'=>'value2', 'secure'=>true) + ctype = "Content-Type: text/html\r\n" + sep = "\r\n" + c1 = "Set-Cookie: name1=abc&123; path=\r\n" + c2 = "Set-Cookie: name2=value2; path=; secure\r\n" + ## CGI::Cookie object + actual = cgi.http_header('cookie'=>cookie1) + expected = ctype + c1 + sep + assert_equal(expected, actual) + ## String + actual = cgi.http_header('cookie'=>cookie2.to_s) + expected = ctype + c2 + sep + assert_equal(expected, actual) + ## Array + actual = cgi.http_header('cookie'=>[cookie1, cookie2]) + expected = ctype + c1 + c2 + sep + assert_equal(expected, actual) + ## Hash + actual = cgi.http_header('cookie'=>{'name1'=>cookie1, 'name2'=>cookie2}) + expected = ctype + c1 + c2 + sep + assert_equal(expected, actual) + end + + + def test_cgi_http_header_output_cookies + cgi = CGI.new + ## output cookies + cookies = [ CGI::Cookie.new('name1', 'abc', '123'), + CGI::Cookie.new('name'=>'name2', 'value'=>'value2', 'secure'=>true), + ] + cgi.instance_variable_set('@output_cookies', cookies) + expected = "Content-Type: text/html; charset=utf8\r\n" + expected << "Set-Cookie: name1=abc&123; path=\r\n" + expected << "Set-Cookie: name2=value2; path=; secure\r\n" + expected << "\r\n" + ## header when string + actual = cgi.http_header('text/html; charset=utf8') + assert_equal(expected, actual) + ## _header_for_string + actual = cgi.http_header('type'=>'text/html', 'charset'=>'utf8') + assert_equal(expected, actual) + end + + + def test_cgi_http_header_nph + time_start = Time.now.to_i + cgi = CGI.new + ## 'nph' is true + ENV['SERVER_SOFTWARE'] = 'Apache 2.2.0' + actual1 = cgi.http_header('nph'=>true) + ## when old IIS, NPH-mode is forced + ENV['SERVER_SOFTWARE'] = 'IIS/4.0' + actual2 = cgi.http_header + actual3 = cgi.http_header('status'=>'REDIRECT', 'location'=>'http://www.example.com/') + ## newer IIS doesn't require NPH-mode ## [ruby-dev:30537] + ENV['SERVER_SOFTWARE'] = 'IIS/5.0' + actual4 = cgi.http_header + actual5 = cgi.http_header('status'=>'REDIRECT', 'location'=>'http://www.example.com/') + time_end = Time.now.to_i + date = /^Date: ([A-Z][a-z]{2}, \d{2} [A-Z][a-z]{2} \d{4} \d\d:\d\d:\d\d GMT)\r\n/ + [actual1, actual2, actual3].each do |actual| + assert_match(date, actual) + assert_includes(time_start..time_end, date =~ actual && Time.parse($1).to_i) + actual.sub!(date, "Date: DATE_IS_REMOVED\r\n") + end + ## assertion + expected = "HTTP/1.1 200 OK\r\n" + expected << "Date: DATE_IS_REMOVED\r\n" + expected << "Server: Apache 2.2.0\r\n" + expected << "Connection: close\r\n" + expected << "Content-Type: text/html\r\n" + expected << "\r\n" + assert_equal(expected, actual1) + expected.sub!(/^Server: .*?\r\n/, "Server: IIS/4.0\r\n") + assert_equal(expected, actual2) + expected.sub!(/^HTTP\/1.1 200 OK\r\n/, "HTTP/1.1 302 Found\r\n") + expected.sub!(/\r\n\r\n/, "\r\nlocation: http://www.example.com/\r\n\r\n") + assert_equal(expected, actual3) + expected = "Content-Type: text/html\r\n" + expected << "\r\n" + assert_equal(expected, actual4) + expected = "Status: 302 Found\r\n" + expected << "Content-Type: text/html\r\n" + expected << "location: http://www.example.com/\r\n" + expected << "\r\n" + assert_equal(expected, actual5) + ensure + ENV.delete('SERVER_SOFTWARE') + end + + + + instance_methods.each do |method| + private method if method =~ /^test_(.*)/ && $1 != ENV['TEST'] + end if ENV['TEST'] + +end diff --git a/jni/ruby/test/cgi/test_cgi_modruby.rb b/jni/ruby/test/cgi/test_cgi_modruby.rb new file mode 100644 index 0000000..b0fc442 --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_modruby.rb @@ -0,0 +1,146 @@ +require 'test/unit' +require 'cgi' + + +class CGIModrubyTest < Test::Unit::TestCase + + + def setup + @environ = { + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'REQUEST_METHOD' => 'GET', + #'QUERY_STRING' => 'a=foo&b=bar', + } + ENV.update(@environ) + CGI.class_eval { const_set(:MOD_RUBY, true) } + Apache._reset() + #@cgi = CGI.new + #@req = Apache.request + end + + + def teardown + @environ.each do |key, val| ENV.delete(key) end + CGI.class_eval { remove_const(:MOD_RUBY) } + end + + + def test_cgi_modruby_simple + req = Apache.request + cgi = CGI.new + assert(req._setup_cgi_env_invoked?) + assert(! req._send_http_header_invoked?) + actual = cgi.http_header + assert_equal('', actual) + assert_equal('text/html', req.content_type) + assert(req._send_http_header_invoked?) + end + + + def test_cgi_modruby_complex + req = Apache.request + cgi = CGI.new + options = { + 'status' => 'FORBIDDEN', + 'location' => 'http://www.example.com/', + 'type' => 'image/gif', + 'content-encoding' => 'deflate', + 'cookie' => [ CGI::Cookie.new('name1', 'abc', '123'), + CGI::Cookie.new('name'=>'name2', 'value'=>'value2', 'secure'=>true), + ], + } + assert(req._setup_cgi_env_invoked?) + assert(! req._send_http_header_invoked?) + actual = cgi.http_header(options) + assert_equal('', actual) + assert_equal('image/gif', req.content_type) + assert_equal('403 Forbidden', req.status_line) + assert_equal(403, req.status) + assert_equal('deflate', req.content_encoding) + assert_equal('http://www.example.com/', req.headers_out['location']) + assert_equal(["name1=abc&123; path=", "name2=value2; path=; secure"], + req.headers_out['Set-Cookie']) + assert(req._send_http_header_invoked?) + end + + + def test_cgi_modruby_location + req = Apache.request + cgi = CGI.new + options = { + 'status' => '200 OK', + 'location' => 'http://www.example.com/', + } + cgi.http_header(options) + assert_equal('200 OK', req.status_line) # should be '302 Found' ? + assert_equal(302, req.status) + assert_equal('http://www.example.com/', req.headers_out['location']) + end + + + def test_cgi_modruby_requestparams + req = Apache.request + req.args = 'a=foo&b=bar' + cgi = CGI.new + assert_equal('foo', cgi['a']) + assert_equal('bar', cgi['b']) + end + + + instance_methods.each do |method| + private method if method =~ /^test_(.*)/ && $1 != ENV['TEST'] + end if ENV['TEST'] + +end + + + +## dummy class for mod_ruby +class Apache #:nodoc: + + def self._reset + @request = Request.new + end + + def self.request + return @request + end + + class Request + + def initialize + hash = {} + def hash.add(name, value) + (self[name] ||= []) << value + end + @http_header = nil + @headers_out = hash + @status_line = nil + @status = nil + @content_type = nil + @content_encoding = nil + end + attr_accessor :headers_out, :status_line, :status, :content_type, :content_encoding + + attr_accessor :args + #def args + # return ENV['QUERY_STRING'] + #end + + def send_http_header + @http_header = '*invoked*' + end + def _send_http_header_invoked? + @http_header ? true : false + end + + def setup_cgi_env + @cgi_env = '*invoked*' + end + def _setup_cgi_env_invoked? + @cgi_env ? true : false + end + + end + +end diff --git a/jni/ruby/test/cgi/test_cgi_multipart.rb b/jni/ruby/test/cgi/test_cgi_multipart.rb new file mode 100644 index 0000000..1325798 --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_multipart.rb @@ -0,0 +1,380 @@ +require 'test/unit' +require 'cgi' +require 'tempfile' +require 'stringio' + + +## +## usage: +## boundary = 'foobar1234' # or nil +## multipart = MultiPart.new(boundary) +## multipart.append('name1', 'value1') +## multipart.append('file1', File.read('file1.html'), 'file1.html') +## str = multipart.close() +## str.each_line {|line| p line } +## ## output: +## # "--foobar1234\r\n" +## # "Content-Disposition: form-data: name=\"name1\"\r\n" +## # "\r\n" +## # "value1\r\n" +## # "--foobar1234\r\n" +## # "Content-Disposition: form-data: name=\"file1\"; filename=\"file1.html\"\r\n" +## # "Content-Type: text/html\r\n" +## # "\r\n" +## # "\n" +## # "

Hello

\n" +## # "\n" +## # "\r\n" +## # "--foobar1234--\r\n" +## +class MultiPart + + def initialize(boundary=nil) + @boundary = boundary || create_boundary() + @buf = '' + @buf.force_encoding(::Encoding::ASCII_8BIT) if defined?(::Encoding) + end + attr_reader :boundary + + def append(name, value, filename=nil, content_type=nil) + content_type = detect_content_type(filename) if filename && content_type.nil? + s = filename ? "; filename=\"#{filename}\"" : '' + buf = @buf + buf << "--#{boundary}\r\n" + buf << "Content-Disposition: form-data: name=\"#{name}\"#{s}\r\n" + buf << "Content-Type: #{content_type}\r\n" if content_type + buf << "\r\n" + value = value.dup.force_encoding(::Encoding::ASCII_8BIT) if defined?(::Encoding) + buf << value + buf << "\r\n" + return self + end + + def close + buf = @buf + @buf = '' + return buf << "--#{boundary}--\r\n" + end + + def create_boundary() #:nodoc: + return "--boundary#{rand().to_s[2..-1]}" + end + + def detect_content_type(filename) #:nodoc: + filename =~ /\.(\w+)\z/ + return MIME_TYPES[$1] || 'application/octet-stream' + end + + MIME_TYPES = { + 'gif' => 'image/gif', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'png' => 'image/png', + 'bmp' => 'image/bmp', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'htm' => 'text/html', + 'html' => 'text/html', + 'xml' => 'text/xml', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'css' => 'text/css', + 'mpg' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'mp3' => 'audio/mpeg', + 'mid' => 'audio/midi', + 'wav' => 'audio/x-wav', + 'zip' => 'application/zip', + #'tar.gz' => 'application/gtar', + 'gz' => 'application/gzip', + 'bz2' => 'application/bzip2', + 'rtf' => 'application/rtf', + 'pdf' => 'application/pdf', + 'ps' => 'application/postscript', + 'js' => 'application/x-javascript', + 'xls' => 'application/vnd.ms-excel', + 'doc' => 'application/msword', + 'ppt' => 'application/vnd.ms-powerpoint', + } + +end + + + +class CGIMultipartTest < Test::Unit::TestCase + + def setup + ENV['REQUEST_METHOD'] = 'POST' + @tempfiles = [] + end + + def teardown + %w[ REQUEST_METHOD CONTENT_TYPE CONTENT_LENGTH REQUEST_METHOD ].each do |name| + ENV.delete(name) + end + $stdin.close() if $stdin.is_a?(Tempfile) + $stdin = STDIN + @tempfiles.each {|t| + t.close! + } + end + + def _prepare(data) + ## create multipart input + multipart = MultiPart.new(defined?(@boundary) ? @boundary : nil) + data.each do |hash| + multipart.append(hash[:name], hash[:value], hash[:filename]) + end + input = multipart.close() + input = yield(input) if block_given? + #$stderr.puts "*** debug: input=\n#{input.collect{|line| line.inspect}.join("\n")}" + @boundary ||= multipart.boundary + ## set environment + ENV['CONTENT_TYPE'] = "multipart/form-data; boundary=#{@boundary}" + ENV['CONTENT_LENGTH'] = input.length.to_s + ENV['REQUEST_METHOD'] = 'POST' + ## set $stdin + tmpfile = Tempfile.new('test_cgi_multipart') + @tempfiles << tmpfile + tmpfile.binmode + tmpfile << input + tmpfile.rewind() + $stdin = tmpfile + end + + def _test_multipart(cgi_options={}) + caller(0).find {|s| s =~ /in `test_(.*?)'/ } + #testname = $1 + #$stderr.puts "*** debug: testname=#{testname.inspect}" + _prepare(@data) + options = {:accept_charset=>"UTF-8"} + options.merge! cgi_options + cgi = CGI.new(options) + expected_names = @data.collect{|hash| hash[:name] }.sort + assert_equal(expected_names, cgi.params.keys.sort) + threshold = 1024*10 + @data.each do |hash| + name = hash[:name] + expected = hash[:value] + if hash[:filename] #if file + expected_class = @expected_class || (hash[:value].length < threshold ? StringIO : Tempfile) + assert(cgi.files.keys.member?(hash[:name])) + else + expected_class = String + assert_equal(expected, cgi[name]) + assert_equal(false,cgi.files.keys.member?(hash[:name])) + end + assert_kind_of(expected_class, cgi[name]) + assert_equal(expected, cgi[name].read()) + assert_equal(hash[:filename] || '', cgi[name].original_filename) #if hash[:filename] + assert_equal(hash[:content_type] || '', cgi[name].content_type) #if hash[:content_type] + end + ensure + if cgi + cgi.params.each {|name, vals| + vals.each {|val| + if val.kind_of?(Tempfile) && val.path + val.close! + end + } + } + end + end + + + def _read(basename) + filename = File.join(File.dirname(__FILE__), 'testdata', basename) + s = File.open(filename, 'rb') {|f| f.read() } + + return s + end + + + def test_cgi_multipart_stringio + @boundary = '----WebKitFormBoundaryAAfvAII+YL9102cX' + @data = [ + {:name=>'hidden1', :value=>'foobar'}, + {:name=>'text1', :value=>"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A"}, + {:name=>'file1', :value=>_read('file1.html'), + :filename=>'file1.html', :content_type=>'text/html'}, + {:name=>'image1', :value=>_read('small.png'), + :filename=>'small.png', :content_type=>'image/png'}, # small image + ] + @data[1][:value].force_encoding(::Encoding::UTF_8) if defined?(::Encoding) + @expected_class = StringIO + _test_multipart() + end + + + def test_cgi_multipart_tempfile + @boundary = '----WebKitFormBoundaryAAfvAII+YL9102cX' + @data = [ + {:name=>'hidden1', :value=>'foobar'}, + {:name=>'text1', :value=>"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A"}, + {:name=>'file1', :value=>_read('file1.html'), + :filename=>'file1.html', :content_type=>'text/html'}, + {:name=>'image1', :value=>_read('large.png'), + :filename=>'large.png', :content_type=>'image/png'}, # large image + ] + @data[1][:value].force_encoding(::Encoding::UTF_8) if defined?(::Encoding) + @expected_class = Tempfile + _test_multipart() + end + + + def _set_const(klass, name, value) + old = nil + klass.class_eval do + old = const_get(name) + remove_const(name) + const_set(name, value) + end + return old + end + + + def test_cgi_multipart_maxmultipartlength + @data = [ + {:name=>'image1', :value=>_read('large.png'), + :filename=>'large.png', :content_type=>'image/png'}, # large image + ] + begin + ex = assert_raise(StandardError) do + _test_multipart(:max_multipart_length=>2 * 1024) # set via simple scalar + end + assert_equal("too large multipart data.", ex.message) + ensure + end + end + + + def test_cgi_multipart_maxmultipartlength_lambda + @data = [ + {:name=>'image1', :value=>_read('large.png'), + :filename=>'large.png', :content_type=>'image/png'}, # large image + ] + begin + ex = assert_raise(StandardError) do + _test_multipart(:max_multipart_length=>lambda{2*1024}) # set via lambda + end + assert_equal("too large multipart data.", ex.message) + ensure + end + end + + + def test_cgi_multipart_maxmultipartcount + @data = [ + {:name=>'file1', :value=>_read('file1.html'), + :filename=>'file1.html', :content_type=>'text/html'}, + ] + item = @data.first + 500.times { @data << item } + #original = _set_const(CGI, :MAX_MULTIPART_COUNT, 128) + begin + ex = assert_raise(StandardError) do + _test_multipart() + end + assert_equal("too many parameters.", ex.message) + ensure + #_set_const(CGI, :MAX_MULTIPART_COUNT, original) + end + end if CGI.const_defined?(:MAX_MULTIPART_COUNT) + + + def test_cgi_multipart_badbody ## [ruby-dev:28470] + @data = [ + {:name=>'file1', :value=>_read('file1.html'), + :filename=>'file1.html', :content_type=>'text/html'}, + ] + _prepare(@data) do |input| + input2 = input.sub(/--(\r\n)?\z/, "\r\n") + assert input2 != input + #p input2 + input2 + end + ex = assert_raise(EOFError) do + CGI.new(:accept_charset=>"UTF-8") + end + assert_equal("bad content body", ex.message) + # + _prepare(@data) do |input| + input2 = input.sub(/--(\r\n)?\z/, "") + assert input2 != input + #p input2 + input2 + end + ex = assert_raise(EOFError) do + CGI.new(:accept_charset=>"UTF-8") + end + assert_equal("bad content body", ex.message) + end + + + def test_cgi_multipart_quoteboundary ## [JVN#84798830] + @boundary = '(.|\n)*' + @data = [ + {:name=>'hidden1', :value=>'foobar'}, + {:name=>'text1', :value=>"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A"}, + {:name=>'file1', :value=>_read('file1.html'), + :filename=>'file1.html', :content_type=>'text/html'}, + {:name=>'image1', :value=>_read('small.png'), + :filename=>'small.png', :content_type=>'image/png'}, # small image + ] + @data[1][:value].force_encoding("UTF-8") + _prepare(@data) + cgi = CGI.new(:accept_charset=>"UTF-8") + assert_equal('file1.html', cgi['file1'].original_filename) + end + + def test_cgi_multipart_boundary_10240 # [Bug #3866] + @boundary = 'AaB03x' + @data = [ + {:name=>'file', :value=>"b"*10134, + :filename=>'file.txt', :content_type=>'text/plain'}, + {:name=>'foo', :value=>"bar"}, + ] + _prepare(@data) + cgi = CGI.new(:accept_charset=>"UTF-8") + assert_equal(cgi['foo'], 'bar') + assert_equal(cgi['file'].read, 'b'*10134) + cgi['file'].close! if cgi['file'].kind_of? Tempfile + end + + def test_cgi_multipart_without_tempfile + assert_in_out_err([], <<-'EOM') + require 'cgi' + require 'stringio' + ENV['REQUEST_METHOD'] = 'POST' + ENV['CONTENT_TYPE'] = 'multipart/form-data; boundary=foobar1234' + body = <<-BODY +--foobar1234 +Content-Disposition: form-data: name=\"name1\" + +value1 +--foobar1234 +Content-Disposition: form-data: name=\"file1\"; filename=\"file1.html\" +Content-Type: text/html + + +

Hello

+ + +--foobar1234-- +BODY + body.gsub!(/\n/, "\r\n") + ENV['CONTENT_LENGTH'] = body.size.to_s + $stdin = StringIO.new(body) + CGI.new + EOM + end + + ### + + self.instance_methods.each do |method| + private method if method =~ /^test_(.*)/ && $1 != ENV['TEST'] + end if ENV['TEST'] + +end diff --git a/jni/ruby/test/cgi/test_cgi_session.rb b/jni/ruby/test/cgi/test_cgi_session.rb new file mode 100644 index 0000000..8bd5177 --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_session.rb @@ -0,0 +1,172 @@ +require 'test/unit' +require 'cgi' +require 'cgi/session' +require 'cgi/session/pstore' +require 'stringio' +require 'tmpdir' + +class CGISessionTest < Test::Unit::TestCase + def setup + @session_dir = Dir.mktmpdir(%w'session dir') + end + + def teardown + @environ.each do |key, val| ENV.delete(key) end + $stdout = STDOUT + FileUtils.rm_rf(@session_dir) + end + + def test_cgi_session_filestore + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F', + # 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + value1="value1" + value2="\x8F\xBC\x8D]" + value2.force_encoding("SJIS") if defined?(::Encoding) + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir) + session["key1"]=value1 + session["key2"]=value2 + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + session.close + $stdout = StringIO.new + cgi.out{""} + + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'HTTP_COOKIE' => "_session_id=#{session_id}", + 'QUERY_STRING' => "_session_id=#{session.session_id}", + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir) + $stdout = StringIO.new + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + session.close + + end + def test_cgi_session_pstore + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F', + # 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + value1="value1" + value2="\x8F\xBC\x8D]" + value2.force_encoding("SJIS") if defined?(::Encoding) + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir,"database_manager"=>CGI::Session::PStore) + session["key1"]=value1 + session["key2"]=value2 + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + session.close + $stdout = StringIO.new + cgi.out{""} + + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'HTTP_COOKIE' => "_session_id=#{session_id}", + 'QUERY_STRING' => "_session_id=#{session.session_id}", + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir,"database_manager"=>CGI::Session::PStore) + $stdout = StringIO.new + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + session.close + end + def test_cgi_session_specify_session_id + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F', + # 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + value1="value1" + value2="\x8F\xBC\x8D]" + value2.force_encoding("SJIS") if defined?(::Encoding) + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir,"session_id"=>"foo") + session["key1"]=value1 + session["key2"]=value2 + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + assert_equal("foo",session.session_id) + #session_id=session.session_id + session.close + $stdout = StringIO.new + cgi.out{""} + + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'HTTP_COOKIE' => "_session_id=#{session_id}", + 'QUERY_STRING' => "_session_id=#{session.session_id}", + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir) + $stdout = StringIO.new + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + assert_equal("foo",session.session_id) + session.close + end + def test_cgi_session_specify_session_key + @environ = { + 'REQUEST_METHOD' => 'GET', + # 'QUERY_STRING' => 'id=123&id=456&id=&str=%40h+%3D%7E+%2F%5E%24%2F', + # 'HTTP_COOKIE' => '_session_id=12345; name1=val1&val2;', + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + value1="value1" + value2="\x8F\xBC\x8D]" + value2.force_encoding("SJIS") if defined?(::Encoding) + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir,"session_key"=>"bar") + session["key1"]=value1 + session["key2"]=value2 + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + session_id=session.session_id + session.close + $stdout = StringIO.new + cgi.out{""} + + @environ = { + 'REQUEST_METHOD' => 'GET', + 'HTTP_COOKIE' => "bar=#{session_id}", + # 'QUERY_STRING' => "bar=#{session.session_id}", + 'SERVER_SOFTWARE' => 'Apache 2.2.0', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + } + ENV.update(@environ) + cgi = CGI.new + session = CGI::Session.new(cgi,"tmpdir"=>@session_dir,"session_key"=>"bar") + $stdout = StringIO.new + assert_equal(value1,session["key1"]) + assert_equal(value2,session["key2"]) + session.close + end +end diff --git a/jni/ruby/test/cgi/test_cgi_tag_helper.rb b/jni/ruby/test/cgi/test_cgi_tag_helper.rb new file mode 100644 index 0000000..eb3c20a --- /dev/null +++ b/jni/ruby/test/cgi/test_cgi_tag_helper.rb @@ -0,0 +1,353 @@ +require 'test/unit' +require 'cgi' +require 'stringio' + + +class CGITagHelperTest < Test::Unit::TestCase + + + def setup + #@environ = { + # 'SERVER_PROTOCOL' => 'HTTP/1.1', + # 'REQUEST_METHOD' => 'GET', + # 'SERVER_SOFTWARE' => 'Apache 2.2.0', + #} + #ENV.update(@environ) + end + + + def teardown + @environ.each do |key, val| ENV.delete(key) end + $stdout = STDOUT + end + + + def test_cgi_tag_helper_html3 + @environ = { + 'REQUEST_METHOD' => 'GET', + } + ENV.update(@environ) + ## html3 + cgi = CGI.new('html3') + assert_equal('
',cgi.a) + assert_equal('',cgi.a('bar')) + assert_equal('foo',cgi.a{'foo'}) + assert_equal('foo',cgi.a('bar'){'foo'}) + assert_equal('',cgi.tt) + assert_equal('',cgi.tt('bar')) + assert_equal('foo',cgi.tt{'foo'}) + assert_equal('foo',cgi.tt('bar'){'foo'}) + assert_equal('',cgi.i) + assert_equal('',cgi.i('bar')) + assert_equal('foo',cgi.i{'foo'}) + assert_equal('foo',cgi.i('bar'){'foo'}) + assert_equal('',cgi.b) + assert_equal('',cgi.b('bar')) + assert_equal('foo',cgi.b{'foo'}) + assert_equal('foo',cgi.b('bar'){'foo'}) + assert_equal('',cgi.u) + assert_equal('',cgi.u('bar')) + assert_equal('foo',cgi.u{'foo'}) + assert_equal('foo',cgi.u('bar'){'foo'}) + assert_equal('',cgi.strike) + assert_equal('',cgi.strike('bar')) + assert_equal('foo',cgi.strike{'foo'}) + assert_equal('foo',cgi.strike('bar'){'foo'}) + assert_equal('',cgi.big) + assert_equal('',cgi.big('bar')) + assert_equal('foo',cgi.big{'foo'}) + assert_equal('foo',cgi.big('bar'){'foo'}) + assert_equal('',cgi.small) + assert_equal('',cgi.small('bar')) + assert_equal('foo',cgi.small{'foo'}) + assert_equal('foo',cgi.small('bar'){'foo'}) + assert_equal('',cgi.sub) + assert_equal('',cgi.sub('bar')) + assert_equal('foo',cgi.sub{'foo'}) + assert_equal('foo',cgi.sub('bar'){'foo'}) + assert_equal('',cgi.sup) + assert_equal('',cgi.sup('bar')) + assert_equal('foo',cgi.sup{'foo'}) + assert_equal('foo',cgi.sup('bar'){'foo'}) + assert_equal('',cgi.em) + assert_equal('',cgi.em('bar')) + assert_equal('foo',cgi.em{'foo'}) + assert_equal('foo',cgi.em('bar'){'foo'}) + assert_equal('',cgi.strong) + assert_equal('',cgi.strong('bar')) + assert_equal('foo',cgi.strong{'foo'}) + assert_equal('foo',cgi.strong('bar'){'foo'}) + assert_equal('',cgi.dfn) + assert_equal('',cgi.dfn('bar')) + assert_equal('foo',cgi.dfn{'foo'}) + assert_equal('foo',cgi.dfn('bar'){'foo'}) + assert_equal('',cgi.code) + assert_equal('',cgi.code('bar')) + assert_equal('foo',cgi.code{'foo'}) + assert_equal('foo',cgi.code('bar'){'foo'}) + assert_equal('',cgi.samp) + assert_equal('',cgi.samp('bar')) + assert_equal('foo',cgi.samp{'foo'}) + assert_equal('foo',cgi.samp('bar'){'foo'}) + assert_equal('',cgi.kbd) + assert_equal('',cgi.kbd('bar')) + assert_equal('foo',cgi.kbd{'foo'}) + assert_equal('foo',cgi.kbd('bar'){'foo'}) + assert_equal('',cgi.var) + assert_equal('',cgi.var('bar')) + assert_equal('foo',cgi.var{'foo'}) + assert_equal('foo',cgi.var('bar'){'foo'}) + assert_equal('',cgi.cite) + assert_equal('',cgi.cite('bar')) + assert_equal('foo',cgi.cite{'foo'}) + assert_equal('foo',cgi.cite('bar'){'foo'}) + assert_equal('',cgi.font) + assert_equal('',cgi.font('bar')) + assert_equal('foo',cgi.font{'foo'}) + assert_equal('foo',cgi.font('bar'){'foo'}) + assert_equal('
',cgi.address) + assert_equal('
',cgi.address('bar')) + assert_equal('
foo
',cgi.address{'foo'}) + assert_equal('
foo
',cgi.address('bar'){'foo'}) + assert_equal('
',cgi.div) + assert_equal('
',cgi.div('bar')) + assert_equal('
foo
',cgi.div{'foo'}) + assert_equal('
foo
',cgi.div('bar'){'foo'}) + assert_equal('
',cgi.center) + assert_equal('
',cgi.center('bar')) + assert_equal('
foo
',cgi.center{'foo'}) + assert_equal('
foo
',cgi.center('bar'){'foo'}) + assert_equal('',cgi.map) + assert_equal('',cgi.map('bar')) + assert_equal('foo',cgi.map{'foo'}) + assert_equal('foo',cgi.map('bar'){'foo'}) + assert_equal('',cgi.applet) + assert_equal('',cgi.applet('bar')) + assert_equal('foo',cgi.applet{'foo'}) + assert_equal('foo',cgi.applet('bar'){'foo'}) + assert_equal('
',cgi.pre)
+    assert_equal('
',cgi.pre('bar'))
+    assert_equal('
foo
',cgi.pre{'foo'}) + assert_equal('
foo
',cgi.pre('bar'){'foo'}) + assert_equal('',cgi.xmp) + assert_equal('',cgi.xmp('bar')) + assert_equal('foo',cgi.xmp{'foo'}) + assert_equal('foo',cgi.xmp('bar'){'foo'}) + assert_equal('',cgi.listing) + assert_equal('',cgi.listing('bar')) + assert_equal('foo',cgi.listing{'foo'}) + assert_equal('foo',cgi.listing('bar'){'foo'}) + assert_equal('
',cgi.dl) + assert_equal('
',cgi.dl('bar')) + assert_equal('
foo
',cgi.dl{'foo'}) + assert_equal('
foo
',cgi.dl('bar'){'foo'}) + assert_equal('
    ',cgi.ol) + assert_equal('
      ',cgi.ol('bar')) + assert_equal('
        foo
      ',cgi.ol{'foo'}) + assert_equal('
        foo
      ',cgi.ol('bar'){'foo'}) + assert_equal('
        ',cgi.ul) + assert_equal('
          ',cgi.ul('bar')) + assert_equal('
            foo
          ',cgi.ul{'foo'}) + assert_equal('
            foo
          ',cgi.ul('bar'){'foo'}) + assert_equal('',cgi.dir) + assert_equal('',cgi.dir('bar')) + assert_equal('foo',cgi.dir{'foo'}) + assert_equal('foo',cgi.dir('bar'){'foo'}) + assert_equal('',cgi.menu) + assert_equal('',cgi.menu('bar')) + assert_equal('foo',cgi.menu{'foo'}) + assert_equal('foo',cgi.menu('bar'){'foo'}) + assert_equal('',cgi.select) + assert_equal('',cgi.select('bar')) + assert_equal('',cgi.select{'foo'}) + assert_equal('',cgi.select('bar'){'foo'}) + assert_equal('
          ',cgi.table) + assert_equal('
          ',cgi.table('bar')) + assert_equal('foo
          ',cgi.table{'foo'}) + assert_equal('foo
          ',cgi.table('bar'){'foo'}) + assert_equal('',cgi.title) + assert_equal('',cgi.title('bar')) + assert_equal('foo',cgi.title{'foo'}) + assert_equal('foo',cgi.title('bar'){'foo'}) + assert_equal('',cgi.style) + assert_equal('',cgi.style('bar')) + assert_equal('',cgi.style{'foo'}) + assert_equal('',cgi.style('bar'){'foo'}) + assert_equal('',cgi.script) + assert_equal('',cgi.script('bar')) + assert_equal('',cgi.script{'foo'}) + assert_equal('',cgi.script('bar'){'foo'}) + assert_equal('

          ',cgi.h1) + assert_equal('

          ',cgi.h1('bar')) + assert_equal('

          foo

          ',cgi.h1{'foo'}) + assert_equal('

          foo

          ',cgi.h1('bar'){'foo'}) + assert_equal('

          ',cgi.h2) + assert_equal('

          ',cgi.h2('bar')) + assert_equal('

          foo

          ',cgi.h2{'foo'}) + assert_equal('

          foo

          ',cgi.h2('bar'){'foo'}) + assert_equal('

          ',cgi.h3) + assert_equal('

          ',cgi.h3('bar')) + assert_equal('

          foo

          ',cgi.h3{'foo'}) + assert_equal('

          foo

          ',cgi.h3('bar'){'foo'}) + assert_equal('

          ',cgi.h4) + assert_equal('

          ',cgi.h4('bar')) + assert_equal('

          foo

          ',cgi.h4{'foo'}) + assert_equal('

          foo

          ',cgi.h4('bar'){'foo'}) + assert_equal('
          ',cgi.h5) + assert_equal('
          ',cgi.h5('bar')) + assert_equal('
          foo
          ',cgi.h5{'foo'}) + assert_equal('
          foo
          ',cgi.h5('bar'){'foo'}) + assert_equal('
          ',cgi.h6) + assert_equal('
          ',cgi.h6('bar')) + assert_equal('
          foo
          ',cgi.h6{'foo'}) + assert_equal('
          foo
          ',cgi.h6('bar'){'foo'}) + assert_match(/^