當前位置: 首頁>>代碼示例>>Golang>>正文


Golang testing.AssertEquals函數代碼示例

本文整理匯總了Golang中github.com/google/gxui/testing.AssertEquals函數的典型用法代碼示例。如果您正苦於以下問題:Golang AssertEquals函數的具體用法?Golang AssertEquals怎麽用?Golang AssertEquals使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AssertEquals函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestTINExpandCollapseOne

func TestTINExpandCollapseOne(t *testing.T) {
	N := createTestTreeNode
	root := CreateTreeInternalRoot(N(0,
		N(10,
			N(11), N(12), N(13), N(14)),
		N(20,
			N(21), N(22), N(23), N(24)),
		N(30,
			N(31), N(32), N(33), N(34)),
	))

	root.Child(1).Expand()
	test.AssertEquals(t, root.descendants, 7)
	test.AssertEquals(t, gxui.AdapterItem(10), root.ItemAt(0))
	test.AssertEquals(t, gxui.AdapterItem(20), root.ItemAt(1))
	test.AssertEquals(t, gxui.AdapterItem(21), root.ItemAt(2))
	test.AssertEquals(t, gxui.AdapterItem(24), root.ItemAt(5))
	test.AssertEquals(t, gxui.AdapterItem(30), root.ItemAt(6))

	root.Child(1).Collapse()
	test.AssertEquals(t, root.descendants, 3)
	test.AssertEquals(t, gxui.AdapterItem(10), root.ItemAt(0))
	test.AssertEquals(t, gxui.AdapterItem(20), root.ItemAt(1))
	test.AssertEquals(t, gxui.AdapterItem(30), root.ItemAt(2))
}
開發者ID:linux-mac,項目名稱:gxui,代碼行數:25,代碼來源:tree_internal_node_test.go

示例2: TestTINFindByIndex

func TestTINFindByIndex(t *testing.T) {
	N := createTestTreeNode
	root := CreateTreeInternalRoot(N(0,
		/*0*/ N(100,
			/*1*/ N(110),
			/*2*/ N(120,
				/*3*/ N(121),
				/*4*/ N(122),
				/*5*/ N(123)),
			/*6*/ N(130),
			/*7*/ N(140,
				/*8*/ N(141),
				/*9*/ N(141)))))

	root.ExpandAll()
	test.AssertEquals(t, 10, root.descendants)

	n, i, d := root.FindByIndex(0)
	test.AssertEquals(t, root, n)
	test.AssertEquals(t, 0, i)
	test.AssertEquals(t, 0, d)

	n, i, d = root.FindByIndex(4)
	test.AssertEquals(t, root.Child(0).Child(1), n)
	test.AssertEquals(t, 1, i)
	test.AssertEquals(t, 2, d)

	n, i, d = root.FindByIndex(9)
	test.AssertEquals(t, root.Child(0).Child(3), n)
	test.AssertEquals(t, 1, i)
	test.AssertEquals(t, 2, d)
}
開發者ID:linux-mac,項目名稱:gxui,代碼行數:32,代碼來源:tree_internal_node_test.go

示例3: TestTBCLineIndent

func TestTBCLineIndent(t *testing.T) {
	c := parseTBC("  ÀÁ\n    BB\nĆ\n      D\n   EE")
	test.AssertEquals(t, 2, c.LineIndent(0))
	test.AssertEquals(t, 4, c.LineIndent(1))
	test.AssertEquals(t, 0, c.LineIndent(2))
	test.AssertEquals(t, 6, c.LineIndent(3))
	test.AssertEquals(t, 3, c.LineIndent(4))
}
開發者ID:langxj,項目名稱:gxui,代碼行數:8,代碼來源:textbox_controller_test.go

示例4: TestU64ListIntersectSingleMiddle

