lodepng_unittest.cpp from lodepng#18
Conversation
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include <stdio.h> |
There was a problem hiding this comment.
| #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.
| #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.
| 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.
| 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.
| 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.
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.
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.
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.
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.
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