resolved the weird issue with double_plus. added optional time parameter for break signal time out.
return to_return;
}
-//#pragma temporary debug in astring!!!
-//#define DEBUG_STRING
-
astring &astring::base_sprintf(const char *initial, va_list &args)
{
#ifdef DEBUG_STRING
#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)
{
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)
#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
+
#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;
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:
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);
}
{
// 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");