mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-04-19 11:13:48 +01:00
Compare commits
No commits in common. "c3fa7d0ff8cbcfea07f7b797f6ecb75064594f28" and "588561be7c05a63d6cecc9c561d91e60303f38c4" have entirely different histories.
c3fa7d0ff8
...
588561be7c
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,7 +7,6 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
bin/
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
*.test
|
||||
|
@ -1,6 +0,0 @@
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-01/internal/one
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkMain-12 1000000000 0.0006628 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-01/internal/one 0.009s
|
@ -1,15 +0,0 @@
|
||||
package one
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
//go:embed testdata/input.txt
|
||||
var data []byte
|
||||
|
||||
func BenchmarkMain(b *testing.B) {
|
||||
os.Stdout, _ = os.Open(os.DevNull)
|
||||
Solve(data)
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-01/internal/two
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkMain-12 1000000000 0.001179 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-01/internal/two 0.011s
|
@ -10,7 +10,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
problems "github.com/onyx-and-iris/aoc2024/day-01"
|
||||
"github.com/onyx-and-iris/aoc2024/day-01/internal/one"
|
||||
"github.com/onyx-and-iris/aoc2024/day-01/internal/two"
|
||||
)
|
||||
|
||||
//go:embed testdata
|
||||
@ -25,5 +26,15 @@ func main() {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
problems.Solve(data)
|
||||
val, err := one.Solve(data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("solution one: %d\n", val)
|
||||
|
||||
val, err = two.Solve(data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("solution two: %d\n", val)
|
||||
}
|
@ -1,15 +1,11 @@
|
||||
package two
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
//go:embed testdata/input.txt
|
||||
var data []byte
|
||||
|
||||
func BenchmarkMain(b *testing.B) {
|
||||
os.Stdout, _ = os.Open(os.DevNull)
|
||||
Solve(data)
|
||||
main()
|
||||
}
|
@ -16,12 +16,10 @@ vet: fmt
|
||||
$(GO) vet ./...
|
||||
|
||||
build: vet | $(BIN_DIR)
|
||||
$(GO) build -o $(EXE) ./cmd/cli/
|
||||
$(GO) build -o $(EXE) .
|
||||
|
||||
bench:
|
||||
$(GO) test ./internal/one/ -bench=. > internal/one/benchmark
|
||||
$(GO) test ./internal/two/ -bench=. > internal/two/benchmark
|
||||
$(GO) test . -count=10 -bench=. > benchmark
|
||||
$(GO) test . -test.count=10 -bench=. > benchmark
|
||||
|
||||
$(BIN_DIR):
|
||||
@mkdir -p $@
|
||||
|
@ -1,23 +0,0 @@
|
||||
package day01
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/onyx-and-iris/aoc2024/day-01/internal/one"
|
||||
"github.com/onyx-and-iris/aoc2024/day-01/internal/two"
|
||||
)
|
||||
|
||||
func Solve(data []byte) {
|
||||
val, err := one.Solve(data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("solution one: %d\n", val)
|
||||
|
||||
val, err = two.Solve(data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("solution two: %d\n", val)
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package day01
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
//go:embed testdata/input.txt
|
||||
var data []byte
|
||||
|
||||
func BenchmarkMain(b *testing.B) {
|
||||
os.Stdout, _ = os.Open(os.DevNull)
|
||||
Solve(data)
|
||||
}
|
@ -7,8 +7,7 @@ if [ -d day-"$name" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$name"/cmd/cli/testdata \
|
||||
"$name"/testdata "$name"/internal/one/testdata "$name"/internal/two/testdata
|
||||
mkdir -p "$name"/testdata
|
||||
touch "$name"/makefile
|
||||
|
||||
cat <<EOT >> "$name"/makefile
|
||||
@ -33,9 +32,7 @@ build: vet | \$(BIN_DIR)
|
||||
\$(GO) build -o \$(EXE) ./\$(SRC_DIR)
|
||||
|
||||
bench:
|
||||
\$(GO) test ./internal/one/ -bench=. > internal/one/benchmark
|
||||
\$(GO) test ./internal/two/ -bench=. > internal/two/benchmark
|
||||
\$(GO) test . -count=10 -bench=. > benchmark
|
||||
\$(GO) test . -test.count=10 -bench=. > benchmark
|
||||
|
||||
\$(BIN_DIR):
|
||||
@mkdir -p \$@
|
||||
@ -44,7 +41,7 @@ clean:
|
||||
@rm -rv \$(BIN_DIR)
|
||||
EOT
|
||||
|
||||
cat <<EOT >> "$name"/cmd/cli/main.go
|
||||
cat <<EOT >> "$name"/solution.go
|
||||
/********************************************************************************
|
||||
Advent of Code 2024 - $name
|
||||
********************************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user