GitXplorerGitXplorer
p

femtounit

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
18bc3a1f163925ec59fd1449717085169870d4bd

Fix duplicate test definitions and refactor

ppamoroso committed 10 months ago
Verified
e38288d3539256623322f13a36ae8ddb7db8642b

Attempt to fix duplicate definitions of tests

ppamoroso committed a year ago
Verified
1b1e9e2e29ab14510fb6ecd3eaecde4305d30bd0

Fix duplicate File Manager definitions of tests

ppamoroso committed a year ago
Verified
ec09cdc0471e28ac2edd1b2d5ea69bb6968ff38a

Make SEdit indentation of DEFTEST prettier

ppamoroso committed a year ago
Verified
c8d226a0da66b377d1361bb865b06cb56d52717b

Define TESTS type and redefine DEFTEST in terms of it

ppamoroso committed a year ago
Verified
a37ba83b3e5d0f0ea649c6204d59d7b6028963f5

Add link to project updates

ppamoroso committed 2 years ago

README

The README file for this repository.

Femtounit

Femtounit is a unit test framework for Medley Interlisp based on the PCL unit test framework by Peter Seibel described in Chapter 9 of his book Practical Common Lisp.

Defining and executing unit tests with Femtounit.

Installation

Download the file FEMTOUNIT from the project repo, copy it to a file system location your Medley Interlisp installation has access to, and optionally compile the source by evaluating the following expression from the Lisp executive:

(TCOMPL 'FEMTOUNIT)

Provide these answers to the questions the compiler asks:

  • listing? no
  • redefine? yes
  • save exprs? no

Finally, to load the framework evaluate:

(FILESLOAD FEMTOUNIT)

Usage

Suppose you want to test this function that returns the square of its argument:

(DEFINEQ (SQUARE (X) (TIMES X X)))

Assuming Femtounit is loaded, you may define a test function like this by evaluating:

(DEFTEST TEST.SQUARE ()
  (CHECK.EXPECT (EQP (SQUARE 1) 1)
                (EQP (SQUARE 2) 4)
                (EQP (SQUARE 3) 9)
                (EQP (SQUARE 4) 16)))

To run the tests call the test function by evaluating:

(TEST.SQUARE)

which will print a dot character for every passed test:

....

Reference

You can use the following Lisp forms to create and run unit tests and test suites.

(DEFTEST NAME PARAMETERS BODY) (macro): Define a test function called NAME with a list of PARAMETERS and a sequence of forms as the BODY. The test function has a syntax similar to defun in Common Lisp.

A test function can call other test functions or use CHECK.EXPECT to run individual test cases.

(CHECK.EXPECT FORMS) (macro): Run each expression in the sequence of FORMS as a test case.

(COMBINE.RESULTS FORMS) (macro): Combine the results as booleans of evaluating the sequence of FORMS in order. Similar to AND but all the forms are evaluated.

Release history

See the list of releases for notes on the changes in each version.

Learn more

Author

Femtounit is developed by Paolo Amoroso.

License

This code is distributed under the MIT license, see the LICENSE file.