Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAX5715BOB_Tester MAX11131BOB_Tester MAX5171BOB_Tester MAX11410BOB_Tester ... more
Diff: MaximTinyTester.cpp
- Revision:
- 16:bb4b003a5cd2
- Parent:
- 15:ac3e4930df8b
- Child:
- 17:65fb4afe4991
diff -r ac3e4930df8b -r bb4b003a5cd2 MaximTinyTester.cpp
--- a/MaximTinyTester.cpp Thu Aug 06 21:11:33 2020 +0000
+++ b/MaximTinyTester.cpp Sat May 29 03:14:33 2021 -0700
@@ -310,7 +310,7 @@
if (actual_result != expect_result)
{
FAIL();
- associatedCmdLine.serial().printf("%s(%6.4fV)", nameOfFunctionUnderTest, arg_1_voltageV);
+ associatedCmdLine.serial().printf("%s(%6.6fV)", nameOfFunctionUnderTest, arg_1_voltageV);
associatedCmdLine.serial().printf(" expect %d", expect_result);
associatedCmdLine.serial().printf(" but got %d", actual_result);
return false;
@@ -318,7 +318,7 @@
else
{
PASS();
- associatedCmdLine.serial().printf("%s(%6.4fV)", nameOfFunctionUnderTest, arg_1_voltageV);
+ associatedCmdLine.serial().printf("%s(%6.6fV)", nameOfFunctionUnderTest, arg_1_voltageV);
associatedCmdLine.serial().printf(" expect %d", expect_result);
return true;
}
@@ -555,6 +555,42 @@
* @return true if success, false if test failed
*
*/
+bool MaximTinyTester::FunctionCall_d_Expect(const char *nameOfFunctionUnderTest,
+ Callback<int()> functionUnderTest,
+ int expect_result)
+{
+ int actual_result = functionUnderTest();
+ if (actual_result != expect_result)
+ {
+ FAIL();
+ associatedCmdLine.serial().printf("%s()", nameOfFunctionUnderTest);
+ associatedCmdLine.serial().printf(" expect %d", expect_result);
+ associatedCmdLine.serial().printf(" but got %d", actual_result);
+ return false;
+ }
+ else
+ {
+ PASS();
+ associatedCmdLine.serial().printf("%s()", nameOfFunctionUnderTest);
+ associatedCmdLine.serial().printf(" expect %d", expect_result);
+ return true;
+ }
+ //~ associatedCmdLine.serial().printf("\r\n");
+}
+
+/** Test a software function
+*
+* @param[in] nameOfFunctionUnderTest is the user-facing name of the function under test
+*
+* @param[in] functionUnderTest points to the function under test
+*
+* @param[in] expect_result contains the expected result
+*
+* @post nPass and nFail counters are updated
+*
+* @return true if success, false if test failed
+*
+*/
bool MaximTinyTester::FunctionCall_su_Expect(const char *nameOfFunctionUnderTest,
Callback<uint8_t()> functionUnderTest,
uint8_t expect_result)