Commit Graph

9 Commits

Author SHA1 Message Date
Wyatt Hepler
1a96094ce6 Fix copyright notices
- Add missing copright header in conf.py.
- Fix inconsistent copyright notice line breaking.

Change-Id: Ib78f7768643069c49ff986a48a176df9fd06e891
2019-11-27 22:34:02 +00:00
Rob Mohr
30b42ef7a1 Bazel build fixes.
Clang-tidy complains about operator=() not returning *this, even though
that's what it was doing anyway.

Then add a direct dependency, add a header to a library, and sync up
argument names in a method declaration with the definition.

Change-Id: Ib64f050ae74309640a4ae1346e617a932377f63e
2019-11-27 21:24:49 +00:00
Wyatt Hepler
8663e9c4f0 Add evaluated string outputs to the test framework
- Integrate StringBuilder with the test framework. Test failures print
  "Actual: " followed by the evaluated values for the expression.
- Update SimplePrintingEventHandler to have the write function
  optionally output the newline.

Example:

[ RUN      ] Status.CompareToStatusCode
../../pw_status/status_test.cc:43: Failure
      Expected: Status(Status::ABORTED) == Status(Status::DATA_LOSS)
        Actual: ABORTED == DATA_LOSS
[  FAILED  ]

Change-Id: I4bd6f63cfd903ce2dc4959a1491825e7e743a522
2019-11-26 21:29:18 +00:00
Armando Montanez
d3ed0f4d9b Make default unit testing main use pw_dumb_io
Updates the default unit testing main to use dumb_io. This allows unit
tests to run on both host and stm32f429i-disc1 with minimal differences.
This change also updates simple_printing_event_handler to print out a
function that takes a std::string_view instead of a char*.

Change-Id: Ib83bd25ca0db243fd5c18325117b5ebe10e40b4e
2019-11-20 18:32:27 +00:00
Rob Mohr
7b49619a76 Add virtual destructor to Test class.
Change-Id: I76c48e519007f32a8c22efd36c094e2600d8e73e
2019-11-18 22:24:46 +00:00
Rob Mohr
92a4247623 Add virtual destructor to EventHandler.
Change-Id: I004629c2f9853aa857ee2db8b3b6a637b801c6f7
2019-11-15 23:00:27 +00:00
Keir Mierle
2b0e008a75 pw_unit_test: Clang fixes
This makes two tweaks to enable compiling with Clang on the desktop:
- Switch from (&function_pointer) to (*function_pointer) style.
- Make destructor final in derived test class to prevent warning from
  the "-Wdelete-non-abstract-non-virtual-dtor" flag.

Change-Id: Ic1783e41ee8092a5ad218ebdb48376742f85ff50
2019-11-08 00:01:49 -08:00
Keir Mierle
243e32a85f pw_unit_test: Make simple runner look like GTest
This makes these changes to the unit test framework:

(1) Makes the simple test runner output match GTest
(2) Adds a new RunAllTestsStart() and RunAllTestsEnd() event
(3) Adds an intentionally-failing expectation to the sample test

Example output:

[==========] Running all tests.
[ RUN      ] PigweedTest.ExpectBool
[       OK ] PigweedTest.ExpectBool
[ RUN      ] PigweedTest.ExpectBasicComparisons
[       OK ] PigweedTest.ExpectBasicComparisons
[ RUN      ] PigweedTest.ExpectStringEquality
[       OK ] PigweedTest.ExpectStringEquality
[ RUN      ] PigweedTest.NonCopyableType
[       OK ] PigweedTest.NonCopyableType
[ RUN      ] PigweedTest.MacroArgumentsOnlyAreEvaluatedOnce
[       OK ] PigweedTest.MacroArgumentsOnlyAreEvaluatedOnce
[ RUN      ] FixtureTest.CustomFixture
[       OK ] FixtureTest.CustomFixture
[ RUN      ] PigweedTestFixture.TheNumberIs35
[       OK ] PigweedTestFixture.TheNumberIs35
[ RUN      ] PigweedTestFixture.YupTheNumberIs35
[       OK ] PigweedTestFixture.YupTheNumberIs35
[ RUN      ] PigweedTestFixture.MissingExpectations
../pw_unit_test/framework_test.cc:156: Failure
      Expected: missed_expectations == 200
[  FAILED  ] PigweedTestFixture.MissingExpectations
[==========] Done running all tests.
[  PASSED  ] 8 test(s).
[  FAILED  ] 1 test(s).

Change-Id: I813096a9d62423e256993ae03724337d52702297
2019-11-05 14:48:19 -08:00
Alexei Frolov
c10c81201d Add preprocessor and unit_test modules
This change adds two Pigweed modules: pw_preprocessor and pw_unit_test.
The preprocessor module contains header files providing helpful macros
for the C preprocessor. The unit test module contains a starter
implementation of a unit testing framework for Pigweed.

Change-Id: I46e1a4cae1fd8ce36d7840a2e92f8013fb489cde
2019-11-04 16:07:34 -08:00