aboutsummaryrefslogtreecommitdiff
path: root/tests/embind/embind.test.js
diff options
context:
space:
mode:
authorChad Austin <caustin@gmail.com>2014-03-07 00:38:05 -0800
committerChad Austin <chad@chadaustin.me>2014-03-28 23:56:39 -0700
commit61849992b28d205eca211a2530ed752839f1c60f (patch)
treedbdec24061da4a098d736736facd659a6c8f8cb5 /tests/embind/embind.test.js
parent13e7b4cf2453c7332ed41297e4a7343747f2274f (diff)
Add some unit tests that verify we can pass all kinds of primitive types through val::as
Diffstat (limited to 'tests/embind/embind.test.js')
-rw-r--r--tests/embind/embind.test.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js
index 5ca972be..67171822 100644
--- a/tests/embind/embind.test.js
+++ b/tests/embind/embind.test.js
@@ -1938,10 +1938,21 @@ module({
derived.delete();
// Let the memory leak test superfixture check that no leaks occurred.
});
+
+ test("val::as supports variety of types", function() {
+ assert.equal(true, cm.val_as_bool(true));
+ assert.equal(127, cm.val_as_char(127));
+ assert.equal(32767, cm.val_as_short(32767));
+ assert.equal(65536, cm.val_as_int(65536));
+ assert.equal(65536, cm.val_as_long(65536));
+ assert.equal(10.5, cm.val_as_float(10.5));
+ assert.equal(10.5, cm.val_as_double(10.5));
+ });
});
/* global run_all_tests */
// If running as part of the emscripten test runner suite, and not as part of the IMVU suite,
// we launch the test execution from here. IMVU suite uses its own dedicated mechanism instead of this.
-if (typeof run_all_tests !== "undefined")
+if (typeof run_all_tests !== "undefined") {
run_all_tests();
+}