Mark Underwood / MaximTinyTester

Dependents:   MAX5715BOB_Tester MAX11131BOB_Tester MAX5171BOB_Tester MAX11410BOB_Tester ... more

Revision:
15:ac3e4930df8b
Parent:
14:10219b869ac3
Child:
16:bb4b003a5cd2
--- a/MaximTinyTester.cpp	Fri May 15 08:36:01 2020 +0000
+++ b/MaximTinyTester.cpp	Thu Aug 06 21:11:33 2020 +0000
@@ -284,6 +284,47 @@
     //~ 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] arg_1_voltageV is a test argument given 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
+*
+*/
+// MaximTinyTester FunctionCall_lu_f_Expect support MAX5719
+bool MaximTinyTester::FunctionCall_lu_f_Expect(const char *nameOfFunctionUnderTest, 
+    Callback<uint32_t(double)> functionUnderTest,
+    double arg_1_voltageV,
+    uint32_t expect_result)
+{
+    uint32_t actual_result = functionUnderTest(arg_1_voltageV);
+    if (actual_result != expect_result)
+    {
+        FAIL();
+        associatedCmdLine.serial().printf("%s(%6.4fV)", nameOfFunctionUnderTest, arg_1_voltageV);
+        associatedCmdLine.serial().printf(" expect %d", expect_result);
+        associatedCmdLine.serial().printf(" but got %d", actual_result);
+        return false;
+    }
+    else
+    {
+        PASS();
+        associatedCmdLine.serial().printf("%s(%6.4fV)", nameOfFunctionUnderTest, arg_1_voltageV);
+        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