Commit Graph

5 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
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
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