Comparing version 0.3.2 to 0.4.0
@@ -7,11 +7,9 @@ var util = require("util"); | ||
FFI.Bindings = require("../build/Release/ffi_bindings"); | ||
} catch (e) { try { | ||
FFI.Bindings = require("../build/default/ffi_bindings"); | ||
} catch (e) { | ||
try { | ||
FFI.Bindings = require("../build/default/ffi_bindings"); | ||
} catch (e) { | ||
throw new Error("Cannot find compiled bindings!"); | ||
} | ||
} | ||
throw new Error("Cannot find compiled bindings!"); | ||
}} | ||
FFI.VERSION = "0.3.2"; | ||
FFI.VERSION = "0.4.0"; | ||
@@ -18,0 +16,0 @@ FFI.TYPE_TO_POINTER_METHOD_MAP = { |
{ | ||
"name": "node-ffi", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"author": "Rick Branson", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -378,2 +378,21 @@ var util = require("util"); | ||
var p = new FFI.Pointer(128) | ||
, orig = p.seek(0) | ||
var put1 = { test: { equality: true } } | ||
, put2 = { test2: 'does this work?' } | ||
p.putObject(put1, true) | ||
p.putObject(put2, true) | ||
var get1 = orig.getObject(true) | ||
, get2 = orig.getObject(true) | ||
assert.ok(put1 === get1) | ||
assert.ok(put2 === get2) | ||
assert.deepEqual(put1, get1) | ||
assert.deepEqual(put2, get2) | ||
////////////////////// | ||
assert.ok(FFI.Bindings.StaticFunctions instanceof Object); | ||
@@ -672,2 +691,23 @@ assert.ok(FFI.Bindings.StaticFunctions.dlopen instanceof Pointer); | ||
// Test Pointer#toBuffer() | ||
var p = new FFI.Pointer(128) | ||
, b = p.toBuffer() | ||
assert.equal(p.allocated, b.length) | ||
// Test Buffer -> Pointer | ||
b.write('hello\0'); | ||
assert.equal(p.getCString(), 'hello') | ||
// Test Pointer -> Buffer | ||
var hw = 'hello world'; | ||
p.putCString(hw); | ||
assert.equal(b.slice(0, hw.length).toString(), hw) | ||
// Test modifying a single byte in the Buffer | ||
b[2] = 'L'.charCodeAt(0) | ||
assert.equal(p.getCString(), 'heLlo world') | ||
/////////////////////// | ||
util.log("Heap increased by " + ((process.memoryUsage()["rss"] - rss) / 1024) + " KB"); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108010
1355