Skip to content

Commit

Permalink
use helper to get uint64 pointers in test
Browse files Browse the repository at this point in the history
  • Loading branch information
chris124567 authored and ChrisSchinnerl committed Feb 11, 2025
1 parent 5123493 commit eb514ab
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions persist/sqlite/hosts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ func TestQueryHosts(t *testing.T) {
t.Fatal(err)
}

uint64Ptr := func(x uint64) *uint64 {
return &x
}
trueBool, falseBool := true, false
tests := []struct {
name string
Expand Down Expand Up @@ -423,11 +426,8 @@ func TestQueryHosts(t *testing.T) {
{
name: "v1 min duration 1000",
query: explorer.HostQuery{
V2: &falseBool,
MinDuration: func() *uint64 {
x := uint64(1000)
return &x
}(),
V2: &falseBool,
MinDuration: uint64Ptr(1000),
},
sortBy: explorer.HostSortAcceptingContracts,
dir: explorer.HostSortDesc,
Expand All @@ -436,11 +436,8 @@ func TestQueryHosts(t *testing.T) {
{
name: "v1 min duration 5000",
query: explorer.HostQuery{
V2: &falseBool,
MinDuration: func() *uint64 {
x := uint64(5000)
return &x
}(),
V2: &falseBool,
MinDuration: uint64Ptr(5000),
},
sortBy: explorer.HostSortAcceptingContracts,
dir: explorer.HostSortDesc,
Expand All @@ -449,11 +446,8 @@ func TestQueryHosts(t *testing.T) {
{
name: "v2 min duration 1000",
query: explorer.HostQuery{
V2: &trueBool,
MinDuration: func() *uint64 {
x := uint64(1000)
return &x
}(),
V2: &trueBool,
MinDuration: uint64Ptr(1000),
},
sortBy: explorer.HostSortAcceptingContracts,
dir: explorer.HostSortDesc,
Expand All @@ -462,11 +456,8 @@ func TestQueryHosts(t *testing.T) {
{
name: "v2 min duration 5000",
query: explorer.HostQuery{
V2: &trueBool,
MinDuration: func() *uint64 {
x := uint64(5000)
return &x
}(),
V2: &trueBool,
MinDuration: uint64Ptr(5000),
},
sortBy: explorer.HostSortAcceptingContracts,
dir: explorer.HostSortDesc,
Expand Down

0 comments on commit eb514ab

Please sign in to comment.