Milena (Olena)
User documentation 2.0a Id
Main Page
Related Pages
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerator
Groups
Pages
tests/value/macros.hh
1
// Copyright (C) 2007, 2009 EPITA Research and Development Laboratory
2
// (LRDE)
3
//
4
// This file is part of Olena.
5
//
6
// Olena is free software: you can redistribute it and/or modify it under
7
// the terms of the GNU General Public License as published by the Free
8
// Software Foundation, version 2 of the License.
9
//
10
// Olena is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
// General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
17
//
18
// As a special exception, you may use this file as part of a free
19
// software project without restriction. Specifically, if other files
20
// instantiate templates or use macros or inline functions from this
21
// file, or you compile this file and link it with other files to produce
22
// an executable, this file does not by itself cause the resulting
23
// executable to be covered by the GNU General Public License. This
24
// exception does not however invalidate any other reasons why the
25
// executable file might be covered by the GNU General Public License.
26
27
31
32
#define sym_compare_assert(V1, OP, V2) \
33
\
34
mln_assertion(V1 OP V2); \
35
mln_assertion(-V1 OP -V2); \
36
mln_assertion(V2 OP V1); \
37
mln_assertion(-V2 OP -V1);
38
39
#define asym_compare_assert(V1, OP, V2) \
40
\
41
mln_assertion(V1 OP V2); \
42
mln_assertion(!(-V1 OP -V2)); \
43
mln_assertion(-V2 OP -V1); \
44
mln_assertion(!(V2 OP V1));
45
46
// For unsigned types, V1 > V2 if op is minus
47
#define test_interop(T1, T2, OP, V1, V2) \
48
\
49
{ \
50
T1 i = V1; \
51
T2 j = V2; \
52
\
53
i = i OP j; \
54
sym_compare_assert(i, ==, float(V1 OP V2)); \
55
sym_compare_assert(j, ==, float(V2)); \
56
\
57
i = V1; \
58
j = V2; \
59
\
60
j = i OP j; \
61
sym_compare_assert(j, ==, float(V1 OP V2)); \
62
sym_compare_assert(i, ==, float(V1)); \
63
\
64
i = V1; \
65
i OP##= i; \
66
sym_compare_assert(i, ==, float(V1 OP V1)); \
67
\
68
i = V1; \
69
j = V2; \
70
i OP##= j; \
71
sym_compare_assert(i, ==, float(V1 OP V2)); \
72
\
73
j OP##= j; \
74
sym_compare_assert(j, ==, float(V2 OP V2)); \
75
\
76
i = V1; \
77
j = V2; \
78
j OP##= i; \
79
sym_compare_assert(j, ==, float(V2 OP V1)); \
80
\
81
i = V1; \
82
i OP##= i; \
83
sym_compare_assert(i, ==, float(((V1 OP V1)))); \
84
}
85
86
#define test_operator(T, OP, V1, V2) \
87
\
88
{ \
89
T i = V1; \
90
T j = V2; \
91
\
92
i = i OP j; \
93
sym_compare_assert(i, ==, float(V1 OP V2)); \
94
sym_compare_assert(j, ==, float(V2)); \
95
\
96
i = V1; \
97
i OP##= i; \
98
sym_compare_assert(i, ==, float(V1 OP V1)); \
99
\
100
i = V1; \
101
j = V2; \
102
i OP##= j; \
103
}
tests
value
macros.hh
Generated on Thu Nov 8 2012 10:58:13 for Milena (Olena) by
1.8.2-20120930