Initial Course
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include "pipeline_ranges.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(PipelineRanges, TopValuesByCategory) {
|
||||
const std::vector<cpp26::Record> 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<cpp26::Record> 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);
|
||||
}
|
||||
Reference in New Issue
Block a user