本文整理匯總了Golang中github.com/pgpst/pgpst/internal/gopkg/in/check/v1.C.Errorf方法的典型用法代碼示例。如果您正苦於以下問題:Golang C.Errorf方法的具體用法?Golang C.Errorf怎麽用?Golang C.Errorf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pgpst/pgpst/internal/gopkg/in/check/v1.C
的用法示例。
在下文中一共展示了C.Errorf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestGeospatialDecodeGeometryPseudoType
func (s *RethinkSuite) TestGeospatialDecodeGeometryPseudoType(c *test.C) {
var response types.Geometry
// setup coordinates
coords := [][][]float64{
{
{-122.423246, 37.779388},
{-122.423246, 37.329898},
{-121.88642, 37.329898},
{-121.88642, 37.329898},
{-122.423246, 37.779388},
},
}
gt := "Polygon"
res, err := Expr(map[string]interface{}{
"$reql_type$": "GEOMETRY",
"type": "Polygon",
"coordinates": coords,
}).Run(session)
c.Assert(err, test.IsNil)
err = res.One(&response)
c.Assert(err, test.IsNil)
// test shape
if response.Type != gt {
c.Errorf("expected [%v], instead [%v]", gt, response.Type)
}
// assert points are within threshold
c.Assert(response, geometryEquals, "Polygon", coords)
}
示例2: TestGeospatialPointDistanceRootKm
func (s *RethinkSuite) TestGeospatialPointDistanceRootKm(c *test.C) {
var response float64
f := 734.125249602186
res, err := Distance(Point(-122.423246, 37.779388), Point(-117.220406, 32.719464), DistanceOpts{Unit: "km"}).Run(session)
c.Assert(err, test.IsNil)
err = res.One(&response)
c.Assert(err, test.IsNil)
if !kindaclose(response, f) {
c.Errorf("the deviation between the compared floats is too great [%v:%v]", response, f)
}
}