Skip to content

Commit

Permalink
Remove constraints package (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
pellared committed Mar 9, 2023
1 parent 93b455c commit e201912
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ All notable changes to this library are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this library adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased](https://github.com/fluentassert/verify/compare/v1.0.0-rc.2...HEAD)
## [Unreleased](https://github.com/fluentassert/verify/compare/v1.0.0-rc.3...HEAD)

<!-- markdownlint-disable-next-line line-length -->
## [1.0.0-rc.3](https://github.com/fluentassert/verify/releases/tag/v1.0.0-rc.3) - 2023-03-09

### Removed

- Remove `constraints` package.

<!-- markdownlint-disable-next-line line-length -->
## [1.0.0-rc.2](https://github.com/fluentassert/verify/releases/tag/v1.0.0-rc.2) - 2023-02-24
Expand Down
14 changes: 0 additions & 14 deletions constraints/constraints.go

This file was deleted.

12 changes: 6 additions & 6 deletions number.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ package verify
import (
"fmt"
"math"

"github.com/fluentassert/verify/constraints"
)

// FluentNumber encapsulates assertions for numbers.
type FluentNumber[T constraints.Number] struct {
// FluentNumber encapsulates assertions for numbers
// that supports the operators < <= >= > + - * /.
type FluentNumber[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64] struct {
FluentOrdered[T]
}

// Number is used for testing numbers.
func Number[T constraints.Number](got T) FluentNumber[T] {
// Number is used for testing numbers
// that supports the operators < <= >= > + - * /.
func Number[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64](got T) FluentNumber[T] {
return FluentNumber[T]{FluentOrdered[T]{FluentObj[T]{FluentAny[T]{got}}}}
}

Expand Down
8 changes: 3 additions & 5 deletions ordered.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ package verify

import (
"fmt"

"github.com/fluentassert/verify/constraints"
)

// FluentOrdered encapsulates assertions for ordered object
// // that supports the operators < <= >= >.
type FluentOrdered[T constraints.Ordered] struct {
// that supports the operators < <= >= >.
type FluentOrdered[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string] struct {
FluentObj[T]
}

// Ordered is used for testing a ordered object
// that supports the operators < <= >= >.
func Ordered[T constraints.Ordered](got T) FluentOrdered[T] {
func Ordered[T ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64 | ~string](got T) FluentOrdered[T] {
return FluentOrdered[T]{FluentObj[T]{FluentAny[T]{got}}}
}

Expand Down

0 comments on commit e201912

Please sign in to comment.