Skip to content

Commit afa77af

Browse files
docs: autoupdate
1 parent 61b0647 commit afa77af

1 file changed

Lines changed: 153 additions & 45 deletions

File tree

README.md

Lines changed: 153 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,41 +15,41 @@
1515
1616
-->
1717

18-
<h1 align="center">AtomicGo | template</h1>
18+
<h1 align="center">AtomicGo | assert</h1>
1919

2020
<p align="center">
21-
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fatomicgo.dev%2Fapi%2Fshields%2Ftemplate&style=flat-square" alt="Downloads">
21+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fatomicgo.dev%2Fapi%2Fshields%2Fassert&style=flat-square" alt="Downloads">
2222

23-
<a href="https://github.com/atomicgo/template/releases">
24-
<img src="https://img.shields.io/github/v/release/atomicgo/template?style=flat-square" alt="Latest Release">
23+
<a href="https://github.com/atomicgo/assert/releases">
24+
<img src="https://img.shields.io/github/v/release/atomicgo/assert?style=flat-square" alt="Latest Release">
2525
</a>
2626

27-
<a href="https://codecov.io/gh/atomicgo/template" target="_blank">
28-
<img src="https://img.shields.io/github/actions/workflow/status/atomicgo/template/go.yml?style=flat-square" alt="Tests">
27+
<a href="https://codecov.io/gh/atomicgo/assert" target="_blank">
28+
<img src="https://img.shields.io/github/actions/workflow/status/atomicgo/assert/go.yml?style=flat-square" alt="Tests">
2929
</a>
3030

31-
<a href="https://codecov.io/gh/atomicgo/template" target="_blank">
32-
<img src="https://img.shields.io/codecov/c/gh/atomicgo/template?color=magenta&logo=codecov&style=flat-square" alt="Coverage">
31+
<a href="https://codecov.io/gh/atomicgo/assert" target="_blank">
32+
<img src="https://img.shields.io/codecov/c/gh/atomicgo/assert?color=magenta&logo=codecov&style=flat-square" alt="Coverage">
3333
</a>
3434

35-
<a href="https://codecov.io/gh/atomicgo/template">
36-
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-3-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
35+
<a href="https://codecov.io/gh/atomicgo/assert">
36+
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-162-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
3737
</a>
3838

3939
<a href="https://opensource.org/licenses/MIT" target="_blank">
4040
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT">
4141
</a>
4242

43-
<a href="https://goreportcard.com/report/github.com/atomicgo/template" target="_blank">
44-
<img src="https://goreportcard.com/badge/github.com/atomicgo/template?style=flat-square" alt="Go report">
43+
<a href="https://goreportcard.com/report/github.com/atomicgo/assert" target="_blank">
44+
<img src="https://goreportcard.com/badge/github.com/atomicgo/assert?style=flat-square" alt="Go report">
4545
</a>
4646

4747
</p>
4848

4949
---
5050

5151
<p align="center">
52-
<strong><a href="https://pkg.go.dev/atomicgo.dev/template#section-documentation" target="_blank">Documentation</a></strong>
52+
<strong><a href="https://pkg.go.dev/atomicgo.dev/assert#section-documentation" target="_blank">Documentation</a></strong>
5353
|
5454
<strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CONTRIBUTING.md" target="_blank">Contributing</a></strong>
5555
|
@@ -68,7 +68,7 @@
6868
</tbody>
6969
</table>
7070
</p>
71-
<h3 align="center"><pre>go get atomicgo.dev/template</pre></h3>
71+
<h3 align="center"><pre>go get atomicgo.dev/assert</pre></h3>
7272
<p align="center">
7373
<table>
7474
<tbody>
@@ -80,83 +80,191 @@
8080

8181
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
8282

83-
# template
83+
# assert
8484

8585
```go
86-
import "atomicgo.dev/template"
86+
import "atomicgo.dev/assert"
8787
```
8888

