\*****************************************************************************/
#include <application/hoople_main.h>
+#include <application/application_shell.h>
#include <basis/byte_array.h>
-#include <mathematics/chaos.h>
#include <basis/functions.h>
#include <basis/guards.h>
#include <basis/astring.h>
-#include <application/application_shell.h>
#include <loggers/console_logger.h>
#include <loggers/program_wide_logger.h>
-#include <structures/static_memory_gremlin.h>
+#include <mathematics/chaos.h>
#include <octopus/entity_data_bin.h>
#include <octopus/entity_defs.h>
+#include <structures/static_memory_gremlin.h>
#include <tentacles/security_infoton.h>
#include <textual/string_manipulation.h>
+#include <unit_test/unit_base.h>
#include <stdio.h>
using namespace loggers;
using namespace octopi;
using namespace textual;
+using namespace unit_test;
const int ITEM_COUNT = 10000;
// the number of times to repeat each test operation.
-#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger().get(), astring(s))
-#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger().get(), astring(s))
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
+#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), astring(s))
-class test_bin : public application_shell
+class test_bin : virtual public unit_base, virtual public application_shell
{
public:
test_bin() : application_shell() {}
//LOG("note memory usage and hit a key:");
//c = getchar();
- program_wide_logger().get().eol(parser_bits::NO_ENDING);
+ program_wide_logger::get().eol(parser_bits::NO_ENDING);
for (int i = 1; i <= ITEM_COUNT; i++) {
// test the basic filling of the values in an entity.
octopus_request_id req_id;
fflush(NULL_POINTER);
}
}
- program_wide_logger().get().eol(parser_bits::CRLF_AT_END);
+ program_wide_logger::get().eol(parser_bits::CRLF_AT_END);
LOG("");
int items_seen = 0;
- program_wide_logger().get().eol(parser_bits::NO_ENDING);
+ program_wide_logger::get().eol(parser_bits::NO_ENDING);
if (q == ANY) {
while (item_list.length()) {
octopus_request_id id;
} else {
deadly_error(class_name(), "looping", "bad enum value");
}
- program_wide_logger().get().eol(parser_bits::CRLF_AT_END);
+ program_wide_logger::get().eol(parser_bits::CRLF_AT_END);
LOG("");
item_list.reset();
item_list.shrink();
\*****************************************************************************/
#include <application/hoople_main.h>
+#include <application/application_shell.h>
#include <basis/byte_array.h>
-#include <mathematics/chaos.h>
+#include <configuration/application_configuration.h>
#include <basis/functions.h>
#include <basis/guards.h>
#include <basis/astring.h>
#include <basis/mutex.h>
-#include <structures/amorph.h>
-#include <structures/static_memory_gremlin.h>
#include <loggers/console_logger.h>
-#include <processes/ethread.h>
-#include <processes/safe_roller.h>
-#include <timely/time_control.h>
-#include <timely/time_stamp.h>
+#include <mathematics/chaos.h>
#include <octopus/entity_data_bin.h>
#include <octopus/entity_defs.h>
#include <octopus/unhandled_request.h>
-#include <application/application_shell.h>
-#include <configuration/application_configuration.h>
+#include <processes/ethread.h>
+#include <processes/safe_roller.h>
+#include <structures/amorph.h>
+#include <structures/static_memory_gremlin.h>
+#include <structures/string_array.h>
#include <textual/string_manipulation.h>
+#include <timely/time_control.h>
+#include <timely/time_stamp.h>
+#include <unit_test/unit_base.h>
#include <stdio.h>
#endif
using namespace application;
+using namespace basis;
using namespace loggers;
+using namespace mathematics;
using namespace octopi;
using namespace processes;
+using namespace structures;
+using namespace textual;
using namespace timely;
+using namespace unit_test;
// global constants...
// a very short duration for data to live.
#define LOG(to_print) printf("%s\n", (char *)astring(to_print).s());
-//CLASS_EMERGENCY_LOG(program_wide_logger().get(), to_print)
+//CLASS_EMERGENCY_LOG(program_wide_logger::get().get(), to_print)
// our macro for logging with a timestamp.
// global objects...
octopus_request_id req_id;
if (randomizer().inclusive(1, 100) < 25) {
// some of the time we make a totally random entity id.
- int sequencer = randomizer().inclusive(1, MAXINT - 10);
- int add_in = randomizer().inclusive(0, MAXINT - 10);
- int process_id = randomizer().inclusive(0, MAXINT - 10);
+ int sequencer = randomizer().inclusive(1, MAXINT32 - 10);
+ int add_in = randomizer().inclusive(0, MAXINT32 - 10);
+ int process_id = randomizer().inclusive(0, MAXINT32 - 10);
req_id._entity = octopus_entity(string_manipulation::make_random_name(),
process_id, sequencer, add_in);
} else {
req_id._entity = octopus_entity("boringentity",
process_id, sequencer, add_in);
}
- req_id._request_num = randomizer().inclusive(1, MAXINT - 10);
+ req_id._request_num = randomizer().inclusive(1, MAXINT32 - 10);
return req_id;
}
void perform_activity(void *formal(data)) {
FUNCDEF("perform_activity");
while (!should_stop()) {
- // one activation of monk has devastating consequences. we empty out
- // the data one item at a time until we see no data at all. after
- // cleaning each item, we ensure that the deadwood is cleaned out.
- binger._ent_lock->lock();
+ {
+ // one activation of monk has devastating consequences. we empty out
+ // the data one item at a time until we see no data at all. after
+ // cleaning each item, we ensure that the deadwood is cleaned out.
+//// binger._ent_lock->lock();
+ auto_synchronizer l(binger.locker());
LOG(a_sprintf("monk sees %d items.", binger.items_held()));
- while (binger.items_held()) {
- // grab one instance of any item in the bin.
- octopus_request_id id;
- infoton *found = binger.acquire_for_any(id);
- WHACK(found);
- // also clean out things a lot faster than normal.
- binger.clean_out_deadwood(MONKS_CLEANING_TIME);
+ while (binger.items_held()) {
+ // grab one instance of any item in the bin.
+ octopus_request_id id;
+ infoton *found = binger.acquire_for_any(id);
+ WHACK(found);
+ // also clean out things a lot faster than normal.
+ binger.clean_out_deadwood(MONKS_CLEANING_TIME);
+ }
+/// binger._ent_lock->unlock();
}
- binger._ent_lock->unlock();
LOG(a_sprintf("after a little cleaning, monk sees %d items.", binger.items_held()));
// snooze.
int sleepy_time = randomizer().inclusive(MIN_MONK_THREAD_PAUSE,
class test_entity_data_bin_threaded : public application_shell
{
public:
- test_entity_data_bin_threaded() : application_shell(class_name()) {}
+ test_entity_data_bin_threaded() : application_shell() {}
DEFINE_CLASS_NAME("test_entity_data_bin_threaded");
// how many evaporated due to timeout.
- guards::alert_message("t_bin_threaded:: works for all functions tested.");
+ critical_events::alert_message("t_bin_threaded:: works for all functions tested.");
return 0;
}