adds simple tiny test suite and updates license headers

Thu, 23 Aug 2018 19:45:36 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 23 Aug 2018 19:45:36 +0200
changeset 57
68018eac46c3
parent 56
ed65f8c73fb2
child 58
bb512754aaf3

adds simple tiny test suite and updates license headers

LICENSE file | annotate | diff | comparison | revisions
Makefile.am file | annotate | diff | comparison | revisions
README file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
prebuild.sh file | annotate | diff | comparison | revisions
src/Makefile.am file | annotate | diff | comparison | revisions
src/arguments.c file | annotate | diff | comparison | revisions
src/arguments.h file | annotate | diff | comparison | revisions
src/bfile_heuristics.c file | annotate | diff | comparison | revisions
src/bfile_heuristics.h file | annotate | diff | comparison | revisions
src/cline.c file | annotate | diff | comparison | revisions
src/cline.h file | annotate | diff | comparison | revisions
src/regex_parser.c file | annotate | diff | comparison | revisions
src/regex_parser.h file | annotate | diff | comparison | revisions
src/scanner.c file | annotate | diff | comparison | revisions
src/scanner.h file | annotate | diff | comparison | revisions
src/settings.c file | annotate | diff | comparison | revisions
src/settings.h file | annotate | diff | comparison | revisions
src/stdinc.h file | annotate | diff | comparison | revisions
src/string_list.c file | annotate | diff | comparison | revisions
src/string_list.h file | annotate | diff | comparison | revisions
src/suffix_fnc.c file | annotate | diff | comparison | revisions
src/suffix_fnc.h file | annotate | diff | comparison | revisions
test/Makefile.am file | annotate | diff | comparison | revisions
test/codeonly.sh file | annotate | diff | comparison | revisions
test/nocomments.sh file | annotate | diff | comparison | revisions
test/testfile.c file | annotate | diff | comparison | revisions
test/total.sh file | annotate | diff | comparison | revisions
--- a/LICENSE	Thu Aug 23 17:58:38 2018 +0200
+++ b/LICENSE	Thu Aug 23 19:45:36 2018 +0200
@@ -1,4 +1,4 @@
-Copyright 2017 Mike Becker. All rights reserved.
+Copyright 2018 Mike Becker. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/Makefile.am	Thu Aug 23 17:58:38 2018 +0200
+++ b/Makefile.am	Thu Aug 23 19:45:36 2018 +0200
@@ -1,4 +1,4 @@
-# Copyright 2017 Mike Becker. All rights reserved.
+# Copyright 2018 Mike Becker. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
--- a/README	Thu Aug 23 17:58:38 2018 +0200
+++ b/README	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
                                        cline
                         _________________________________________
-                             Copyright (C) 2017 Mike Becker
+                             Copyright (C) 2018 Mike Becker
 
 Contents:
 1) About ................................................................... 12
@@ -47,7 +47,7 @@
 
 4) License ____________________________________________________________________
 
-Copyright 2017 Mike Becker. All rights reserved.
+Copyright 2018 Mike Becker. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
--- a/configure.ac	Thu Aug 23 17:58:38 2018 +0200
+++ b/configure.ac	Thu Aug 23 19:45:36 2018 +0200
@@ -1,4 +1,4 @@
-# Copyright 2017 Mike Becker. All rights reserved.
+# Copyright 2018 Mike Becker. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
@@ -22,7 +22,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
 AC_PREREQ([2.69])
-AC_INIT(cline, 1.1, universe@uap-core.de)
+AC_INIT(cline, 1.2, universe@uap-core.de)
 AM_INIT_AUTOMAKE
 
 # Conditionals
--- a/prebuild.sh	Thu Aug 23 17:58:38 2018 +0200
+++ b/prebuild.sh	Thu Aug 23 19:45:36 2018 +0200
@@ -1,4 +1,4 @@
-# Copyright 2017 Mike Becker. All rights reserved.
+# Copyright 2018 Mike Becker. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
--- a/src/Makefile.am	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/Makefile.am	Thu Aug 23 19:45:36 2018 +0200
@@ -1,4 +1,4 @@
-# Copyright 2017 Mike Becker. All rights reserved.
+# Copyright 2018 Mike Becker. All rights reserved.
 # 
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
--- a/src/arguments.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/arguments.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,13 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * 
- * arguments.c
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "arguments.h"
--- a/src/arguments.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/arguments.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * arguments.h
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef ARGUMENTS_H_
--- a/src/bfile_heuristics.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/bfile_heuristics.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * bfile_heuristics.c
- *
- *  Created on: 20.10.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "bfile_heuristics.h"
--- a/src/bfile_heuristics.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/bfile_heuristics.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * bfile_heuristics.h
- *
- *  Created on: 20.10.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef BFILE_HEURISTICS_H_
--- a/src/cline.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/cline.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * cline.c
- *
- *  Created on: 23.05.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "cline.h"
@@ -58,8 +53,8 @@
     "\n  -v, --version       - print out version information"
     "\n  -V                  - turn verbose output off, print the result only"
     "\n\nShortcuts:"
-    "\n  --exclude-cstyle-comments"
-    "\n = -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\""
+    "\n  --exclude-cstyle-comments : -E '\\s*//' -e '\\s*/\\*' '\\*/\\s*'"
+    "\n  --exclude-blank-lines     : -E '^\\s*$'"
     "\n\n"
     "The default call without any options is:"    
     "\n  cline ./\n\n"
