-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Tests for edge cases #154
Adding Tests for edge cases #154
Conversation
Codecov Report
@@ Coverage Diff @@
## main #154 +/- ##
==========================================
+ Coverage 64.64% 65.85% +1.21%
==========================================
Files 17 17
Lines 4279 4326 +47
==========================================
+ Hits 2766 2849 +83
+ Misses 1513 1477 -36
... and 1 file with indirect coverage changes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 18. Check the log or trigger a new build to see more.
@@ -119,6 +125,7 @@ TEST(EnumReflectionTest, GetIntegerTypeFromEnumScope) { | |||
EXPECT_EQ(Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[2])), "int"); | |||
EXPECT_EQ(Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[3])), "long long"); | |||
EXPECT_EQ(Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[4])), "unsigned int"); | |||
EXPECT_EQ(Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[5])),"NULL TYPE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(Cpp::GetTypeAsString(Cpp::GetIntegerTypeFromEnumScope(Decls[5])),"NULL TYPE");
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[7]), "int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "long long"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "unsigned int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[5]), "NULL TYPE"); // When a nullptr is returned by GetVariableType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[5]), "NULL TYPE"); // When a nullptr is returned by GetVariableType()
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "long long"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "unsigned int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[5]), "NULL TYPE"); // When a nullptr is returned by GetVariableType() | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[6]), "bool"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 6 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[6]), "bool");
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "unsigned int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[5]), "NULL TYPE"); // When a nullptr is returned by GetVariableType() | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[6]), "bool"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[7]), "char"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 7 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[7]), "char");
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[5]), "NULL TYPE"); // When a nullptr is returned by GetVariableType() | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[6]), "bool"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[7]), "char"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "int"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 8 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "int");
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[6]), "bool"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[7]), "char"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "long long"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 9 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "long long");
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[7]), "char"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "long long"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[10]), "unsigned int"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 10 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[10]), "unsigned int");
^
EXPECT_EQ(get_int_type_from_enum_var(Decls[8]), "int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[9]), "long long"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[10]), "unsigned int"); | ||
EXPECT_EQ(get_int_type_from_enum_var(Decls[11]), "NULL TYPE"); // When a non Enum Type variable is used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 11 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(get_int_type_from_enum_var(Decls[11]), "NULL TYPE"); // When a non Enum Type variable is used
^
@@ -205,6 +225,7 @@ | |||
EXPECT_EQ(Cpp::GetEnumConstants(Decls[2]).size(), 2); | |||
EXPECT_EQ(Cpp::GetEnumConstants(Decls[3]).size(), 3); | |||
EXPECT_EQ(Cpp::GetEnumConstants(Decls[4]).size(), 4); | |||
EXPECT_EQ(Cpp::GetEnumConstants(Decls[5]).size(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 5 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
EXPECT_EQ(Cpp::GetEnumConstants(Decls[5]).size(), 0);
^
)"; | ||
|
||
Cpp::CreateInterpreter(); | ||
Interp->declare(code); | ||
std::vector<std::string> enumNames1, enumNames2; | ||
std::vector<std::string> enumNames1, enumNames2, enumNames3, enumNames4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'enumNames1' is not initialized [cppcoreguidelines-init-variables]
std::vector<std::string> enumNames1, enumNames2, enumNames3, enumNames4; | |
std::vector<std::string> enumNames1 = 0, enumNames2, enumNames3, enumNames4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* IsAggregate * GetIntegerTypeFromEnumScope * GetIntegerTypeFromEnumType * GetEnumConstants * GetCanonicalType * GetType * GetScopeFromType * GetAllCppNames * GetEnums * GetBaseClass * IsSubClass * GetFunctionReturnType * GetFunctionNumArgs * GetFunctionRequiredArgs * GetFunctionArgType * GetFunctionSignature * GetFunctionsUsingName * HasDefaultConstructor * IsComplete * IsAbstract * GetEnumConstantType * GetEnumConstantValue * GetUnderlyingScope * GeTClassMethods * GetDestructor
No description provided.