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>
16 #include <basis/enhance_cpp.h>
18 
19 using namespace basis;
20 using namespace loggers;
21 using namespace unit_test;
22 
23 namespace system_checkup {
24 
25 #undef UNIT_BASE_THIS_OBJECT
26 #define UNIT_BASE_THIS_OBJECT testing
27 #undef static_class_name
28 #define static_class_name() "system_checkup"
29 
31 {
32  FUNCDEF("check_system_characteristics")
33  // a big assumption is that the size of an unsigned character is just
34  // one byte. if this is not true, probably many things would break...
35  int byte_size = sizeof(abyte);
36  ASSERT_EQUAL(byte_size, 1, "byte size should be 1 byte");
37  int int16_size = sizeof(int16);
38  ASSERT_FALSE( (sizeof(uint16) != int16_size) || (int16_size != 2),
39  "uint16 size should be 2 bytes");
40  int uint_size = sizeof(un_int);
41 //hmmm: the checks are actually redundant...
42  ASSERT_FALSE( (uint_size != sizeof(int)) || (uint_size != 4),
43  "un_int size should be 2 bytes");
44  // all tests successfully passed.
45  return true;
46 }
47 
48 #undef UNIT_BASE_THIS_OBJECT
49 #define UNIT_BASE_THIS_OBJECT (*this)
50 #undef static_class_name
51 
52 } // namespace
53 
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Definition: enhance_cpp.h:54
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:30
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