]> feistymeow.org Git - feisty_meow.git/commitdiff
clobbering our way through the errors
authorFred T. Hamster <fred@feistymeow.org>
Sun, 15 Feb 2026 19:01:19 +0000 (14:01 -0500)
committerFred T. Hamster <fred@feistymeow.org>
Sun, 15 Feb 2026 19:01:19 +0000 (14:01 -0500)
octopi/library/tests_octopus/test_entity.cpp
octopi/library/tests_octopus/test_identity.cpp
octopi/library/tests_octopus/test_security.cpp
octopi/library/tests_octopus/test_unpacker.cpp

index d92409824eee962a1b00965b618371f31ac842cf..a23cb176b68f12cf44b6f192d6eb5532407f0cda 100644 (file)
 * Please send any updates to: fred@gruntose.com                               *
 \*****************************************************************************/
 
+#include <application/application_shell.h>
+#include <application/hoople_main.h>
 #include <basis/byte_array.h>
-#include <mathematics/chaos.h>
 #include <basis/guards.h>
 #include <basis/astring.h>
-#include <octopus/entity_defs.h>
-#include <application/application_shell.h>
+#include <configuration/application_configuration.h>
 #include <loggers/console_logger.h>
 #include <loggers/file_logger.h>
-#include <structures/static_memory_gremlin.h>
+#include <loggers/program_wide_logger.h>
+#include <mathematics/chaos.h>
+#include <octopus/entity_defs.h>
 #include <sockets/tcpip_stack.h>
+#include <structures/static_memory_gremlin.h>
 #include <textual/string_manipulation.h>
+#include <unit_test/unit_base.h>
 
 #ifdef __WIN32__
   #include <process.h>
   #include <unistd.h>
 #endif
 
+using namespace application;
+using namespace basis;
+using namespace configuration;
+using namespace loggers;
+using namespace mathematics;
+using namespace octopi;
+using namespace sockets;
+using namespace textual;
+using namespace unit_test;
+
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
+
 const int ITERATE_EACH_TEST = 1000;
   // the number of times to repeat each test operation.
 
-class test_entity : public application_shell
+class test_entity : virtual public unit_base, virtual public application_shell
 {
 public:
-  test_entity() : application_shell(class_name()) {}
+  test_entity() : application_shell() {}
+//class_name()
   DEFINE_CLASS_NAME("test_entity");
   virtual int execute();
 };
 
 int test_entity::execute()
 {
+  FUNCDEF("execute");
   chaos rando;
-  SET_DEFAULT_COMBO_LOGGER;
+///  SET_DEFAULT_COMBO_LOGGER;
   tcpip_stack stack;
 
   octopus_entity blankie;
@@ -63,8 +81,8 @@ int test_entity::execute()
   for (int i = 0; i < ITERATE_EACH_TEST; i++) {
     // test the basic filling of the values in an entity.
     octopus_entity blank_ent;
-    int sequencer = rando.inclusive(1, MAXINT - 10);
-    int add_in = rando.inclusive(0, MAXINT - 10);
+    int sequencer = rando.inclusive(1, MAXINT32 - 10);
+    int add_in = rando.inclusive(0, MAXINT32 - 10);
     octopus_entity filled_ent(stack.hostname(), application_configuration::process_id(), sequencer,
         add_in);
     blank_ent = octopus_entity(stack.hostname(), application_configuration::process_id(), sequencer,
@@ -76,9 +94,9 @@ int test_entity::execute()
     astring text2 = blank_ent.to_text();
     if (text1 != text2)
       deadly_error(class_name(), "to_text test", "strings are different");
-///log(text1);
+///LOG(text1);
     octopus_entity georgio = octopus_entity::from_text(text2);
-///log(georgio.to_text());
+///LOG(georgio.to_text());
     if (georgio != filled_ent)
       deadly_error(class_name(), "from_text test",
           "entity is different after from_text");
@@ -96,7 +114,7 @@ int test_entity::execute()
     if (blank_ent != filled_ent)
       deadly_error(class_name(), "reset from attribs test",
           "failed to resolve to same id");
-//    log(a_sprintf("%d: ", i + 1) + filled_ent.mangled_form());
+//    LOG(a_sprintf("%d: ", i + 1) + filled_ent.mangled_form());
 
     byte_array chunk1;
     filled_ent.pack(chunk1);
@@ -108,10 +126,10 @@ int test_entity::execute()
 
     // test of entity packing and size calculation.
     octopus_entity ent(string_manipulation::make_random_name(1, 428),
-            randomizer().inclusive(0, MAXINT/2),
-            randomizer().inclusive(0, MAXINT/2),
-            randomizer().inclusive(0, MAXINT/2));
-    octopus_request_id bobo(ent, randomizer().inclusive(0, MAXINT/2));
+            randomizer().inclusive(0, MAXINT32/2),
+            randomizer().inclusive(0, MAXINT32/2),
+            randomizer().inclusive(0, MAXINT32/2));
+    octopus_request_id bobo(ent, randomizer().inclusive(0, MAXINT32/2));
     int packed_estimate = bobo.packed_size();
     byte_array packed_bobo;
     bobo.pack(packed_bobo);
@@ -121,7 +139,7 @@ int test_entity::execute()
   }
 
 
-  log("octopus_entity:: works for those functions tested.");
+  LOG(astring(class_name()) + ":: works for those functions tested.");
   return 0;
 }
 
