本文整理汇总了Golang中github.com/knakk/specs.Expect函数的典型用法代码示例。如果您正苦于以下问题:Golang Expect函数的具体用法?Golang Expect怎么用?Golang Expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Expect函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestSliceSetAdd
func TestSliceSetAdd(t *testing.T) {
specs := specs.New(t)
set := NewSliceSet(100).Add(1, 2, 5, 2)
specs.Expect(set.Contains(1, 2, 5), true)
specs.Expect(set.Size(), 3)
}
示例2: TestSliceSetSize
func TestSliceSetSize(t *testing.T) {
specs := specs.New(t)
set := NewSliceSet(100).Add(1, 2, 3)
specs.Expect(set.Size(), 3)
set.Remove(2)
specs.Expect(set.Size(), 2)
}
示例3: TestSliceSetRemove
func TestSliceSetRemove(t *testing.T) {
specs := specs.New(t)
set := NewSliceSet(100).Add(3, 1)
specs.Expect(set.Contains(3, 1), true)
set.Remove(1, 3)
specs.Expect(set.Contains(1, 3), false)
}
示例4: TestSliceSetClear
func TestSliceSetClear(t *testing.T) {
specs := specs.New(t)
set := NewSliceSet(100).Add(1, 2, 3, 4, 5).Clear()
specs.Expect(set.Contains(1, 2, 3, 4, 5), false)
specs.Expect(set.Size(), 0)
}
示例5: TestSliceSetContains
func TestSliceSetContains(t *testing.T) {
specs := specs.New(t)
set := NewSliceSet(100).Add(1, 2, 3).Remove(2)
specs.Expect(set.Contains(2), false)
specs.Expect(set.Contains(1, 3), true)
specs.Expect(set.Contains(1, 2, 3), false)
}
示例6: TestSliceSetSupersetOf
func TestSliceSetSupersetOf(t *testing.T) {
specs := specs.New(t)
setA := NewSliceSet(100).Add(1, 2)
setB := NewSliceSet(100).Add(1, 2, 3)
setC := NewSliceSet(100).Add(3, 4, 5)
specs.Expect(setB.SupersetOf(setA), true)
specs.Expect(setC.SupersetOf(setA), false)
}
示例7: TestSliceSetEqual
func TestSliceSetEqual(t *testing.T) {
specs := specs.New(t)
setA := NewSliceSet(100).Add(1, 2)
setB := NewSliceSet(100).Add(2, 1, 1)
setC := NewSliceSet(100).Add(1, 3)
specs.Expect(setA.Equal(setB), true)
specs.Expect(setA.Equal(setC), false)
}
示例8: TestSliceSetSymetricDifference
func TestSliceSetSymetricDifference(t *testing.T) {
specs := specs.New(t)
setA := NewSliceSet(100).Add(1, 2, 4)
setB := NewSliceSet(100).Add(1, 2, 3)
setC := NewSliceSet(100).Add(3, 4, 5)
specs.Expect(setA.SymetricDifference(setB).Equal(NewSliceSet(100).Add(3, 4)), true)
specs.Expect(setB.SymetricDifference(setC).Equal(NewSliceSet(100).Add(1, 2, 4, 5)), true)
}
示例9: TestSliceSetIntersection
func TestSliceSetIntersection(t *testing.T) {
specs := specs.New(t)
setA := NewSliceSet(100).Add(1, 2)
setB := NewSliceSet(100).Add(1, 2, 3)
setC := NewSliceSet(100).Add(3, 4, 5)
specs.Expect(setA.Intersection(setB).Equal(setA), true)
specs.Expect(setB.Intersection(setC).Equal(NewSliceSet(100).Add(3)), true)
}
示例10: TestSliceSetUnion
func TestSliceSetUnion(t *testing.T) {
specs := specs.New(t)
setA := NewSliceSet(100).Add(1, 2)
setB := NewSliceSet(100).Add(3, 4)
setC := NewSliceSet(100).Add(1, 99)
specs.Expect(setA.Union(setB).Equal(NewSliceSet(100).Add(1, 2, 3, 4)), true)
specs.Expect(setA.Union(setC).Equal(NewSliceSet(100).Add(1, 2, 99)), true)
}
示例11: TestBriggsSetSubsetOf
func TestBriggsSetSubsetOf(t *testing.T) {
specs := specs.New(t)
setA := NewBriggsSet(100).Add(1, 2)
setB := NewBriggsSet(100).Add(1, 2, 3)
setC := NewBriggsSet(100).Add(3, 4, 5)
specs.Expect(setA.SubsetOf(setB), true)
specs.Expect(setA.SubsetOf(setC), false)
}
示例12: TestSliceSetAll
func TestSliceSetAll(t *testing.T) {
specs := specs.New(t)
set := NewSliceSet(100).Add(99, 1, 5)
all := set.All()
specs.Expect(len(all), 3)
specs.Expect(all[0], 1)
specs.Expect(all[1], 5)
specs.Expect(all[2], 99)
}
示例13: TestBriggsSetAll
func TestBriggsSetAll(t *testing.T) {
specs := specs.New(t)
set := NewBriggsSet(100).Add(99, 1, 5)
all := set.All()
specs.Expect(len(all), 3)
sort.Ints(all) // Hashet.All() doesn't guarantee order of ints
specs.Expect(all[0], 1)
specs.Expect(all[1], 5)
specs.Expect(all[2], 99)
}
示例14: TestSliceSetClone
func TestSliceSetClone(t *testing.T) {
specs := specs.New(t)
setA := NewSliceSet(100).Add(9, 3, 1)
setB := setA.Clone()
specs.Expect(setB.Equal(setA), true)
}