testinput flag as argument

master
Benjamin Kraft 2 years ago
parent a757a50b6c
commit c1df946d1e
  1. 4
      README.md
  2. 7
      src/main.cpp
  3. 3
      src/util.h

@ -9,4 +9,6 @@ Place a file called "session" with your session key cookie from https://adventof
Expects runtime arguments as days, for example: Expects runtime arguments as days, for example:
"5 9 1" executes Days 5, 9, 1 in this order. "5 9 1" executes Days 5, 9, 1 in this order.
Add argument "T" before to use XX_testInput.txt rather than XX_input.txt

@ -50,7 +50,12 @@ int main(int argc, char *argv[]) {
auto days = getAllDays(); auto days = getAllDays();
std::filesystem::create_directory("input"); std::filesystem::create_directory("input");
for (int i = 1; i < argc; i++) { int i = 1;
if (argc > 1 && std::string(argv[1]) == "T") {
useTestInput = true;
i++;
}
for (; i < argc; i++) {
int dayNum = std::stoi(argv[i]); int dayNum = std::stoi(argv[i]);
std::cout << "Running day " << dayNum << std::endl; std::cout << "Running day " << dayNum << std::endl;
Input input = getInput(dayNum, key, useTestInput); Input input = getInput(dayNum, key, useTestInput);

@ -7,4 +7,5 @@
#include <iostream> #include <iostream>
using std::stoi, std::to_string; using std::stoi, std::to_string;
using std::cout, std::endl; using std::cout, std::endl;
using std::string, std::vector;
Loading…
Cancel
Save