本文整理汇总了Golang中github.com/twstrike/coyim/Godeps/_workspace/src/gopkg/in/check/v1.C.Check方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Check方法的具体用法?Golang C.Check怎么用?Golang C.Check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/twstrike/coyim/Godeps/_workspace/src/gopkg/in/check/v1.C
的用法示例。
在下文中一共展示了C.Check方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Test_TopLevelGroup_returnsATopLevelGroup
func (s *GroupListSuite) Test_TopLevelGroup_returnsATopLevelGroup(c *g.C) {
result := TopLevelGroup()
c.Check(result.GroupName, g.Equals, "")
c.Check(result.fullGroupName, g.DeepEquals, []string{})
c.Check(result.peers, g.DeepEquals, []*Peer{})
c.Check(result.groups, g.DeepEquals, map[string]*Group{})
}
示例2: Test_Groups_willReturnTheGroups
func (s *GroupListSuite) Test_Groups_willReturnTheGroups(c *g.C) {
l := New()
p1 := &Peer{Jid: "somewhere", Name: "something", Groups: toSet("hello"), Subscription: "from"}
p2 := &Peer{Jid: "somewhere2", Name: "something2", Groups: toSet("hello", "goodbye::foo::bar"), Subscription: "from"}
p3 := &Peer{Jid: "somewhere3", Name: "something3", Groups: toSet(), Subscription: "from"}
l.AddOrMerge(p1)
l.AddOrMerge(p2)
l.AddOrMerge(p3)
gr := l.Grouped("::")
res := gr.Groups()
c.Check(len(res), g.Equals, 2)
c.Check(res[0].FullGroupName(), g.Equals, "goodbye")
c.Check(res[1].FullGroupName(), g.Equals, "hello")
}
示例3: Test_Grouped_WillGroupPeersInAList
func (s *GroupListSuite) Test_Grouped_WillGroupPeersInAList(c *g.C) {
l := New()
p1 := &Peer{Jid: "somewhere", Name: "something", Groups: toSet("hello"), Subscription: "from"}
p2 := &Peer{Jid: "somewhere2", Name: "something2", Groups: toSet("hello", "goodbye::foo::bar"), Subscription: "from"}
p3 := &Peer{Jid: "somewhere3", Name: "something3", Groups: toSet(), Subscription: "from"}
l.AddOrMerge(p1)
l.AddOrMerge(p2)
l.AddOrMerge(p3)
result := l.Grouped("::")
c.Check(result.GroupName, g.Equals, "")
c.Check(result.fullGroupName, g.DeepEquals, []string{})
c.Check(result.peers, g.DeepEquals, []*Peer{p3})
c.Check(len(result.groups), g.Equals, 2)
c.Check(result.groups["goodbye"].GroupName, g.DeepEquals, "goodbye")
c.Check(result.groups["goodbye"].fullGroupName, g.DeepEquals, []string{"goodbye"})
c.Check(result.groups["goodbye"].peers, g.DeepEquals, []*Peer{})
c.Check(len(result.groups["goodbye"].groups), g.Equals, 1)
c.Check(result.groups["goodbye"].groups["foo"].GroupName, g.DeepEquals, "foo")
c.Check(result.groups["goodbye"].groups["foo"].fullGroupName, g.DeepEquals, []string{"goodbye", "foo"})
c.Check(result.groups["goodbye"].groups["foo"].peers, g.DeepEquals, []*Peer{})
c.Check(len(result.groups["goodbye"].groups["foo"].groups), g.Equals, 1)
c.Check(result.groups["goodbye"].groups["foo"].groups["bar"].GroupName, g.DeepEquals, "bar")
c.Check(result.groups["goodbye"].groups["foo"].groups["bar"].fullGroupName, g.DeepEquals, []string{"goodbye", "foo", "bar"})
c.Check(result.groups["goodbye"].groups["foo"].groups["bar"].peers, g.DeepEquals, []*Peer{p2})
c.Check(len(result.groups["goodbye"].groups["foo"].groups["bar"].groups), g.Equals, 0)
c.Check(result.groups["hello"].GroupName, g.DeepEquals, "hello")
c.Check(result.groups["hello"].fullGroupName, g.DeepEquals, []string{"hello"})
if result.groups["hello"].peers[0] == p1 {
c.Check(result.groups["hello"].peers, g.DeepEquals, []*Peer{p1, p2})
} else {
c.Check(result.groups["hello"].peers, g.DeepEquals, []*Peer{p2, p1})
}
c.Check(len(result.groups["hello"].groups), g.Equals, 0)
}