[llvm] [MIR2Vec] Added create factory methods for Vocabulary (PR #162569)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 8 16:16:40 PDT 2025
================
@@ -214,4 +225,20 @@ TEST_F(MIR2VecVocabTestFixture, VocabularyConstruction) {
EXPECT_GT(Count, 0u);
}
+// Test factory method with empty vocabulary
+TEST_F(MIR2VecVocabTestFixture, EmptyVocabularyCreation) {
+ VocabMap EmptyVMap;
+
+ auto VocabOrErr = MIRVocabulary::create(std::move(EmptyVMap), *TII);
+ EXPECT_FALSE(static_cast<bool>(VocabOrErr))
+ << "Factory method should fail with empty vocabulary";
+
+ // Consume the error
+ if (!VocabOrErr) {
+ auto Err = VocabOrErr.takeError();
+ std::string ErrorMsg = toString(std::move(Err));
+ EXPECT_FALSE(ErrorMsg.empty());
+ }
+}
+
} // namespace
----------------
mtrofin wrote:
newline missing
https://github.com/llvm/llvm-project/pull/162569
More information about the llvm-commits
mailing list