MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestUint256

Function TestUint256

pow/cpuminer/uint256_test.go:29–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func TestUint256(t *testing.T) {
30 Convey("uint256 len", t, func() {
31 i := Uint256{}
32 So(unsafe.Sizeof(Uint256{}), ShouldEqual, 32)
33 So(len(i.Bytes()), ShouldEqual, 32)
34 })
35 Convey("convert", t, func() {
36 i := Uint256{math.MaxUint64, 3, 444, 1230}
37 log.Print(i.Bytes())
38 j, err := Uint256FromBytes(i.Bytes())
39
40 So(err, ShouldBeNil)
41 So(j.A == math.MaxUint64, ShouldBeTrue)
42 So(j.B, ShouldEqual, 3)
43 So(j.C, ShouldEqual, 444)
44 So(j.D, ShouldEqual, 1230)
45 })
46 Convey("convert error", t, func() {
47 i, err := Uint256FromBytes([]byte("aaa"))
48 So(err, ShouldEqual, ErrBytesLen)
49 So(i, ShouldBeNil)
50 })
51}
52
53func TestUint256_Inc(t *testing.T) {
54 Convey("uint256 inc", t, func() {

Callers

nothing calls this directly

Calls 3

BytesMethod · 0.95
PrintFunction · 0.92
Uint256FromBytesFunction · 0.85

Tested by

no test coverage detected