diff options
author | Chad Austin <caustin@gmail.com> | 2014-03-07 02:33:32 -0800 |
---|---|---|
committer | Chad Austin <chad@chadaustin.me> | 2014-03-28 23:56:39 -0700 |
commit | 555cb8207b9b06f86284a88d97a74c43e20469fb (patch) | |
tree | d26598cb5f5bd64dfa1967fe03a57a6db4c4c408 /tests/embind/embind.test.js | |
parent | 61849992b28d205eca211a2530ed752839f1c60f (diff) |
tests for val::as on strings and val too
Diffstat (limited to 'tests/embind/embind.test.js')
-rw-r--r-- | tests/embind/embind.test.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js index 67171822..033b47b5 100644 --- a/tests/embind/embind.test.js +++ b/tests/embind/embind.test.js @@ -1939,14 +1939,26 @@ module({ // 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)); + BaseFixture.extend("val::as built-in types", function() { + test("primitives", 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)); + + assert.equal("foo", cm.val_as_string("foo")); + assert.equal("foo", cm.val_as_wstring("foo")); + + var obj = {}; + assert.equal(obj, cm.val_as_val(obj)); + + // JS->C++ memory view not implemented + //var ab = cm.val_as_memory_view(new ArrayBuffer(13)); + //assert.equal(13, ab.byteLength); + }); }); }); |