Skip to content

Commit

Permalink
Fix docstring typos in qtest (#2034)
Browse files Browse the repository at this point in the history
Some types were slightly off in the qtest docstrings. This PR fixes
them.
  • Loading branch information
sezna authored Dec 3, 2024
1 parent 7c15bce commit 959ec84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions library/qtest/src/Functions.qs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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.
///
Expand Down
13 changes: 7 additions & 6 deletions library/qtest/src/Operations.qs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 959ec84

Please sign in to comment.