Add general fixes

- Fix compile warnings in old solutions
- Fix makegen not generating Release mode with optimization
- Fix makegen generating executables in different directories for
  Release and Debug
- Add time elapsed for single day tests
This commit is contained in:
Thraix
2025-12-03 21:25:52 +01:00
parent f7e7f25ba4
commit cab1cf5a07
4 changed files with 13 additions and 5 deletions
+3 -2
View File
@@ -2,7 +2,8 @@
<configuration name="Release">
<generatehfile>false</generatehfile>
<includedir>src/</includedir>
<outputdir>bin/</outputdir>
<cflag>-O3</cflag>
<outputdir>bin/Release</outputdir>
<outputname>adventofcode.out</outputname>
<outputtype>executable</outputtype>
<projectname>AdventOfCode</projectname>
@@ -12,7 +13,7 @@
<generatehfile>false</generatehfile>
<includedir>src/</includedir>
<cflag>-g</cflag>
<outputdir>bin/</outputdir>
<outputdir>bin/Debug/</outputdir>
<outputname>adventofcode.out</outputname>
<outputtype>executable</outputtype>
<projectname>AdventOfCode</projectname>
+2
View File
@@ -35,6 +35,8 @@ namespace y2023::day10
case Direction::West:
return Index2D{position.x - 1, position.y};
}
std::cerr << "Reached unreachable code" << std::endl;
abort();
}
Direction GetNextDirection(const Array2D<char>& map, Index2D position, Direction prevDirection)
+2 -1
View File
@@ -107,7 +107,8 @@ namespace y2023::day13
map.Set(x, y, c);
}
}
std::cout << "here" << std::endl;
std::cerr << "Reached unreachable code" << std::endl;
abort();
}
// Too low: 35441
+6 -2
View File
@@ -127,12 +127,14 @@ namespace aoc
std::cout << TERM_RED << "Could not find input file: " << test->GetInputFile() << TERM_CLEAR << std::endl;
return false;
}
Timer timer{};
std::string testName = name + ".P" + std::to_string(test->GetPart()) + "." + test->GetName();
std::cout << TERM_GREEN << "[ RUN ] " << TERM_CLEAR << testName << std::endl;
InputType input = ReadInput(inputStream);
OutputType output = test->GetPart() == 1 ? Output1(input) : Output2(input);
timer.Stop();
if (!Check(test->GetExpectedOutput(), output, testName))
if (!Check(test->GetExpectedOutput(), output, testName, timer.Elapsed()))
{
return false;
};
@@ -150,10 +152,12 @@ namespace aoc
virtual OutputType Output2(const InputType& input) = 0;
private:
bool Check(const OutputType& expected, const OutputType& actual, const std::string& name) const
bool Check(const OutputType& expected, const OutputType& actual, const std::string& name, double elapsedTime) const
{
if (expected == actual)
{
std::cout << TERM_GREEN << "[ ] " << TERM_CLEAR << " Took: " << elapsedTime << " seconds"
<< std::endl;
std::cout << TERM_GREEN << "[ OK ] " << TERM_CLEAR << " Result: " << actual << std::endl;
return true;
}