• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /macosx-10.10.1/pyobjc-45/2.6/pyobjc/pyobjc-core/libffi-src/tests/testsuite/libffi.call/
1/* Area:	ffi_call
2   Purpose:	Check return value double.
3   Limitations:	none.
4   PR:		none.
5   Originator:	From the original ffitest.c  */
6
7/* { dg-do run } */
8#include "ffitest.h"
9#include "float.h"
10
11static double dblit(float f)
12{
13  return f/3.0;
14}
15
16int main (void)
17{
18  ffi_cif cif;
19  ffi_type *args[MAX_ARGS];
20  void *values[MAX_ARGS];
21  float f;
22  double d;
23
24
25  args[0] = &ffi_type_float;
26  values[0] = &f;
27
28  /* Initialize the cif */
29  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
30		     &ffi_type_double, args) == FFI_OK);
31
32  f = 3.14159;
33
34  ffi_call(&cif, FFI_FN(dblit), &d, values);
35
36  /* These are not always the same!! Check for a reasonable delta */
37
38  CHECK(d - dblit(f) < DBL_EPSILON);
39
40  exit(0);
41
42}
43