Common Lisp Package: ODD-STREAMS-TEST

README:

FUNCTION

Private

CLEAN-UP

Deletes all the files that were created during the tests.

CONSISTENCY-TESTS (BYTE-SIZE N)

Tests "compatibility" with standard CL file functions. Only useful on little endian platforms.

CONVERSION-TESTS (BYTE-SIZE N FACTOR)

Tests "compatibility" between byte sizes which are a multiple of each other.

FILE-CONTENTS (ODD-STREAM &OPTIONAL MAX-LENGTH)

Helper function which returns the complete contents of the file underlying ODD-STREAM as a list of bytes.

FILE-SIZE (PATHSPEC)

Helper function which returns the size of the file denoted by the pathname designator PATHSPEC in octets.

IO-TESTS (BYTE-SIZE N M)

Tests working with IO files - reading, writing, modifying...

ODD-FILE-SIZE (PATHSPEC BYTE-SIZE)

Helper function which returns the size of the file denoted by the pathname designator PATHSPEC in bytes of size BYTE-SIZE.

POSITION-TESTS (BYTE-SIZE N M)

Mainly test the FILE-POSITION functionality.

READ-WRITE-TESTS (BYTE-SIZE N)

Tests basic reading and writing (bytes and sequences) and the ODD-FILE-LENGTH function.

RUN-TESTS

Runs all tests defined above with several different parameters and writes reports to *ERROR-OUTPUT*. Might take a pretty long time.

TEMP-FILE (FILENAME)

FILENAME should be a pathname designators with all components except for the name and the type being empty and optionally a /relative/ directory component. The result will be a pathname with the same name and type located in the temporary directory *TMP-DIR*. The directory of the resulting pathname will be created if it doesn't exist.

MACRO

Private

WITH-TEST ((TEST-DESCRIPTION) &BODY BODY)

Defines a test. Three utilities are available inside of the body of the macro: The function FAIL and the macros CHECK and WITH-EXPECTED-ERROR. FAIL, the lowest level utility, marks the test defined by WITH-TEST as failed. CHECK checks whether its argument is true, otherwise it calls FAIL. If during evaluation of the specified expression any condition is signaled, this is also considered a failure. WITH-EXPECTED-ERROR uses CHECK and HANDLER-CASE to execute some forms and check whether a specified error condition was signalled. WITH-TEST prints reports while the tests run.

VARIABLE

Private

*NUMBER-OF-FAILED-TESTS*

Counter which counts the number of failed tests.

*TMP-DIR*

The pathname of a temporary directory used for testing.