-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathblock_hash.json
More file actions
165 lines (165 loc) · 3.87 KB
/
Copy pathblock_hash.json
File metadata and controls
165 lines (165 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
{
"title": "Block Hash Operations",
"description": "Covers block hash object creation from valid and invalid bytes, byte serialization, equality checks, copying, and cleanup",
"stateful": true,
"tests": [
{
"description": "Creates a block hash from 32 raw bytes",
"request": {
"id": "block_hash#1",
"method": "btck_block_hash_create",
"params": {
"block_hash": "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000"
},
"ref": "$hash1"
},
"expected_response": {
"result": {
"ref": "$hash1"
}
}
},
{
"description": "Verifies block hash serialization round-trips to the original bytes",
"request": {
"id": "block_hash#2",
"method": "btck_block_hash_to_bytes",
"params": {
"block_hash": {
"ref": "$hash1"
}
}
},
"expected_response": {
"result": "6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000"
}
},
{
"description": "Verifies a block hash equals itself",
"request": {
"id": "block_hash#3",
"method": "btck_block_hash_equals",
"params": {
"hash1": {
"ref": "$hash1"
},
"hash2": {
"ref": "$hash1"
}
}
},
"expected_response": {
"result": true
}
},
{
"description": "Creates a block hash from all-zero bytes",
"request": {
"id": "block_hash#4",
"method": "btck_block_hash_create",
"params": {
"block_hash": "0000000000000000000000000000000000000000000000000000000000000000"
},
"ref": "$hash2"
},
"expected_response": {
"result": {
"ref": "$hash2"
}
}
},
{
"description": "Verifies different block hashes are not equal",
"request": {
"id": "block_hash#5",
"method": "btck_block_hash_equals",
"params": {
"hash1": {
"ref": "$hash1"
},
"hash2": {
"ref": "$hash2"
}
}
},
"expected_response": {
"result": false
}
},
{
"description": "Destroys the all-zero block hash",
"request": {
"id": "block_hash#6",
"method": "btck_block_hash_destroy",
"params": {
"block_hash": {
"ref": "$hash2"
}
}
},
"expected_response": {}
},
{
"description": "Copies the first block hash",
"request": {
"id": "block_hash#7",
"method": "btck_block_hash_copy",
"params": {
"block_hash": {
"ref": "$hash1"
}
},
"ref": "$hash1_copy"
},
"expected_response": {
"result": {
"ref": "$hash1_copy"
}
}
},
{
"description": "Verifies the copied block hash equals the original",
"request": {
"id": "block_hash#8",
"method": "btck_block_hash_equals",
"params": {
"hash1": {
"ref": "$hash1_copy"
},
"hash2": {
"ref": "$hash1"
}
}
},
"expected_response": {
"result": true
}
},
{
"description": "Destroys the copied block hash",
"request": {
"id": "block_hash#9",
"method": "btck_block_hash_destroy",
"params": {
"block_hash": {
"ref": "$hash1_copy"
}
}
},
"expected_response": {}
},
{
"description": "Destroys the original block hash",
"request": {
"id": "block_hash#10",
"method": "btck_block_hash_destroy",
"params": {
"block_hash": {
"ref": "$hash1"
}
}
},
"expected_response": {}
}
]
}