• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang rdtest.Assert函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestFindHintsByClueId

func TestFindHintsByClueId(t *T) {
	beforeHintTest()

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


示例17: TestFindCurrentTracks

func TestFindCurrentTracks(t *T) {
	beforeTrackTest()
	tracks, err := table.FindCurrentTracks(time.Now())
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, len(tracks) == 3, "%d", len(tracks))
	rdtest.Assert(t, tracks[0].TrackId == 1)
	rdtest.Assert(t, tracks[1].TrackId == 2)
	rdtest.Assert(t, tracks[2].TrackId == 3)
}
开发者ID:pjherring,项目名称:ggc,代码行数:9,代码来源:track_test.go


示例18: TestCurrentClueForTeam_ClueDisabled

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

	log.Println("before")
	clue, err := clues.CurrentForTeam(1, 2)

	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, clue.ClueId == 3)
	rdtest.Assert(t, clue.AdvancementReason == clues.DisabledAdvancement, "Actual (%s)", clue.AdvancementReason)
}
开发者ID:pjherring,项目名称:ggc,代码行数:10,代码来源:current_test.go


示例19: TestGetTrackIdForTelephone

func TestGetTrackIdForTelephone(t *T) {
	beforeTrackTest()
	trackId, err := table.GetTrackForTelephone("1231231234")
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, trackId == 1, err)

	trackId, err = table.GetTrackForTelephone("3213213214")
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, trackId == 1, err)
}
开发者ID:pjherring,项目名称:ggc,代码行数:10,代码来源:track_test.go


示例20: TestFindAllTracks

func TestFindAllTracks(t *T) {
	beforeTrackTest()

	tracks, err := table.FindAllTracks()
	rdtest.Assert(t, err == nil, err)
	rdtest.Assert(t, len(tracks) == 3, "3 != %d", len(tracks))
	rdtest.Assert(t, tracks[0].TrackId == 1)
	rdtest.Assert(t, tracks[1].TrackId == 2)
	rdtest.Assert(t, tracks[2].TrackId == 3)
}
开发者ID:pjherring,项目名称:ggc,代码行数:10,代码来源:track_test.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang browser.OpenURL函数代码示例发布时间:2022-05-28
下一篇:
Golang generator.FileDescriptor类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap