File: test-integers.c

package info (click to toggle)
libexif 0.6.25-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,664 kB
  • sloc: ansic: 13,214; cpp: 457; makefile: 395; sh: 206
file content (46 lines) | stat: -rw-r--r-- 1,351 bytes parent folder | download | duplicates (2)
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
/** \file test-integers.c
 * \brief Check assumptions about integer types (sizes, ranges).
 *
 * Copyright (C) 2007 Hans Ulrich Niedermann <gp@n-dimensional.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA.
 *
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */


#include "libexif/_stdint.h"
#include <assert.h>

typedef enum {
   EN_A,
   EN_B,
   EN_C,
   EN_D,
   EN_E,
   EN_F
} enum_t;

int main(void)
{
  /* libexif assumes unsigned ints are not smaller than 32bit in many places */
  assert(sizeof(unsigned int) >= sizeof(uint32_t));

  /* libexif assumes that enums fit into ints */
  assert(sizeof(enum_t) <= sizeof(int));
  
  return 0;
}