Skip to content

Commit ec92486

Browse files
committed
Try fix test 2
1 parent 3bbf780 commit ec92486

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

test/program.test.ts

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -210,44 +210,54 @@ describe('Program', async () => {
210210
});
211211

212212
it('links one compiled program', () => {
213-
U.withProgram(context, squareKern, (prg) => {
214-
cl.compileProgram(prg);
215-
const nprg = cl.linkProgram(context, null, null, [prg]);
216-
U.assertType(nprg, 'object');
217-
});
213+
const prg = cl.createProgramWithSource(context, squareKern);
214+
cl.compileProgram(prg);
215+
216+
const nprg = cl.linkProgram(context, null, null, [prg]);
217+
U.assertType(nprg, 'object');
218+
219+
cl.releaseProgram(nprg);
220+
cl.releaseProgram(prg);
218221
});
219222

220223
it('links one program and calls the callback', (t, done) => {
221224
const cb: cl.TBuildProgramCb = (prg, userData) => {
222225
assert.ok(prg);
223-
cl.releaseProgram(prg);
224226
assert.strictEqual((userData as { done: () => void }).done, done);
227+
228+
cl.releaseProgram(prg);
225229
done();
226230
};
231+
227232
const prg = cl.createProgramWithSource(context, squareKern);
228-
const ret = cl.compileProgram(prg);
229-
assert.strictEqual(ret, cl.SUCCESS);
233+
cl.compileProgram(prg);
234+
230235
const nprg = cl.linkProgram(context, null, null, [prg], cb, { done, prg });
231-
U.assertType(nprg, 'object');
236+
237+
cl.releaseProgram(prg);
238+
cl.releaseProgram(nprg);
232239
});
233240

234241
it('links one compiled program with a list of devices', () => {
235-
U.withProgram(context, squareKern, (prg) => {
236-
cl.compileProgram(prg);
237-
const nprg = cl.linkProgram(context, [device], null, [prg]);
238-
U.assertType(nprg, 'object');
239-
});
242+
const prg = cl.createProgramWithSource(context, squareKern);
243+
cl.compileProgram(prg, [device]);
244+
const nprg = cl.linkProgram(context, [device], null, [prg]);
245+
U.assertType(nprg, 'object');
246+
cl.releaseProgram(prg);
240247
});
241248

242249
it('links two compiled programs', () => {
243-
U.withProgram(context, squareKern, (prg) => {
244-
U.withProgram(context, squareCpyKern, (prg2) => {
245-
cl.compileProgram(prg);
246-
cl.compileProgram(prg2);
247-
const nprg = cl.linkProgram(context, null, null, [prg, prg2]);
248-
U.assertType(nprg, 'object');
249-
});
250-
});
250+
const prg = cl.createProgramWithSource(context, squareKern);
251+
cl.compileProgram(prg);
252+
253+
const prg2 = cl.createProgramWithSource(context, squareCpyKern);
254+
cl.compileProgram(prg2);
255+
256+
const nprg = cl.linkProgram(context, null, null, [prg, prg2]);
257+
U.assertType(nprg, 'object');
258+
259+
cl.releaseProgram(prg);
260+
cl.releaseProgram(prg2);
251261
});
252262
});
253263

0 commit comments

Comments
 (0)