8#include <framework/utilities/NumberSequence.h>
9#include <gtest/gtest.h>
14 TEST(NumberSequenceTest, TestSingleNumber)
17 std::set<int64_t> expected = {3};
18 EXPECT_EQ(sequence, expected);
21 TEST(NumberSequenceTest, TestManyNumbers)
24 std::set<int64_t> expected = {3, 4, 5, 10, 12};
25 EXPECT_EQ(sequence, expected);
28 TEST(NumberSequenceTest, TestNegativeNumbers)
31 std::set<int64_t> expected = { -5, -3, 4, 10, 12};
32 EXPECT_EQ(sequence, expected);
35 TEST(NumberSequenceTest, TestOutOfOrderNumbers)
38 std::set<int64_t> expected = {3, 4, 5, 10, 12};
39 EXPECT_EQ(sequence, expected);
42 TEST(NumberSequenceTest, TestSingleInterval)
45 std::set<int64_t> expected = {3, 4, 5, 6};
46 EXPECT_EQ(sequence, expected);
49 TEST(NumberSequenceTest, TestManyIntervals)
52 std::set<int64_t> expected = {3, 4, 5, 6, 7, 8, 9, 12, 13};
53 EXPECT_EQ(sequence, expected);
56 TEST(NumberSequenceTest, TestOutOfOrderIntervals)
59 std::set<int64_t> expected = {3, 4, 5, 6, 7, 8, 9, 12, 13};
60 EXPECT_EQ(sequence, expected);
63 TEST(NumberSequenceTest, TestOverlappingIntervals)
66 std::set<int64_t> expected = {3, 4, 5, 6, 7, 8};
67 EXPECT_EQ(sequence, expected);
70 TEST(NumberSequenceTest, TestNegativeIntervals)
73 std::set<int64_t> expected = { -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8};
74 EXPECT_EQ(sequence, expected);
77 TEST(NumberSequenceTest, TestReversedIntervalIsEmpty)
80 std::set<int64_t> expected;
81 EXPECT_EQ(sequence, expected);
84 TEST(NumberSequenceTest, TestMixNumbersAndIntervals)
87 std::set<int64_t> expected = {1, 3, 6, 7, 8, 9, 12, 13};
88 EXPECT_EQ(sequence, expected);
91 TEST(NumberSequenceTest, TestWhitespaces)
94 std::set<int64_t> expected = {1, 3, 6, 7, 8, 9, 12, 13};
95 EXPECT_EQ(sequence, expected);
std::set< int64_t > generate_number_sequence(const std::string &str)
Generate a sequence of numbers defined by a string.
Abstract base class for different kinds of events.