-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_assert_test.cpp
47 lines (35 loc) · 1.39 KB
/
compile_assert_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
This file is part of the MiLi Minimalistic Library.
Copyright (C) Hugo Arregui, FuDePAN 2011
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt in the root directory or
copy at http://www.boost.org/LICENSE_1_0.txt)
MiLi IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
This is a test file.
*/
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "mili/platform_detection.h"
#if (MILI_CXX_VERSION == MILI_CXX_VERSION_CXX98)
#define COMPILE_ASSERT_TEST
#include "mili/mili.h"
using namespace mili;
declare_static_assert(assert1);
TEST(CompileAssert, test_no_fail)
{
compile_assert(sizeof(char) == 1, assert1);
ASSERT_TRUE(bool(template_info<assert1__>::is_equal_to<int>::value));
}
declare_static_assert(assert2);
TEST(CompileAssert, test_fail)
{
compile_assert(sizeof(char) == 2, assert2); // fails
ASSERT_TRUE(bool(template_info<assert2__>::is_equal_to<float>::value));
}
#endif