index eb7dd35f114b01bf59d74fba76f2b362d62a2a25..8e541c55277fdea98086185f1c0012bdedcc07ce 100644 (file)
 * Please send any updates to: fred@gruntose.com                               *
 \*****************************************************************************/
 
+#include <application/application_shell.h>
+#include <application/hoople_main.h>
 #include <basis/astring.h>
+#include <loggers/console_logger.h>
+#include <loggers/critical_events.h>
+#include <loggers/program_wide_logger.h>
 #include <octopus/entity_defs.h>
 #include <octopus/identity_infoton.h>
 #include <octopus/infoton.h>
 #include <octopus/octopus.h>
 #include <octopus/tentacle.h>
-#include <application/application_shell.h>
-#include <loggers/console_logger.h>
 #include <structures/static_memory_gremlin.h>
+#include <unit_test/unit_base.h>
+
+using namespace application;
+using namespace basis;
+//using namespace configuration;
+using namespace loggers;
+using namespace mathematics;
+using namespace octopi;
+//using namespace sockets;
+using namespace textual;
+using namespace unit_test;
+
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
 
 //////////////
 
-class test_octopus_identity : public application_shell
+class test_octopus_identity : virtual public unit_base, virtual public application_shell
 {
 public:
-  test_octopus_identity() : application_shell(class_name()) {}
+  test_octopus_identity() : application_shell() {}
+//class_name()
   DEFINE_CLASS_NAME("test_octopus_identity");
   virtual int execute();
 };
 
 int test_octopus_identity::execute()
 {
+  FUNCDEF("execute")
   octopus logos("local", 18 * MEGABYTE);
 
   identity_infoton *ide = new identity_infoton;
@@ -55,7 +73,7 @@ int test_octopus_identity::execute()
     deadly_error(class_name(), "evaluate test",
         astring("the evaluation failed with an error ")
         + tentacle::outcome_name(ret));
-log("point a");
+LOG("point a");
 
   octopus_request_id response_id;  // based on bogus from before.
   infoton *response = logos.acquire_result(junk_id._entity, response_id);
@@ -70,14 +88,14 @@ log("point a");
 
   octopus_entity my_ide = new_id->_new_name;
 
-log(astring("new id is: ") + my_ide.text_form());
+LOG(astring("new id is: ") + my_ide.text_form());
 
   if (my_ide.blank())
     deadly_error(class_name(), "retrieving id",
         astring("the new entity id is blank."));
 
 
-  log("octopus:: identity works for those functions tested.");
+  LOG("octopus:: identity works for those functions tested.");
 
   return 0;
 }
index 4ce733b16e76c3013e48796c25baafc6a7fb60a0..3be12117cd801435d59487721ae99519abfebbcf 100644 (file)
 * Please send any updates to: fred@gruntose.com                               *
 \*****************************************************************************/
 
+#include <application/application_shell.h>
+#include <application/hoople_main.h>
 #include <basis/astring.h>
 #include <basis/mutex.h>
-#include <structures/static_memory_gremlin.h>
+#include <configuration/application_configuration.h>
+#include <loggers/console_logger.h>
+#include <loggers/critical_events.h>
+#include <loggers/program_wide_logger.h>
 #include <octopus/entity_defs.h>
 #include <octopus/infoton.h>
 #include <octopus/octopus.h>
 #include <octopus/tentacle.h>
-#include <application/application_shell.h>
-#include <loggers/console_logger.h>
 #include <structures/static_memory_gremlin.h>
 #include <sockets/internet_address.h>
