Commit Graph

25 Commits

Author SHA1 Message Date
Aryadev Chavali
7a5eee932a Moved logging macros to base.h and use them everywhere
The macros used in the testing library are actually useful everywhere
so may as well use them.
2024-07-07 03:16:42 +01:00
Aryadev Chavali
6014620baa Changed fill-column to 80, so more space for comments. 2024-06-28 16:11:01 +01:00
Aryadev Chavali
3a09beb582 Change license agreement terming to ensure version 2 only. 2024-06-28 16:07:15 +01:00
Aryadev Chavali
a9f81992ab Update copyright notices and top level licenses 2024-06-25 00:48:43 +01:00
Aryadev Chavali
002b21b649 Fix some errors in pedantic mode for testing.h 2024-06-18 23:57:09 +01:00
Aryadev Chavali
91af3e14ef Clean up code 2024-05-05 20:20:25 +05:30
Aryadev Chavali
7a3e6d180f Use eglot for project
I rely on eglot being enabled for this to work
2024-05-05 20:20:25 +05:30
Aryadev Chavali
a40eaf29b8 OP_HALT is its own opcode, fixed some other minor bugs 2024-05-01 22:36:34 +05:30
Aryadev Chavali
ba573fd230 Quick fix to make compilation with VERBOSE=2 work 2024-04-29 01:11:33 +05:30
Aryadev Chavali
05c3342e27 Added test for darr_append_bytes 2024-04-29 01:07:15 +05:30
Aryadev Chavali
1fcdf853bd Implemented tests for darr_ensure_capacity and darr_append_byte 2024-04-29 00:38:49 +05:30
Aryadev Chavali
e8671042df Add angle brackets to suite output 2024-04-29 00:11:50 +05:30
Aryadev Chavali
cd6eeeeafe Fix some undefined behaviour in tests 2024-04-29 00:11:35 +05:30
Aryadev Chavali
33ec19566a Started unit testing darr.h 2024-04-28 23:32:01 +05:30
Aryadev Chavali
fadc61c2b0 INFO(..."Testing ... = ...") to "Testing ... -> ..." 2024-04-28 23:30:48 +05:30
Aryadev Chavali
15ed8e32c2 test_lib -> test_lib_base and implement remaining tests for base
Also refactored tests to new byteswap method
2024-04-28 22:33:35 +05:30
Aryadev Chavali
dede607036 If VERBOSE >= 1 then RUN_TEST_SUITE logs for each test of the suite 2024-04-28 22:32:18 +05:30
Aryadev Chavali
7ca9f1b98b Added test_lib_base_hword_to_bytes 2024-04-28 20:57:24 +05:30
Aryadev Chavali
8c0bebc8ea Function to generate string representation of byte array in testing.h 2024-04-28 20:57:16 +05:30
Aryadev Chavali
a0857b9090 test WORD_NTH_* and WORD_SAFE_SUB, ~refactored general testing code
The new general testing procedure is making a structure for tests that
include all the samples and expected results, then iterating over them
to run the test.
2024-04-28 19:08:20 +05:30
Aryadev Chavali
26a8fac732 Updated testing library to make writing tests easier
Success is printed by the RUN_TEST_SUITE macro so we don't need to add
that boilerplate.
2024-04-28 19:06:44 +05:30
Aryadev Chavali
06a883d538 Made lib/base conversion functions const where possible 2024-04-28 17:41:17 +05:30
Aryadev Chavali
cf6aa96539 Wrote tests for lib/base.h's convert_bytes_to_* functions
Just runs a sample of suitably byte arrays with an expected set of
functions.  The samples are in little endian format and the outputs
are what we expect them to be.  This should run regardless of the
endian of your machine.
2024-04-28 17:35:46 +05:30
Aryadev Chavali
ab839efbcd Defined a base testing library header
This defines useful macros, in particular to print information and to
define tests and test suites.

The idea is a suite will be a set of test functions, where a test
function will fail <=> an assert is called.  This allows us to stop
testing immediately upon a test failing and produce viable output.
2024-04-28 17:27:42 +05:30
Aryadev Chavali
f725c2a668 Started developing a unit test module
Folder per module in test/.  Header only tests with one actual main
file to implement a program that runs them.

Makefile runs the test and provides some eye candy to show if the test
succeeded or failed.  The tests, on the other hand, will show success
or failure for each of them.
2024-04-28 15:33:47 +05:30