-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnode_test.go
46 lines (39 loc) · 836 Bytes
/
node_test.go
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
package main
import (
"testing"
)
var node Node
func init() {
node = Node{
Protocol: "http://",
Hostname: "localhost",
Port: 8001,
Name: "node_x",
}
node.createWallet()
}
func TestCreateNodeWallet(t *testing.T) {
if !hasValidHash(node) {
t.Error("Node has no hash of wallet.")
}
}
func TestGetNodeHash(t *testing.T) {
if node.Hash != node.getHash() {
t.Errorf("Incorrect node Hash: Expected %s, got %s.", node.Hash, node.getHash())
}
}
func TestGetNodeAddress(t *testing.T) {
if node.getAddress() != "http://localhost:8001" {
t.Errorf("Incorrect node address: Expected http://localhost:8001, got %s.", node.getAddress())
}
}
func TestGreet(t *testing.T) {
me = Node{
Protocol: "http://",
Hostname: "localhost",
Port: 8000,
Name: "this is me",
}
me.createWallet()
greet(node)
}