11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Flags: --expose-gc 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst common = require('../../common'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ciconst test = require(`./build/${common.buildType}/7_factory_wrap`); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciassert.strictEqual(test.finalizeCount, 0); 91cb0ef41Sopenharmony_ciasync function runGCTests() { 101cb0ef41Sopenharmony_ci (() => { 111cb0ef41Sopenharmony_ci const obj = test.createObject(10); 121cb0ef41Sopenharmony_ci assert.strictEqual(obj.plusOne(), 11); 131cb0ef41Sopenharmony_ci assert.strictEqual(obj.plusOne(), 12); 141cb0ef41Sopenharmony_ci assert.strictEqual(obj.plusOne(), 13); 151cb0ef41Sopenharmony_ci })(); 161cb0ef41Sopenharmony_ci await common.gcUntil('test 1', () => (test.finalizeCount === 1)); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci (() => { 191cb0ef41Sopenharmony_ci const obj2 = test.createObject(20); 201cb0ef41Sopenharmony_ci assert.strictEqual(obj2.plusOne(), 21); 211cb0ef41Sopenharmony_ci assert.strictEqual(obj2.plusOne(), 22); 221cb0ef41Sopenharmony_ci assert.strictEqual(obj2.plusOne(), 23); 231cb0ef41Sopenharmony_ci })(); 241cb0ef41Sopenharmony_ci await common.gcUntil('test 2', () => (test.finalizeCount === 2)); 251cb0ef41Sopenharmony_ci} 261cb0ef41Sopenharmony_cirunGCTests(); 27