You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oh this is going to be a big one. When I first started this challenge, I was fairly new to Elixir and the file structure for inputs was different. So to save myself some time figuring out the relativity of locations (maybe) I decided to use Macro and include it everywhere.
I recently restructured the input file locations (by moving them to /priv/input_files) and this makes it easier to just use functions. There are 97 modules that use the macro and the task is to replace them with function calls.
And then on tests, remove individual tests for run_1 and run_2 and make them a single run test. As an example -
THIS
defmoduleAdventOfCode.Y2020.Day01Testdo...test"Year 2020, Day 1, Part 1"doassertSolution.run_1()==1_014_624endtest"Year 2020, Day 1, Part 2"doassertSolution.run_2()==80_072_256endend
SHOULD BECOME THIS
defmoduleAdventOfCode.Y2020.Day01Testdo...test"Year 2020, Day 1"doassertSolution.run_1()=={1_014_624,80_072_256}end
Basically, use turns into alias and we add a new @input that is read_from_input(year, day) (which is in the use macro now).
After the change is done, we should ensure it didn't break anything by running mix test --only y151 (15 = 20(15) and 01 = day 01 -- days < 10 are 0 padded ). Thankfully, I had them test cases covered 🤓
In addition, we moved some common functionalities into Transformers module. Like String.split(&1, "\n") became Transformers.lines(). If while changing this, we encounter some of those, then we can change those as well.
I will be opening up PRs that solve fraction of these and add a checkbox in here.
Will add tool to visualize/find them here soon.
The text was updated successfully, but these errors were encountered:
Oh this is going to be a big one. When I first started this challenge, I was fairly new to Elixir and the file structure for inputs was different. So to save myself some time figuring out the relativity of locations (maybe) I decided to use Macro and include it everywhere.
I recently restructured the input file locations (by moving them to
/priv/input_files
) and this makes it easier to just use functions. There are97
modules that use the macro and the task is to replace them with function calls.As an example:
If we previously had:
They will now become:
And then on tests, remove individual tests for
run_1
andrun_2
and make them a singlerun
test. As an example -THIS
SHOULD BECOME THIS
Basically,
use
turns intoalias
and we add a new@input
that isread_from_input(year, day)
(which is in theuse
macro now).After the change is done, we should ensure it didn't break anything by running
mix test --only y151
(15 = 20(15) and 01 = day 01 -- days < 10 are 0 padded ). Thankfully, I had them test cases covered 🤓In addition, we moved some common functionalities into
Transformers
module. LikeString.split(&1, "\n")
becameTransformers.lines()
. If while changing this, we encounter some of those, then we can change those as well.I will be opening up PRs that solve fraction of these and add a checkbox in here.
Will add tool to visualize/find them here soon.
The text was updated successfully, but these errors were encountered: