t_node.cpp

Go to the documentation of this file.
00001 /*****************************************************************************\
00002 *                                                                             *
00003 *  Name   : t_node                                                            *
00004 *  Author : Chris Koeritz                                                     *
00005 *                                                                             *
00006 *  Purpose:                                                                   *
00007 *                                                                             *
00008 *    Tests out the node base class.                                           *
00009 *                                                                             *
00010 *******************************************************************************
00011 * Copyright (c) 1989-$now By Author.  This program is free software; you can  *
00012 * redistribute it and/or modify it under the terms of the GNU General Public  *
00013 * License as published by the Free Software Foundation; either version 2 of   *
00014 * the License or (at your option) any later version.  This is online at:      *
00015 *     http://www.fsf.org/copyleft/gpl.html                                    *
00016 * Please send any updates to: fred@gruntose.com                               *
00017 \*****************************************************************************/
00018 
00019 //hmmm: make this a more aggressive and realistic test.  try implementing
00020 //      some list algorithms or graph algorithms to push node around.
00021 
00022 #include <basis/byte_array.h>
00023 #include <basis/function.h>
00024 #include <basis/guards.h>
00025 #include <basis/istring.h>
00026 #include <nodes/node.h>
00027 #include <loggers/console_logger.h>
00028 #include <data_struct/static_memory_gremlin.h>
00029 
00030 HOOPLE_STARTUP_CODE;
00031 
00032 using namespace nodes;
00033 
00034 void log(const istring &to_print)
00035 { static console_logger _log; _log.log(to_print); }
00036 
00037 void bogon(byte_array *fred)
00038 {
00039   if (fred) log("eep");
00040   else log("eek");
00041 }
00042 
00043 int main(int formal(argc), char *formal(argv)[])
00044 {
00045   SET_DEFAULT_CONSOLE_LOGGER;
00046 
00047   byte_array blank;
00048   basket<byte_array> fred(2, blank);
00049   basket<byte_array> george(2, blank);
00050   basket<byte_array> f_end1(0);
00051   basket<byte_array> f_end2(0);
00052   basket<byte_array> g_end1(0);
00053   basket<byte_array> g_end2(0);
00054 
00055   node root;
00056 
00057   // add some links to the linkless root.
00058   root.insert_link(0, &fred);
00059   root.insert_link(1, &george);
00060 
00061   // set the pre-existing links to our end points.
00062   fred.set_link(0, &f_end1);
00063   fred.set_link(1, &f_end2);
00064   george.set_link(0, &g_end1);
00065   george.set_link(1, &g_end2);
00066 
00067   guards::alert_message("node:: works for those functions tested.");
00068   return 0;
00069 }
00070 
00071 

Generated on Fri Nov 21 04:30:12 2008 for HOOPLE Libraries by  doxygen 1.5.1