mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-26 16:09:45 -05:00
2d8fcd9bf4
Co-authored-by: Malte Poll <mp@edgeless.systems> Co-authored-by: katexochen <katexochen@users.noreply.github.com> Co-authored-by: Daniel Weiße <dw@edgeless.systems> Co-authored-by: Thomas Tendyck <tt@edgeless.systems> Co-authored-by: Benedict Schlueter <bs@edgeless.systems> Co-authored-by: leongross <leon.gross@rub.de> Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
31 lines
625 B
Go
31 lines
625 B
Go
package state
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"go.uber.org/goleak"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
goleak.VerifyTestMain(m)
|
|
}
|
|
|
|
func TestState(t *testing.T) {
|
|
assert := assert.New(t)
|
|
|
|
var st State
|
|
assert.Equal(Uninitialized, st)
|
|
assert.Equal(Uninitialized, st.Get())
|
|
assert.NoError(st.Require(Uninitialized))
|
|
assert.Error(st.Require(AcceptingInit))
|
|
|
|
st.Advance(AcceptingInit)
|
|
assert.Equal(AcceptingInit, st)
|
|
assert.Equal(AcceptingInit, st.Get())
|
|
assert.Error(st.Require(Uninitialized))
|
|
assert.NoError(st.Require(AcceptingInit))
|
|
|
|
assert.Panics(func() { st.Advance(Uninitialized) })
|
|
}
|