t_unique_id.cpp

Go to the documentation of this file.
00001 /*****************************************************************************\
00002 *                                                                             *
00003 *  Name   : t_unique_id                                                       *
00004 *  Author : Chris Koeritz                                                     *
00005 *                                                                             *
00006 *******************************************************************************
00007 * Copyright (c) 2005-$now By Author.  This program is free software; you can  *
00008 * redistribute it and/or modify it under the terms of the GNU General Public  *
00009 * License as published by the Free Software Foundation; either version 2 of   *
00010 * the License or (at your option) any later version.  This is online at:      *
00011 *     http://www.fsf.org/copyleft/gpl.html                                    *
00012 * Please send any updates to: fred@gruntose.com                               *
00013 \*****************************************************************************/
00014 
00015 #include <basis/chaos.h>
00016 #include <basis/guards.h>
00017 #include <basis/istring.h>
00018 #include <data_struct/unique_id.h>
00019 #include <data_struct/static_memory_gremlin.h>
00020 
00021 #ifdef DEBUG_STACK
00022   #include <loggers/console_logger.h>
00023   #include <stdio.h>
00024   console_logger out;
00025   #define LOG(to_print) { out.log(to_print); fflush(0); }
00026 #endif
00027 
00028 #include <stdlib.h>
00029 #include <string.h>
00030 
00031 HOOPLE_STARTUP_CODE;
00032 
00033 int main(int formal(argc), char *formal(argv)[])
00034 {
00035   unique_int ted(25);
00036   unique_int jed;
00037 
00038   if (!ted)
00039     deadly_error("t_unique_id", "testing non-zero", "claimed was zero");
00040   if (!!jed)
00041     deadly_error("t_unique_id", "testing zero", "claimed was not zero");
00042   if (!!!ted)
00043     deadly_error("t_unique_id", "testing non-zero doubled", "claimed was zero");
00044   if (!!!!jed)
00045     deadly_error("t_unique_id", "testing zero doubled", "claimed was not zero");
00046 
00047   unique_int med(25);
00048   unique_int fed(0);
00049 
00050   if (med != ted)
00051     deadly_error("t_unique_id", "testing equality 1", "incorrect result");
00052   if (fed != jed)
00053     deadly_error("t_unique_id", "testing equality 2", "incorrect result");
00054   if (med == jed)
00055     deadly_error("t_unique_id", "testing equality 3", "incorrect result");
00056   if (fed == ted)
00057     deadly_error("t_unique_id", "testing equality 4", "incorrect result");
00058 
00059   guards::alert_message("unique_id:: works for those functions tested.");
00060   return 0;
00061 }
00062 

Generated on Fri Nov 28 04:29:37 2008 for HOOPLE Libraries by  doxygen 1.5.1