aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_prime.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb: Add basic argument checking to Prime.prime?marcandre2015-10-201-0/+5
| | | | | | [Bug #11606] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test: refine assertionsnobu2015-06-251-3/+1
| | | | | | | | | | | | | * test/test_prime.rb (test_eratosthenes_works_fine_after_timeout): use assert_raise to check timeout. * test/test_securerandom.rb: check if results are hexadecimal strings, and refine failure messages. * test/test_tracer.rb (test_tracer_with_option_r_without_gems): use assert_equal to compare. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51023 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_prime.rb: cosmetic changesnobu2015-06-251-2/+2
| | | | | | | * test/test_prime.rb (test_eratosthenes_works_fine_after_timeout): use spaces instead of TABs in ruby codes. [Fix GH-944] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_prime.rb: descriptive assertionsnobu2015-06-141-32/+32
| | | | | | | * test/test_prime.rb: use more descriptive assertions for better failure meessages, instead of simple assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb: Return sized enumerators.marcandre2015-06-121-0/+7
| | | | | | Patch by Kenichi Kamiya [GH-931] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb: Fix with_object with no block givenmarcandre2015-06-121-0/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb: Have with_index accept an offset parameter.marcandre2015-06-121-0/+11
| | | | | | Based on patch by T Yamada. [#11007] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use assert_raisenobu2015-06-021-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb: Remove obsolete Prime.newmarcandre2015-05-221-14/+8
| | | | | | patch by Ajay Kumar. [Fixes GH-891] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb (Prime#prime?): negative numbers can't be primesayumin2014-05-081-2/+2
| | | | | | | by definition. reported by Ivan Kataitsev. [Bug #7395] * test/test_prime.rb: add test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45878 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb (Prime::EratosthenesGenerator,yugui2013-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prime::EratosthenesSieve): New implementation by robertjlooby <robertjlooby AT gmail.com>. * test/test_prime.rb: updated with new method name commit 4b6090ea852d63b26e02796c69b41caa0fa95077 Merge: ceda881 c8f7809 Author: Yuki Sonoda (Yugui) <yugui@yugui.jp> Date: Mon Jul 15 12:50:04 2013 +0900 Merge commit 'c8f780987fbdfbae428977487e1cf793c4c36d3f' Conflicts: lib/prime.rb commit c8f780987fbdfbae428977487e1cf793c4c36d3f Author: robertjlooby <robertjlooby@gmail.com> Date: Thu Jun 27 23:04:45 2013 -0500 updated test/test_prime.rb with new method name commit 996517bdbb3108cd1687d99613b69e539eb1567b Author: robertjlooby <robertjlooby@gmail.com> Date: Thu Jun 27 22:59:39 2013 -0500 new implementation of Prime::EratosthenesGenerator and Prime::EratosthenesSieve git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/syck/test_string.rb (Syck::TestString#test_non_binary_string):nobu2011-02-131-1/+1
| | | | | | | | 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
* * test/test_prime.rb (TestPrime#test_new): the warning expected haveyugui2010-09-221-5/+7
| | | | | | | | 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
* supress warnings.akr2010-01-251-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/test_prime.rbyugui2009-10-181-0/+26
| | | | | | | | | | | | (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
* * lib/prime.rb (Prime#prime_division): now decomposesyugui2009-07-131-0/+5
| | | | | | | | 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
* * {ext,lib,test}/**/*.rb: removed trailing spaces.nobu2009-03-061-10/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/prime.rb (Prime::prime?): used to return a wrong answer.yugui2009-03-031-0/+15
| | | | | | | | [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
* * lib/mathn.rb (Integer): moved into prime.rb.yugui2008-09-031-0/+126
(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