shuffle-dee-doo
authorChris Koeritz <fred@gruntose.com>
Thu, 2 Feb 2017 07:25:01 +0000 (02:25 -0500)
committerChris Koeritz <fred@gruntose.com>
Thu, 2 Feb 2017 07:25:01 +0000 (02:25 -0500)
more rearrangement.  also some nicer shunit language in output.

scripts/generator/inc_num.pl [new file with mode: 0644]
scripts/math/inc_num.pl [deleted file]
scripts/shunit/shunit2

diff --git a/scripts/generator/inc_num.pl b/scripts/generator/inc_num.pl
new file mode 100644 (file)
index 0000000..acecc29
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+
+###############################################################################
+#                                                                             #
+#  Name   : inc_num                                                           #
+#  Author : Chris Koeritz                                                     #
+#  Rights : Copyright (C) 1996-$now by Author                                 #
+#                                                                             #
+#  Purpose:                                                                   #
+#                                                                             #
+#    Operates on a number stored in a text file.  the number can be retrieved #
+#  for whatever purpose or it can be incremented.                             #
+#                                                                             #
+###############################################################################
+#  This program is free software; you can redistribute it and/or modify it    #
+#  under the terms of the GNU General Public License as published by the Free #
+#  Software Foundation; either version 2 of the License or (at your option)   #
+#  any later version.  See: "http://www.gruntose.com/Info/GNU/GPL.html" for a #
+#  version of the License.  Please send any updates to "fred@gruntose.com".   #
+###############################################################################
+
+# A number is retrieved from the passed in filename and returned.
+sub get_number {
+  local($number_file) = @_;
+#print "num file is $number_file\n";
+  open(NUMBERING, "$number_file");
+  local($number) = int(<NUMBERING>);
+  if ($number <= 0) { $number = 1; }
+  if ($number < 10) { $number = '0'.$number; }
+  if ($number < 100) { $number = '0'.$number; }
+  if ($number < 1000) { $number = '0'.$number; }
+  # upgraded to 6 digit numbers.  whoo hoo.
+  if ($number < 10000) { $number = '0'.$number; }
+  if ($number < 100000) { $number = '0'.$number; }
+  close(NUMBERING);
+  return $number;
+}
+
+# the number in the passed filename is increased.
+sub next_number {
+  local($number_file) = @_;
+  local($number) = &get_number($number_file);
+  if ($number < 0) { $number = '000000'; }
+  $number++;
+  if ($number > 999999) { $number = '000000'; }
+  open(NUMBERING, "> $number_file");
+#print "number is now $number\n";
+  print NUMBERING "$number\n";
+  close(NUMBERING);
+}
+
+# stores the number specified into the file specified.
+sub store_number {
+  local($number, $number_file) = @_;
+#print "storing $number into $number_file\n";
+  open(NUMBERING, "> $number_file");
+  print NUMBERING "$number\n";
+  close(NUMBERING);
+}
+
+1;
+
diff --git a/scripts/math/inc_num.pl b/scripts/math/inc_num.pl
deleted file mode 100644 (file)
index acecc29..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/perl
-
-###############################################################################
-#                                                                             #
-#  Name   : inc_num                                                           #
-#  Author : Chris Koeritz                                                     #
-#  Rights : Copyright (C) 1996-$now by Author                                 #
-#                                                                             #
-#  Purpose:                                                                   #
-#                                                                             #
-#    Operates on a number stored in a text file.  the number can be retrieved #
-#  for whatever purpose or it can be incremented.                             #
-#                                                                             #
-###############################################################################
-#  This program is free software; you can redistribute it and/or modify it    #
-#  under the terms of the GNU General Public License as published by the Free #
-#  Software Foundation; either version 2 of the License or (at your option)   #
-#  any later version.  See: "http://www.gruntose.com/Info/GNU/GPL.html" for a #
-#  version of the License.  Please send any updates to "fred@gruntose.com".   #
-###############################################################################
-
-# A number is retrieved from the passed in filename and returned.
-sub get_number {
-  local($number_file) = @_;
-#print "num file is $number_file\n";
-  open(NUMBERING, "$number_file");
-  local($number) = int(<NUMBERING>);
-  if ($number <= 0) { $number = 1; }
-  if ($number < 10) { $number = '0'.$number; }
-  if ($number < 100) { $number = '0'.$number; }
-  if ($number < 1000) { $number = '0'.$number; }
-  # upgraded to 6 digit numbers.  whoo hoo.
-  if ($number < 10000) { $number = '0'.$number; }
-  if ($number < 100000) { $number = '0'.$number; }
-  close(NUMBERING);
-  return $number;
-}
-
-# the number in the passed filename is increased.
-sub next_number {
-  local($number_file) = @_;
-  local($number) = &get_number($number_file);
-  if ($number < 0) { $number = '000000'; }
-  $number++;
-  if ($number > 999999) { $number = '000000'; }
-  open(NUMBERING, "> $number_file");
-#print "number is now $number\n";
-  print NUMBERING "$number\n";
-  close(NUMBERING);
-}
-
-# stores the number specified into the file specified.
-sub store_number {
-  local($number, $number_file) = @_;
-#print "storing $number into $number_file\n";
-  open(NUMBERING, "> $number_file");
-  print NUMBERING "$number\n";
-  close(NUMBERING);
-}
-
-1;
-
index e9afb3d5cb1bb919c1236484da4fc38da33db8f5..aa0a4e7d0da0c2d9f571e00d9405ae2fd1b7d984 100644 (file)
@@ -123,7 +123,7 @@ assertEquals()
   shunit_return=${SHUNIT_TRUE}
   if [ "${shunit_expected_}" = "${shunit_actual_}" ]; then
     if [ ! -z "$DEBUGGING" -a ! -z "$assertion_name" ]; then
