test-types.c

Go to the documentation of this file.
00001 #include "config.h"
00002 
00003 #include "headers.h"
00004 #include "types.h"
00005 
00006 void test_u8(void)
00007 {
00008         uint8 u8 = 0;
00009         uint8 u8_old = 0;
00010         unsigned int c = 0;
00011 
00012         u8 = 1;
00013         for (c = 0; u8 != u8_old; c++) {
00014                 u8_old = u8;
00015                 u8 <<= 1;
00016                 u8 |= 1;
00017         }
00018         assert(c == 8);
00019 }
00020 
00021 void test_u16(void)
00022 {
00023         uint16 u16 = 0;
00024         uint16 u16_old = 0;
00025         unsigned int c = 0;
00026 
00027         u16 = 1;
00028         for (c = 0; u16 != u16_old; c++) {
00029                 u16_old = u16;
00030                 u16 <<= 1;
00031                 u16 |= 1;
00032         }
00033         assert(c == 16);
00034 }
00035 
00036 void test_u32(void)
00037 {
00038         uint32 u32 = 0;
00039         uint32 u32_old = 0;
00040         unsigned int c = 0;
00041 
00042         u32 = 1;
00043         for (c = 0; u32 != u32_old; c++) {
00044                 u32_old = u32;
00045                 u32 <<= 1;
00046                 u32 |= 1;
00047         }
00048         assert(c == 32);
00049 }
00050 
00051 void test_u64(void)
00052 {
00053         uint64 u64 = 0;
00054         uint64 u64_old = 0;
00055         unsigned int c = 0;
00056 
00057         u64 = 1;
00058         for (c = 0; u64 != u64_old; c++) {
00059                 u64_old = u64;
00060                 u64 <<= 1;
00061                 u64 |= 1;
00062         }
00063         assert(c == 64);
00064 }
00065 
00066 int main(int argc, char* argv[])
00067 {
00068         test_u8();
00069         test_u16();
00070         test_u32();
00071         test_u64();
00072         return(0);
00073 }

Generated on Thu Jun 28 09:13:06 2007 for bar by  doxygen 1.5.1