(t *testing.T)
| 80 | } |
| 81 | |
| 82 | func TestGetNextVerifier(t *testing.T) { |
| 83 | verifier, err := getNextVerifier(previousBlock, currentBlock) |
| 84 | if err != nil { |
| 85 | t.Error(err) |
| 86 | } |
| 87 | wantedVerifier := int32(hash.FNVHash32uint([]byte(previousBlock.ID))) % int32(len(currentBlock.Nodes)) |
| 88 | if verifier != wantedVerifier { |
| 89 | t.Errorf("the next verifier is %d, should be %d", verifier, wantedVerifier) |
| 90 | } |
| 91 | |
| 92 | // void previousBlock |
| 93 | verifier, err = getNextVerifier(voidBlock, currentBlock) |
| 94 | if err == nil { |
| 95 | t.Errorf("verifier is %d, but should be failed", verifier) |
| 96 | } |
| 97 | |
| 98 | // void currentBlock |
| 99 | verifier, err = getNextVerifier(previousBlock, voidBlock) |
| 100 | if err == nil { |
| 101 | t.Errorf("verifier is %d, but should be failed", verifier) |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | func TestSelectRecord(t *testing.T) { |
| 106 | if strings.Compare(selectRecord(0), "hello world") != 0 { |
nothing calls this directly
no test coverage detected