From: Fred T. Hamster Date: Sun, 8 Feb 2026 14:07:27 +0000 (-0500) Subject: adding in another retro test X-Git-Tag: 2.140.190^2~24 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=f7158788f7602b2e6c9b2238d9644bce7ba92283;p=feisty_meow.git adding in another retro test test ini parser inna house. also broken. will work on it and the upgrader script in tandem. --- diff --git a/nucleus/library/tests_application/test_ini_parser.cpp b/nucleus/library/tests_application/test_ini_parser.cpp deleted file mode 100644 index 1caa22cf..00000000 --- a/nucleus/library/tests_application/test_ini_parser.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/*****************************************************************************\ -* * -* Name : test_ini_parser * -* Author : Chris Koeritz * -* * -******************************************************************************* -* Copyright (c) 1991-$now By Author. 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. This is online at: * -* http://www.fsf.org/copyleft/gpl.html * -* Please send any updates to: fred@gruntose.com * -\*****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -const istring INI_FILE_1 = "\ -[bork]\n\ -norple=1\n\ -train=12.5\n\ -singhy=9 \r\n\ -\n\ -[twerf]\r\n\ -noodles=fungus\n\ -dora=34\n\ -"; - -//#define READ_FILE_TEST - // uncomment to read in a file and parse it. - -class test_ini_parser : public application_shell -{ -public: - test_ini_parser() : application_shell(class_name()) {} - IMPLEMENT_CLASS_NAME("test_ini_parser"); - virtual int execute(); -}; - -int test_ini_parser::execute() -{ - program_wide_logger().eol(log_base::NO_ENDING); - - ini_parser par(INI_FILE_1); - -//istring dump; -//par.restate(dump); -//log(istring("table has:\n") + dump); - - string_table twerf; - if (!par.get_section("twerf", twerf)) - deadly_error(class_name(), "get_section 1", "twerf section was not found"); -//log(istring("twerf section is: ") + twerf.text_form()); - if (!twerf.find("noodles")) - deadly_error(class_name(), "get_section 1", "item #1 was not found"); - if (*twerf.find("noodles") != "fungus") - deadly_error(class_name(), "get_section 1", "item #1 found is incorrect"); - if (!twerf.find("dora")) - deadly_error(class_name(), "get_section 1", "item #2 was not found"); - if (*twerf.find("dora") != "34") - deadly_error(class_name(), "get_section 1", "item #2 found is incorrect"); - - string_table bork; - if (!par.get_section("bork", bork)) - deadly_error(class_name(), "get_section 2", "bork section was not found"); - if (!bork.find("norple")) - deadly_error(class_name(), "get_section 2", "item #1 was not found"); - if (*bork.find("norple") != "1") - deadly_error(class_name(), "get_section 2", "item #1 found is incorrect"); - if (!bork.find("train")) - deadly_error(class_name(), "get_section 2", "item #2 was not found"); - if (*bork.find("train") != "12.5") - deadly_error(class_name(), "get_section 2", "item #2 found is incorrect"); - if (!bork.find("singhy")) - deadly_error(class_name(), "get_section 2", "item #3 was not found"); - if (*bork.find("singhy") != "9") - deadly_error(class_name(), "get_section 2", "item #3 found is incorrect"); - - istring new_ini; - par.restate(new_ini); - - program_wide_logger().eol(log_base::CRLF_AT_END); - log(""); - -#ifdef READ_FILE_TEST - byte_filer input("c:/home/fungal.lld", "rb"); - int len = input.length(); - log(isprintf("fungal len is %d", len)); - istring jojo; - input.read(jojo, len); - //log("whole file is:"); - //log(jojo); - - ini_parser klug(jojo); - istring dump2; - klug.restate(dump2); - log(dump2); -#endif - - guards::alert_message("ini_parser:: works for those functions tested.\n"); - return 0; -} - -HOOPLE_MAIN(test_ini_parser, ) - diff --git a/nucleus/library/tests_configuration/makefile b/nucleus/library/tests_configuration/makefile index 3f24b07a..8cc39336 100644 --- a/nucleus/library/tests_configuration/makefile +++ b/nucleus/library/tests_configuration/makefile @@ -2,7 +2,7 @@ include cpp/variables.def PROJECT = tests_configuration TYPE = test -TARGETS = test_ini_configurator.exe test_section_manager.exe test_tokenizer.exe +TARGETS = test_ini_configurator.exe test_ini_parser.exe test_section_manager.exe test_tokenizer.exe LOCAL_LIBS_USED = unit_test application loggers geometric configuration textual timely filesystem \ structures basis RUN_TARGETS = $(ACTUAL_TARGETS) diff --git a/nucleus/library/tests_configuration/test_ini_parser.cpp b/nucleus/library/tests_configuration/test_ini_parser.cpp new file mode 100644 index 00000000..42921454 --- /dev/null +++ b/nucleus/library/tests_configuration/test_ini_parser.cpp @@ -0,0 +1,112 @@ +/*****************************************************************************\ +* * +* Name : test_ini_parser * +* Author : Chris Koeritz * +* * +******************************************************************************* +* Copyright (c) 1991-$now By Author. 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. This is online at: * +* http://www.fsf.org/copyleft/gpl.html * +* Please send any updates to: fred@gruntose.com * +\*****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const astring INI_FILE_1 = "\ +[bork]\n\ +norple=1\n\ +train=12.5\n\ +singhy=9 \r\n\ +\n\ +[twerf]\r\n\ +noodles=fungus\n\ +dora=34\n\ +"; + +//#define READ_FILE_TEST + // uncomment to read in a file and parse it. + +class test_ini_parser : public application_shell +{ +public: + test_ini_parser() : application_shell(class_name()) {} + DEFINE_CLASS_NAME("test_ini_parser"); + virtual int execute(); +}; + +int test_ini_parser::execute() +{ + program_wide_logger::get().eol(log_base::NO_ENDING); + + ini_parser par(INI_FILE_1); + +//astring dump; +//par.restate(dump); +//log(astring("table has:\n") + dump); + + string_table twerf; + if (!par.get_section("twerf", twerf)) + deadly_error(class_name(), "get_section 1", "twerf section was not found"); +//log(astring("twerf section is: ") + twerf.text_form()); + if (!twerf.find("noodles")) + deadly_error(class_name(), "get_section 1", "item #1 was not found"); + if (*twerf.find("noodles") != "fungus") + deadly_error(class_name(), "get_section 1", "item #1 found is incorrect"); + if (!twerf.find("dora")) + deadly_error(class_name(), "get_section 1", "item #2 was not found"); + if (*twerf.find("dora") != "34") + deadly_error(class_name(), "get_section 1", "item #2 found is incorrect"); + + string_table bork; + if (!par.get_section("bork", bork)) + deadly_error(class_name(), "get_section 2", "bork section was not found"); + if (!bork.find("norple")) + deadly_error(class_name(), "get_section 2", "item #1 was not found"); + if (*bork.find("norple") != "1") + deadly_error(class_name(), "get_section 2", "item #1 found is incorrect"); + if (!bork.find("train")) + deadly_error(class_name(), "get_section 2", "item #2 was not found"); + if (*bork.find("train") != "12.5") + deadly_error(class_name(), "get_section 2", "item #2 found is incorrect"); + if (!bork.find("singhy")) + deadly_error(class_name(), "get_section 2", "item #3 was not found"); + if (*bork.find("singhy") != "9") + deadly_error(class_name(), "get_section 2", "item #3 found is incorrect"); + + astring new_ini; + par.restate(new_ini); + + program_wide_logger::get().eol(log_base::CRLF_AT_END); + log(""); + +#ifdef READ_FILE_TEST + byte_filer input("c:/home/fungal.lld", "rb"); + int len = input.length(); + log(a_sprintf("fungal len is %d", len)); + astring jojo; + input.read(jojo, len); + //log("whole file is:"); + //log(jojo); + + ini_parser klug(jojo); + astring dump2; + klug.restate(dump2); + log(dump2); +#endif + + critical_events::alert_message("ini_parser:: works for those functions tested.\n"); + return 0; +} + +HOOPLE_MAIN(test_ini_parser, ) + diff --git a/scripts/buildor/upgrade_hoople_to_feistymeow.sh b/scripts/buildor/upgrade_hoople_to_feistymeow.sh index 515b9819..9c549b05 100644 --- a/scripts/buildor/upgrade_hoople_to_feistymeow.sh +++ b/scripts/buildor/upgrade_hoople_to_feistymeow.sh @@ -153,6 +153,7 @@ standards and usages." | sed -e 's/application_shell(static_class_name())/application_shell()/g' \ | sed -e 's/guards::alert_message/critical_events::alert_message/g' \ | sed -e 's/^#include *$/#include /g' \ + | sed -e 's/^#include *$/#include /g' \ | sed -e 's/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/[\/]*/\/\/\/\/\/\/\/\/\/\/\/\/\/\//g' \ >"$tempfile"