root/software/fixed/fixed_test.cc @ 852d0468
| c7e0510c | David Sorber | |||
| 835f4592 | David Sorber | #include <cstdint>
|
||
| 7fa2f28e | David Sorber | #include <limits>
|
||
| c7e0510c | David Sorber | |||
#define BOOST_TEST_MAIN 1
|
||||
#include <boost/test/unit_test.hpp>
|
||||
| 835f4592 | David Sorber | |||
#include "fixed.h"
|
||||
| c7e0510c | David Sorber | BOOST_AUTO_TEST_CASE(t0)
|
||
| 835f4592 | David Sorber | {
|
||
| c7e0510c | David Sorber | // Check overall type sizes
|
||
fixed_8_8 f_8_8;
|
||||
fixed_8_32 f_8_32;
|
||||
fixed_8_16 f_8_16;
|
||||
fixed_8_64 f_8_64;
|
||||
BOOST_CHECK(sizeof(f_8_8) == 2);
|
||||
BOOST_CHECK(sizeof(f_8_16) == 4);
|
||||
BOOST_CHECK(sizeof(f_8_32) == 8);
|
||||
BOOST_CHECK(sizeof(f_8_64) == 16);
|
||||
fixed_16_8 f_16_8;
|
||||
fixed_16_16 f_16_16;
|
||||
fixed_16_32 f_16_32;
|
||||
fixed_16_64 f_16_64;
|
||||
BOOST_CHECK(sizeof(f_16_8) == 4);
|
||||
BOOST_CHECK(sizeof(f_16_16) == 4);
|
||||
BOOST_CHECK(sizeof(f_16_32) == 8);
|
||||
BOOST_CHECK(sizeof(f_16_64) == 16);
|
||||
fixed_32_8 f_32_8;
|
||||
fixed_32_16 f_32_16;
|
||||
fixed_32_32 f_32_32;
|
||||
fixed_32_64 f_32_64;
|
||||
BOOST_CHECK(sizeof(f_32_8) == 8);
|
||||
BOOST_CHECK(sizeof(f_32_16) == 8);
|
||||
BOOST_CHECK(sizeof(f_32_32) == 8);
|
||||
BOOST_CHECK(sizeof(f_32_64) == 16);
|
||||
fixed_64_8 f_64_8;
|
||||
fixed_64_16 f_64_16;
|
||||
fixed_64_32 f_64_32;
|
||||
fixed_64_64 f_64_64;
|
||||
BOOST_CHECK(sizeof(f_64_8) == 16);
|
||||
BOOST_CHECK(sizeof(f_64_16) == 16);
|
||||
BOOST_CHECK(sizeof(f_64_32) == 16);
|
||||
BOOST_CHECK(sizeof(f_64_64) == 16);
|
||||
| 835f4592 | David Sorber | }
|