spec/bitcoin/key_spec.rb in bitcoin-ruby-0.0.11 vs spec/bitcoin/key_spec.rb in bitcoin-ruby-0.0.12

- old
+ new

@@ -250,9 +250,16 @@ k = Bitcoin::Key.from_warp("FPdAxCygMJg", "X+qaSwhUYXw") k.addr.should == "14Pqeo9XNRxjtKFFYd6TvRrJuZxVpciS81" k.to_base58.should == "5JBAonQ4iGKFJxENExZghDtAS6YB8BsCw5mwpHSvZvP3Q2UxmT1" end + it "should raise error for private key out of range." do + proc{Bitcoin::Key.new('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141')}.should.raise(Exception) + proc{Bitcoin::Key.new('00')}.should.raise(Exception) + proc{Bitcoin::Key.new('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140')}.should.not.raise(Exception) + proc{Bitcoin::Key.new('01')}.should.not.raise(Exception) + end + end begin describe "Bitcoin::OpenSSL_EC" do Bitcoin::OpenSSL_EC