+//#include <structures/static_memory_gremlin.h>
+#include <structures/string_array.h>
 #include <tentacles/login_tentacle.h>
 #include <tentacles/simple_entity_registry.h>
+#include <unit_test/unit_base.h>
+
+using namespace application;
+using namespace basis;
+using namespace configuration;
+using namespace loggers;
+using namespace mathematics;
+using namespace octopi;
+using namespace sockets;
+using namespace structures;
+using namespace textual;
+using namespace unit_test;
+
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
 
 //////////////
 
@@ -44,6 +63,10 @@ public:
 
   simple_infoton() : infoton(simp_classifier()) {}
 
+  virtual void text_form(basis::base_string &state_fill) const {
+    state_fill.concatenate_string(astring("futzle=") + futzle);
+  }
+
   virtual void pack(byte_array &packed_form) const {
     futzle.pack(packed_form);
   }
@@ -96,16 +119,18 @@ public:
 //      a while, log out, do another one, let it time out, try to access
 //      something with dead id hoping to be rejected, etc.
 
-class test_octopus_security : public application_shell
+class test_octopus_security : virtual public unit_base, virtual public application_shell
 {
 public:
-  test_octopus_security() : application_shell(class_name()) {}
+  test_octopus_security() : application_shell() {}
+//class_name()
   DEFINE_CLASS_NAME("test_octopus_security");
   virtual int execute();
 };
 
 int test_octopus_security::execute()
 {
+  FUNCDEF("execute")
   octopus logos("local", 18 * MEGABYTE);
   simple_tentacle *tenty = new simple_tentacle;
   logos.add_tentacle(tenty);
@@ -173,7 +198,7 @@ int test_octopus_security::execute()
         astring("the operation failed with an error ")
         + tentacle::outcome_name(ret));
 
-  log("octopus:: security works for those functions tested.");
+  LOG(astring(class_name()) + ":: security works for those functions tested.");
 
   WHACK(guardian); 
 
index 1ad69a8d2a9e6d1eaf62fb0e7183388a98cd8963..ed16fcf8ce598602f0f196d3b22cb511ced834fa 100644 (file)
 * Please send any updates to: fred@gruntose.com                               *
 \*****************************************************************************/
 
+#include <application/application_shell.h>
+#include <application/hoople_main.h>
 #include <basis/astring.h>
-#include <structures/static_memory_gremlin.h>
+#include <loggers/console_logger.h>
+#include <loggers/file_logger.h>
+#include <loggers/program_wide_logger.h>
 #include <octopus/entity_defs.h>
 #include <octopus/infoton.h>
 #include <octopus/octopus.h>
 #include <octopus/tentacle_helper.h>
-#include <application/application_shell.h>
-#include <loggers/console_logger.h>
-#include <loggers/file_logger.h>
-#include <structures/static_memory_gremlin.h>
 #include <sockets/internet_address.h>
+#include <structures/static_memory_gremlin.h>
+#include <structures/string_array.h>
+#include <unit_test/unit_base.h>
+
+using namespace application;
+using namespace basis;
+using namespace configuration;
+using namespace loggers;
+using namespace mathematics;
+using namespace octopi;
+using namespace sockets;
+using namespace structures;
+using namespace textual;
+using namespace unit_test;
+
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
 
 //hmmm: provide equality ops to be able to check that same stuff
 //      came back out that went in.
 
