[test] use cmake to run unit tests (#8724)

This commit migrates unit tests to cmake.
* build unit tests with cmake
* add missing tests in cmake
* use ctest
* add platform udp stubs for test platform
* skip some static_assert with gcc-4
This commit is contained in:
Yakun Xu
2023-02-09 10:19:01 -08:00
committed by GitHub
parent 6e6a2ae145
commit 0e667b8e03
19 changed files with 273 additions and 472 deletions
+3
View File
@@ -64,9 +64,12 @@ void TestBinarySearch(void)
constexpr Entry kUnsortedTable[] = {{"z", 0}, {"a", 0}, {"b", 0}};
constexpr Entry kDuplicateEntryTable[] = {{"duplicate", 1}, {"duplicate", 2}};
// gcc-4 does not support constexpr function
#if __GNUC__ > 4
static_assert(BinarySearch::IsSorted(kTable), "IsSorted() failed");
static_assert(!BinarySearch::IsSorted(kUnsortedTable), "failed for unsorted table");
static_assert(!BinarySearch::IsSorted(kDuplicateEntryTable), "failed for table with duplicate entries");
#endif
for (const Entry &tableEntry : kTable)
{