Skip to content

Commit

Permalink
Remove range checks already carried out by the type system
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisPH3 committed Jul 15, 2024
1 parent bafd388 commit 9185697
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions go/ct/gen/interval_solver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,21 +279,21 @@ func TestInterval_isEmpty(t *testing.T) {
}
}

func TestIntervalSolver_uint64fullrangeAndEdges(t *testing.T) {
func TestIntervalSolver_uint64FullRangeAndEdges(t *testing.T) {

tests := map[string]struct {
setup func(*IntervalSolver[uint64])
check func(uint64) bool
}{
"full-range": {
setup: func(s *IntervalSolver[uint64]) {},
check: func(v uint64) bool { return v >= 0 && v <= math.MaxUint64 }},
check: func(v uint64) bool { return true }}, // this tests that does not return err
"remove-zero": {
setup: func(s *IntervalSolver[uint64]) { s.Exclude(0, 0) },
check: func(v uint64) bool { return v > 0 && v < math.MaxUint64 }},
"remove-max": {
setup: func(s *IntervalSolver[uint64]) { s.Exclude(math.MaxUint64, math.MaxUint64) },
check: func(v uint64) bool { return v >= 0 && v < math.MaxUint64-1 }},
check: func(v uint64) bool { return v != math.MaxUint64 }},
"fix-max": {
setup: func(s *IntervalSolver[uint64]) { s.AddEqualityConstraint(math.MaxUint64) },
check: func(v uint64) bool { return v == math.MaxUint64 }},
Expand Down Expand Up @@ -321,18 +321,21 @@ func TestIntervalSolver_uint64fullrangeAndEdges(t *testing.T) {
}
}

func TestIntervalSolver_int64fullrangeAndEdges(t *testing.T) {
func TestIntervalSolver_int64FullRangeAndEdges(t *testing.T) {

tests := map[string]struct {
setup func(*IntervalSolver[int64])
check func(int64) bool
}{
"full-range": {
setup: func(s *IntervalSolver[int64]) {},
check: func(v int64) bool { return v >= math.MinInt64 && v <= math.MaxInt64 }},
check: func(v int64) bool { return true }}, // this tests that does not return err
"remove-min": {
setup: func(s *IntervalSolver[int64]) { s.Exclude(math.MinInt64, math.MinInt64) },
check: func(v int64) bool { return v != math.MaxInt64 }},
"remove-zero": {
setup: func(s *IntervalSolver[int64]) { s.Exclude(0, 0) },
check: func(v int64) bool { return v != 0 }},
"remove-max": {
setup: func(s *IntervalSolver[int64]) { s.Exclude(math.MaxInt64, math.MaxInt64) },
check: func(v int64) bool { return v != math.MaxInt64 }},
Expand All @@ -342,9 +345,6 @@ func TestIntervalSolver_int64fullrangeAndEdges(t *testing.T) {
"remove-all-negative": {
setup: func(s *IntervalSolver[int64]) { s.Exclude(math.MinInt64, 0) },
check: func(v int64) bool { return v > 0 }},
"remove-zero": {
setup: func(s *IntervalSolver[int64]) { s.Exclude(0, 0) },
check: func(v int64) bool { return v != 0 }},
"fix-max": {
setup: func(s *IntervalSolver[int64]) { s.AddEqualityConstraint(math.MaxInt64) },
check: func(v int64) bool { return v == math.MaxInt64 }},
Expand Down

0 comments on commit 9185697

Please sign in to comment.