���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /home/real/node-v13.0.1/test/parallel/ |
'use strict'; // Flags: --expose-internals require('../common'); const assert = require('assert'); const FreeList = require('internal/freelist'); assert.strictEqual(typeof FreeList, 'function'); const flist1 = new FreeList('flist1', 3, Object); // Allocating when empty, should not change the list size const result = flist1.alloc(); assert.strictEqual(typeof result, 'object'); assert.strictEqual(flist1.list.length, 0); // Exhaust the free list assert(flist1.free({ id: 'test1' })); assert(flist1.free({ id: 'test2' })); assert(flist1.free({ id: 'test3' })); // Now it should not return 'true', as max length is exceeded assert.strictEqual(flist1.free({ id: 'test4' }), false); assert.strictEqual(flist1.free({ id: 'test5' }), false); // At this point 'alloc' should just return the stored values assert.strictEqual(flist1.alloc().id, 'test3'); assert.strictEqual(flist1.alloc().id, 'test2'); assert.strictEqual(flist1.alloc().id, 'test1'); // Check list has elements const flist2 = new FreeList('flist2', 2, Object); assert.strictEqual(flist2.hasItems(), false); flist2.free({ id: 'test1' }); assert.strictEqual(flist2.hasItems(), true); flist2.alloc(); assert.strictEqual(flist2.hasItems(), false);