-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add test cases for the file metric calculation for C++ #89
Conversation
@@ -58,7 +58,7 @@ This is quite slow and can take up to one or two hours but can provide good resu | |||
Counts expressions that branch the control flow (if-statements, loops, catch-blocks, etc. - but no else/default/finally statements) and other expressions that are considered to increase the complexity of the code inside a file: | |||
|
|||
- function declarations (including lambda expressions) | |||
- logical operations (like AND and OR) | |||
- binary logical operations (like AND and OR) |
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.
Clearification, as we do not count unary logical operations, like the use of the !
/ negation operator.
["hpp", Languages.CPlusPlus], | ||
["hxx", Languages.CPlusPlus], | ||
["hh", Languages.CPlusPlus], |
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.
Added more file extensions for as supported by the GNU compiler for C++, but not the .C (capital C) extension, as we currently convert all file extension to lower case, and lower case c would indicate a file for the C programming language.
Note that we will have some trouble here anyway if we introduce a parser for the C programming language, as they also use the .h header files. We probably have to introduce a command line option to make the user decide whether his .h files should be interpreted as C or C++ code. Just leaving .h for C is no viable option here, as the use of the .h file extension is also very common for C++ headers.
@@ -56,7 +56,7 @@ export function sortCouplingResults(couplingResult: CouplingResult) { | |||
* @param metric Name of the metric. | |||
* @param expected Expected test result. | |||
* */ | |||
export async function testFileMetrics(inputPath: string, metric: FileMetric, expected: number) { | |||
export async function testFileMetric(inputPath: string, metric: FileMetric, expected: number) { |
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.
renamed testFileMetrics
to testFileMetric
, as it only checks one value.
318f981
to
36e12ad
Compare
36e12ad
to
3b9ca10
Compare
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.
very nice example source files, everything looks good
Adds test source and header files in the C++ programming languages. These files are tested to compile correctly using the LLVM C++ compiler clang that comes with MacOS (command
clang -c -xc++ -std=c++20 <file>
)Adds test cases that check if the file metrics are calculated correctly if these C++ files are used as input.
Additional notes:
for_range_loop
) were not counted when calculating the complexity metricResolves #84