Mercurial > hg > orthanc
comparison UnitTestsSources/UnitTestsMain.cpp @ 1337:afaa55d42ddd
FreeBSD support
author | jodogne |
---|---|
date | Tue, 31 Mar 2015 11:40:29 +0200 |
parents | 6e7e5ed91c2d |
children | feaf2840917c |
comparison
equal
deleted
inserted
replaced
1336:a80e811ec619 | 1337:afaa55d42ddd |
---|---|
43 #include "../Core/OrthancException.h" | 43 #include "../Core/OrthancException.h" |
44 #include "../Core/Toolbox.h" | 44 #include "../Core/Toolbox.h" |
45 #include "../Core/Uuid.h" | 45 #include "../Core/Uuid.h" |
46 #include "../OrthancServer/OrthancInitialization.h" | 46 #include "../OrthancServer/OrthancInitialization.h" |
47 | 47 |
48 | |
48 using namespace Orthanc; | 49 using namespace Orthanc; |
49 | 50 |
50 | 51 |
51 TEST(Uuid, Generation) | 52 TEST(Uuid, Generation) |
52 { | 53 { |
666 | 667 |
667 | 668 |
668 | 669 |
669 #if defined(__linux) | 670 #if defined(__linux) |
670 #include <endian.h> | 671 #include <endian.h> |
672 #elif defined(__FreeBSD__) | |
673 #include <machine/endian.h> | |
671 #endif | 674 #endif |
675 | |
672 | 676 |
673 TEST(Toolbox, Endianness) | 677 TEST(Toolbox, Endianness) |
674 { | 678 { |
675 // Parts of this test come from Adam Conrad | 679 // Parts of this test come from Adam Conrad |
676 // http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=728822#5 | 680 // http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=728822#5 |
677 | 681 |
678 #if defined(_WIN32) | 682 |
683 /** | |
684 * Windows and OS X are assumed to always little-endian. | |
685 **/ | |
686 | |
687 #if defined(_WIN32) || defined(__APPLE__) | |
679 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); | 688 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); |
680 | 689 |
681 #elif defined(__APPLE__) | 690 |
682 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); | 691 /** |
683 | 692 * Linux. |
693 **/ | |
694 | |
684 #elif defined(__linux) || defined(__FreeBSD_kernel__) | 695 #elif defined(__linux) || defined(__FreeBSD_kernel__) |
685 | 696 |
686 #if !defined(__BYTE_ORDER) | 697 #if !defined(__BYTE_ORDER) |
687 # error Support your platform here | 698 # error Support your platform here |
688 #endif | 699 #endif |
689 | 700 |
690 # if __BYTE_ORDER == __BIG_ENDIAN | 701 # if __BYTE_ORDER == __BIG_ENDIAN |
691 ASSERT_EQ(Endianness_Big, Toolbox::DetectEndianness()); | 702 ASSERT_EQ(Endianness_Big, Toolbox::DetectEndianness()); |
692 # else // __LITTLE_ENDIAN | 703 # else // __LITTLE_ENDIAN |
693 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); | 704 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); |
705 # endif | |
706 | |
707 | |
708 /** | |
709 * FreeBSD. | |
710 **/ | |
711 | |
712 #elif defined(__FreeBSD__) | |
713 # if _BYTE_ORDER == _BIG_ENDIAN | |
714 ASSERT_EQ(Endianness_Big, Toolbox::DetectEndianness()); | |
715 # else // _LITTLE_ENDIAN | |
716 ASSERT_EQ(Endianness_Little, Toolbox::DetectEndianness()); | |
694 # endif | 717 # endif |
695 | 718 |
696 #else | 719 #else |
697 #error Support your platform here | 720 #error Support your platform here |
698 #endif | 721 #endif |