func TestU64ListIntersectSingleMiddle(t *testing.T) {
	l := U64List{
		CreateU64Inc(10, 20),
	}
	first, count := Intersect(&l, CreateU64Inc(12, 18))
	test.AssertEquals(t, 0, first)
	test.AssertEquals(t, 1, count)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:8,代碼來源:list_test.go

示例5: TestCreateMat3PositionToBarycentric

func TestCreateMat3PositionToBarycentric(t *testing.T) {
	a := Vec2{+0.0, -1.0}
	b := Vec2{-1.0, 1.0}
	c := Vec2{+1.0, 1.0}
	m := CreateMat3PositionToBarycentric(a, b, c)
	test.AssertEquals(t, Vec3{1.0, 0.0, 1.0}, a.Vec3(1).MulM(m))
	test.AssertEquals(t, Vec3{0.0, 1.0, 1.0}, b.Vec3(1).MulM(m))
	test.AssertEquals(t, Vec3{0.0, 0.0, 1.0}, c.Vec3(1).MulM(m))
}
開發者ID:langxj,項目名稱:gxui,代碼行數:9,代碼來源:mat3_test.go

示例6: TestTINFlatSimple

func TestTINFlatSimple(t *testing.T) {
	N := createTestTreeNode
	root := CreateTreeInternalRoot(N(0, N(10), N(20), N(30)))

	test.AssertEquals(t, 3, root.descendants)
	test.AssertEquals(t, gxui.AdapterItem(10), root.ItemAt(0))
	test.AssertEquals(t, gxui.AdapterItem(20), root.ItemAt(1))
	test.AssertEquals(t, gxui.AdapterItem(30), root.ItemAt(2))
}
開發者ID:linux-mac,項目名稱:gxui,代碼行數:9,代碼來源:tree_internal_node_test.go

示例7: TestEventNoArgs

func TestEventNoArgs(t *testing.T) {
	e := CreateEvent(func() {})

	fired := false
	e.Listen(func() { fired = true })
	test.AssertEquals(t, false, fired)

	e.Fire()
	test.AssertEquals(t, true, fired)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:10,代碼來源:event_test.go

示例8: TestU64ListIntersectOverlapThree

func TestU64ListIntersectOverlapThree(t *testing.T) {
	l := U64List{
		CreateU64Inc(10, 20),
		CreateU64Inc(30, 40),
		CreateU64Inc(50, 60),
	}
	first, count := Intersect(&l, CreateU64Inc(15, 55))
	test.AssertEquals(t, 0, first)
	test.AssertEquals(t, 3, count)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:10,代碼來源:list_test.go

示例9: TestU64ListIntersectOverlapLastTwo

func TestU64ListIntersectOverlapLastTwo(t *testing.T) {
	l := U64List{
		CreateU64Inc(10, 20),
		CreateU64Inc(30, 40),
		CreateU64Inc(50, 60),
	}
	first, count := Intersect(&l, CreateU64Inc(35, 60))
	test.AssertEquals(t, 1, first)
	test.AssertEquals(t, 2, count)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:10,代碼來源:list_test.go

示例10: TestEventEmptyVariadic

func TestEventEmptyVariadic(t *testing.T) {
	e := CreateEvent(func(...int) {})

	fired := false
	e.Listen(func(va ...int) {
		test.AssertEquals(t, 0, len(va))
		fired = true
	})
	e.Fire()
	test.AssertEquals(t, true, fired)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:11,代碼來源:event_test.go

示例11: TestEventSingleVariadic

func TestEventSingleVariadic(t *testing.T) {
	e := CreateEvent(func(...int) {})

	fired := false
	e.Listen(func(va ...int) {
		test.AssertEquals(t, 3, len(va))

		test.AssertEquals(t, 2, va[0])
		test.AssertEquals(t, 3, va[1])
		test.AssertEquals(t, 4, va[2])
		fired = true
	})
	e.Fire(2, 3, 4)
	test.AssertEquals(t, true, fired)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:15,代碼來源:event_test.go

示例12: TestU64ListReplaceFromEmpty

func TestU64ListReplaceFromEmpty(t *testing.T) {
	l := &U64List{}
	Replace(l, CreateU64Inc(0, 10))
	test.AssertEquals(t, &U64List{
		CreateU64Inc(0, 10),
	}, l)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:7,代碼來源:list_test.go

示例13: TestU64ListRemoveTrimFront

func TestU64ListRemoveTrimFront(t *testing.T) {
	l := &U64List{CreateU64Inc(10, 20)}
	Remove(l, CreateU64Inc(5, 14))
	test.AssertEquals(t, &U64List{
		CreateU64Inc(15, 20),
	}, l)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:7,代碼來源:list_test.go

示例14: TestU64ListMergeExtendSingleBack

func TestU64ListMergeExtendSingleBack(t *testing.T) {
	l := &U64List{CreateU64Inc(3, 5)}
	Merge(l, CreateU64Inc(5, 7))
	test.AssertEquals(t, &U64List{
		CreateU64Inc(3, 7),
	}, l)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:7,代碼來源:list_test.go

示例15: TestU64ListMergeExtendSingleFront

// Extending tests
func TestU64ListMergeExtendSingleFront(t *testing.T) {
	l := &U64List{CreateU64Inc(3, 5)}
	Merge(l, CreateU64Inc(0, 3))
	test.AssertEquals(t, &U64List{
		CreateU64Inc(0, 5),
	}, l)
}
開發者ID:4ydx,項目名稱:gxui,代碼行數:8,代碼來源:list_test.go


注:本文中的github.com/google/gxui/testing.AssertEquals函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。