Commit Graph

24 Commits

Author SHA1 Message Date
Josh Stewart 65bcf5b1a7 Add unit tests for maths functions 2022-01-05 13:13:41 +11:00
tx_haggis be0f2c69c7
Add table2d tests (#748)
* Improve native debug experience

* Add unit tests for table2d
2021-12-23 15:07:38 +11:00
tx_haggis 9ad500189b
Performance: 15%+ loop/sec speedup by optimising 3d table bilinear interpolation (#735)
* Bi-linear interpolation - round towards nearest integer

Add the equivalent of 0.5 to the final calculation pre-rounding.
This will have the effect of rounding to the nearest integer, rather
than truncating. I.e. rounding down

* Unit tests: isolate table tests and check interpolation x/y bins

* Unit tests: add native table3d tests

* Unit tests: derive min/max from axis test values

* Unit tests: more detailed messages

* Unit tests: fix rounding & unit tests

* Performance

* Performance: use uint16_t instead of unsigned long
for the fixed point math: we only need the fractional
part. I.e. 1.16 not 16.16

* Use narrowest possible type

* Optimise bin position logic for performance

* Only promote to uint32_t when really required.

* Simplify bin checks - no zero width bins

* Save memory: use a single byte for the last bin caches

* Performance: increment pointers instead of
repeatedly dereferncing array by index.

* Comments

* Incorrect array underrun logic

* Rename type, comments

* Fix unit tests
2021-12-09 20:40:31 +11:00
Josh Stewart 61de6ff038 Fix tests from PR #662 2021-11-18 11:51:32 +11:00
tx_haggis 5ed9ec3ca9
Reduce 3d table memory usage (>500 bytes) (#662)
* Use table_row_iterator_t to adjust ignitionTable

* Separate 2d & 3d table code, abstract page to table iterator conversion.

This is just moving code around in preparation for future changes.

* Reduce table RAM (.bss) usage

Generate a separate type for each possible
3d axis & size combination.

This turns what was runtime information into
compile time data.

* Save 1 byte per table.

Use a flag value (INT16_MAX) instead of a separate boolean
flag

* File renaming

table_iterator -> table3d_iterator.h
table3d.h -> table3d_interpolate.h
table3d.cpp -> table3d_interpolate.cpp
table3d_types.h -> table3d.h

* Optimize page.cpp: reduce code clutter, maintain performance

* Reduce flash usage

* Encapsulate table metadata

* Performance - hoist if statement

* Replace function with macro

* Use a packed enum as a type identifier

Use a packed enum as a type identifier

Slimmer data types

* Use table iterators for random access to table
values and axis.

* Centralize write buffer check

* Encapsulate 16-bit reference concept

* Performance: make table iterators proper classes

This allows us to chain calls on temporaries - not possible
with regular function calls.

* Performance: encapsulate EEPROM update
& address increment

* Save flash - don't duplicate function

* Performance: directly invalidate table cache

* Separate out iterator reversal

* Separate out entity mapping & per-byte access

Much faster, smaller code footprint & easier to understand

* Code quality fixes

* Separate out axis metadata

* Doxygen comments

* Separate int16_ref into separate file

* Separate out table axies & values into separate types

No need for metadata types & more localised code.
E.g. creating iterators is now alongside the data over
which they iterate.

* Doxygen
2021-11-18 11:30:29 +11:00
Josh Stewart efe962598a Fix for OUTPUT test failing due to random pin assignments 2021-10-05 11:15:14 +11:00
Josh Stewart fd9fa36c29 Major revamp of unit testing framework 2020-11-19 21:38:00 +11:00
Josh Stewart efb84d4449 Fix some of the broken tables tests 2020-11-10 16:12:10 +11:00
Josh Stewart 01298b4747 Update tests for new PW calc options 2020-08-17 11:25:00 +10:00
Josh Stewart e3afe69955 Minor fixes from last PR pull 2020-08-16 09:55:13 +10:00
Josh Stewart 99abe431db Take 2 on fixing PW tests 2020-08-14 13:34:23 +10:00
Josh Stewart a6aafee534 Updated PW tests to ensure that work following the introduction of incorporate AFR 2020-08-14 13:17:16 +10:00
noisymime-test f0b2c86d02
Added unit test for DFCO (#426)
* Update README.md

* Added DFCO unit test

* Update README.md

Co-authored-by: Josh Stewart <josh@noisymime.org>
2020-08-02 09:05:10 +10:00
Josh Stewart 33dc5e58dd Add unit tests for pulse width calculation 2020-04-23 16:20:09 +10:00
Josh Stewart 21412e74a1 Provide missing externs from last commit to allow unit testing 2020-04-02 09:54:43 +11:00
Josh Stewart a611e00f57 Add tests for table lookups 2020-03-16 11:58:01 +11:00
Josh Stewart dc2f06241a Add basic tests for the dual wheel decoder 2020-03-04 18:58:23 +11:00
Josh Stewart 349d03249d Introduce tests for the setEndTooth function in missing tooth 2020-02-13 11:51:58 +11:00
Josh Stewart 1054f1d290 Restructure all units tests in single layered arrangement 2020-02-11 23:33:00 +11:00
Bruno Bousquet 76319fdf22
Separate one schedule unit test per function (#315)
* one test per function

* add tests

* use initialiseSchedulers in tests

* remove generic tests for schedules

* fix schedule accuracy tests

* fix warning static function never defined

* fix test_schedule not working
2020-02-04 09:19:42 +11:00
Josh Stewart 4f5a2bdc35 Fix for failing test_corrections_WUE_active on blank board 2020-02-03 17:36:07 +11:00
Bruno Bousquet 68f2288dd7
add schedule test (#312)
add temp test file to gitignore


improve schedule testing


add check for schedule delays and pending variants

move time sampling to callback methods

add comments and improve pending tests
2020-01-30 16:17:20 +11:00
Josh Stewart a5d3a311b6 Example unit tests for corrections 2020-01-24 14:18:57 +11:00
Josh Stewart b2c27b7eb0 Initial commit of the unit testing framework 2020-01-24 12:21:12 +11:00