mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/prime.rb (Prime#prime?): negative numbers can't be primes
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
This commit is contained in:
parent
16b8aadc75
commit
bef8e4557c
3 changed files with 8 additions and 3 deletions
|
@ -141,8 +141,8 @@ class TestPrime < Test::Unit::TestCase
|
|||
|
||||
# negative
|
||||
assert !-1.prime?
|
||||
assert(-2.prime?)
|
||||
assert(-3.prime?)
|
||||
assert !-2.prime?
|
||||
assert !-3.prime?
|
||||
assert !-4.prime?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue