Skip to content

Commit 55f4d8d

Browse files
docs: autoupdate
1 parent 49b7911 commit 55f4d8d

1 file changed

Lines changed: 161 additions & 52 deletions

File tree

README.md

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

18-
<h1 align="center">AtomicGo | template</h1>
18+
<p align="center">
19+
<img src="https://raw.githubusercontent.com/atomicgo/atomicgo/main/assets/header.png" alt="AtomicGo">
20+
</p>
21+
22+
</br>
23+
</br>
24+
25+
<h1 align="center">AtomicGo | assert</h1>
1926

2027
<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">
28+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fatomicgo.dev%2Fapi%2Fshields%2Fassert&style=flat-square" alt="Downloads">
2229

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">
30+
<a href="https://github.com/atomicgo/assert/releases">
31+
<img src="https://img.shields.io/github/v/release/atomicgo/assert?style=flat-square" alt="Latest Release">
2532
</a>
2633

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">
34+
<a href="https://codecov.io/gh/atomicgo/assert" target="_blank">
35+
<img src="https://img.shields.io/github/actions/workflow/status/atomicgo/assert/go.yml?style=flat-square" alt="Tests">
2936
</a>
3037

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">
38+
<a href="https://codecov.io/gh/atomicgo/assert" target="_blank">
39+
<img src="https://img.shields.io/codecov/c/gh/atomicgo/assert?color=magenta&logo=codecov&style=flat-square" alt="Coverage">
3340
</a>
3441

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 -->
42+
<a href="https://codecov.io/gh/atomicgo/assert">
43+
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-162-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
3744
</a>
3845

3946
<a href="https://opensource.org/licenses/MIT" target="_blank">
4047
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT">
4148
</a>
4249

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">
50+
<a href="https://goreportcard.com/report/github.com/atomicgo/assert" target="_blank">
51+
<img src="https://goreportcard.com/badge/github.com/atomicgo/assert?style=flat-square" alt="Go report">
4552
</a>
4653

4754
</p>
4855

4956
---
5057

5158
<p align="center">
52-
<strong><a href="https://pkg.go.dev/atomicgo.dev/template#section-documentation" target="_blank">Documentation</a></strong>
59+
<strong><a href="https://pkg.go.dev/atomicgo.dev/assert#section-documentation" target="_blank">Documentation</a></strong>
5360
|
5461
<strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CONTRIBUTING.md" target="_blank">Contributing</a></strong>
5562
|
@@ -58,19 +65,13 @@
5865

5966
---
6067

61-
62-
63-
<p align="center">
64-
<img src="https://raw.githubusercontent.com/atomicgo/atomicgo/main/assets/header.png" alt="AtomicGo">
65-
</p>
66-
6768
<p align="center">
6869
<table>
6970
<tbody>
7071
</tbody>
7172
</table>
7273
</p>
73-
<h3 align="center"><pre>go get atomicgo.dev/template</pre></h3>
74+
<h3 align="center"><pre>go get atomicgo.dev/assert</pre></h3>
7475
<p align="center">
7576
<table>
7677
<tbody>
@@ -82,83 +83,191 @@
8283

8384
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
8485

85-
# template
86+
# assert
8687

8788
```go
88-
import "atomicgo.dev/template"
89+
import "atomicgo.dev/assert"
8990
```
9091

91-
Package template is used to generate new AtomicGo repositories.
92+
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.
9293

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

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

98+
## Index
9799

