chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:17:40 +08:00
commit f1825c8ceb
10096 changed files with 2364182 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test")
cc_library(
name = "example_lib",
srcs = ["example.cc"],
hdrs = ["example.h"],
visibility = ["//visibility:public"],
)
cc_test(
name = "example_test",
size = "small",
srcs = ["example_test.cc"],
tags = ["team:ci"],
deps = [
":example_lib",
"@com_google_googletest//:gtest_main",
],
)
+9
View File
@@ -0,0 +1,9 @@
#include "example.h"
int SumMapValues(const std::unordered_map<int, int> &map) {
int sum = 0;
for (const auto &[_, val] : map) {
sum += val;
}
return sum;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef __EXAMPLE_H__
#define __EXAMPLE_H__
#include <unordered_map>
// Function to calculate the sum of values in an unordered_map
int SumMapValues(const std::unordered_map<int, int> &map);
#endif // __EXAMPLE_H__
+10
View File
@@ -0,0 +1,10 @@
#include "example.h"
#include <gtest/gtest.h>
#include <unordered_map>
TEST(SumMapTest, HandlesEmptyMap) {
std::unordered_map<int, int> empty_map;
EXPECT_EQ(SumMapValues(empty_map), 0);
}