Skip to content

Commit

Permalink
global improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dbut2 committed Dec 3, 2024
1 parent c8a7cd8 commit b530c8b
Show file tree
Hide file tree
Showing 65 changed files with 341 additions and 530 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ on:

jobs:
build-current:
name: "Build Current Year"
name: Build and Run
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod

- name: Build all Go files
run: |
find ./2023 -name "*.go" -exec go build {} \;
find ./2024 -name "*.go" -exec go build {} \;
find ./2023 -name "*.go" -exec go build -o /dev/null {} \;
find ./2024 -name "*.go" -exec go build -o /dev/null {} \;
- name: Run all Go files
run: |
Expand Down
3 changes: 2 additions & 1 deletion 2020/10/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package main
import (
_ "embed"
"fmt"
"strings"

"github.com/dbut2/advent-of-code/pkg/math"
"github.com/dbut2/advent-of-code/pkg/sti"
"github.com/dbut2/advent-of-code/pkg/utils"
"strings"
)

//go:embed input.txt
Expand Down
2 changes: 1 addition & 1 deletion 2021/01/1.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func main() {
continue
}

if v > ints[i - 1] {
if v > ints[i-1] {
c++
}
}
Expand Down
2 changes: 1 addition & 1 deletion 2021/02/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func main() {
switch i.d {
case forward:
h += i.n
d += i.n*a
d += i.n * a
case up:
a -= i.n
case down:
Expand Down
11 changes: 4 additions & 7 deletions 2023/01/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import (
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Tester.Expect(1, 142)
h := harness.New(solve, inputs)
h.Expect(1, 142)
h.Run()
}

Expand Down
11 changes: 4 additions & 7 deletions 2023/01/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ import (
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Tester.Expect(2, 281)
h := harness.New(solve, inputs)
h.Expect(2, 281)
h.Run()
}

Expand Down
23 changes: 8 additions & 15 deletions 2023/02/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@ package main
import (
"embed"
_ "embed"
"fmt"
"github.com/dbut2/advent-of-code/pkg/benchmark"
"github.com/dbut2/advent-of-code/pkg/sti"
"strings"

"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/sti"

"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(1, 8)
fmt.Println(solve(input))
benchmark.Run(func() {
solve(input)
}, benchmark.Count(1000))
h := harness.New(solve, inputs)
h.Expect(1, 8)
h.Run()
}

func solve(input string) int {
Expand Down
22 changes: 7 additions & 15 deletions 2023/02/01v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@ package main
import (
"embed"
_ "embed"
"fmt"
"github.com/dbut2/advent-of-code/pkg/benchmark"
"github.com/dbut2/advent-of-code/pkg/test"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/utils"
"time"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(1, 8)
fmt.Println(solve(input))
benchmark.Run(func() {
solve(input)
}, benchmark.Time(time.Second))
h := harness.New(solve, inputs)
h.Expect(1, 8)
h.Run()
}

func solve(input string) int {
Expand Down
23 changes: 8 additions & 15 deletions 2023/02/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@ package main
import (
"embed"
_ "embed"
"fmt"
"github.com/dbut2/advent-of-code/pkg/benchmark"
"github.com/dbut2/advent-of-code/pkg/sti"
"strings"

"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/sti"

"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(2, 2286)
fmt.Println(solve(input))
benchmark.Run(func() {
solve(input)
}, benchmark.Count(1000))
h := harness.New(solve, inputs)
h.Expect(2, 2286)
h.Run()
}

func solve(input string) int {
Expand Down
21 changes: 7 additions & 14 deletions 2023/02/02v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,18 @@ package main
import (
"embed"
_ "embed"
"fmt"
"github.com/dbut2/advent-of-code/pkg/benchmark"
"github.com/dbut2/advent-of-code/pkg/test"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(2, 2286)
fmt.Println(solve(input))
benchmark.Run(func() {
solve(input)
}, benchmark.Count(1000))
h := harness.New(solve, inputs)
h.Expect(2, 2286)
h.Run()
}

func solve(input string) int {
Expand Down
16 changes: 6 additions & 10 deletions 2023/03/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@ package main
import (
"embed"
_ "embed"
"fmt"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/sets"
"github.com/dbut2/advent-of-code/pkg/space"
"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(1, 4361)
fmt.Println(solve(input))
h := harness.New(solve, inputs)
h.Expect(1, 4361)
h.Run()
}

func solve(input string) int {
Expand Down
16 changes: 6 additions & 10 deletions 2023/03/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,20 @@ package main
import (
"embed"
_ "embed"
"fmt"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/sets"
"github.com/dbut2/advent-of-code/pkg/space"
"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(2, 467835)
fmt.Println(solve(input))
h := harness.New(solve, inputs)
h.Expect(2, 467835)
h.Run()
}

func solve(input string) int {
Expand Down
16 changes: 6 additions & 10 deletions 2023/04/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ package main
import (
"embed"
_ "embed"
"fmt"
"strings"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/lists"
"github.com/dbut2/advent-of-code/pkg/math"
strings2 "github.com/dbut2/advent-of-code/pkg/strings"
"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(1, 13)
fmt.Println(solve(input))
h := harness.New(solve, inputs)
h.Expect(1, 13)
h.Run()
}

func solve(input string) int {
Expand Down
16 changes: 6 additions & 10 deletions 2023/04/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,21 @@ package main
import (
"embed"
_ "embed"
"fmt"
"strings"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/lists"
strings2 "github.com/dbut2/advent-of-code/pkg/strings"
"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(2, 30)
fmt.Println(solve(input))
h := harness.New(solve, inputs)
h.Expect(2, 30)
h.Run()
}

func solve(input string) int {
Expand Down
16 changes: 6 additions & 10 deletions 2023/05/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@ package main

import (
"embed"
"fmt"
"strings"

"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/math"
"github.com/dbut2/advent-of-code/pkg/sti"
"github.com/dbut2/advent-of-code/pkg/test"
"github.com/dbut2/advent-of-code/pkg/utils"
)

//go:embed input.txt
var input string

//go:embed test*.txt
var tests embed.FS
//go:embed *.txt
var inputs embed.FS

func main() {
t := test.Register(tests, solve)
t.Expect(1, 35)
fmt.Println(solve(input))
h := harness.New(solve, inputs)
h.Expect(1, 35)
h.Run()
}

func solve(input string) int {
Expand Down
Loading

0 comments on commit b530c8b

Please sign in to comment.