Skip to content

Commit

Permalink
Restore and fix infinity testcase for Javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
wsfulton committed Apr 20, 2014
1 parent 1010fba commit bebd97e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions Examples/test-suite/common.mk
Expand Up @@ -587,6 +587,7 @@ C_TEST_CASES += \
global_functions \
immutable_values \
inctest \
infinity \
integers \
keyword_rename \
lextype \
Expand Down
9 changes: 4 additions & 5 deletions Examples/test-suite/infinity.i
@@ -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. */
Expand All @@ -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
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion Examples/test-suite/javascript/infinity_runme.js
@@ -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);

0 comments on commit bebd97e

Please sign in to comment.