1
0
mirror of synced 2024-11-28 01:20:51 +01:00
Commit Graph

71 Commits

Author SHA1 Message Date
WerWolv
ad223a4e5c sys: Refactor pattern language api functions a bit 2021-12-20 20:40:28 +01:00
WerWolv
a05d09ffea build: Build unit tests again when needed 2021-12-14 21:27:02 +01:00
WerWolv
3e736b36b6 api: Refactored providers to allow for loading interfaces and config views 2021-12-12 00:41:44 +01:00
RADICS Áron
467e9d1463
Tests for the CRC and hash algorithms (#335)
* Update TEST_ASSERT to do nothing if condition is true

The TEST_ASSERT should not return if the condition is true, because:
- it prevents the usage of multiple TEST_ASSERT in a single test case,
- that behavior differs from how the assert in the standard library
works, and thus may give unexpected results.

Make the TEST_ASSERT to print an error message (with an formatted
optional user part) when it fails to make debugging easier.

* Fix some bugs in TestProvider, add unit tests

Use pointer-to-vector in TestProvider so writes can be tested, too.

* Add test EncodeDecode16, fix some encode16 bugs

The function mbedtls_mpi_write_string needs a bit longer buffer than the
resulting string actually will be.

Known bug: mbedtls_mpi_read_binary ingores initial null bytes

* Add test EncodeDecode64, fix some bugs

The functions mbedtls_base64_encode and mbedtls_base64_decode needs a
bit longer buffer than the resulting string actually will be.

* Remove check for empty data from TestProvider

It can be valid to get the hash of empty string.

* Add tests for CRC calculation

Two type of thests:
- compare the result of the CRC calculation to a known to be good
results,
- generate random data as message, calculate of it's CRC and append that
to the message, the CRC of this new data should be 0.

* Add test for hash algorithms

* Add includes in tests

* Remove the use of C++20 ranges

It seems that Apple Clang does not support range-based constrained
algorithms at this time.

* Replace encode16 implementation

To encode the zero bytes at the begining of the input vector, too.
2021-11-26 22:14:44 +01:00
WerWolv
d9a77d396c tests: Fixed endian test being marked as failing 2021-10-20 11:23:06 +02:00
WerWolv
442f164159 tests: Added endian changer tests 2021-10-20 11:17:55 +02:00
WerWolv
d6f9ec3f8f tests: Improved pattern unit tests 2021-10-20 11:06:24 +02:00
WerWolv
1b6035d6c6 tests: Added properly working custom unit tests 2021-10-14 21:19:31 +02:00
WerWolv
9b316795fc tests: Refactor to add support for other types of tests 2021-10-12 21:32:33 +02:00
WerWolv
a93049056a tests: Run all tests multiple times
Tests are all done pretty quickly anyways and this should detect use-after-frees and co
2021-10-03 23:10:08 +02:00
WerWolv
51a98736e8 tests: Fixed compile errors 2021-10-03 12:32:58 +02:00
WerWolv
62656f4c51 tests: Added pointer test 2021-09-25 23:31:37 +02:00
WerWolv
c051f5d3e7
patterns: Rewrite evaluation engine (#306)
* patterns: Rewrite most of the evaluator to mainly use polymorphism instead of just RTTI

* patterns: Fixed a couple of AST memory leaks

* patterns: Parse string operations correctly

* patterns: Various fixes and cleanup

* patterns: Implement primitive function definitions

Function parameters now need to provide their type in the definition

* patterns: Added function variable definition and assignment

* patterns: Added remaining function statements

* patterns: Added unsized and while-sized arrays

* patterns: Added multi variable declarations to functions

* patterns: Added std::format built-in function

* patterns: Allow passing custom types to functions

* patterns: Added attributes and new "format" attribute

* patterns: Use libfmt for std::print instead of custom version

* patterns: Remove unnecessary string compare function

* pattern: Fix preprocessor directives

* patterns: Fix unit tests

* patterns: Added cast expression

* patterns: Handle endianess in function parameters

* patterns: Added casting to different endian

* patterns: Added 'str' type for functions
2021-09-21 21:29:18 +02:00
WerWolv
26a0352851 tests: Fixed unit test compiling 2021-09-21 02:48:41 +02:00
WerWolv
22a904baf4 tests: Added RValue, Namespaces and extra semicolon test 2021-09-13 10:49:24 +02:00
WerWolv
7fbb540674 tests: Added operator test 2021-09-12 21:54:18 +02:00
WerWolv
bed5361879 tests: Added bitfield test 2021-09-12 20:29:05 +02:00
WerWolv
3d15a108af tests: Added more tests 2021-09-11 23:13:49 +02:00
WerWolv
aac6385dc6 build: Fixed unit tests on linux. Fuck cmake... 2021-09-11 18:09:15 +02:00
WerWolv
8396e40fa0 tests: Added initial test structure 2021-09-11 14:41:18 +02:00
WerWolv
71b06f4b20 build: Only copy yara crypto wrapper if it changed 2021-09-11 14:40:53 +02:00