aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-08-24 01:47:33 +0100
committerYann Herklotz <ymherklotz@gmail.com>2017-08-24 01:47:33 +0100
commitfc42f18705072928c0aff12cb6fcbc69e61239b6 (patch)
tree67854282652472268d5b6e61aa90df43d9292806
parentf9cc383fc697a884413bda65d75e0e13dfcf3cbb (diff)
downloadYAGE-fc42f18705072928c0aff12cb6fcbc69e61239b6.tar.gz
YAGE-fc42f18705072928c0aff12cb6fcbc69e61239b6.zip
Even more clang formatting and clang tidy fixing.
-rw-r--r--.clang-format1
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/picopng.cpp24
-rw-r--r--test/yagetest.cpp3
4 files changed, 17 insertions, 15 deletions
diff --git a/.clang-format b/.clang-format
index cedf99a1..41283136 100644
--- a/.clang-format
+++ b/.clang-format
@@ -7,5 +7,6 @@ AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakTemplateDeclarations: true
BreakBeforeBraces: Linux
+UseTab: Never
...
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b92ec79a..e9e0fd5c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,7 @@ set(SIMULATION_RUNS 1000)
add_executable(yagetest ${YAGE_TEST_DIR}/yagetest.cpp)
target_link_libraries(yagetest gtest_main ${YAGE_LIB_DEP_L})
-add_test(NAME Yagetest COMMAND yagetest --gtest_repeat=${SIMULATION_RUNS} --gtest_break_on_failure)
+add_test(NAME YageTest COMMAND yagetest --gtest_repeat=10 --gtest_break_on_failure)
add_executable(matrixtest ${YAGE_TEST_DIR}/matrixtest.cpp)
target_link_libraries(matrixtest gtest_main ${YAGE_LIB_DEP_L})
@@ -98,4 +98,4 @@ add_test(NAME ParticleBodyTest COMMAND particlebodytest --gtest_repeat=${SIMULAT
add_executable(windowtest ${YAGE_TEST_DIR}/windowtest.cpp)
target_link_libraries(windowtest gtest_main ${YAGE_LIB_DEP_L})
-add_test(NAME Windowtest COMMAND windowtest --gtest_repeat=${SIMULATION_RUNS} --gtest_break_on_failure)
+add_test(NAME WindowTest COMMAND windowtest --gtest_repeat=${SIMULATION_RUNS} --gtest_break_on_failure)
diff --git a/src/picopng.cpp b/src/picopng.cpp
index 401fb932..dcc4b367 100644
--- a/src/picopng.cpp
+++ b/src/picopng.cpp
@@ -366,7 +366,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 16;
return;
} // error: somehow an unexisting code appeared. This can
- // never happen.
+ // never happen.
}
if (bitlen[256] == 0) {
error = 64;
@@ -493,17 +493,17 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
if ((in[0] * 256 + in[1]) % 31 != 0) {
return 24;
} // error: 256 * in[0] + in[1] must be a multiple of 31, the
- // FCHECK value is supposed to be made that way
+ // FCHECK value is supposed to be made that way
unsigned long CM = in[0] & 15, CINFO = (in[0] >> 4) & 15,
FDICT = (in[1] >> 5) & 1;
if (CM != 8 || CINFO > 7) {
return 25;
} // error: only compression method 8: inflate with sliding window
- // of 32k is supported by the PNG spec
+ // of 32k is supported by the PNG spec
if (FDICT != 0) {
return 26;
} // error: the specification of PNG says about the zlib stream:
- // "The additional flags shall not specify a preset dictionary."
+ // "The additional flags shall not specify a preset dictionary."
inflator.inflate(out, in, 2);
return inflator
.error; // note: adler32 checksum was skipped and ignored
@@ -542,7 +542,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 30;
return;
} // error: size of the in buffer too small to contain next
- // chunk
+ // chunk
size_t chunkLength = read32bitInt(&in[pos]);
pos += 4;
if (chunkLength > 2147483647) {
@@ -553,7 +553,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 35;
return;
} // error: size of the in buffer too small to contain next
- // chunk
+ // chunk
if (in[pos + 0] == 'I' && in[pos + 1] == 'D' &&
in[pos + 2] == 'A' &&
in[pos + 3] ==
@@ -593,7 +593,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 39;
return;
} // error: more alpha values given than there are
- // palette entries
+ // palette entries
for (size_t i = 0; i < chunkLength; i++) {
info.palette[4 * i + 3] = in[pos++];
}
@@ -602,7 +602,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 40;
return;
} // error: this chunk must be 2 bytes for greyscale
- // image
+ // image
info.key_defined = true;
info.key_r = info.key_g = info.key_b =
256 * in[pos] + in[pos + 1];
@@ -630,7 +630,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 69;
return;
} // error: unknown critical chunk (5th bit of first byte
- // of chunk type is 0)
+ // of chunk type is 0)
pos += (chunkLength + 4); // skip 4 letters and
// uninterpreted data of
// unimplemented chunk
@@ -745,7 +745,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 27;
return;
} // error: the data length is smaller than the length of the
- // header
+ // header
if (in[0] != 137 || in[1] != 80 || in[2] != 78 || in[3] != 71 ||
in[4] != 13 || in[5] != 10 || in[6] != 26 || in[7] != 10) {
error = 28;
@@ -765,7 +765,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 32;
return;
} // error: only compression method 0 is allowed in the
- // specification
+ // specification
info.filterMethod = in[27];
if (in[27] != 0) {
error = 33;
@@ -776,7 +776,7 @@ int decodePNG(std::vector<unsigned char> &out_image, unsigned long &image_width,
error = 34;
return;
} // error: only interlace methods 0 and 1 exist in the
- // specification
+ // specification
error = checkColorValidity(info.colorType, info.bitDepth);
}
void unFilterScanline(unsigned char *recon,
diff --git a/test/yagetest.cpp b/test/yagetest.cpp
index 17ecf85a..39ef5072 100644
--- a/test/yagetest.cpp
+++ b/test/yagetest.cpp
@@ -12,7 +12,8 @@
TEST(YAGE, InitQuit)
{
- ASSERT_TRUE(true);
+ ASSERT_TRUE(yage::init());
+ yage::quit();
}
int main(int argc, char **argv)