feisty meow concerns codebase  2.140
checkup.cpp
Go to the documentation of this file.
1 /*
2 * Name : checkup
3 * Author : Chris Koeritz
4 **
5 * Copyright (c) 1990-$now By Author. This program is free software; you can *
6 * redistribute it and/or modify it under the terms of the GNU General Public *
7 * License as published by the Free Software Foundation; either version 2 of *
8 * the License or (at your option) any later version. This is online at: *
9 * http://www.fsf.org/copyleft/gpl.html *
10 * Please send any updates to: fred@gruntose.com *
11 */
12 
13 #include "checkup.h"
14 
15 #include <basis/astring.h>
17 
18 using namespace basis;
19 using namespace loggers;
20 using namespace unit_test;
21 
22 namespace system_checkup {
23 
24 #undef UNIT_BASE_THIS_OBJECT
25 #define UNIT_BASE_THIS_OBJECT testing
26 #undef static_class_name
27 #define static_class_name() astring("system_checkup")
28 
30 {
31  FUNCDEF("check_system_characteristics")
32  // a big assumption is that the size of an unsigned character is just
33  // one byte. if this is not true, probably many things would break...
34  int byte_size = sizeof(abyte);
35  ASSERT_EQUAL(byte_size, 1, "byte size should be 1 byte");
36  int int16_size = sizeof(int16);
37  ASSERT_FALSE( (sizeof(uint16) != int16_size) || (int16_size != 2),
38  "uint16 size should be 2 bytes");
39  int uint_size = sizeof(un_int);
40 //hmmm: the checks are actually redundant...
41  ASSERT_FALSE( (uint_size != sizeof(int)) || (uint_size != 4),
42  "un_int size should be 2 bytes");
43  // all tests successfully passed.
44  return true;
45 }
46 
47 #undef UNIT_BASE_THIS_OBJECT
48 #define UNIT_BASE_THIS_OBJECT (*this)
49 #undef static_class_name
50 
51 } // namespace
52 
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Definition: enhance_cpp.h:57
The guards collection helps in testing preconditions and reporting errors.
Definition: array.h:30
unsigned short uint16
Definition: definitions.h:111
unsigned char abyte
A fairly important unit which is seldom defined...
Definition: definitions.h:51
unsigned int un_int
Abbreviated name for unsigned integers.
Definition: definitions.h:62
signed short int16
Definition: definitions.h:110
A logger that sends to the console screen using the standard output device.
bool check_system_characteristics(unit_base &testing)
Definition: checkup.cpp:29
Useful support functions for unit testing, especially within hoople.
Definition: unit_base.cpp:35
#define ASSERT_EQUAL(a, b, test_name)
Definition: unit_base.h:38
#define ASSERT_FALSE(a, test_name)
Definition: unit_base.h:50