Commit b2ab78b2 authored by David Vorick's avatar David Vorick

add tests for toggle mining

parent 71d96edb
......@@ -14,3 +14,11 @@ test-long: install
pdflatex whitepaper.tex
go install -race std
dependencies: race-libs
go get -u
.PHONY: all fmt install test test-long whitepaper dependencies race-libs
package siad
import (
func TestToggleMining(t *testing.T) {
if testing.Short() {
state := siacore.CreateGenesisState()
miner := CreateMiner()
if state.Height() != 0 {
t.Error("unexpected genesis height:", state.Height())
miner.ToggleMining(state, siacore.CoinAddress{})
time.Sleep(1 * time.Second)
miner.ToggleMining(state, siacore.CoinAddress{})
newHeight := state.Height()
if newHeight == 0 {
t.Error("height did not increase after mining for a second")
time.Sleep(1 * time.Second)
if state.Height() != newHeight {
t.Error("height still increasing after disabling mining...")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment