1 /*****************************************************************************\
4 * Author : Chris Koeritz *
8 * Tests out the node base class. *
10 *******************************************************************************
11 * Copyright (c) 1989-$now By Author. This program is free software; you can *
12 * redistribute it and/or modify it under the terms of the GNU General Public *
13 * License as published by the Free Software Foundation; either version 2 of *
14 * the License or (at your option) any later version. This is online at: *
15 * http://www.fsf.org/copyleft/gpl.html *
16 * Please send any updates to: fred@gruntose.com *
17 \*****************************************************************************/
19 //hmmm: make this a more aggressive and realistic test. try implementing
20 // some list algorithms or graph algorithms to push node around.
22 #include <application/hoople_main.h>
23 #include <basis/astring.h>
24 #include <basis/byte_array.h>
25 #include <basis/functions.h>
26 #include <basis/guards.h>
27 #include <loggers/console_logger.h>
28 #include <nodes/node.h>
29 #include <structures/static_memory_gremlin.h>
30 #include <unit_test/unit_base.h>
32 using namespace application;
33 using namespace basis;
34 using namespace filesystem;
35 using namespace loggers;
36 using namespace mathematics;
37 using namespace nodes;
38 using namespace structures;
39 using namespace textual;
40 using namespace timely;
41 using namespace unit_test;
43 #define LOG(to_print) EMERGENCY_LOG(program_wide_logger().get(), astring(to_print))
45 class test_node : public virtual unit_base, public virtual application_shell
49 DEFINE_CLASS_NAME("test_node");
50 virtual int execute();
53 void bogon(byte_array *fred)
59 int test_node::execute()
64 basket<byte_array> fred(2, blank);
65 basket<byte_array> george(2, blank);
66 basket<byte_array> f_end1(0);
67 basket<byte_array> f_end2(0);
68 basket<byte_array> g_end1(0);
69 basket<byte_array> g_end2(0);
73 // add some links to the linkless root.
74 root.insert_link(0, &fred);
75 root.insert_link(1, &george);
77 // set the pre-existing links to our end points.
78 fred.set_link(0, &f_end1);
79 fred.set_link(1, &f_end2);
80 george.set_link(0, &g_end1);
81 george.set_link(1, &g_end2);
83 return final_report();
86 HOOPLE_MAIN(test_node, );