-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathrelop_test.go
36 lines (27 loc) · 1003 Bytes
/
relop_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2013 Canonical Ltd.
// Licensed under the LGPLv3, see LICENCE file for details.
package checkers_test
import (
gc "gopkg.in/check.v1"
jc "github.com/juju/testing/checkers"
)
type RelopSuite struct{}
var _ = gc.Suite(&RelopSuite{})
func (s *RelopSuite) TestGreaterThan(c *gc.C) {
c.Assert(45, jc.GreaterThan, 42)
c.Assert(2.25, jc.GreaterThan, 1.0)
c.Assert(42, gc.Not(jc.GreaterThan), 42)
c.Assert(10, gc.Not(jc.GreaterThan), 42)
result, msg := jc.GreaterThan.Check([]interface{}{"Hello", "World"}, nil)
c.Assert(result, jc.IsFalse)
c.Assert(msg, gc.Equals, `obtained value string:"Hello" not supported`)
}
func (s *RelopSuite) TestLessThan(c *gc.C) {
c.Assert(42, jc.LessThan, 45)
c.Assert(1.0, jc.LessThan, 2.25)
c.Assert(42, gc.Not(jc.LessThan), 42)
c.Assert(42, gc.Not(jc.LessThan), 10)
result, msg := jc.LessThan.Check([]interface{}{"Hello", "World"}, nil)
c.Assert(result, jc.IsFalse)
c.Assert(msg, gc.Equals, `obtained value string:"Hello" not supported`)
}