mbeddr / mbeddr.core

The mbeddr core. An extensible C
Eclipse Public License 2.0
224 stars 77 forks source link

Add two memoizing supplier implementations #2426

Closed kbirken closed 2 months ago

kbirken commented 2 months ago

This PR provides two helper classes implementing the Supplier<T> interface. They can be used for lazy evaluation as well as lazy evaluation with an expensive and a cheap computation part.

The PR also provides tests for these helper classes.

I also added existing tests for c.m.mpsutil.compare to the CI testing job, as I believe the tests are useful and should be executed on CI (boy scout's rule).

The change is not visible to users, so no CHANGELOG entry.

Solves #2424.

kbirken commented 2 months ago

@dbinkele You wrote the original code of these classes, so maybe you want to check. @alexanderpann Added as reviewer because I changed build scripts etc.

kbirken commented 2 months ago

LGTM, only the comments in the tests are lying about the actual value (777 vs 77).

Thanks, fixed the test comments.

dbinkele commented 2 months ago

@kbirken the tests cannot be run in the IDE: https://github.com/mbeddr/mbeddr.core/pull/2426

kbirken commented 2 months ago

@kbirken the tests cannot be run in the IDE: #2426

Works here.

image

You probably have to uncheck "Execute in the same process":

image