Further mix improvements

This commit is contained in:
bluepython508
2023-12-02 18:12:57 +00:00
parent cf508c9396
commit 70cf651767
2 changed files with 20 additions and 11 deletions

View File

@@ -3,14 +3,18 @@ defmodule Mix.Tasks.Aoc do
import Aoc2023.Common import Aoc2023.Common
defp module(1), do: Aoc2023.Day1 defp module(1), do: Aoc2023.Day1
defp module(2), do: Aoc2023.Day2
# [MODULE INSERTION POINT] # [MODULE INSERTION POINT]
defp base_dir(), do: System.get_env("AOC_BASE") defp base_dir(), do: System.get_env("AOC_BASE")
defp tests(day) do defp tests(day) do
case File.ls(tests_dir(day)) do case File.ls(tests_dir(day)) do
{:ok, paths} -> paths |> Enum.filter(&(not String.contains?(&1, "."))) {:ok, paths} ->
{:error, e} -> dbg(e) paths |> Enum.filter(&(not String.contains?(&1, ".")))
{:error, e} ->
dbg(e)
[] []
end end
end end
@@ -65,10 +69,10 @@ defmodule Mix.Tasks.Aoc do
input input
end end
def part1(input) do def part1(_input) do
end end
def part2(input) do def part2(_input) do
end end
end end
""") """)
@@ -110,6 +114,8 @@ defmodule Mix.Tasks.Aoc do
if stringify(p1) != p1e do if stringify(p1) != p1e do
IO.puts("Failed at #{test}.1: expected #{p1e}, got:") IO.puts("Failed at #{test}.1: expected #{p1e}, got:")
dbg(p1) dbg(p1)
else
IO.puts("Test #{test}.1 succeeded")
end end
else else
IO.puts("Test #{test}.1") IO.puts("Test #{test}.1")
@@ -122,6 +128,8 @@ defmodule Mix.Tasks.Aoc do
if stringify(p2) != p2e do if stringify(p2) != p2e do
IO.puts("Failed at #{test}.2: expected #{p2e}, got:") IO.puts("Failed at #{test}.2: expected #{p2e}, got:")
dbg(p2) dbg(p2)
else
IO.puts("Test #{test}.2 succeeded")
end end
else else
IO.puts("Test #{test}.2") IO.puts("Test #{test}.2")

View File

@@ -5,10 +5,11 @@
elixir, elixir,
elixir-ls, elixir-ls,
inotify-tools, inotify-tools,
entr,
}: }:
mkShell { mkShell {
packages = packages =
[elixir elixir-ls] [elixir elixir-ls entr]
++ lib.lists.optional (pkgs.system == "x86_64-linux") inotify-tools ++ lib.lists.optional (pkgs.system == "x86_64-linux") inotify-tools
++ lib.lists.optionals (pkgs.system == "aarch64-darwin") (with pkgs.darwin.apple_sdk.frameworks; [ ++ lib.lists.optionals (pkgs.system == "aarch64-darwin") (with pkgs.darwin.apple_sdk.frameworks; [
CoreFoundation CoreFoundation