Path: blob/main/test/embind/test_negative_constants.cpp
4150 views
// Copyright 2018 The Emscripten Authors. All rights reserved.1// Emscripten is available under two separate licenses, the MIT license and the2// University of Illinois/NCSA Open Source License. Both these licenses can be3// found in the LICENSE file.45#include <emscripten/bind.h>6#include <emscripten/emscripten.h>78#define NEGATIVE_FLOAT_NUM -3.14169#define NEGATIVE_INT_NUM -1010const float negative_float_num = -3.1416;11const double negative_double_num = -2.7182818;12const int negative_int_num = -10;1314EMSCRIPTEN_BINDINGS(constants) {15emscripten::constant("NEGATIVE_FLOAT_NUM", NEGATIVE_FLOAT_NUM);16emscripten::constant("NEGATIVE_INT_NUM", NEGATIVE_INT_NUM);17emscripten::constant("negative_float_num", negative_float_num);18emscripten::constant("negative_double_num", negative_double_num);19emscripten::constant("negative_int_num", negative_int_num);20}2122int main() {23EM_ASM(24out("NEGATIVE_FLOAT_NUM = " + Module['NEGATIVE_FLOAT_NUM']);25out("NEGATIVE_INT_NUM = " + Module['NEGATIVE_INT_NUM']);26out("negative_float_num = " + Module['negative_float_num']);27out("negative_double_num = " + Module['negative_double_num']);28out("negative_int_num = " + Module['negative_int_num']);29);30}313233