1// Copyright 2011 Aaron Jacobs. All Rights Reserved.
2// Author: aaronjjacobs@gmail.com (Aaron Jacobs)
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//     http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package oglematchers_test
17
18import (
19	"fmt"
20	"testing"
21	"time"
22
23	. "github.com/smartystreets/assertions/internal/oglematchers"
24	. "github.com/smartystreets/assertions/internal/ogletest"
25)
26
27func TestPassingTest(t *testing.T) { RunTests(t) }
28
29////////////////////////////////////////////////////////////////////////
30// PassingTest
31////////////////////////////////////////////////////////////////////////
32
33type PassingTest struct {
34}
35
36func init() { RegisterTestSuite(&PassingTest{}) }
37
38func (t *PassingTest) EmptyTestMethod() {
39}
40
41func (t *PassingTest) SuccessfullMatches() {
42	ExpectThat(17, Equals(17.0))
43	ExpectThat(16.9, LessThan(17))
44	ExpectThat("taco", HasSubstr("ac"))
45
46	AssertThat(17, Equals(17.0))
47	AssertThat(16.9, LessThan(17))
48	AssertThat("taco", HasSubstr("ac"))
49}
50
51func (t *PassingTest) ExpectAliases() {
52	ExpectEq(17, 17.0)
53
54	ExpectLe(17, 17.0)
55	ExpectLe(17, 18.0)
56	ExpectLt(17, 18.0)
57
58	ExpectGe(17, 17.0)
59	ExpectGe(17, 16.0)
60	ExpectGt(17, 16.0)
61
62	ExpectNe(17, 18.0)
63
64	ExpectTrue(true)
65	ExpectFalse(false)
66}
67
68func (t *PassingTest) AssertAliases() {
69	AssertEq(17, 17.0)
70
71	AssertLe(17, 17.0)
72	AssertLe(17, 18.0)
73	AssertLt(17, 18.0)
74
75	AssertGe(17, 17.0)
76	AssertGe(17, 16.0)
77	AssertGt(17, 16.0)
78
79	AssertNe(17, 18.0)
80
81	AssertTrue(true)
82	AssertFalse(false)
83}
84
85func (t *PassingTest) SlowTest() {
86	time.Sleep(37 * time.Millisecond)
87}
88
89////////////////////////////////////////////////////////////////////////
90// PassingTestWithHelpers
91////////////////////////////////////////////////////////////////////////
92
93type PassingTestWithHelpers struct {
94}
95
96var _ SetUpTestSuiteInterface = &PassingTestWithHelpers{}
97var _ SetUpInterface = &PassingTestWithHelpers{}
98var _ TearDownInterface = &PassingTestWithHelpers{}
99var _ TearDownTestSuiteInterface = &PassingTestWithHelpers{}
100
101func init() { RegisterTestSuite(&PassingTestWithHelpers{}) }
102
103func (t *PassingTestWithHelpers) SetUpTestSuite() {
104	fmt.Println("SetUpTestSuite ran.")
105}
106
107func (t *PassingTestWithHelpers) SetUp(ti *TestInfo) {
108	fmt.Println("SetUp ran.")
109}
110
111func (t *PassingTestWithHelpers) TearDown() {
112	fmt.Println("TearDown ran.")
113}
114
115func (t *PassingTestWithHelpers) TearDownTestSuite() {
116	fmt.Println("TearDownTestSuite ran.")
117}
118
119func (t *PassingTestWithHelpers) EmptyTestMethod() {
120}
121