-class test_unpacker : public application_shell
+class test_unpacker : virtual public unit_base, virtual public application_shell
 {
 public:
-  test_unpacker() : application_shell(class_name()) {}
+  test_unpacker() : application_shell() {}
   DEFINE_CLASS_NAME("test_unpacker");
   virtual int execute();
   void test_unpacking();
@@ -63,17 +79,23 @@ const char *addr_list[] = { "address" };
 SAFE_STATIC_CONST(string_array, addr_classifier, (base_classifier()
     + string_array(1, addr_list)))
 
-class address_ton : public infoton, public network_address
+class address_ton : public infoton, public internet_address
 {
 public:
   address_ton() : infoton(addr_classifier() + "leaf") {}
 
+  const char *class_name() const { return "address_ton"; }
+
   virtual void pack(byte_array &packed_form) const {
-    network_address::pack(packed_form);
+    internet_address::pack(packed_form);
+  }
+
+  virtual void text_form(basis::base_string &state_fill) const {
+    state_fill.concatenate_string(internet_address::text_form());
   }
 
   virtual bool unpack(byte_array &packed_form) {
-    return network_address::unpack(packed_form);
+    return internet_address::unpack(packed_form);
   }
 
   virtual int packed_size() const {
@@ -94,11 +116,17 @@ public:
 
   float_ton() : infoton(math_classifier() + "float") {}
 
+  const char *class_name() const { return "float_ton"; }
+
   virtual void pack(byte_array &packed_form) const {
     structures::attach(packed_form, f1);
     structures::attach(packed_form, d1);
   }
 
+  virtual void text_form(basis::base_string &state_fill) const {
+    state_fill.concatenate_string(a_sprintf("f1=%f d1=%f", f1, d1));
+  }
+
   virtual int packed_size() const {
     return sizeof(double) + sizeof(float);
   }
@@ -124,6 +152,19 @@ public:
 
   int_set_ton() : infoton(math_classifier() + "intset") {}
 
+  const char *class_name() const { return "int_set_ton"; }
+
+  virtual void text_form(basis::base_string &state_fill) const {
+    state_fill.concatenate_string(astring("( "));
+    for (int indy = 0; indy < nums.length(); indy++) {
+      state_fill.concatenate_string(a_sprintf("%d", nums[indy]));
+      if (indy < nums.length() - 1) {
+        state_fill.concatenate_string(astring(", "));
+      }
+    }
+    state_fill.concatenate_string(astring(" )"));
+  }
+
   virtual void pack(byte_array &packed_form) const {
     structures::attach(packed_form, nums.elements());
     for (int i = 0; i < nums.elements(); i++)
@@ -173,7 +214,7 @@ public:
     reformed = NULL_POINTER;
     if (classifier.length() < 2) return BAD_INPUT;
     astring key = classifier[1];
-    if (key == "float") {
+    if (key == astring("float")) {
       float_ton *to_return = new float_ton;
       if (!to_return->unpack(packed_form)) {
         WHACK(to_return);
@@ -181,7 +222,7 @@ public:
       }
       reformed = to_return;
       return OKAY;
-    } else if (key == "intset") {
+    } else if (key == astring("intset")) {
       int_set_ton *to_return = new int_set_ton;
       if (!to_return->unpack(packed_form)) {
         WHACK(to_return);
@@ -250,7 +291,7 @@ public:
     real_class.zap(0, 0);
     to_chow.set_classifier(real_class);
     // route to octopus.
-    return _unpackers.evaluate((infoton *)to_chow.clone(), item_id);
+    return _unpackers.evaluate(dynamic_cast<infoton *>(to_chow.clone()), item_id);
   }
 
   void expunge(const octopus_entity &formal(whackola)) {}
@@ -352,7 +393,7 @@ void test_unpacker::test_unpacking()
   chunkmo += 0x37;
   chunkmo += 0x65;
   address_ton norf;
-  (network_address &)norf = network_address(internet_address
+  (internet_address &)norf = internet_address(internet_address
       (chunkmo, "urp", 23841));
   chunkmo.reset();
   infoton::fast_pack(chunkmo, norf);
@@ -361,7 +402,7 @@ void test_unpacker::test_unpacking()
   if (!infoton::fast_unpack(chunkmo, clarfiator, pacula))
     deadly_error(class_name(), "test fast_unpack", "chunkmo has errors");
   infoton *scrung = NULL_POINTER;
-//log(astring("classif is ") + clarfiator.text_form());
+//LOG(astring("classif is ") + clarfiator.text_form());
 
   outcome scrung_ret = unpacky.restore(clarfiator, pacula, scrung);
   if (scrung_ret != tentacle::OKAY)
@@ -372,7 +413,7 @@ void test_unpacker::test_unpacking()
   if (!rescrung)
     deadly_error(class_name(), "test fast_unpack", "wrong dynamic type for scrung");
   address_ton &prescrung = *rescrung;
-  if ((network_address &)prescrung != (network_address &)norf)
+  if ((internet_address &)prescrung != (internet_address &)norf)
     deadly_error(class_name(), "test fast_unpack", "wrong network address restored");
   WHACK(scrung);
 }
@@ -382,12 +423,13 @@ const int MAXIMUM_TESTS = 10;
 
 int test_unpacker::execute()
 {
+  FUNCDEF("execute");
   int iters = 0;
   while (iters++ < MAXIMUM_TESTS) {
-//log(a_sprintf("iter #%d", iters));
+//LOG(a_sprintf("iter #%d", iters));
     test_unpacking();
   }
-  log("unpacking octopus:: works for all functions tested.");
+  LOG(astring(class_name()) + ":: works for all functions tested.");
 //time_control::sleep_ms(30000);
   return 0;
 }