linguini1 opened a new pull request, #3259:
URL: https://github.com/apache/nuttx-apps/pull/3259

   ## Summary
   
   **DO NOT MERGE THIS! IT IS AN EXAMPLE ONLY!**
   
   A simple demonstration of how Unity can be used to obtain clearer test output
   and a better unit testing structure.
   
   ## Impact
   
   None.
   
   ## Testing
   
   I ran the application on sim to obtain this output:
   
   ```console
   nsh> unity_ostest
   unity_ostest_main.c:446:fpu_addnums:PASS
   unity_ostest_main.c:447:fpu_subnums:PASS
   unity_ostest_main.c:448:fpu_mulnums:PASS
   unity_ostest_main.c:449:fpu_divnums:PASS
   unity_ostest_main.c:451:fpu_addnums_double:PASS
   unity_ostest_main.c:452:fpu_subnums_double:PASS
   unity_ostest_main.c:453:fpu_mulnums_double:PASS
   unity_ostest_main.c:437:fpu_divnums_double:FAIL: Expected 33.3333 Was 
33.3333333
   unity_ostest_main.c:324:fpu_test:IGNORE: System does not HAVE_FPU.
   
   -----------------------
   9 Tests 1 Failures 1 Ignored
   FAIL
   ```
   
   ## Notes
   
   It appears the simulator doesn't implement `HAVE_FPU`, so this actually does 
not
   test the original FPU test in OS test (it is ignored in this case). I'm not
   entirely sure how Unity would perform in that case since it involves
   asynchronous tasks. I think the test could be modified so that the tasks
   indicate a pass/fail in some static variable which is then read by the
   `fpu_test` function to determine pass/fail for Unity to check. I would
   appreciate if someone were to try running this on a system with an FPU.
   
   The failing test is simply because I didn't add enough trailing digits to be
   within the floating point precision tolerance for Unity (which is 
configurable,
   by the way). It is a demonstration of what a failure looks like.
   
   Overall, I believe the output looks *much* clearer in terms of what the test
   results were, and it took very little time to set up/write. I still need to
   compare the size of the binary.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to