diff --git a/library/qtest/src/Functions.qs b/library/qtest/src/Functions.qs index 8c9a1a1f99..c5cf1d0bcc 100644 --- a/library/qtest/src/Functions.qs +++ b/library/qtest/src/Functions.qs @@ -12,7 +12,7 @@ import Std.Arrays.Mapped, Std.Arrays.All; /// test results instead of printing out to output. /// /// # Input -/// Takes a list of test cases. A test case is a tuple of `(String, () -> T, 'T)`, where +/// Takes a list of test cases. A test case is a tuple of `(String, () -> 'T, 'T)`, where /// the first String is the name of the test, the function is the test case itself, and the /// final element of the tuple is the expected return value from the test case. /// @@ -33,7 +33,7 @@ function CheckAllTestCases<'T : Eq + Show>(test_cases : (String, () -> 'T, 'T)[] /// This is a good alternative to `CheckAllTestCases` when you want custom output based on the results of your tests, /// or more control over how test results are rendered. /// # Input -/// Takes a list of test cases. A test case is a tuple of `(String, () -> T, 'T)`, where +/// Takes a list of test cases. A test case is a tuple of `(String, () -> 'T, 'T)`, where /// the first String is the name of the test, the function is the test case itself, and the /// final element of the tuple is the expected return value from the test case. /// diff --git a/library/qtest/src/Operations.qs b/library/qtest/src/Operations.qs index b1246c177d..c559b8ce66 100644 --- a/library/qtest/src/Operations.qs +++ b/library/qtest/src/Operations.qs @@ -12,15 +12,16 @@ import Std.Arrays.Mapped, Std.Arrays.All; /// test results instead of printing out to output. /// /// # Input -/// Takes a list of test cases. A test case is a tuple of `(String, () -> T, 'T)`, where -/// the first String is the name of the test, the function is the test case itself, and the +/// Takes a list of test cases. A test case is a tuple of `(String, Int, Qubit[] => Unit, Qubit[] => 'T, 'T)`, where +/// the first String is the name of the test, the int is the number of qubits to allocate for this test, +/// the first function is a qubit state prep function to be run before the test, the second function is the test case itself, and the /// final element of the tuple is the expected return value from the test case. /// /// # Example /// ```qsharp -/// CheckAllTestCases([("Should return 42", () -> 42, 42)]); +/// CheckAllTestCases([("0b0001 == 1", 4, (qs) => X(qs[0]), (qs) => MeasureSignedInteger(qs, 4), 1)]); /// ``` -operation CheckAllTestCases<'T : Eq + Show>(test_cases : (String, Int, (Qubit[]) => (), (Qubit[]) => 'T, 'T)[]) : Bool { +operation CheckAllTestCases<'T : Eq + Show>(test_cases : (String, Int, Qubit[] => (), Qubit[] => 'T, 'T)[]) : Bool { let test_results = RunAllTestCases(test_cases); OutputMessage(test_results); @@ -35,13 +36,13 @@ operation CheckAllTestCases<'T : Eq + Show>(test_cases : (String, Int, (Qubit[]) /// This is a good alternative to `CheckAllTestCases` when you want custom output based on the results of your tests, /// or more control over how test results are rendered. /// # Input -/// Takes a list of test cases. A test case is a tuple of `(String, () -> T, 'T)`, where +/// Takes a list of test cases. A test case is a tuple of `(String, () => 'T, 'T)`, where /// the first String is the name of the test, the function is the test case itself, and the /// final element of the tuple is the expected return value from the test case. /// /// # Example /// ```qsharp -/// RunAllTestCases([("Should return 42", () -> 42, 42)]); +/// RunAllTestCases([("0b0001 == 1", 4, (qs) => X(qs[0]), (qs) => MeasureSignedInteger(qs, 4), 1)]); /// ``` operation RunAllTestCases<'T : Eq + Show>(test_cases : (String, Int, (Qubit[]) => (), (Qubit[]) => 'T, 'T)[]) : TestCaseResult[] { let num_tests = Length(test_cases);