mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-05 08:13:55 +00:00
68 lines
1.8 KiB
Markdown
68 lines
1.8 KiB
Markdown
# tt
|
|
Simple and colorful test tools
|
|
|
|
[](https://circleci.com/gh/vcaesar/tt)
|
|

|
|
[](https://codecov.io/gh/vcaesar/tt)
|
|
[](https://travis-ci.org/vcaesar/tt)
|
|
[](https://goreportcard.com/report/github.com/vcaesar/tt)
|
|
[](https://godoc.org/github.com/vcaesar/tt)
|
|
[](https://github.com/vcaesar/tt/releases/latest)
|
|
[](https://gitter.im/go-ego/ego?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
|
|
## Installation/Update
|
|
|
|
```
|
|
go get -u github.com/vcaesar/tt
|
|
```
|
|
|
|
## Usage:
|
|
|
|
#### [Look at an example](/example/)
|
|
|
|
```go
|
|
package tt
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/vcaesar/tt"
|
|
"github.com/vcaesar/tt/example"
|
|
)
|
|
|
|
func TestAdd(t *testing.T) {
|
|
fmt.Println(add.Add(1, 1))
|
|
|
|
tt.Expect(t, "1", add.Add(1, 1))
|
|
tt.Expect(t, "2", add.Add(1, 1))
|
|
|
|
tt.Equal(t, 1, add.Add(1, 1))
|
|
tt.Equal(t, 2, add.Add(1, 1))
|
|
|
|
at := tt.New(t)
|
|
at.Expect("2", add.Add(1, 1))
|
|
at.Equal(2, add.Add(1, 1))
|
|
}
|
|
|
|
func Benchmark1(b *testing.B) {
|
|
at := tt.New(b)
|
|
fn := func() {
|
|
at.Equal(2, add.Add(1, 1))
|
|
}
|
|
|
|
tt.BM(b, fn)
|
|
// at.BM(b, fn)
|
|
}
|
|
|
|
func Benchmark2(b *testing.B) {
|
|
at := tt.New(b)
|
|
for i := 0; i < b.N; i++ {
|
|
at.Equal(2, Add(1, 1))
|
|
}
|
|
}
|
|
|
|
```
|
|
## Thanks
|
|
|
|
[Testify](https://github.com/stretchr/testify), the code has some inspiration. |