当前位置: 首页>>代码示例>>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;未经允许,请勿转载。