Giter Club home page Giter Club logo

aoc2021's Introduction

go test

Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

This repo contains my solutions for this year's Advent of Code problem sets, written in Go. No one-liners here—we're doing this the hard way! I've organized each day's problem sets into Go modules and wrote a simple runner in main.go to quickly iterate on the solutions.

I haven't used Go in a while, so I'm relearning the module system. I have a feeling that this project can be better organized. Suggestions are welcome :).

I've also included unit tests which run on every git push via GitHub Actions—this makes the badge above all nice and green.

Howto

  1. Each day has an associated problem set. Use make init to generate all the required files for each day. For example:

    make init FOLDER=day3
  2. Add new case statements in main.go.

  3. Start writing code in the ${DAY} folder.

  4. When you're ready to test, add unit tests in the ${DAY} folder. Use day1/part2_test.go as a template, and add a line to the test rule in Makefile. Afterwards, run tests with make test. E.g.:

    $ make test
    go test github.com/dlo/aoc2021/day1 -cover
    ok      github.com/dlo/aoc2021/day1     0.234s  coverage: 100.0% of statements
    go test github.com/dlo/aoc2021/utils -cover
    ok      github.com/dlo/aoc2021/utils    (cached)        coverage: 12.1% of statements
  5. Run the command for a specific day:

    $ go build
    $ ./aoc2021 --day 1 --part 1 --filename input.txt // Reads from day01/testdata/input.txt

aoc2021's People

Contributors

dlo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.