junrushao1994 commented on a change in pull request #5740: URL: https://github.com/apache/incubator-tvm/pull/5740#discussion_r442576289
########## File path: tests/cpp/container_test.cc ########## @@ -324,6 +324,29 @@ TEST(Map, Iterator) { CHECK(map2[a].as<IntImmNode>()->value == 2); } +TEST(Map, Insert) { + using namespace tvm; + auto check = [](const Map<String, Integer>& result, + std::unordered_map<std::string, int64_t> expected) { + CHECK_EQ(result.size(), expected.size()); + for (const auto& kv : result) { + CHECK(expected.count(kv.first)); + CHECK_EQ(expected[kv.first], kv.second.operator int64_t()); + expected.erase(kv.first); + } + }; + Map<String, Integer> result; + std::unordered_map<std::string, int64_t> expected; + char key = 'a'; + int64_t val = 1; + for (int i = 0; i < 26; ++i, ++key, ++val) { + std::string s(1, key); + result.Set(s, val); + expected[s] = val; + check(result, expected); + } +} + Review comment: Done :-) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org