Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Jim Hyslop on March 08, 2011, 04:28:53 AM



Title: Unit tests?
Post by: Jim Hyslop on March 08, 2011, 04:28:53 AM
Hi,

Are there any unit tests, or testbeds of any kind, for Bitcoin?


Title: Re: Unit tests?
Post by: error on March 08, 2011, 04:37:18 AM
I don't know about unit tests, but there's a whole test network. Run the official client with -testnet option to use it.


Title: Re: Unit tests?
Post by: Steve on March 08, 2011, 09:55:06 PM
Hi,

Are there any unit tests, or testbeds of any kind, for Bitcoin?

Not that I've found.  I'm in the process of refactoring the code (one h/cpp per class, etc).  I also grabbed googletest and plan to add a few unit tests to get the ball rolling.  The refactoring part might be a hinderance to adoption in the master branch (due to the large amount of change), but I do plan to keep it updated with the master.


Title: Re: Unit tests?
Post by: Jim Hyslop on March 09, 2011, 02:17:22 AM
Not that I've found.  I'm in the process of refactoring the code (one h/cpp per class, etc).  I also grabbed googletest and plan to add a few unit tests to get the ball rolling.  The refactoring part might be a hinderance to adoption in the master branch (due to the large amount of change), but I do plan to keep it updated with the master.
I haven't used googletest. How does it compare to cppunit?

I've been thinking about splitting out the files, too. No functional changes, just moving things around. I think that might help its adoption into the main trunk.



Title: Re: Unit tests?
Post by: Gavin Andresen on March 09, 2011, 02:20:53 AM
I've been thinking about splitting out the files, too. No functional changes, just moving things around. I think that might help its adoption into the main trunk.

Somebody did that a few months ago (theres a message here in the forums SOMEWHERE...)

If I recall correctly, after he was done he found that it wouldn't compile on Windows any more.



Title: Re: Unit tests?
Post by: Jim Hyslop on March 09, 2011, 03:05:44 AM
Somebody did that a few months ago (theres a message here in the forums SOMEWHERE...)

If I recall correctly, after he was done he found that it wouldn't compile on Windows any more.
Not encouraging :=( Can you recall any keywords that might help me find it?

Steve, what platform are you compiling on?


Title: Re: Unit tests?
Post by: Stephen Gornick on March 09, 2011, 06:01:18 AM
I've been thinking about splitting out the files, too. No functional changes, just moving things around.

Somebody did that a few months ago (theres a message here in the forums SOMEWHERE...)

This?
  http://bitcointalk.org/index.php?topic=2244.0


Title: Re: Unit tests?
Post by: Steve on March 09, 2011, 08:52:46 PM
Somebody did that a few months ago (theres a message here in the forums SOMEWHERE...)

If I recall correctly, after he was done he found that it wouldn't compile on Windows any more.
Not encouraging :=( Can you recall any keywords that might help me find it?

Steve, what platform are you compiling on?

Mac OSX 10.6.6.


Title: Re: Unit tests?
Post by: Steve on March 09, 2011, 09:05:49 PM
I took a look at that other refactoring effort.  In light of that, I think I may be better off not worrying about master branch adoption and just carry on ...adopting changes from the master branch as they happen.  The thought of trying to get things compiling on MSVC++ isn't very appealing to me.  I want to split up the ui, miner, peer and wallet and enhance what the wallet can do (automated encryption and backups, etc).  I also have some ideas about the UI to make it better for novices (and working with the native ObjC/Xcode will facilitate that).  I also would like each of these components to be able to be statically or dynamically linked via well defined, C based APIs.  And, I'd like them to each have standalone versions with google protocol buffers for communications.  Lot's of ideas, but need to focus on one or two for now.