* under the License.\r
*/\r
\r
- // This is the Node test driver for the standard Apache Thrift \r
+ // This is the Node.js test driver for the standard Apache Thrift \r
// test service. The driver invokes every function defined in the \r
// Thrift Test service with a representative range of parameters.\r
//\r
\r
var assert = require('assert');\r
var ttypes = require('./gen-nodejs/ThriftTest_types');\r
+var Int64 = require('node-int64');\r
\r
var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) {\r
\r
-// deepEqual doesn't work with fields using node-int64\r
function checkRecursively(map1, map2) {\r
if (typeof map1 !== 'function' && typeof map2 !== 'function') {\r
if (!map1 || typeof map1 !== 'object') {\r
+ //Handle int64 types (which use node-int64 in Node.js JavaScript)\r
+ if ((typeof map1 === "number") && (typeof map2 === "object") && \r
+ (map2.buffer) && (map2.buffer instanceof Buffer) && (map2.buffer.length === 8)) {\r
+ var n = new Int64(map2.buffer);\r
+ assert.equal(map1, n.toNumber()); \r
+ } else {\r
assert.equal(map1, map2);\r
+ }\r
} else {\r
for (var key in map1) {\r
checkRecursively(map1[key], map2[key]);\r
});\r
var insanity = {\r
"1":{ "2": crazy, "3": crazy },\r
- "2":{ "6":{ "userMap":null, "xtructs":null } }\r
+ "2":{ "6":{ "userMap":{}, "xtructs":[] } }\r
};\r
client.testInsanity(crazy, function(err, response) {\r
assert( ! err);\r