#include "pipeline_ranges.hpp" #include TEST(PipelineRanges, TopValuesByCategory) { const std::vector records{ {"math", 10}, {"math", 50}, {"code", 30}, {"code", 5}}; const auto result = cpp26::top_values_by_category(records, 20); ASSERT_EQ(result.size(), 2U); EXPECT_EQ(result[0].category, "math"); EXPECT_EQ(result[0].value, 50); } TEST(PipelineRanges, TotalByCategory) { const std::vector records{{"math", 10}, {"math", 5}, {"code", 7}}; const auto totals = cpp26::total_by_category(records); ASSERT_EQ(totals.size(), 2U); EXPECT_EQ(totals[0].first, "code"); EXPECT_EQ(totals[0].second, 7); }