100+
- [func Contains\(a any, b any\) bool](<#Contains>)
101+
- [func ContainsAll\[T any\]\(a T, v \[\]T\) bool](<#ContainsAll>)
102+
- [func ContainsAny\[T any\]\(a T, v \[\]T\) bool](<#ContainsAny>)
103+
- [func ContainsNone\[T any\]\(a T, v \[\]T\) bool](<#ContainsNone>)
104+
- [func Equal\[T any\]\(a, b T\) bool](<#Equal>)
105+
- [func Implements\(a, iface any\) bool](<#Implements>)
106+
- [func Kind\(a any, kind reflect.Kind\) bool](<#Kind>)
107+
- [func Len\(a any, length int\) \(b bool\)](<#Len>)
108+
- [func Lowercase\(s string\) bool](<#Lowercase>)
109+
- [func Nil\(a any\) bool](<#Nil>)
110+
- [func Number\(a any\) bool](<#Number>)
111+
- [func Panic\(f func\(\)\) \(panicked bool\)](<#Panic>)
112+
- [func Range\[T constraints.Number\]\(a, minimum, maximum T\) bool](<#Range>)
113+
- [func Regex\(regex, s string\) bool](<#Regex>)
114+
- [func Unique\[T any\]\(s \[\]T\) bool](<#Unique>)
115+
- [func Uppercase\(s string\) bool](<#Uppercase>)
116+
- [func Zero\(a any\) bool](<#Zero>)
117+
118+
119+
<a name="Contains"></a>
120+
## func [Contains](<https://github.com/atomicgo/assert/blob/main/assert.go#L108>)
121+
122+
```go
123+
func Contains(a any, b any) bool
124+
```
98125

126+
Contains returns true if obj contains expectedLen.
99127

128+
<a name="ContainsAll"></a>
129+
## func [ContainsAll](<https://github.com/atomicgo/assert/blob/main/assert.go#L128>)
100130

101131
```go
102-
package main
132+
func ContainsAll[T any](a T, v []T) bool
133+
```
103134

104-
import (
105-
"fmt"
135+
ContainsAll returns true if all values are contained in obj.
106136

107-
"atomicgo.dev/template"
108-
)
137+
<a name="ContainsAny"></a>
138+
## func [ContainsAny](<https://github.com/atomicgo/assert/blob/main/assert.go#L139>)
109139

110-
func main() {
111-
fmt.Println(template.HelloWorld())
112-
}
140+
```go
141+
func ContainsAny[T any](a T, v []T) bool
113142
```
114143

115-
#### Output
144+
ContainsAny returns true if any of the values are contained in obj.
116145

146+
<a name="ContainsNone"></a>
147+
## func [ContainsNone](<https://github.com/atomicgo/assert/blob/main/assert.go#L150>)
148+
149+
```go
150+
func ContainsNone[T any](a T, v []T) bool
117151
```
118-
Hello, World!
152+
153+
ContainsNone returns true if none of the values are contained in obj.
154+
155+
<a name="Equal"></a>
156+
## func [Equal](<https://github.com/atomicgo/assert/blob/main/assert.go#L12>)
157+
158+
```go
159+
func Equal[T any](a, b T) bool
119160
```
120161

162+
Equal compares two values and returns true if they are equal.
121163

164+
<a name="Implements"></a>
165+
## func [Implements](<https://github.com/atomicgo/assert/blob/main/assert.go#L64>)
122166

123-
## Index
167+
```go
168+
func Implements(a, iface any) bool
169+
```
170+
171+
Implements returns true if the value implements the interface.
124172

125-
- [func HelloWorld\(\) string](<#HelloWorld>)
173+
<a name="Kind"></a>
174+
## func [Kind](<https://github.com/atomicgo/assert/blob/main/assert.go#L17>)
175+
176+
```go
177+
func Kind(a any, kind reflect.Kind) bool
178+
```
126179

180+
Kind returns true if the value is of the given kind.
127181

128-
<a name="HelloWorld"></a>
129-
## func [HelloWorld](<https://github.com/atomicgo/template/blob/main/template.go#L4>)
182+
<a name="Len"></a>
183+
## func [Len](<https://github.com/atomicgo/assert/blob/main/assert.go#L176>)
130184

131185
```go
132-
func HelloWorld() string
186+
func Len(a any, length int) (b bool)
133187
```
134188

135-
HelloWorld returns \`Hello, World\!\`.
189+
Len returns true if the length of the value is equal to the given length.
136190

191+
<a name="Lowercase"></a>
192+
## func [Lowercase](<https://github.com/atomicgo/assert/blob/main/assert.go#L166>)
137193

194+
```go
195+
func Lowercase(s string) bool
196+
```
138197

198+
Lowercase returns true if the string is lowercase.
139199

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

141203
```go
142-
package main
204+
func Nil(a any) bool
205+
```
143206

144-
import (
145-
"fmt"
207+
Nil returns true if the value is nil.
146208

147-
"atomicgo.dev/template"
148-
)
209+
<a name="Number"></a>
210+
## func [Number](<https://github.com/atomicgo/assert/blob/main/assert.go#L37>)
149211

150-
func main() {
151-
fmt.Println(template.HelloWorld())
152-
}
212+
```go
213+
func Number(a any) bool
153214
```
154215

155-
#### Output
216+
Number returns true if the value is obj number.
156217

218+
<a name="Panic"></a>
219+
## func [Panic](<https://github.com/atomicgo/assert/blob/main/assert.go#L79>)
220+
221+
```go
222+
func Panic(f func()) (panicked bool)
157223
```
158-
Hello, World!
224+
225+
Panic returns true if the function panics.
226+
227+
<a name="Range"></a>
228+
## func [Range](<https://github.com/atomicgo/assert/blob/main/assert.go#L54>)
229+
230+
```go
231+
func Range[T constraints.Number](a, minimum, maximum T) bool
232+
```
233+
234+
Range returns true if the value is within the range.
235+
236+
<a name="Regex"></a>
237+
## func [Regex](<https://github.com/atomicgo/assert/blob/main/assert.go#L171>)
238+
239+
```go
240+
func Regex(regex, s string) bool
159241
```
160242

243+
Regex returns true if the string matches the regex.
244+
245+
<a name="Unique"></a>
246+
## func [Unique](<https://github.com/atomicgo/assert/blob/main/assert.go#L93>)
247+
248+
```go
249+
func Unique[T any](s []T) bool
250+
```
251+
252+
Unique returns true if the slice contains unique values. Items are considered unique if they are not deep equal.
253+
254+
<a name="Uppercase"></a>
255+
## func [Uppercase](<https://github.com/atomicgo/assert/blob/main/assert.go#L161>)
256+
257+
```go
258+
func Uppercase(s string) bool
259+
```
260+
261+
Uppercase returns true if the string is uppercase.
262+
263+
<a name="Zero"></a>
264+
## func [Zero](<https://github.com/atomicgo/assert/blob/main/assert.go#L59>)
265+
266+
```go
267+
func Zero(a any) bool
268+
```
161269

270+
Zero returns true if the value is the zero value.
162271

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

@@ -169,4 +278,4 @@ Generated by [gomarkdoc](<https://github.com/princjef/gomarkdoc>)
169278

170279
> [AtomicGo.dev](https://atomicgo.dev) &nbsp;&middot;&nbsp;
171280
> with ❤️ by [@MarvinJWendt](https://github.com/MarvinJWendt) |
172-
> [MarvinJWendt.com](https://marvinjwendt.com)
281+
> [mjw.dev](https://mjw.dev)

0 commit comments

Comments
 (0)