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">
|
<configuration name="Release">
|
||||||
<generatehfile>false</generatehfile>
|
<generatehfile>false</generatehfile>
|
||||||
<includedir>src/</includedir>
|
<includedir>src/</includedir>
|
||||||
<outputdir>bin/</outputdir>
|
<cflag>-O3</cflag>
|
||||||
|
<outputdir>bin/Release</outputdir>
|
||||||
<outputname>adventofcode.out</outputname>
|
<outputname>adventofcode.out</outputname>
|
||||||
<outputtype>executable</outputtype>
|
<outputtype>executable</outputtype>
|
||||||
<projectname>AdventOfCode</projectname>
|
<projectname>AdventOfCode</projectname>
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
<generatehfile>false</generatehfile>
|
<generatehfile>false</generatehfile>
|
||||||
<includedir>src/</includedir>
|
<includedir>src/</includedir>
|
||||||
<cflag>-g</cflag>
|
<cflag>-g</cflag>
|
||||||
<outputdir>bin/</outputdir>
|
<outputdir>bin/Debug/</outputdir>
|
||||||
<outputname>adventofcode.out</outputname>
|
<outputname>adventofcode.out</outputname>
|
||||||
<outputtype>executable</outputtype>
|
<outputtype>executable</outputtype>
|
||||||
<projectname>AdventOfCode</projectname>
|
<projectname>AdventOfCode</projectname>
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ namespace y2023::day10
|
|||||||
case Direction::West:
|
case Direction::West:
|
||||||
return Index2D{position.x - 1, position.y};
|
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)
|
Direction GetNextDirection(const Array2D<char>& map, Index2D position, Direction prevDirection)
|
||||||
|
|||||||
+2
-1
@@ -107,7 +107,8 @@ namespace y2023::day13
|
|||||||
map.Set(x, y, c);
|
map.Set(x, y, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << "here" << std::endl;
|
std::cerr << "Reached unreachable code" << std::endl;
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Too low: 35441
|
// 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;
|
std::cout << TERM_RED << "Could not find input file: " << test->GetInputFile() << TERM_CLEAR << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Timer timer{};
|
||||||
std::string testName = name + ".P" + std::to_string(test->GetPart()) + "." + test->GetName();
|
std::string testName = name + ".P" + std::to_string(test->GetPart()) + "." + test->GetName();
|
||||||
std::cout << TERM_GREEN << "[ RUN ] " << TERM_CLEAR << testName << std::endl;
|
std::cout << TERM_GREEN << "[ RUN ] " << TERM_CLEAR << testName << std::endl;
|
||||||
InputType input = ReadInput(inputStream);
|
InputType input = ReadInput(inputStream);
|
||||||
OutputType output = test->GetPart() == 1 ? Output1(input) : Output2(input);
|
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;
|
return false;
|
||||||
};
|
};
|
||||||
@@ -150,10 +152,12 @@ namespace aoc
|
|||||||
virtual OutputType Output2(const InputType& input) = 0;
|
virtual OutputType Output2(const InputType& input) = 0;
|
||||||
|
|
||||||
private:
|
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)
|
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;
|
std::cout << TERM_GREEN << "[ OK ] " << TERM_CLEAR << " Result: " << actual << std::endl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user