Test - Test code for forth virtual machine
[Forth - Forth virtual machine]

Collaboration diagram for Test - Test code for forth virtual machine:

Classes

class  StdForthIo
class  TestForthIo
class  ForthTest

Defines

#define SOURCE_ROOT_PATH   "forth/"
#define STRING(string)   string
#define LINE(string)   string "\n"
#define COUNTED_STRING(string)   (CHAR*)STRING(string),(sizeof(string)-1)

Functions

bool ReadFile (const char *name, void *&address, unsigned &size)
void TestForth (bool interactive)
CELL ForthTest::Include (const char *fileName)
CELL ForthTest::IncludeLines (const char *fileName)

Define Documentation

#define SOURCE_ROOT_PATH   "forth/"

Path for source code location

Definition at line 45 of file forthtest.cpp.

#define STRING ( string   )     string

Macro to include string constants in source which match the width of the CHAR type.

Definition at line 188 of file forthtest.cpp.

#define LINE ( string   )     string "\n"

Macro to include a line of text as an in-source constant .

Definition at line 190 of file forthtest.cpp.

#define COUNTED_STRING ( string   )     (CHAR*)STRING(string),(sizeof(string)-1)

Construct counted string arguments in the form (CHAR*)string,(CELL)stringLength

Parameters:
string A quoted string, e.g. "A string"

Definition at line 285 of file forthtest.cpp.


Function Documentation

bool ReadFile ( const char *  name,
void *&  address,
unsigned &  size 
)

Read a files contents into memory. The file is assumed to contain characters of 8 bit size but they are stored in memory as characters the same size as the Forth VM's CHAR.

Parameters:
name The file name.
address On success, this is the address of the memory cell containing the read contents. This memory must be freed when it is no longer required.
size On success, this is the number of characters in the file.
Returns:
True, if the read was successful, false otherwise.

Definition at line 158 of file forthtest.cpp.

void TestForth ( bool  interactive  ) 

Top level test function. Call this to perform all tests.

Parameters:
interactive True, if the user will interact with the tests, false if tests are to run non-interactively.

Definition at line 294 of file forthtest.cpp.

CELL ForthTest::Include ( const char *  fileName  )  [inherited]

Load the contents of a file and EVALUATE it.

Parameters:
fileName The name of the file.
Returns:
0 or a forth execption value.

Definition at line 216 of file forthtest.cpp.

CELL ForthTest::IncludeLines ( const char *  fileName  )  [inherited]

Load the contents of a file and EVALUATE it a line at a time.

Parameters:
fileName The name of the file.
Returns:
0 or a forth execption value.

Definition at line 231 of file forthtest.cpp.


Generated by  doxygen 1.6.1