-
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
lodepng_unittest.cpp from lodepng #18
base: master
Are you sure you want to change the base?
Conversation
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.
This is autogenerated code-style review, only first 25 of 33 new suggestions are shown
#include <string> | ||
#include <vector> | ||
|
||
#include <stdio.h> |
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.
#include <stdio.h> | |
#include <cstdio> |
This comment was generated with the following checker: ClangTidy
#include <vector> | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> |
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.
#include <stdlib.h> | |
#include <cstdlib> |
This comment was generated with the following checker: ClangTidy
|
||
//assert that no error | ||
void assertNoPNGError(unsigned error, const std::string& message = "") { | ||
if(error) { |
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.
if(error) { | |
if(error != 0u) { |
This comment was generated with the following checker: ClangTidy
} | ||
|
||
void assertNoError(unsigned error) { | ||
if(error) { |
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.
if(error) { | |
if(error != 0u) { |
This comment was generated with the following checker: ClangTidy
|
||
//Test LodePNG encoding and decoding the encoded result, using the C interface | ||
void doCodecTestC(Image& image) { | ||
unsigned char* encoded = 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.
unsigned char* encoded = 0; | |
unsigned char* encoded = nullptr; |
This comment was generated with the following checker: ClangTidy
//Generate a 16-bit test image with minimal size that requires at minimum the given color type (bit depth, grayscaleness, ...) | ||
//If key is true, makes it such that exactly one color is transparent, so it can use a key. If false, adds a translucent color depending on | ||
//whether it's an alpha color type or not. | ||
void generateTestImageRequiringColorType16(Image& image, LodePNGColorType colorType, unsigned bitDepth, bool key) { |
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.
The function is too complicated
generateTestImageRequiringColorType16( Image & image , LodePNGColorType colorType , unsigned bitDepth , bool key)
now has cyclomatic complexity of 26.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.
This comment was generated with the following checker: high_cyclomatic_complexity
//Generate a 8-bit test image with minimal size that requires at minimum the given color type (bit depth, grayscaleness, ...). bitDepth max 8 here. | ||
//If key is true, makes it such that exactly one color is transparent, so it can use a key. If false, adds a translucent color depending on | ||
//whether it's an alpha color type or not. | ||
void generateTestImageRequiringColorType8(Image& image, LodePNGColorType colorType, unsigned bitDepth, bool key) { |
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.
The function is too complicated
generateTestImageRequiringColorType8( Image & image , LodePNGColorType colorType , unsigned bitDepth , bool key)
now has cyclomatic complexity of 16.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.
This comment was generated with the following checker: high_cyclomatic_complexity
} | ||
|
||
// Tests combinations of various colors in different orders | ||
void testFewColors() { |
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.
The function is too complicated
testFewColors()
now has cyclomatic complexity of 19.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.
This comment was generated with the following checker: high_cyclomatic_complexity
|
||
//This tests color conversions from any color model to any color model, with any bit depth | ||
//But it tests only with colors black and white, because that are the only colors every single model supports | ||
void testColorConvert2() { |
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.
The function is too complicated
testColorConvert2()
now has cyclomatic complexity of 12.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.
This comment was generated with the following checker: high_cyclomatic_complexity
ASSERT_EQUALS(5, h); | ||
} | ||
|
||
void test |
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.
The function is too complicated
testAutoColorModels()
now has cyclomatic complexity of 15.
Corresponding modifications started here.
Split your routines to keep cyclomatic complexity below 10 to improve their maintainability.
This comment was generated with the following checker: high_cyclomatic_complexity
lodepng_unittest.cpp from https://github.com/lvandeve/lodepng/blob/b4539da/lodepng_unittest.cpp