Created
December 1, 2021 11:23
-
-
Save HappyCerberus/633e7bdd2e2674c57a02c9d8f13e4277 to your computer and use it in GitHub Desktop.
AOC 2021 - test day1 part1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "trivial.h" | |
#include <gtest/gtest.h> | |
#include <sstream> | |
TEST(TrivialTest, Simple) { | |
std::vector<std::pair<std::string, uint32_t>> inputs = { | |
{"", 0}, // empty input 0 increasing | |
{"0", 0}, // single element 0 increasing | |
{"0 1", 1}, // two elements, with increase | |
{"0 1 0 1 0 1 0 1", 4}, // alternating, 4 repetitions | |
{"0 0 0 0 0 0", 0}, // monotonic, no increase | |
{"0 1 2 3", 3}, // increasing sequence - 3 increases | |
{"3 2 1 0", 0}, // decreasing sequence - 0 increases | |
}; | |
for (auto &i : inputs) { | |
std::stringstream s(i.first); | |
EXPECT_EQ(count_increasing(s), i.second) << " on input " << i.first; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment