Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Advent of Code Tests

on: [push, pull_request]

jobs:
rust_tests:
runs-on: ubuntu-latest
strategy:
matrix:
project:
- 2015
- 2018
- 2019/aoc_rust
- 2020/01
- 2021/_1
- 2021/_2
- 2021/_3
- 2021/_4
- 2021/_5
- 2021/_6
- 2021/_7
- 2022
steps:
- uses: actions/checkout@v4
- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable
if: ${{ matrix.project != '2021/_4' }}
- name: Install Rust Nightly for 2021/_4
uses: dtolnay/rust-toolchain@nightly
if: ${{ matrix.project == '2021/_4' }}
- name: Set up cargo-nextest
uses: taiki-e/install-action@nextest
- name: Build 2015 binary
if: ${{ matrix.project == '2015' }}
run: cargo build --release
working-directory: ${{ matrix.project }}
- name: Run Rust tests in 2015 with cargo-nextest
if: ${{ matrix.project == '2015' }}
run: cargo nextest run
working-directory: ${{ matrix.project }}
- name: Run Rust tests in ${{ matrix.project }}
if: ${{ matrix.project != '2015' }}
run: cargo test
working-directory: ${{ matrix.project }}

go_tests:
runs-on: ubuntu-latest
strategy:
matrix:
project:
- 2017
- 2019/go
- 2020/02
- 2024/golang
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '^1.18'
- name: Run Go tests in 2017
if: ${{ matrix.project == '2017' }}
run: go test ./...
working-directory: 2017
- name: Run Go tests in 2019/go
if: ${{ matrix.project == '2019/go' }}
run: go test ./cmd/...
working-directory: 2019/go
- name: Run Go tests in 2020/02
if: ${{ matrix.project == '2020/02' }}
run: go test ./...
working-directory: 2020/02
- name: Run Go tests in 2024/golang
if: ${{ matrix.project == '2024/golang' }}
run: go test ./cmd/...
working-directory: 2024/golang

csharp_tests:
runs-on: ubuntu-latest
strategy:
matrix:
project:
- 2021/cs/1
- 2021/cs/2
steps:
- uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Restore dependencies for ${{ matrix.project }}
run: dotnet restore
working-directory: ${{ matrix.project }}
- name: Run C# tests in ${{ matrix.project }}
run: dotnet test
working-directory: ${{ matrix.project }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions 2015/src/day26.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
pub fn first(content: String) -> i32 {
// Solution for part 1 of Day 26
0
}

pub fn solve_first(is_prod: bool) -> i32 {
let content = if is_prod {
include_str!("./inputs/26_prod.txt")
} else {
include_str!("./inputs/26_test.txt")
};
first(content.to_string())
}

pub fn second(content: String) -> i32 {
// Solution for part 2 of Day 26
0
}

pub fn solve_second(is_prod: bool) -> i32 {
let content = if is_prod {
include_str!("./inputs/26_prod.txt")
} else {
include_str!("./inputs/26_test.txt")
};
second(content.to_string())
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_26_first() {
assert_eq!(solve_first(false), 0);
}

#[test]
fn test_26_second() {
assert_eq!(solve_second(false), 0);
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions 2015/src/inputs/26_prod.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26_prod_data
1 change: 1 addition & 0 deletions 2015/src/inputs/26_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
26_test_data
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 26 additions & 25 deletions 2015/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
pub mod eighteenth;
pub mod eigth;
pub mod eleventh;
pub mod fifteenth;
pub mod fifth;
pub mod first;
pub mod fourteenth;
pub mod fourth;
pub mod nineteenth;
pub mod ninth;
pub mod second;
pub mod seventeenth;
pub mod seventh;
pub mod sixteenth;
pub mod sixth;
pub mod tenth;
pub mod thirteenth;
pub mod trird;
pub mod twelfth;
pub mod twentieth;
pub mod twentyfifth;
pub mod twentyfirst;
pub mod twentyfourth;
pub mod twentysecond;
pub mod twentythird;
pub mod day18;
pub mod day08;
pub mod day11;
pub mod day15;
pub mod day05;
pub mod day01;
pub mod day14;
pub mod day04;
pub mod day19;
pub mod day09;
pub mod day02;
pub mod day17;
pub mod day07;
pub mod day16;
pub mod day06;
pub mod day10;
pub mod day13;
pub mod day03;
pub mod day12;
pub mod day20;
pub mod day25;
pub mod day21;
pub mod day24;
pub mod day22;
pub mod day23;
pub mod day26;

struct Excercise {
content: String,
Expand Down
3 changes: 2 additions & 1 deletion CRUSH.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Due to the polyglot nature of this repository, build and test commands are speci

### Rust Projects

For Rust projects (identified by `Cargo.toml`):
For Rust projects (identified by `Cargo.toml`), you might need `libclang` development headers installed on your system for some dependencies.

- **Build**: `cargo build`
- **Run**: `cargo run`
- **Test**: `cargo test`
Expand Down
Loading