2 * Copyright © 2019 Facebook, Inc.
4 * This is part of HarfBuzz, a text shaping library.
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24 * Facebook Author(s): Behdad Esfahbod
30 #include <type_traits>
32 template <typename T> struct U { typedef T type; };
35 main (int argc, char **argv)
37 static_assert (hb_is_convertible (void, void), "");
38 static_assert (hb_is_convertible (void, const void), "");
39 static_assert (hb_is_convertible (const void, void), "");
41 static_assert (hb_is_convertible (int, int), "");
42 static_assert (hb_is_convertible (char, int), "");
43 static_assert (hb_is_convertible (long, int), "");
45 static_assert (hb_is_convertible (int, int), "");
47 static_assert (hb_is_convertible (const int, int), "");
48 static_assert (hb_is_convertible (int, const int), "");
49 static_assert (hb_is_convertible (const int, const int), "");
51 static_assert (hb_is_convertible (int&, int), "");
52 static_assert (!hb_is_convertible (int, int&), "");
54 static_assert (hb_is_convertible (int, const int&), "");
55 static_assert (!hb_is_convertible (const int, int&), "");
56 static_assert (hb_is_convertible (const int, const int&), "");
57 static_assert (hb_is_convertible (int&, const int), "");
58 static_assert (hb_is_convertible (const int&, int), "");
59 static_assert (hb_is_convertible (const int&, const int), "");
60 static_assert (hb_is_convertible (const int&, const int), "");
65 static_assert (hb_is_convertible (const X &, const X), "");
66 static_assert (hb_is_convertible (X &, const X), "");
67 static_assert (hb_is_convertible (X &, const X &), "");
68 static_assert (hb_is_convertible (X, const X &), "");
69 static_assert (hb_is_convertible (const X, const X &), "");
70 static_assert (!hb_is_convertible (const X, X &), "");
71 static_assert (!hb_is_convertible (X, X &), "");
72 static_assert (hb_is_convertible (X &, X &), "");
74 static_assert (hb_is_convertible (int&, long), "");
75 static_assert (!hb_is_convertible (int&, long&), "");
77 static_assert (hb_is_convertible (int *, int *), "");
78 static_assert (hb_is_convertible (int *, const int *), "");
79 static_assert (!hb_is_convertible (const int *, int *), "");
80 static_assert (!hb_is_convertible (int *, long *), "");
81 static_assert (hb_is_convertible (int *, void *), "");
82 static_assert (!hb_is_convertible (void *, int *), "");
84 static_assert (hb_is_base_of (void, void), "");
85 static_assert (hb_is_base_of (void, int), "");
86 static_assert (!hb_is_base_of (int, void), "");
88 static_assert (hb_is_base_of (int, int), "");
89 static_assert (hb_is_base_of (const int, int), "");
90 static_assert (hb_is_base_of (int, const int), "");
92 static_assert (hb_is_base_of (X, X), "");
93 static_assert (hb_is_base_of (X, Y), "");
94 static_assert (hb_is_base_of (const X, Y), "");
95 static_assert (hb_is_base_of (X, const Y), "");
96 static_assert (!hb_is_base_of (Y, X), "");
98 static_assert (hb_is_constructible (int), "");
99 static_assert (hb_is_constructible (int, int), "");
100 static_assert (hb_is_constructible (int, char), "");
101 static_assert (hb_is_constructible (int, long), "");
102 static_assert (!hb_is_constructible (int, X), "");
103 static_assert (!hb_is_constructible (int, int, int), "");
104 static_assert (hb_is_constructible (X), "");
105 static_assert (!hb_is_constructible (X, int), "");
106 static_assert (hb_is_constructible (X, X), "");
107 static_assert (!hb_is_constructible (X, X, X), "");
108 static_assert (hb_is_constructible (X, Y), "");
109 static_assert (!hb_is_constructible (Y, X), "");
111 static_assert (hb_is_trivially_default_constructible (X), "");
112 static_assert (hb_is_trivially_default_constructible (Y), "");
113 static_assert (hb_is_trivially_copy_constructible (X), "");
114 static_assert (hb_is_trivially_copy_constructible (Y), "");
115 static_assert (hb_is_trivially_move_constructible (X), "");
116 static_assert (hb_is_trivially_move_constructible (Y), "");
117 static_assert (hb_is_trivially_destructible (Y), "");
119 static_assert (hb_is_trivially_copyable (int), "");
120 static_assert (hb_is_trivially_copyable (X), "");
121 static_assert (hb_is_trivially_copyable (Y), "");
123 static_assert (hb_is_trivial (int), "");
124 static_assert (hb_is_trivial (X), "");
125 static_assert (hb_is_trivial (Y), "");
127 static_assert (hb_is_signed (hb_unwrap_type (U<U<U<int>>>)), "");
128 static_assert (hb_is_unsigned (hb_unwrap_type (U<U<U<U<unsigned>>>>)), "");
130 /* TODO Add more meaningful tests. */