Skip to content

Commit

Permalink
Fix Update func
Browse files Browse the repository at this point in the history
  • Loading branch information
PenguinCabinet committed Apr 13, 2024
1 parent f0d23c5 commit 689030e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ type Machine struct {
/*This is the function for processing that is called in every frames.It is used internally.
これは処理のため毎フレーク呼び出される関数です。内部的にEbitenで使います*/
func (g *Machine) Update(screen *ebiten.Image) error {
func (g *Machine) Update() error {

if g.Empty() {
return nil
Expand Down
14 changes: 7 additions & 7 deletions gsm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestCodeNilOfMachine(t *testing.T) {
})
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the current state")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the current state")
}

Expand All @@ -65,7 +65,7 @@ func TestCodeChangeOfMachine(t *testing.T) {
})
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the current state")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State2", "Check the id of the current state")
}

Expand All @@ -87,7 +87,7 @@ func TestCodeAddOfMachine(t *testing.T) {
assert.Equal(t, len(gms.StateStack), 1, "Check the length of the states")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the state[0]")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, len(gms.StateStack), 2, "Check the length of the states")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the state[0]")
assert.Equal(t, gms.StateStack[1].(*StateForTest).ID, "State2", "Check the id of the state[1]")
Expand All @@ -107,7 +107,7 @@ func TestCodeDeleteOfMachine(t *testing.T) {
assert.Equal(t, gms.Empty(), false, "Run Empty func when not empty.")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the current state")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, gms.Empty(), true, "Run Empty func when empty.")
}

Expand Down Expand Up @@ -141,7 +141,7 @@ func TestCodeAllDeleteAndChangeOfMachine(t *testing.T) {

assert.Equal(t, len(gms.StateStack), 4, "Check the length of the states")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, len(gms.StateStack), 1, "Check the length of the states")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State5", "Check the id of the current state")
}
Expand All @@ -164,7 +164,7 @@ func TestCodeInsertBackOfMachine(t *testing.T) {
assert.Equal(t, len(gms.StateStack), 1, "Check the length of the states")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the state[0]")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, len(gms.StateStack), 2, "Check the length of the states")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State2", "Check the id of the state[0]")
assert.Equal(t, gms.StateStack[1].(*StateForTest).ID, "State1", "Check the id of the state[1]")
Expand All @@ -190,7 +190,7 @@ func TestCodeInsertBackOfMachine(t *testing.T) {
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the state[0]")
assert.Equal(t, gms.StateStack[1].(*StateForTest).ID, "State2", "Check the id of the state[1]")
//continue one frame.
_ = gms.Update(nil)
_ = gms.Update()
assert.Equal(t, len(gms.StateStack), 3, "Check the length of the states")
assert.Equal(t, gms.StateStack[0].(*StateForTest).ID, "State1", "Check the id of the state[0]")
assert.Equal(t, gms.StateStack[1].(*StateForTest).ID, "State3", "Check the id of the state[1]")
Expand Down

0 comments on commit 689030e

Please sign in to comment.