Restore and fix infinity testcase for Javascript

This commit is contained in:
William S Fulton 2014-04-20 14:25:49 +01:00
commit bebd97e7f4
3 changed files with 6 additions and 6 deletions

View file

@ -587,6 +587,7 @@ C_TEST_CASES += \
global_functions \
immutable_values \
inctest \
infinity \
integers \
keyword_rename \
lextype \

View file

@ -1,15 +1,12 @@
%module infinity
#include <math.h>
/* C99 defines INFINITY
Because INFINITY may be defined by compiler built-ins, we can't use #define.
Instead, expose the variable MYINFINITY and then use %rename to make it INFINITY in the scripting language.
*/
%rename(INFINITY) MYINFINITY;
%inline %{
%{
#include <math.h>
/* C99 math.h defines INFINITY. If not available, this is the fallback. */
@ -26,7 +23,7 @@
#ifdef __GNUC__
#define INFINITY (__builtin_inf())
#elif defined(__clang__)
#elif defined(__clang__)
#if __has_builtin(__builtin_inf)
#define INFINITY (__builtin_inf())
#endif
@ -36,7 +33,9 @@
#define INFINITY (1e1000)
#endif
#endif
%}
%inline %{
/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */
const double MYINFINITY = INFINITY;

View file

@ -1,4 +1,4 @@
var infinity = require("./infinity");
var my_infinity = infinity.INFINTY;
var my_infinity = infinity.INFINITY;
var ret_val = infinity.use_infinity(my_infinity);