Page MenuHomePhorge

TypeTests.cpp
No OneTemporary

Size
966 B
Referenced Files
None
Subscribers
None

TypeTests.cpp

/*
* Author: sean
* Test suite to ensure that basic types are the correct size for a platform.
* Incorrect sizes may result in unexpected behaviour.
*/
#include <echo/Types.h>
#include <iostream>
//Ah macro love =(...
#define CHECKSIZE(a,b) \
std::cout << "%TEST_STARTED% "#a" (TypeTests)" << std::endl; \
if(sizeof(a)!=b) \
{ \
std::cout << "%TEST_FAILED% time=0 testname=Check "#a" size is "#b" (TypeTests) message="#a " != "#b" bytes." << std::endl; \
} \
std::cout << "%TEST_FINISHED% time=0 "#a" (TypeTests)" << std::endl;
int main(int argc, char** argv)
{
using namespace Echo;
std::cout << "%SUITE_STARTING% TypeTests" << std::endl;
std::cout << "%SUITE_STARTED%" << std::endl;
CHECKSIZE(u8,1)
CHECKSIZE(u16,2)
CHECKSIZE(u32,4)
CHECKSIZE(u64,8)
CHECKSIZE(s8,1)
CHECKSIZE(s16,2)
CHECKSIZE(s32,4)
CHECKSIZE(s64,8)
CHECKSIZE(f32,4)
CHECKSIZE(f64,8)
std::cout << "%SUITE_FINISHED% time=0" << std::endl;
return(EXIT_SUCCESS);
}

File Metadata

Mime Type
text/x-c
Expires
Wed, Jan 15, 9:31 PM (3 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72058
Default Alt Text
TypeTests.cpp (966 B)

Event Timeline