@@ -205,12 +200,14 @@
     }
     if (argflags == 0) {
       /* SHORTCUTS */
-      /* exclude-cstyle-comments */
       if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) {
         add_string(settings->regex->pattern_list, "\\s*//");
         add_string(settings->regex->pattern_list, "$");
         add_string(settings->regex->pattern_list, "\\s*/\\*");
         add_string(settings->regex->pattern_list, "\\*/\\s*");
+      } else if (strcmp(argv[t], "--exclude-blank-lines") == 0) {
+        add_string(settings->regex->pattern_list, "^\\s*$");
+        add_string(settings->regex->pattern_list, "$");
       }
       /* Path */
       else {
--- a/src/cline.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/cline.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * cline.h
- *
- *  Created on: 23.05.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef CLINE_H_
--- a/src/regex_parser.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/regex_parser.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * regex_parser.c
- *
- *  Created on: 26.01.2012
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "regex_parser.h"
--- a/src/regex_parser.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/regex_parser.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * regex_parser.h
- *
- *  Created on: 26.01.2012
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef REGEX_PARSER_H_
--- a/src/scanner.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/scanner.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * scanner.c
- *
- *  Created on: 23.05.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 
--- a/src/scanner.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/scanner.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * scanner.h
- *
- *  Created on: 23.05.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef SCANNER_H_
--- a/src/settings.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/settings.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * settings.c
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "settings.h"
--- a/src/settings.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/settings.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * settings.h
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef SETTINGS_H_
--- a/src/stdinc.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/stdinc.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * stdinc.h
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef STDINC_H_
--- a/src/string_list.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/string_list.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * string_list.c
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "string_list.h"
--- a/src/string_list.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/string_list.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -21,12 +21,7 @@
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * string_list.h
- *
- *  Created on: 15.09.2011
- *      Author: Mike
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifndef STRING_LIST_H_
--- a/src/suffix_fnc.c	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/suffix_fnc.c	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -22,11 +22,6 @@
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- *
- * suffix_fnc.c
- *
- *  Created on: 15.09.2011
- *      Author: Mike
  */
 
 #include "suffix_fnc.h"
--- a/src/suffix_fnc.h	Thu Aug 23 17:58:38 2018 +0200
+++ b/src/suffix_fnc.h	Thu Aug 23 19:45:36 2018 +0200
@@ -1,6 +1,6 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 
- * Copyright 2017 Mike Becker. All rights reserved.
+ * Copyright 2018 Mike Becker. All rights reserved.
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -23,10 +23,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  *
- * suffix_fnc.h
- *
- *  Created on: 15.09.2011
- *      Author: Mike
  */
 
 #ifndef SUFFIX_FNC_H_
--- a/test/Makefile.am	Thu Aug 23 17:58:38 2018 +0200
+++ b/test/Makefile.am	Thu Aug 23 19:45:36 2018 +0200
@@ -22,4 +22,4 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 
 TESTS = $(check_SCRIPTS)
-check_SCRIPTS = total.sh nocomments.sh codeonly.sh
\ No newline at end of file
+check_SCRIPTS = total.sh nocomments.sh codeonly.sh
--- a/test/codeonly.sh	Thu Aug 23 17:58:38 2018 +0200
+++ b/test/codeonly.sh	Thu Aug 23 19:45:36 2018 +0200
@@ -27,5 +27,18 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-echo "Verifying correctness of total line count."
+echo -n "Verifying correctness of code only line count: "
+
+clineprg="$(pwd)/../src/cline"
+
+cd $srcdir
+count=`$clineprg -Vs testfile.c --exclude-cstyle-comments --exclude-blank-lines`
+expected=5
 
+if [ "$count" -eq "$expected" ]; then
+    echo "OK."
+    exit 0;
+else
+    echo "FAIL! $count is not $expected"
+    exit 1;
+fi
--- a/test/nocomments.sh	Thu Aug 23 17:58:38 2018 +0200
+++ b/test/nocomments.sh	Thu Aug 23 19:45:36 2018 +0200
@@ -27,5 +27,18 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-echo "Verifying correctness of total line count."
+echo -n "Verifying correctness of line count without comments: "
+
+clineprg="$(pwd)/../src/cline"
+
+cd $srcdir
+count=`$clineprg -Vs testfile.c --exclude-cstyle-comments`
+expected=12
 
+if [ "$count" -eq "$expected" ]; then
+    echo "OK."
+    exit 0;
+else
+    echo "FAIL! $count is not $expected"
+    exit 1;
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testfile.c	Thu Aug 23 19:45:36 2018 +0200
@@ -0,0 +1,21 @@
+/*
+ * Many Files have license headers.
+ */
+// And add other stuff below.
+
+
+int main(int argc, char* argv) { // comments behind code don't matter
+    
+    int zero /* in block comments we are genius enough to
+              * detect, if there is still some code in the line
+              */ = 0;
+    
+    /* otherwise the whole comment is
+     * not counted*/   
+    
+    // this holds also for this empty line
+    
+    return zero;
+}
+
+/* rare case, but must also work: last line is a comment */
\ No newline at end of file
--- a/test/total.sh	Thu Aug 23 17:58:38 2018 +0200
+++ b/test/total.sh	Thu Aug 23 19:45:36 2018 +0200
@@ -27,5 +27,18 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-echo "Verifying correctness of total line count."
+echo -n "Verifying correctness of total line count: "
+
+clineprg="$(pwd)/../src/cline"
+
+cd $srcdir
+count=`$clineprg -Vs testfile.c`
+expected=21
 
+if [ "$count" -eq "$expected" ]; then
+    echo "OK."
+    exit 0;
+else
+    echo "FAIL! $count is not $expected"
+    exit 1;
+fi

mercurial