當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。