tests for break signal and ini config working
authorFred T. Hamster <fred@feistymeow.org>
Sun, 8 Feb 2026 13:58:33 +0000 (08:58 -0500)
committerFred T. Hamster <fred@feistymeow.org>
Sun, 8 Feb 2026 13:58:33 +0000 (08:58 -0500)
resolved the weird issue with double_plus.  added optional time parameter for break signal time out.

nucleus/library/basis/astring.cpp
nucleus/library/mathematics/math_ops.h
nucleus/library/tests_application/makefile
nucleus/library/tests_application/test_break_signal.cpp
nucleus/library/tests_configuration/test_ini_configurator.cpp

index 16a6e3c7057380632b11afb82409fe5373690778..4837fccff9ec1665d691c159e367207025972731 100644 (file)
@@ -180,9 +180,6 @@ astring &astring::sprintf(const char *initial, ...)
   return to_return;
 }
 
-//#pragma temporary debug in astring!!!
-//#define DEBUG_STRING
-
 astring &astring::base_sprintf(const char *initial, va_list &args)
 {
 #ifdef DEBUG_STRING
@@ -329,8 +326,6 @@ void astring::seek_modifier(const char *&traverser, char *modifier_chars)
 #endif
 }
 
-//#undef DEBUG_STRING
-
 void astring::get_type_character(const char * &traverser, va_list &args,
     astring &output_string, const char *flag_chars, const char *width_chars,
     const char *precision_chars, const char *modifier_chars)
index a449e326cfcafc49ebaf8fcfb24ba799f8d3e583..6f61468e4d43ad914ad3cd2bcbb5e1e5314e1245 100644 (file)
@@ -25,6 +25,7 @@ class math_ops
 {
 public:
   typedef signed long long fat_int;
+//hmmm: get this definition (or a better named one) into our definitions header.
 
   //! returns the rounded integer value for "to_round".
   static fat_int round_it(float to_round)
index d5b4c23b55413620e396132ae4fa123bc53ba322..154328e51eaa01c4c1d81f5828edce6ab4028ebc 100644 (file)
@@ -22,14 +22,17 @@ LOCAL_LIBS_USED = unit_test application configuration filesystem loggers \
 #VCPP_USE_GUI=t
 #USE_HOOPLE_DLLS=t
 
-RUN_TARGETS = $(ACTUAL_TARGETS)
-# run every test except test_rendezvous, which waits for a key.
-#RUN_TARGETS =    test_command_line.exe \
-#test_break_signal.exe test_byte_filer.exe 
-#  test_directory.exe test_directory_tree.exe test_filename.exe \
+LAST_TARGETS += test_break_signal_special 
+RUN_TARGETS = $(EXECUTABLE_DIR)/test_command_line 
+
+#  test_filename.exe \
 #  test_huge_file.exe test_ini_configurator.exe test_ini_parser.exe test_logger.exe \
 #  test_path_configuration.exe test_registry_configurator.exe \
 #  test_system_values.exe test_timer_driver.exe
 
 include cpp/rules.def
 
+# run the break signal tester with a short timeout, since generally no one's watching the build to hit break.
+test_break_signal_special:
+       $(EXECUTABLE_DIR)/test_break_signal 1
+
index 5e8e4224ae463516e0afc20cdad647a7ed904b50..7b4dae48519271acfe1f212d491c6934dbe35dc1 100644 (file)
 #include <stdio.h>
 //hmmm: also a flush mechanism for i/o being inside feisty code would be better than this call to stdio.
 
-
 using namespace application;
 using namespace basis;
-//using namespace configuration;
-//using namespace filesystem;
 using namespace loggers;
-//using namespace structures;
-//using namespace textual;
 using namespace timely;
 using namespace unit_test;
 
@@ -46,6 +41,8 @@ using namespace unit_test;
 
 static bool _leave_now = false;
 
+const int DEFAULT_PAUSE_TIME = 20;  // how long we'll wait, unless told a different time.
+
 class test_break_signal : virtual public unit_base, virtual public application_shell
 {
 public:
@@ -67,9 +64,17 @@ void handle_break(int formal(signal))
 int test_break_signal::execute()
 {
   FUNCDEF("execute");
+
+  int pause_time = DEFAULT_PAUSE_TIME;
+  if (application::_global_argc >= 2) {
+    astring passed_pause = application::_global_argv[1];
+    pause_time = passed_pause.convert(DEFAULT_PAUSE_TIME);
+  }
+
+
   signal(SIGINT, handle_break);
   LOG("starting loop--hit ctrl-C to exit or wait for timeout.");
-  time_stamp leave_time(20 * SECOND_ms);
+  time_stamp leave_time(pause_time * SECOND_ms);
   while (!_leave_now && (time_stamp() < leave_time) ) {
     time_control::sleep_ms(20);
   }
index 184204a8af797dd92e86bdc59450ae1c7e9d6a91..ce92bc9110a997f4acb192f41156db96b2c54712 100644 (file)
@@ -131,24 +131,14 @@ LOG(astring("exe directory is currently: ") + application_configuration::applica
     {
       // fourth test set.
       const char *TEST_NAME = "fourth test: frunkle";
-      frunkle def_frunkle((double)1487335673.1415926535834985987);
+      frunkle def_frunkle(1487335673.1415926535834985987);
       astring def_text(astring::SPRINTF, "%f", def_frunkle.value());     
-LOG(astring("def text is ") + def_text);
-double comparator = 1487335673.1415926535834985987;
-LOG(a_sprintf("starting from double gets %f instead", comparator));
-
       ini.store("test", "frunkle_test", def_text);
       astring found_string = ini.load("test", "frunkle_test", MACRO_AS_STRING(UNWANTED_DEFAULT_VALUE));
-                 
-LOG(astring("found string is ") + found_string);         
-
       frunkle found_frunkle = found_string.convert(0.0);
       if (found_frunkle == frunkle(0.0))
         deadly_error(INI_SECTION, TEST_NAME,
            "ini_configurator load failed: float conversion failed--got zero");
-
-LOG(astring("found number ") + a_sprintf("%f", found_frunkle.value()) + " which we want to be " + a_sprintf("%f", def_frunkle.value()));
-
       if (found_frunkle == frunkle(UNWANTED_DEFAULT_VALUE))
         deadly_error(INI_SECTION, TEST_NAME,
            "ini_configurator load failed: wrong unwanted default was used");