Граф коммитов

8 Коммитов

Автор SHA1 Сообщение Дата
nobu b16fc57852 * test/syck/test_string.rb (Syck::TestString#test_non_binary_string):
use assert_not instead of refute, unless required minitest
 directly.
* test/test_prime.rb (TestPrime::sieve.Integer): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-13 00:56:44 +00:00
yugui a33353f880 * test/test_prime.rb (TestPrime#test_new): the warning expected have
not been displayed when $VERBOSE == nil. Patch by Shota Fukumori
  a.k.a. sora_h. [ruby-dev:42272]
  Recovers $stderr even if StringIO.new fails. Reported by unak.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-22 08:03:55 +00:00
akr 37679ee584 supress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-25 23:12:50 +00:00
yugui c0b42eedea * test/test_prime.rb
(TestPrime#test_eratosthenes_works_fine_after_timeout):
  test for [ruby-dev:39465].

* lib/prime.rb (Prime::EratosthenesSieve):
  fixed [ruby-dev:39465].
  suppressed memory reallocation.
  constantified some magic numbers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-18 00:55:34 +00:00
yugui 7287b852da * lib/prime.rb (Prime#prime_division): now decomposes
negative integer into a decomposition with element [-1, 1].

* test/test_prime.rb: test for it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-13 13:51:49 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
yugui 294f45b0fc * lib/prime.rb (Prime::prime?): used to return a wrong answer.
[ruby-core:22646].

* test/test_prime.rb (test_prime?): test case for [ruby-core:22646].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-03 15:57:15 +00:00
yugui fce093432e * lib/mathn.rb (Integer): moved into prime.rb.
(Prime): ditto.

* lib/prime.rb (Integer): moved from mathn.rb.
  (Integer.each_prime): added.
  (Integer#prime?): added.
  (Prime): moved from mathn.rb.
    Its implmentation was rewritten. see [ruby-dev:35863].
    And patched by Keiju ISHITSUKA <keiju@ishitsuka.com>,
    see [ruby-dev:36128].
  (Prime.new):                     obsolete.
  (Prime.instance):                added.
  (Prime.each):                    added.
  (Prime.int_from_prime_division): added.
  (Prime.prime_division):          added.
  (Prime.prime?):                  added.
    Patch by TOYOFUKU Chikanobu
    <nobu_toyofuku at nifty.com> in [ruby-dev:36067].
  (Prime.cache):                   removed.
  (Prime.primes):                  removed.
  (Prime.primes_so_far):           removed.
  (Prime#int_from_prime_division): added.
  (Prime#prime_division):          added.
  (Prime#prime?):                  added.
  (Prime#primes):                  removed.
  (Prime#primes_so_far):           removed.
  (Prime::PseudoPrmeGenerator):    added.
  (Prime::EratosthenesGenerator):  added.
  (Prime::TrialDivisionGenerator): added.
  (Prime::Generator23):            added.
  (Prime::TrialDivision):          added.
    Extracted from the previous implementation of Prime
    by Keiju ISHITSUKA.
  (Prime::EratosthenesSieve):      added.

* lib/.document (prime.rb): added

* lib/README (prime.rb): added

* test/test_prime.rb: added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-03 13:57:21 +00:00