当前位置: 首页>>代码示例>>Golang>>正文


Golang rdtest.Assert函数代码示例

本文整理汇总了Golang中github.com/pjherring/rdtest.Assert函数的典型用法代码示例。如果您正苦于以下问题:Golang Assert函数的具体用法?Golang Assert怎么用?Golang Assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Assert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestCreateDuplicateUser

func TestCreateDuplicateUser(t *T) {
	beforeUserTest()
	_, err := table.CreateUser("123 123 1234", 1)
	rdtest.Assert(t, err == nil, err)
	_, err = table.CreateUser("123 123 1234", 1)
	rdtest.Assert(t, err == table.DuplicateUser, "%s", err)
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:user_test.go

示例2: TestFindUserWithTeam

func TestFindUserWithTeam(t *T) {
	beforeUserTest()
	user, team, err := table.FindUserWithTeam(100)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, user.UserId == 100, user)
	rdtest.Assert(t, team.TeamId == 1, team)
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:user_test.go

示例3: TestFindClue

func TestFindClue(t *T) {
	beforeClueTest()
	clue, err := table.FindClue(1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, clue != nil)
	rdtest.Assert(t, clue.Text == "Text 1")
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:clue_test.go

示例4: TestLeastUsedTrackId_NoTeamTracks

func TestLeastUsedTrackId_NoTeamTracks(t *T) {
	table.LoadFixtures(table.Fixtures{
		"team_tracks": []table.RowFixture{},
		"tracks": []table.RowFixture{
			table.RowFixture{
				"track_id":          1,
				"question_id_order": "1|2|3",
				"start_time":        time.Now().Add(-1 * time.Hour),
				"end_time":          time.Now().Add(1 * time.Hour),
			},
			table.RowFixture{
				"track_id":          2,
				"question_id_order": "3|2|1",
				"start_time":        time.Now().Add(-1 * time.Hour),
				"end_time":          time.Now().Add(1 * time.Hour),
			},
			table.RowFixture{
				"track_id":          3,
				"question_id_order": "2|1|3",
				"start_time":        time.Now().Add(-1 * time.Hour),
				"end_time":          time.Now().Add(1 * time.Hour),
			},
		},
	})

	trackId, err := table.LeastUsedTrackId(time.Now())
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, trackId >= 1 && trackId <= 3, "%d", trackId)
}
开发者ID:pjherring,项目名称:ggc,代码行数:29,代码来源:track_test.go

示例5: TestUnusedPhrase

func TestUnusedPhrase(t *T) {
	beforePhraseTest()
	p_id, p, err := table.UnusedPhrase()
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, p_id == 1, "%s", p)
	rdtest.Assert(t, p == "phrase_1", "%s", p)
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:phrase_test.go

示例6: TestStartProgressForClueTeam

func TestStartProgressForClueTeam(t *T) {
	beforeTeamProgressTest()
	err := table.StartProgress(3, 1)
	rdtest.Assert(t, err == nil, err)
	_, err = table.FindProgressByClueTeam(3, 1)
	rdtest.Assert(t, err == nil, err)
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:team_progress_test.go

示例7: TestCreateTeamProgress_PreventDuplicate

func TestCreateTeamProgress_PreventDuplicate(t *T) {
	beforeTeamProgressTest()

	p, err := table.CreateTeamProgress(1, 1)
	rdtest.Assert(t, p == nil)
	rdtest.Assert(t, err == table.TeamProgressExists)
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:team_progress_test.go

示例8: TestCurrentClueForTeam_NoProgress

func TestCurrentClueForTeam_NoProgress(t *testing.T) {
	beforeCurrentTest()

	clue, err := clues.CurrentForTeam(2, clues.NoExpectedId)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, clue.ClueId == 1)
}
开发者ID:pjherring,项目名称:ggc,代码行数:7,代码来源:current_test.go

示例9: TestFindOneClue

func TestFindOneClue(t *T) {
	beforeClueTest()

	c := new(record.Clue)
	err := table.FindOne(c, "SELECT question_id, text, answer, hint_one, hint_two, description, is_enabled FROM questions where question_id = ?", 1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, c.ClueId == 1, "%d", c.ClueId)
}
开发者ID:pjherring,项目名称:ggc,代码行数:8,代码来源:clue_test.go

示例10: TestFindTeamByPhrase

func TestFindTeamByPhrase(t *T) {
	beforeTeamTest()

	team, err := table.FindTeamByPhrase("phrase 1000")
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, team.TeamId == 100)
	rdtest.Assert(t, team.Phrase == "phrase 1000")
}
开发者ID:pjherring,项目名称:ggc,代码行数:8,代码来源:team_test.go

示例11: TestFindHintsByClueIdLessThanIdx

func TestFindHintsByClueIdLessThanIdx(t *T) {
	beforeHintTest()

	hints, err := table.FindHintsByClueIdLessThanIdx(1, 0)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, len(hints) == 1, "1 != %d", len(hints))
	rdtest.Assert(t, hints[0].Idx == 0, "0 != %d", hints[0].Idx)
}
开发者ID:pjherring,项目名称:ggc,代码行数:8,代码来源:hint_test.go

示例12: TestFindAllClues

func TestFindAllClues(t *T) {
	beforeClueTest()
	clues, err := table.FindAllClues()
	rdtest.Assert(t, err == nil, err)
	rdtest.Equal(t, len(clues), 2)
	rdtest.Assert(t, clues[0].ClueId == 1)
	rdtest.Assert(t, clues[1].ClueId == 2)
}
开发者ID:pjherring,项目名称:ggc,代码行数:8,代码来源:clue_test.go

示例13: TestCreateTeam

func TestCreateTeam(t *T) {
	beforeTeamTest()
	user, team, err := biz.CreateTeam("Best Team", "1231231234")
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, user.UserId > 0, "user not saved")
	rdtest.Assert(t, team.TeamId > 0, "team not saved")
	rdtest.Assert(t, team.Phrase == "phrase_1", "wrong phrase")
	rdtest.Assert(t, team.TrackId == 1, "wrong track")
}
开发者ID:pjherring,项目名称:ggc,代码行数:9,代码来源:team_test.go

示例14: TestCreateUser

func TestCreateUser(t *T) {
	beforeUserTest()
	u, err := table.CreateUser("123 123 1234", 1)
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, u.UserId > 0, "no user id")
	rdtest.Assert(t, u.Telephone == "1231231234", "wrong telephone")
	rdtest.Assert(t, u.TeamId == 1, "wrong team id")
	rdtest.Assert(t, !u.DidAcceptWaiver, "should not have accepted waiver")
}
开发者ID:pjherring,项目名称:ggc,代码行数:9,代码来源:user_test.go

示例15: TestIncrementHintsTakenForClueTeam

func TestIncrementHintsTakenForClueTeam(t *T) {
	beforeTeamProgressTest()

	err := table.IncrementHintsTakenForClueTeam(1, 1)
	rdtest.Assert(t, err == nil, err)
	currentClue, err := table.FindClueWithProgressForTeam(1)
	rdtest.Assert(t, err == nil)
	rdtest.Assert(t, currentClue.HintCnt == 1)
}
开发者ID:pjherring,项目名称:ggc,代码行数:9,代码来源:team_progress_test.go


注:本文中的github.com/pjherring/rdtest.Assert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。