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:
+3
-2
@@ -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>
|
||||
|
||||
@@ -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
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user