compiler-research / CppInterOp

A Clang-based C++ Interoperability Library
Other
43 stars 21 forks source link

issue #28

Closed rajeck1234 closed 1 year ago

rajeck1234 commented 1 year ago

TEST(TypeReflectionTest, DISABLED_IsSubType) { std::vector<Decl *> Decls;

std::string code = R"( class A {}; class B {}; class C {};

  A a;
  B b;
  C c;
)";

GetAllTopLevelDecls(code, Decls);

InterOp::TCppType_t type_A = InterOp::GetVariableType(Decls[3]); InterOp::TCppType_t type_B = InterOp::GetVariableType(Decls[4]); InterOp::TCppType_t type_C = InterOp::GetVariableType(Decls[5]);

EXPECT_TRUE(InterOp::IsSubType(type_B, type_A)); EXPECT_FALSE(InterOp::IsSubType(type_A, type_B)); EXPECT_FALSE(InterOp::IsSubType(type_C, type_A)); }

vgvassilev commented 1 year ago

Please consider reading https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/ This pull request needs more work.

rajeck1234 commented 1 year ago

@vgvassilev i checked the whole code i found that is put 2 vector <Decl>Decls,SubDecls; are now work as two diffrent vector one is Decls and other one is SubDecls now i am going to mention in my comment how it look like TEST(FunctionReflectionTest, DISABLED_GetFunctionArgName) { std::vector<Decl> Decls, SubDecls; std::string code = R"( void f1(int i, double d, long l, char ch) {} void f2(const int i, double d[], long *l, char ch[4]) {} )";

GetAllTopLevelDecls(code, Decls);

//the GetAllSubDecls(Decls[0], SubDecls); the function of this vector is to get value of the vector at Decls[0] and then it should //be checked and give funtion name according to given character :-

GetAllSubDecls(Decls[0], SubDecls);

//now it look like each function of sub index represent by a given character

EXPECT_EQ(InterOp::GetFunctionArgName(Decls[0], 0), "i"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[0], 1), "d"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[0], 2), "l"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[0], 3), "ch"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[1], 0), "i"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[1], 1), "d"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[1], 2), "l"); EXPECT_EQ(InterOp::GetFunctionArgName(Decls[1], 3), "ch"); }

vgvassilev commented 1 year ago

Please consider reading https://github.blog/2015-01-21-how-to-write-the-perfect-pull-request/ This pull request needs more work.

This PR does not propose any new changes. Please read well what I have pasted above.

vgvassilev commented 1 year ago

Let's close this PR for now.