Commit graph

3565 commits

Author SHA1 Message Date
Dave Collins
5b78dee7e1 Add negative tests for MsgTx.
This commit adds tests for the error paths when encoding and decoding
MsgTx.  This commit also achieves 100% test coverage.
2013-05-13 02:09:55 -05:00
Dave Collins
6f511eb75d Make MsgTx test data available to all funcs.
Rather than having to repeat the same data for positive and negative
tests, make the same test data available to both.
2013-05-13 02:08:14 -05:00
Dave Collins
f9b6375d5b Add negative tests for MsgVersion.
This commit adds tests for the error paths when encoding and decoding
MsgVersion.
2013-05-12 21:47:36 -05:00
Dave Collins
3aef93f442 Make MsgVersion test data available to all funcs.
Rather than having to repeat the same data for positive and negative
tests, make the same test data available to both.
2013-05-12 21:01:40 -05:00
Dave Collins
1bab947596 Remove a few dead error checks.
The functions for generating transaction and block hashes contained a few
error checks for conditions which could never fail without run-time
panics.  This commit removes those superfluous checks and adds explanatory
comments.
2013-05-12 14:01:50 -05:00
Dave Collins
1ca8015ea0 Add negative tests for MsgBlock tx location decode.
This commit adds tests for the error paths when decoding MsgBlock via the
transaction location decode variant.
2013-05-12 12:48:52 -05:00
Dave Collins
0e033023bf Improve MsgBlock negative tests.
Rather than decoding from a zero-filled buffer, use valid block encoded
test data.
2013-05-12 12:43:01 -05:00
Dave Collins
4e16030fe8 Add tests for MsgBlock transaction location decode. 2013-05-12 11:52:35 -05:00
Dave Collins
c9d2dfea3d Add negative tests for WriteMessage.
This commit adds tests for the error paths when writing a message
to the wire.
2013-05-11 23:34:10 -05:00
Dave Collins
0400d0cec3 Remove dead error check in WriteMessage.
The io.Writer.Write function always returns an error if the bytes written
is less than provided, so there is no reason to further check if the
payload length matches after a successful write.
2013-05-11 23:22:09 -05:00
Dave Collins
7385f6ff24 Correct several test error messages. 2013-05-11 12:55:50 -05:00
Dave Collins
93070ef960 Add negative tests for MsgAlert.
This commit adds tests for the error paths when encoding and decoding
MsgAlert.
2013-05-11 12:49:22 -05:00
Dave Collins
3d303feefb Add negative test for NewShaHash.
This commit adds a test to ensure NewShaHash fails as expected when the
passed buffer has too many bytes to be a valid sha hash.
2013-05-11 11:19:46 -05:00
Dave Collins
61b86b1bb5 Add negative tests for MsgGetBlocks.
This commit adds tests for the error paths when encoded and decoding
MsgGetBlocks.
2013-05-11 11:06:52 -05:00
Dave Collins
2a2745d0d3 Add negative tests for MsgGetHeaders.
This commit adds tests for the error paths when encoded and decoding
MsgHeaders.   Also, while here modify the casing of the local vars to be
consistent.
2013-05-11 10:52:22 -05:00
Dave Collins
20bebc13a5 Convert WriteMessage errors to MessgeError type. 2013-05-11 02:29:29 -05:00
Dave Collins
cbcbe5eb43 Convert MsgVersion errors to MessageError type. 2013-05-11 02:23:45 -05:00
Dave Collins
f6cdbd430e Convert MsgMemPool errors to MessageError type. 2013-05-11 02:18:03 -05:00
Dave Collins
bd1dcf8a0c Convert MsgGetBlocks errors to MessageError type. 2013-05-11 02:15:50 -05:00
Dave Collins
9bd97a5972 Convert MsgGetHeaders errors to MessageError type. 2013-05-10 23:58:10 -05:00
Dave Collins
95aa4a7da8 Add negative tests for MsgHeaders.
This commit adds tests for the error paths when encoded and decoding
MsgHeaders.
2013-05-10 23:12:55 -05:00
Dave Collins
40a9a90e4b Convert MsgHeaders errors to MessageError type. 2013-05-10 23:10:59 -05:00
Dave Collins
88e1d7634f Add negative tests for MsgPong.
This commit adds tests for the error paths when encoded and decoding
MsgPong.
2013-05-10 21:46:41 -05:00
Dave Collins
cbb28edb30 Convert MsgPong errors to MessageError type. 2013-05-10 21:31:56 -05:00
Dave Collins
1220e72f35 Add negative tests for MsgAddr.
This commit adds tests for the error paths when encoded and decoding
MsgAddr.
2013-05-10 18:09:10 -05:00
Dave Collins
cfb17f7da4 Update gocov path in comments to correct path. 2013-05-10 15:58:05 -05:00
Dave Collins
e699ca0bef Cleanup a few comments. 2013-05-10 15:40:09 -05:00
Dave Collins
d5f4e5e989 Initial commit. 2013-05-10 15:06:18 -05:00
Dave Collins
1f72b40823 Convert MsgAddr errors to MessageError type. 2013-05-10 14:54:36 -05:00
Dave Collins
72348986c9 Correct func prefix in GetData error message. 2013-05-10 13:37:55 -05:00
Dave Collins
2665b4358e Add negative tests for MsgGetData.
This commit adds tests for the error paths when encoded and decoding
MsgGetData.
2013-05-10 13:14:19 -05:00
Dave Collins
7c3129bf89 Convert MsgGetData errors to MessageError type. 2013-05-10 13:04:20 -05:00
Dave Collins
0c65e7da89 Add negative tests for MsgNotFound.
This commit adds tests for the error paths when encoded and decoding
MsgNotFound.
2013-05-10 12:51:45 -05:00
Dave Collins
9b798b6306 Convert MsgNotFound errors to MessageError type. 2013-05-10 11:32:20 -05:00
Dave Collins
e41a3bcaf3 Correct a couple of func prefixes in err messages. 2013-05-10 11:31:06 -05:00
Dave Collins
d33fdb2c3c Add additional doco on how btcwire relates to btcd. 2013-05-10 11:04:30 -05:00
Dave Collins
29cd3a7246 Fix comment typo in test coverage report script. 2013-05-10 10:31:39 -05:00
Dave Collins
72fa9f4b7b Update test coverage report. 2013-05-10 10:18:34 -05:00
Dave Collins
59d64ee076 Add negative tests for MsgInv.
This commit adds tests for the error paths when encoded and decoding
MsgInv.
2013-05-10 10:14:13 -05:00
Dave Collins
036f14ff49 Convert MsgInv errors to new MessageError type. 2013-05-10 10:12:45 -05:00
Dave Collins
953a236e2a Add negative tests for MsgBlock.
This commit adds tests for the error paths when encoded and decoding
MsgBlock.
2013-05-10 09:12:46 -05:00
Dave Collins
862374115f Bump the protocol version to 70001.
As documented in the package overview, this package does not yet support
BIP0037 which was the reason for this bump.
2013-05-10 00:54:56 -05:00
Dave Collins
e026f50486 Improve MsgGetBlocks tests.
This commit corrects the MsgGetBlocks tests so that the protocol version
in the multiLocators data matches the wire encoded test data.  This will
help future proof the tests against protocol changes.  Also, while here
modify the casing of the local vars to be consistent.
2013-05-10 00:44:55 -05:00
Dave Collins
135552cd72 Improve MsgBlock tests.
This commit corrects the tests so that the main API functions are tested
against the latest protocol version, but the TxSha and BlockSha functions
are run against the specific protocol version used to encode the test
data.  This will help future proof the tests against protocol changes.
2013-05-09 23:47:12 -05:00
Dave Collins
4aea957b19 Add negative tests for NetAddress.
This commit adds tests for the error paths when encoding and
decoding NetAddress with and without the timestamp field.
2013-05-09 23:01:09 -05:00
Dave Collins
2aee754448 Add test for discarding invalid large messages. 2013-05-09 22:25:21 -05:00
Dave Collins
f182e4f323 Correct error output colon string placement. 2013-05-09 21:25:19 -05:00
Dave Collins
e7abb08b6b Fix a comment typo. 2013-05-09 21:24:47 -05:00
Dave Collins
149d77ad3f Add negative tests for ReadMessage.
This commit adds tests for the error paths when reading the initial
message header and message payload from the wire.
2013-05-09 21:23:06 -05:00
Dave Collins
aa4086a1b1 Update test coverage report. 2013-05-09 21:13:37 -05:00