From 689030e791b22bb9b35dda4775bf63a0978871b8 Mon Sep 17 00:00:00 2001 From: PenguinCabinet Date: Sat, 13 Apr 2024 19:26:22 +0900 Subject: [PATCH] Fix Update func --- gsm.go | 2 +- gsm_test.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gsm.go b/gsm.go index 8bb91f4..df8ad15 100644 --- a/gsm.go +++ b/gsm.go @@ -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 diff --git a/gsm_test.go b/gsm_test.go index 7ab6c37..bbe6daf 100644 --- a/gsm_test.go +++ b/gsm_test.go @@ -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") } @@ -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") } @@ -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]") @@ -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.") } @@ -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") } @@ -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]") @@ -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]")