File: relop_test.go

package info (click to toggle)
golang-github-juju-testing 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 512 kB
  • sloc: makefile: 6
file content (36 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download | duplicates (2)
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`)
}