89-
Package template is used to generate new AtomicGo repositories.
89+
Package assert provides a set of assertion functions. Every assertion function returns a boolean. This package does not integrateinto the testing package automatically. If you want to use this package inside unit tests, you have to check the returning boolean value and call \`t.Fatal\(\)\` if the assertion fails.
9090

91-
Write the description of the module here. You can use \*\*markdown\*\*\! This description should clearly explain what the package does.
91+
This library does not provide any error messages. That way the assertions can also be used in production code.
9292

93-
Example description: https://golang.org/src/encoding/gob/doc.go
93+
If you want a full\-featured testing framework, we recommend https://github.com/MarvinJWendt/testza \(which uses this library for assertions\)
9494

95+
## Index
96+
97+
- [func Contains\(a any, b any\) bool](<#Contains>)
98+
- [func ContainsAll\[T any\]\(a T, v \[\]T\) bool](<#ContainsAll>)
99+
- [func ContainsAny\[T any\]\(a T, v \[\]T\) bool](<#ContainsAny>)
100+
- [func ContainsNone\[T any\]\(a T, v \[\]T\) bool](<#ContainsNone>)
101+
- [func Equal\[T any\]\(a, b T\) bool](<#Equal>)
102+
- [func Implements\(a, iface any\) bool](<#Implements>)
103+
- [func Kind\(a any, kind reflect.Kind\) bool](<#Kind>)
104+
- [func Len\(a any, length int\) \(b bool\)](<#Len>)
105+
- [func Lowercase\(s string\) bool](<#Lowercase>)
106+
- [func Nil\(a any\) bool](<#Nil>)
107+
- [func Number\(a any\) bool](<#Number>)
108+
- [func Panic\(f func\(\)\) \(panicked bool\)](<#Panic>)
109+
- [func Range\[T constraints.Number\]\(a, minimum, maximum T\) bool](<#Range>)
110+
- [func Regex\(regex, s string\) bool](<#Regex>)
111+
- [func Unique\[T any\]\(s \[\]T\) bool](<#Unique>)
112+
- [func Uppercase\(s string\) bool](<#Uppercase>)
113+
- [func Zero\(a any\) bool](<#Zero>)
114+
115+
116+
<a name="Contains"></a>
117+
## func [Contains](<https://github.com/atomicgo/assert/blob/main/assert.go#L108>)
118+
119+
```go
120+
func Contains(a any, b any) bool
121+
```
122+
123+
Contains returns true if obj contains expectedLen.
124+
125+
<a name="ContainsAll"></a>
126+
## func [ContainsAll](<https://github.com/atomicgo/assert/blob/main/assert.go#L128>)
127+
128+
```go
129+
func ContainsAll[T any](a T, v []T) bool
130+
```
131+
132+
ContainsAll returns true if all values are contained in obj.
133+
134+
<a name="ContainsAny"></a>
135+
## func [ContainsAny](<https://github.com/atomicgo/assert/blob/main/assert.go#L139>)
95136

137+
```go
138+
func ContainsAny[T any](a T, v []T) bool
139+
```
96140

141+
ContainsAny returns true if any of the values are contained in obj.
97142

143+
<a name="ContainsNone"></a>
144+
## func [ContainsNone](<https://github.com/atomicgo/assert/blob/main/assert.go#L150>)
98145

99146
```go
100-
package main
147+
func ContainsNone[T any](a T, v []T) bool
148+
```
101149

102-
import (
103-
"fmt"
150+
ContainsNone returns true if none of the values are contained in obj.
104151

105-
"atomicgo.dev/template"
106-
)
152+
<a name="Equal"></a>
153+
## func [Equal](<https://github.com/atomicgo/assert/blob/main/assert.go#L12>)
107154

108-
func main() {
109-
fmt.Println(template.HelloWorld())
110-
}
155+
```go
156+
func Equal[T any](a, b T) bool
111157
```
112158

113-
#### Output
159+
Equal compares two values and returns true if they are equal.
160+
161+
<a name="Implements"></a>
162+
## func [Implements](<https://github.com/atomicgo/assert/blob/main/assert.go#L64>)
114163

164+
```go
165+
func Implements(a, iface any) bool
115166
```
116-
Hello, World!
167+
168+
Implements returns true if the value implements the interface.
169+
170+
<a name="Kind"></a>
171+
## func [Kind](<https://github.com/atomicgo/assert/blob/main/assert.go#L17>)
172+
173+
```go
174+
func Kind(a any, kind reflect.Kind) bool
117175
```
118176

177+
Kind returns true if the value is of the given kind.
119178

179+
<a name="Len"></a>
180+
## func [Len](<https://github.com/atomicgo/assert/blob/main/assert.go#L176>)
120181

121-
## Index
182+
```go
183+
func Len(a any, length int) (b bool)
184+
```
185+
186+
Len returns true if the length of the value is equal to the given length.
187+
188+
<a name="Lowercase"></a>
189+
## func [Lowercase](<https://github.com/atomicgo/assert/blob/main/assert.go#L166>)
190+
191+
```go
192+
func Lowercase(s string) bool
193+
```
122194

123-
- [func HelloWorld\(\) string](<#HelloWorld>)
195+
Lowercase returns true if the string is lowercase.
124196

197+
<a name="Nil"></a>
198+
## func [Nil](<https://github.com/atomicgo/assert/blob/main/assert.go#L22>)
125199

126-
<a name="HelloWorld"></a>
127-
## func [HelloWorld](<https://github.com/atomicgo/template/blob/main/template.go#L4>)
200+
```go
201+
func Nil(a any) bool
202+
```
203+
204+
Nil returns true if the value is nil.
205+
206+
<a name="Number"></a>
207+
## func [Number](<https://github.com/atomicgo/assert/blob/main/assert.go#L37>)
128208

129209
```go
130-
func HelloWorld() string
210+
func Number(a any) bool
131211
```
132212

133-
HelloWorld returns \`Hello, World\!\`.
213+
Number returns true if the value is obj number.
134214

215+
<a name="Panic"></a>
216+
## func [Panic](<https://github.com/atomicgo/assert/blob/main/assert.go#L79>)
135217

218+
```go
219+
func Panic(f func()) (panicked bool)
220+
```
136221

222+
Panic returns true if the function panics.
137223

224+
<a name="Range"></a>
225+
## func [Range](<https://github.com/atomicgo/assert/blob/main/assert.go#L54>)
138226

139227
```go
140-
package main
228+
func Range[T constraints.Number](a, minimum, maximum T) bool
229+
```
141230

142-
import (
143-
"fmt"
231+
Range returns true if the value is within the range.
144232

145-
"atomicgo.dev/template"
146-
)
233+
<a name="Regex"></a>
234+
## func [Regex](<https://github.com/atomicgo/assert/blob/main/assert.go#L171>)
147235

148-
func main() {
149-
fmt.Println(template.HelloWorld())
150-
}
236+
```go
237+
func Regex(regex, s string) bool
151238
```
152239

153-
#### Output
240+
Regex returns true if the string matches the regex.
241+
242+
<a name="Unique"></a>
243+
## func [Unique](<https://github.com/atomicgo/assert/blob/main/assert.go#L93>)
154244

245+
```go
246+
func Unique[T any](s []T) bool
155247
```
156-
Hello, World!
248+
249+
Unique returns true if the slice contains unique values. Items are considered unique if they are not deep equal.
250+
251+
<a name="Uppercase"></a>
252+
## func [Uppercase](<https://github.com/atomicgo/assert/blob/main/assert.go#L161>)
253+
254+
```go
255+
func Uppercase(s string) bool
157256
```
158257

258+
Uppercase returns true if the string is uppercase.
259+
260+
<a name="Zero"></a>
261+
## func [Zero](<https://github.com/atomicgo/assert/blob/main/assert.go#L59>)
262+
263+
```go
264+
func Zero(a any) bool
265+
```
159266

267+
Zero returns true if the value is the zero value.
160268

161269
Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
162270

0 commit comments

Comments
 (0)