Skip to content

Commit

Permalink
Fix nested tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sezna committed Dec 12, 2024
1 parent e960916 commit 7d2aadc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion library/signed/src/Tests.qs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Measurement.MeasureSignedInteger;
@Test()
operation MeasureSignedIntTests() : Unit {
let testCases = [
("0b0001 == 1", 4, (qs) => X(qs[0]), (qs) => MeasureSignedInteger(qs, 4), 1),
("0b0001 == 1", 4, (qs) => X(qs[0]), (qs) => MeasureSignedInteger(qs, 6), 11),
("0b1111 == -1", 4, (qs) => { X(qs[0]); X(qs[1]); X(qs[2]); X(qs[3]); }, (qs) => MeasureSignedInteger(qs, 4), -1),
("0b01000 == 8", 5, (qs) => X(qs[3]), (qs) => MeasureSignedInteger(qs, 5), 8),
("0b11110 == -2", 5, (qs) => {
Expand Down
26 changes: 8 additions & 18 deletions vscode/src/testExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,8 @@ export async function initTestExplorer(context: vscode.ExtensionContext) {
return;
}

const queue = [];

for (const testCase of request.include || []) {
if (testCase.children.size > 0) {
for (const childTestCase of testCase.children) {
queue.push(async () =>
runTestCase(ctrl, childTestCase[1], request, worker, program),
);
}
} else {
queue.push(async () =>
runTestCase(ctrl, testCase, request, worker, program),
);
}
}

for (const func of queue) {
await func();
await runTestCase(ctrl, testCase, request, worker, program);
}
};

Expand Down Expand Up @@ -244,6 +228,12 @@ async function runTestCase(
worker: ICompilerWorker,
program: ProgramConfig,
): Promise<void> {
if (testCase.children.size > 0) {
for (const childTestCase of testCase.children) {
await runTestCase(ctrl, childTestCase[1], request, worker, program);
}
return;
}
const run = ctrl.createTestRun(request);
const evtTarget = new QscEventTarget(false);
evtTarget.addEventListener("Message", (msg) => {
Expand Down Expand Up @@ -273,5 +263,5 @@ async function runTestCase(
log.error(`Error running test ${testCase.id}:`, error);
run.appendOutput(`Error running test ${testCase.id}: ${error}\r\n`);
}
log.info("ran test", testCase.id);
log.trace("ran test:", testCase.id);
}

0 comments on commit 7d2aadc

Please sign in to comment.