MCPcopy Create free account
hub / github.com/apache/thrift / makeRecursiveCheck

Function makeRecursiveCheck

lib/nodets/test/test_driver.ts:223–257  ·  view source on GitHub ↗
(assert: test.Test)

Source from the content-addressed store, hash-verified

221// =========================================================
222
223function makeRecursiveCheck(assert: test.Test) {
224 return function (map1: any, map2: any, msg: string) {
225 var equal = true;
226
227 var equal = checkRecursively(map1, map2);
228
229 assert.ok(equal, msg);
230
231 // deepEqual doesn't work with fields using node-int64
232 function checkRecursively(map1: any, map2: any): boolean {
233 if (!(typeof map1 !== "function" && typeof map2 !== "function")) {
234 return false;
235 }
236 if (!map1 || typeof map1 !== "object") {
237 //Handle int64 types (which use node-int64 in Node.js JavaScript)
238 if (
239 typeof map1 === "number" &&
240 typeof map2 === "object" &&
241 map2.buffer &&
242 map2.buffer instanceof Buffer &&
243 map2.buffer.length === 8
244 ) {
245 var n = new Int64(map2.buffer);
246 return map1 === n.toNumber();
247 } else {
248 return map1 == map2;
249 }
250 } else {
251 return Object.keys(map1).every(function (key) {
252 return checkRecursively(map1[key], map2[key]);
253 });
254 }
255 }
256 };
257}
258
259function checkOffByOne(
260 done: (callback: () => void) => void,

Callers 2

ThriftTestDriverFunction · 0.70
ThriftTestDriverPromiseFunction · 0.70

Calls 1

checkRecursivelyFunction · 0.70

Tested by

no test coverage detected