diff --git a/CMakeLists.txt b/CMakeLists.txt
index d68dc5b193f488b8f1bfbc547ca81e9e0a52f8a8..6d014dffa968c1b2dc7d43f541d475b579bb0a1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -67,9 +67,12 @@ endif()
 #add_custom_target (corsika_pre_build)
 #add_custom_command (TARGET corsika_pre_build PRE_BUILD COMMAND "${PROJECT_SOURCE_DIR}/pre_compile.py")
 
-# add call to do-interaction to run as unit-test-case
+# add call to ./do-copyright.py to run as unit-test-case
 add_test (NAME copyright_notices COMMAND "./do-copyright.py" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
 
+# add call to do-clang-format.sh checking to run as unit-test-case
+add_test (NAME clang_format COMMAND ./do-clang-format.sh check WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
 find_package (Pythia8) # optional
   
 find_package (Eigen3 REQUIRED)
diff --git a/do-clang-format.sh b/do-clang-format.sh
index c7680e486cc7d2df5fe3530c10df131074b6450a..ebfcb2322063638db155308dfb1c5d45272324f9 100755
--- a/do-clang-format.sh
+++ b/do-clang-format.sh
@@ -1 +1,10 @@
-clang-format -i -style=file `find . -iregex '^.*\.\(cc\|h\)$' -not -path './ThirdParty/*'`
+#!/bin/bash
+
+command="clang-format -style=file `find . -iregex '^.*\.\(cc\|h\)$' -not -path './ThirdParty/*'`"
+
+if [ "$1" == "check" ];
+then
+    ! ${command}  -output-replacements-xml | grep -c "<replacement " 
+else
+    ${command} -i
+fi