删除单元测试代码

This commit is contained in:
kercylan98 2023-05-26 09:12:12 +08:00
parent 3d89177fec
commit 50d7689376
2 changed files with 0 additions and 102 deletions

View File

@ -1,53 +0,0 @@
package builtin
import (
"github.com/smartystreets/goconvey/convey"
"testing"
)
func TestNewRankingList(t *testing.T) {
convey.Convey("NewRankingList", t, func() {
convey.So(NewRankingList[string, int](), convey.ShouldNotEqual, nil)
convey.So(NewRankingList[string, int](WithRankingListCount[string, int](50)).rankCount, convey.ShouldEqual, 50)
convey.So(NewRankingList[string, int](WithRankingListASC[string, int]()).asc, convey.ShouldEqual, true)
})
}
func TestRankingList_Competitor(t *testing.T) {
convey.Convey("TestRankingList_Competitor", t, func() {
rankingList := NewRankingList[string, int]()
rankingList.Competitor("angle", 63)
rankingList.Competitor("jacky", 59)
rankingList.Competitor("dave", 86)
rankingList.Competitor("jacky", 42)
convey.So(rankingList.Size(), convey.ShouldEqual, 3)
})
convey.Convey("TestRankingList_Competitor", t, func() {
rankingList := NewRankingList[string, int](WithRankingListCount[string, int](2))
rankingList.Competitor("angle", 63)
rankingList.Competitor("jacky", 59)
rankingList.Competitor("dave", 86)
rankingList.Competitor("jacky", 42)
convey.So(rankingList.Size(), convey.ShouldEqual, 2)
one, err := rankingList.GetCompetitor(0)
convey.So(one, convey.ShouldEqual, "dave")
convey.So(err, convey.ShouldEqual, nil)
two, err := rankingList.GetCompetitor(1)
convey.So(two, convey.ShouldEqual, "angle")
convey.So(err, convey.ShouldEqual, nil)
})
}
func TestRankingList_CompetitorIncrease(t *testing.T) {
convey.Convey("TestRankingList_Competitor", t, func() {
rankingList := NewRankingList[string, int]()
rankingList.Competitor("angle", 63)
rankingList.Competitor("dave", 86)
rankingList.Competitor("jacky", 42)
rankingList.CompetitorIncrease("jacky", 100)
convey.So(rankingList.Size(), convey.ShouldEqual, 3)
one, err := rankingList.GetCompetitor(0)
convey.So(one, convey.ShouldEqual, "jacky")
convey.So(err, convey.ShouldEqual, nil)
})
}

View File

@ -1,49 +0,0 @@
package builtin
import (
"github.com/smartystreets/goconvey/convey"
"testing"
)
var room = NewRoom[string, *Player[string]](1)
func TestNewRoomSeat(t *testing.T) {
roomSeat := NewRoomSeat[string, *Player[string]](room)
convey.Convey("TestNewRoomSeat.NewRoomSeat", t, func() {
convey.So(roomSeat, convey.ShouldNotEqual, nil)
})
player1 := NewPlayer[string]("kiki", nil)
player2 := NewPlayer[string]("john", nil)
player3 := NewPlayer[string]("dave", nil)
_ = roomSeat.Join(player1)
_ = roomSeat.Join(player2)
_ = roomSeat.Join(player3)
player1Seat, _ := roomSeat.GetSeat(player1.GetID())
player2Seat, _ := roomSeat.GetSeat(player2.GetID())
player3Seat, _ := roomSeat.GetSeat(player3.GetID())
convey.Convey("TestNewRoomSeat.GetSeat", t, func() {
convey.So(player1Seat, convey.ShouldEqual, 0)
convey.So(player2Seat, convey.ShouldEqual, 1)
convey.So(player3Seat, convey.ShouldEqual, 2)
})
player1, _ = roomSeat.GetPlayerWithSeat(0)
player2, _ = roomSeat.GetPlayerWithSeat(1)
player3, _ = roomSeat.GetPlayerWithSeat(2)
convey.Convey("TestNewRoomSeat.GetPlayerWithSeat", t, func() {
convey.So(player1.GetID(), convey.ShouldEqual, "kiki")
convey.So(player2.GetID(), convey.ShouldEqual, "john")
convey.So(player3.GetID(), convey.ShouldEqual, "dave")
})
room.Leave(player2.GetID())
player1Seat, _ = roomSeat.GetSeat(player1.GetID())
player2Seat, err := roomSeat.GetSeat(player2.GetID())
player3Seat, _ = roomSeat.GetSeat(player3.GetID())
convey.Convey("TestNewRoomSeat.Leave", t, func() {
convey.So(err, convey.ShouldNotEqual, nil)
convey.So(player1Seat, convey.ShouldEqual, 0)
convey.So(player3Seat, convey.ShouldEqual, 2)
})
}