Commit Graph

41 Commits

Author SHA1 Message Date
Peter Keresztes Schmidt 46155942c1 Misc: Rename namespace ZM to zm
We had a mixture of both spellings. Unify it according to our code-style.
2021-06-06 19:11:11 +02:00
Peter Keresztes Schmidt 9a983bb321 Crypto: Implement SHA1 hashing 2021-05-30 22:56:21 +02:00
Peter Keresztes Schmidt d2932b5d68 Utils: Add a ByteArrayToHexString helper 2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt 2bda413698 Crypto: Implement a generic hashing API
Currently MD5 is implemented
2021-05-30 22:53:05 +02:00
Peter Keresztes Schmidt 9900fc1273 tests/Font: Avoid lambda capture initialization
Remove the use of this language feature until we raise the requirements to C++14.
2021-05-24 00:55:46 +02:00
Peter Keresztes Schmidt 298415fff3 Remove remaining usages of VLAs 2021-05-17 22:12:04 +02:00
Peter Keresztes Schmidt b1de220958 Polygon: Perform clip operation on existing object instead of returning a new clipped one 2021-05-16 19:42:41 +02:00
Peter Keresztes Schmidt 29488900a1 Box: Make range calculations mathematically correct 2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt 3c85d63655 Polygon: Implement clipping to a boundary box
Using the Sutherland-Hodgman algorithms convex and concave subject polygons can be clipped
by convex clip polygons.
For now we only need clipping to rectangles (Box), so limit our implementation to that. If needed this can be
trivially extended to convex clip polygons (a check whether the clip polygon is actually convex has to be added).
If convex clip polygons are needed we have to switch to e.g the Vatti algorithm.
2021-05-16 19:41:45 +02:00
Peter Keresztes Schmidt c2a7f7b593 tests/Box: Add unit tests 2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt e6c159fb70 Vector2: Make coordinate components public
The components were already unconditionally/without side-effects writable. Let's make them public so we don't need the setters.
2021-05-16 16:42:58 +02:00
Peter Keresztes Schmidt 707700e24e Vector2: Add unit tests 2021-05-14 20:14:50 +02:00
Peter Keresztes Schmidt 68bedfe48f Fix logging format string mismatches
* Remove SZFMTD format macro and use %zu instead for size_t. %zu is understood by every compiler nowadays.
2021-04-30 00:26:24 +02:00
Peter Keresztes Schmidt 3020acf994 ZmFont: Store character padding in font file
The size/variant specific character padding should be stored with the font data.
Modify the FontBitmapHeader accordingly and introduce a version field in the FontFileHeader
so we are able to check we have a font file with the right structure associated with that version.

The version field is set to 1 in this changeset.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt 07e49e47af utils: Add a clamping function mimicking std::clamp
This can be replaced with std::clamp in C++17.
2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt 4d14347c42 tests: Add tests for ZmFont 2021-04-25 23:13:21 +02:00
Peter Keresztes Schmidt 369fb68bb4 tests/comms: Disable tests which bind TCP sockets on CI runs
Those tests timeout on Cirrus. Disable them for now.
This introduces a new tag [notCI] with which tests can be marked which shouldn't be run during CI.
2021-04-11 02:46:56 +02:00
Peter Keresztes Schmidt f84d23817e tests/comms: Add tests for TcpInetClient/Server 2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt 25e6b70381 tests/comms: Add tests for ZM::UdpUnixSocket 2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt 17485f3547 tests/comms: Add tests for ZM::UdpInetSocket 2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt 45986c8ee2 tests/comms: Add some tests for SockAddrInet/Unix 2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt 5aa508bc74 tests/comms: Add read/write tests for ZM::Pipe 2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt a06d374292 tests/comms: Add some basic tests for ZM::Pipe 2021-04-11 01:28:23 +02:00
Peter Keresztes Schmidt 545f0dbb96 utils: cleanup Base64Encode 2021-04-04 00:39:40 +02:00
Peter Keresztes Schmidt e330f8553d utils: cleanup Split and Join 2021-04-04 00:30:18 +02:00
Peter Keresztes Schmidt 39a896f5b6 utils: cleanup StartsWith 2021-04-03 23:51:12 +02:00
Peter Keresztes Schmidt 3dbf13e00b utils: cleanup ReplaceAll 2021-04-03 23:50:35 +02:00
Peter Keresztes Schmidt 664cd649f8 utils: cleanup Trim (was trimSet) and TrimSpaces 2021-04-03 23:30:59 +02:00
Peter Keresztes Schmidt 3968a411a0 tests/utils: Add tests for QueryString 2021-04-03 22:37:44 +02:00
Peter Keresztes Schmidt fa7c420442 tests/utils: Add tests for UriDecode 2021-04-03 22:37:44 +02:00
Peter Keresztes Schmidt 46a4b615c8 tests/utils: Add tests for base64Encode
Test vectors according to RFC4648
2021-04-03 22:37:44 +02:00
Peter Keresztes Schmidt bbc4afcf1b tests/utils: Add tests for join 2021-04-03 22:37:44 +02:00
Peter Keresztes Schmidt e54c10fdb4 tests/utils: Add tests for StringVector split(const std::string&, const std::string&, int limit=0) 2021-04-03 22:37:44 +02:00
Peter Keresztes Schmidt 64cf69ebc1 tests/utils: Add tests for int split(const char*, const char, std::vector<std::string>&) 2021-04-03 22:37:44 +02:00
Peter Keresztes Schmidt bde0bde066 tests/utils: Add tests for startsWith 2021-04-03 22:35:03 +02:00
Peter Keresztes Schmidt 13f91b5826 tests/utils: Add tests for replaceAll 2021-04-03 22:35:03 +02:00
Peter Keresztes Schmidt 6150ceeb17 tests/utils: Add tests for trimSpaces 2021-04-03 22:35:03 +02:00
Peter Keresztes Schmidt 4529e59b1d tests/utils: Add tests for trimSet 2021-04-03 22:35:03 +02:00
Peter Keresztes Schmidt 00104b020c Build: Link our libs and executable targets against zm-core-interface 2021-02-08 23:08:22 +01:00
Peter Keresztes Schmidt bb067c065b tests: Add unit tests for JWT validation 2021-02-04 18:53:58 +01:00
Peter Keresztes Schmidt bef4e4032f Add Catch2 as C++ test framework
Use -DCMAKE_BUILD_TEST_SUITE=1 during CMake invocation to activate building the tests.
The 'tests' target builds the unit tests which can then be executed using the 'test' target.

We depend on the Catch2 version of the system.
Since development normally takes place on current OSs, this shouldn't pose a problem.
2021-02-04 18:53:54 +01:00