From 0b92d61a140923080b4bca8cf8bf80d37cfe2c03 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 28 Oct 2011 15:19:54 -0500 Subject: [PATCH] libCom/test: Added epicsTypesTest, checks type sizes. --- src/libCom/test/Makefile | 5 ++++ src/libCom/test/epicsRunLibComTests.c | 3 +++ src/libCom/test/epicsTypesTest.c | 34 +++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 src/libCom/test/epicsTypesTest.c diff --git a/src/libCom/test/Makefile b/src/libCom/test/Makefile index d59ad7621..fc77cf5c4 100644 --- a/src/libCom/test/Makefile +++ b/src/libCom/test/Makefile @@ -17,6 +17,11 @@ epicsUnitTestTest_SRCS += epicsUnitTestTest.c # Not much point running this on vxWorks or RTEMS... TESTS += epicsUnitTestTest +TESTPROD_HOST += epicsTypesTest +epicsTypesTest_SRCS += epicsTypesTest.cpp +testHarness_SRCS += epicsTypesTest.cpp +TESTS += epicsTypesTest + TESTPROD_HOST += epicsCalcTest epicsCalcTest_SRCS += epicsCalcTest.cpp testHarness_SRCS += epicsCalcTest.cpp diff --git a/src/libCom/test/epicsRunLibComTests.c b/src/libCom/test/epicsRunLibComTests.c index 80ddbf3b3..145f84076 100644 --- a/src/libCom/test/epicsRunLibComTests.c +++ b/src/libCom/test/epicsRunLibComTests.c @@ -33,6 +33,7 @@ int epicsThreadOnceTest(void); int epicsThreadPriorityTest(void); int epicsThreadPrivateTest(void); int epicsTimeTest(void); +int epicsTypesTest(void); int macLibTest(void); int macEnvExpandTest(void); int ringPointerTest(void); @@ -85,6 +86,8 @@ void epicsRunLibComTests(void) runTest(epicsTimeTest); + runTest(epicsTypesTest); + runTest(macLibTest); runTest(macEnvExpandTest); diff --git a/src/libCom/test/epicsTypesTest.c b/src/libCom/test/epicsTypesTest.c new file mode 100644 index 000000000..66803f927 --- /dev/null +++ b/src/libCom/test/epicsTypesTest.c @@ -0,0 +1,34 @@ +/*************************************************************************\ +* Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ +/* epicsTypesTest.c + * + * Size-check epicsTypes + * + */ + +#include "epicsUnitTest.h" +#include "epicsTypes.h" +#include "testMain.h" + +MAIN(epicsTypesTest) +{ + testPlan(8); + + testOk1(sizeof(epicsInt8) == 1); + testOk1(sizeof(epicsUInt8) == 1); + + testOk1(sizeof(epicsInt16) == 2); + testOk1(sizeof(epicsUInt16) == 2); + + testOk1(sizeof(epicsInt32) == 4); + testOk1(sizeof(epicsUInt32) == 4); + + testOk1(sizeof(epicsFloat32) == 4); + testOk1(sizeof(epicsFloat64) == 8); + + return testDone(); +}