-      echo "    OK: $assertion_name"
+      echo "    OKAY: $assertion_name"
     fi
     _shunit_assertPass
   else
@@ -166,7 +166,7 @@ assertNotEquals()
   shunit_return=${SHUNIT_TRUE}
   if [ "${shunit_expected_}" != "${shunit_actual_}" ]; then
     if [ ! -z "$DEBUGGING" -a ! -z "$assertion_name" ]; then
-      echo "    OK: $assertion_name"
+      echo "    OKAY: $assertion_name"
     fi
     _shunit_assertPass
   else
@@ -357,7 +357,7 @@ assertTrue()
   # record the test
   if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then
     if [ ! -z "$DEBUGGING" -a ! -z "$assertion_name" ]; then
-      echo "    OK: $assertion_name"
+      echo "    OKAY: $assertion_name"
     fi
     _shunit_assertPass
   else
@@ -427,7 +427,7 @@ assertFalse()
   # record the test
   if [ ${shunit_return} -eq ${SHUNIT_TRUE} ]; then
     if [ ! -z "$DEBUGGING" -a ! -z "$assertion_name" ]; then
-      echo "    OK: $assertion_name"
+      echo "    OKAY: $assertion_name"
     fi
     _shunit_assertPass
   else
@@ -822,7 +822,7 @@ _shunit_execSuite()
   unset _shunit_test_
 }
 
-# Generates the user friendly report with appropriate OK/FAILED message.
+# Generates the user friendly report with appropriate OKAY/FAILED message.
 #
 # Args:
 #   None
@@ -852,11 +852,11 @@ _shunit_generateReport()
       && _shunit_skipped_="skipped=${__shunit_assertsSkipped}"
 
   if [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then
-    _shunit_msg_='OK'
+    _shunit_msg_="$(basename $0) PASSED 100% OKAY"
     [ -n "${_shunit_skipped_}" ] \
         && _shunit_msg_="${_shunit_msg_} (${_shunit_skipped_})"
   else
-    _shunit_msg_="FAILED (${_shunit_failures_}"
+    _shunit_msg_="$(basename $0) FAILED (${_shunit_failures_}"
     [ -n "${_shunit_skipped_}" ] \
         && _shunit_msg_="${_shunit_msg_},${_shunit_skipped_}"
     _shunit_msg_="${_shunit_msg_})"