tests: Add tests for some library entries

We don't test all the entries, because most of them are a bit too
complicated to test automatically, and may take too long.

Fixes: #1218

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
Christophe de Dinechin 2024-09-29 01:39:48 +02:00
parent 4bf3d8aa8e
commit 4e67aac60a
6 changed files with 39 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

BIN
images/lib-kinetic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
images/lib-triangle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -149,6 +149,7 @@ TESTS(poly, "Polynomials");
TESTS(quorem, "Quotient and remainder");
TESTS(expr, "Operations on expressions");
TESTS(random, "Random number generation");
TESTS(library, "Library entries");
EXTRA(plotfns, "Plot all functions");
EXTRA(sysflags, "Enable/disable every RPL flag");
@ -175,7 +176,7 @@ void tests::run(uint onlyCurrent)
{
here().begin("Current");
if (onlyCurrent & 1)
symbolic_integration();
library();
if (onlyCurrent & 2)
demo_ui();
if (onlyCurrent & 4)
@ -256,6 +257,7 @@ void tests::run(uint onlyCurrent)
expression_operations();
random_number_generation();
object_structure();
library();
regression_checks();
demo_ui();
demo_math();
@ -9478,6 +9480,41 @@ void tests::object_structure()
}
void tests::library()
// ----------------------------------------------------------------------------
// Check the content of the content library.
// ----------------------------------------------------------------------------
{
BEGIN(library);
step("Secrets: Dedicace")
.test(CLEAR, RSHIFT, H, F1, F1)
.expect("\"À tous ceux qui se souviennent de Maubert électronique\"");
step("Secrets: Library help")
.test(CLEAR, F2)
.expect("\"To modify the library, edit the config/library.csv file\"");
step("Physics: Relativistic and classical kinetic energy")
.test(CLEAR, RSHIFT, H, F2, F1)
.image("lib-kinetic", 2000);
step("Math: Collatz conjecture benchmark")
.test(CLEAR, RSHIFT, H, F3, LENGTHY(5000), F1, ENTER, SWAP)
.expect("1")
.test(BSP)
.match("duration:[1-9].*ms");
step("Math: Collatz conjecture")
.test(CLEAR, "15", LENGTHY(500), F2, ENTER, ENTER)
.expect("1");
step("Math: Count primes")
.test(CLEAR, "227", F3)
.expect("49");
step("Math: Triangle equations")
.test(CLEAR, F4)
.image("lib-triangle");
}
void tests::regression_checks()
// ----------------------------------------------------------------------------
// Checks for specific regressions

View file

@ -130,6 +130,7 @@ struct tests
void expression_operations();
void random_number_generation();
void object_structure();
void library();
void regression_checks();
void demo_setup();
void demo_ui();